summaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2014-02-14 11:53:56 +0100
committerPhilipp Zabel <p.zabel@pengutronix.de>2014-03-06 17:41:48 +0100
commitf2a575f67695dcba9062acd666ae5aab2380b95c (patch)
tree86f69c5cfb33eee11693e496bf02103e50d3a3c9 /drivers/of/base.c
parent4329b93b283cce828967c01bc3827fdff51c8d7e (diff)
downloadop-kernel-dev-f2a575f67695dcba9062acd666ae5aab2380b95c.zip
op-kernel-dev-f2a575f67695dcba9062acd666ae5aab2380b95c.tar.gz
[media] of: move common endpoint parsing to drivers/of
This patch adds a new struct of_endpoint which is then embedded in struct v4l2_of_endpoint and contains the endpoint properties that are not V4L2 (or even media) specific: the port number, endpoint id, local device tree node and remote endpoint phandle. of_graph_parse_endpoint parses those properties and is used by v4l2_of_parse_endpoint, which just adds the V4L2 MBUS information to the containing v4l2_of_endpoint structure. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index a8e47d3..715144af 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1985,6 +1985,34 @@ struct device_node *of_find_next_cache_node(const struct device_node *np)
}
/**
+ * of_graph_parse_endpoint() - parse common endpoint node properties
+ * @node: pointer to endpoint device_node
+ * @endpoint: pointer to the OF endpoint data structure
+ *
+ * The caller should hold a reference to @node.
+ */
+int of_graph_parse_endpoint(const struct device_node *node,
+ struct of_endpoint *endpoint)
+{
+ struct device_node *port_node = of_get_parent(node);
+
+ memset(endpoint, 0, sizeof(*endpoint));
+
+ endpoint->local_node = node;
+ /*
+ * It doesn't matter whether the two calls below succeed.
+ * If they don't then the default value 0 is used.
+ */
+ of_property_read_u32(port_node, "reg", &endpoint->port);
+ of_property_read_u32(node, "reg", &endpoint->id);
+
+ of_node_put(port_node);
+
+ return 0;
+}
+EXPORT_SYMBOL(of_graph_parse_endpoint);
+
+/**
* of_graph_get_next_endpoint() - get next endpoint node
* @parent: pointer to the parent device node
* @prev: previous endpoint node, or NULL to get first
OpenPOWER on IntegriCloud