aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 21:32:07 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 14:32:24 +0800
commitf18589576cb87e76c20046b335124a8af6feb6ac (patch)
treef8f1b8a00c47c2923da94b3cf8fbe994b18056d4 /drivers/core
parentf02d0eb3fab332b94ebb98b73c3445f920a0c852 (diff)
downloadu-boot-f18589576cb87e76c20046b335124a8af6feb6ac.zip
u-boot-f18589576cb87e76c20046b335124a8af6feb6ac.tar.gz
u-boot-f18589576cb87e76c20046b335124a8af6feb6ac.tar.bz2
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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c
index b566f4f..ae69258 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
*