diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-07 21:32:07 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-07-17 14:32:24 +0800 |
commit | f18589576cb87e76c20046b335124a8af6feb6ac (patch) | |
tree | f8f1b8a00c47c2923da94b3cf8fbe994b18056d4 /drivers/core | |
parent | f02d0eb3fab332b94ebb98b73c3445f920a0c852 (diff) |
dm: core: Add a way of overriding the ACPI device path
Some devices such as GPIO need to override the normal path that would be
generated by driver model. Add a device-tree property for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/acpi.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c index b566f4f186..ae69258562 100644 --- a/drivers/core/acpi.c +++ b/drivers/core/acpi.c @@ -82,6 +82,25 @@ int acpi_get_name(const struct udevice *dev, char *out_name) return 0; } +int acpi_get_path(const struct udevice *dev, char *out_path, int maxlen) +{ + const char *path; + int ret; + + path = dev_read_string(dev, "acpi,path"); + if (path) { + if (strlen(path) >= maxlen) + return -E2BIG; + strcpy(out_path, path); + return 0; + } + ret = acpi_device_path(dev, out_path, maxlen); + if (ret) + return log_msg_ret("dev", ret); + + return 0; +} + /** * acpi_add_item() - Add a new item to the list of data collected * |