summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-06-19 16:40:15 +0300
committerTao Huang <huangtao@rock-chips.com>2017-11-27 14:12:20 +0800
commit68ef162152120220aea4415f4ea72e16eb8215c0 (patch)
tree78a696d0679dd83a39be692e608bb67f52bec893 /drivers/acpi
parentbc255db94951820d14599033d692c975bbac02fa (diff)
BACKPORT: device property: Introduce fwnode_property_get_reference_args
The new fwnode_property_get_reference_args() interface amends the fwnode property API with the functionality of both of_parse_phandle_with_args() and __acpi_node_get_property_reference(). The semantics is slightly different: the cells property is ignored on ACPI as the number of arguments can be explicitly obtained from the firmware interface. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> (cherry picked from commit 3e3119d3088f41106f3581d39e7694a50ca3fc02) Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com> Brian L: Had to de-constify this commit, and picks are unclean due to the number of commits skipped for this kernel. Conflicts: drivers/acpi/property.c drivers/base/property.c include/linux/fwnode.h BUG=b:64133998 TEST=media device topology shows subdevs registered successfully TEST=no camera regression Change-Id: I982255df1aabaadb9de09fc71e6db5c4b99b0e02 Reviewed-on: https://chromium-review.googlesource.com/693682 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/property.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 476a52c60cf3..1b5eaad29ec8 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1187,6 +1187,32 @@ acpi_fwnode_get_named_child_node(struct fwnode_handle *fwnode,
return NULL;
}
+static int
+acpi_fwnode_get_reference_args(struct fwnode_handle *fwnode,
+ const char *prop, const char *nargs_prop,
+ unsigned int args_count, unsigned int index,
+ struct fwnode_reference_args *args)
+{
+ struct acpi_reference_args acpi_args;
+ unsigned int i;
+ int ret;
+
+ ret = __acpi_node_get_property_reference(fwnode, prop, index,
+ args_count, &acpi_args);
+ if (ret < 0)
+ return ret;
+ if (!args)
+ return 0;
+
+ args->nargs = acpi_args.nargs;
+ args->fwnode = acpi_fwnode_handle(acpi_args.adev);
+
+ for (i = 0; i < NR_OF_FWNODE_REFERENCE_ARGS; i++)
+ args->args[i] = i < acpi_args.nargs ? acpi_args.args[i] : 0;
+
+ return 0;
+}
+
static struct fwnode_handle *
acpi_fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode,
struct fwnode_handle *prev)
@@ -1231,6 +1257,7 @@ const struct fwnode_operations acpi_fwnode_ops = {
.get_parent = acpi_node_get_parent,
.get_next_child_node = acpi_get_next_subnode,
.get_named_child_node = acpi_fwnode_get_named_child_node,
+ .get_reference_args = acpi_fwnode_get_reference_args,
.graph_get_next_endpoint = acpi_fwnode_graph_get_next_endpoint,
.graph_get_remote_endpoint = acpi_fwnode_graph_get_remote_endpoint,
.graph_get_port_parent = acpi_node_get_parent,