
On Wed, Jul 8, 2020 at 3:13 AM Simon Glass sjg@chromium.org wrote:
For many device types it is possible to figure out the name just by looking at its uclass or parent. Add a function to handle this, since it allows us to cover the vast majority of cases automatically.
However it is sometimes impossible to figure out an ACPI name for a device just by looking at its uclass. For example a touch device may have a vendor-specific name. Add a new "acpi,name" property to allow a custom name to be created.
With this new feature we can drop the get_name() methods in the sandbox I2C and SPI drivers. They were only added for testing purposes. Update the tests to use the new values.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Wolfgang Wallner wolfgang.wallner@br-automation.com
Changes in v4:
- Mention that acpi_device_infer_name() only supports x86
- Add a comment about only supporting USB3.0
Changes in v3:
- Fix 'of' typo
Changes in v1:
- Use acpi,ddn instead of acpi,desc
- Rename to acpi_device_infer_name()
- Update newly created sandbox tests
arch/sandbox/dts/test.dts | 1 + doc/device-tree-bindings/device.txt | 13 ++++ drivers/core/acpi.c | 13 +++- drivers/i2c/sandbox_i2c.c | 10 --- drivers/spi/sandbox_spi.c | 10 --- include/acpi/acpi_device.h | 18 +++++ lib/acpi/acpi_device.c | 106 ++++++++++++++++++++++++++++ test/dm/acpi.c | 42 ++++++++++- 8 files changed, 190 insertions(+), 23 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com