Skip to content

Commit b625fe6

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: docs: enumeration: Discourage to use custom _DSM methods
Since we have _DSD established and specified (ACPI v5.1+) there is no need to use custom _DSM methods. Rewrite documentation to use _DSD. Fixes: f60e707 ("misc: at25: Make use of device property API") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 7e57714 commit b625fe6

1 file changed

Lines changed: 21 additions & 27 deletions

File tree

Documentation/firmware-guide/acpi/enumeration.rst

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -188,43 +188,37 @@ to at25 SPI eeprom driver (this is meant for the above ACPI snippet)::
188188
};
189189

190190
Note that this driver actually needs more information like page size of the
191-
eeprom etc. but at the time writing this there is no standard way of
192-
passing those. One idea is to return this in _DSM method like::
191+
eeprom, etc. This information can be passed via _DSD method like::
193192

194193
Device (EEP0)
195194
{
196195
...
197-
Method (_DSM, 4, NotSerialized)
196+
Name (_DSD, Package ()
198197
{
199-
Store (Package (6)
198+
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
199+
Package ()
200200
{
201-
"byte-len", 1024,
202-
"addr-mode", 2,
203-
"page-size, 32
204-
}, Local0)
205-
206-
// Check UUIDs etc.
207-
208-
Return (Local0)
209-
}
210-
211-
Then the at25 SPI driver can get this configuration by calling _DSM on its
212-
ACPI handle like::
213-
214-
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
215-
struct acpi_object_list input;
216-
acpi_status status;
201+
Package () { "size", 1024 },
202+
Package () { "pagesize", 32 },
203+
Package () { "address-width", 16 },
204+
}
205+
})
206+
}
217207

218-
/* Fill in the input buffer */
208+
Then the at25 SPI driver can get this configuration by calling device property
209+
APIs during ->probe() phase like::
219210

220-
status = acpi_evaluate_object(ACPI_HANDLE(&spi->dev), "_DSM",
221-
&input, &output);
222-
if (ACPI_FAILURE(status))
223-
/* Handle the error */
211+
err = device_property_read_u32(dev, "size", &size);
212+
if (err)
213+
...error handling...
224214

225-
/* Extract the data here */
215+
err = device_property_read_u32(dev, "pagesize", &page_size);
216+
if (err)
217+
...error handling...
226218

227-
kfree(output.pointer);
219+
err = device_property_read_u32(dev, "address-width", &addr_width);
220+
if (err)
221+
...error handling...
228222

229223
I2C serial bus support
230224
======================

0 commit comments

Comments
 (0)