diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-02-14 05:53:56 -0500 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2014-03-06 11:41:48 -0500 |
commit | f2a575f67695dcba9062acd666ae5aab2380b95c (patch) | |
tree | 86f69c5cfb33eee11693e496bf02103e50d3a3c9 /drivers/of/base.c | |
parent | 4329b93b283cce828967c01bc3827fdff51c8d7e (diff) |
[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.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index a8e47d37cc7f..715144af3a83 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) | |||
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | /** | 1987 | /** |
1988 | * of_graph_parse_endpoint() - parse common endpoint node properties | ||
1989 | * @node: pointer to endpoint device_node | ||
1990 | * @endpoint: pointer to the OF endpoint data structure | ||
1991 | * | ||
1992 | * The caller should hold a reference to @node. | ||
1993 | */ | ||
1994 | int of_graph_parse_endpoint(const struct device_node *node, | ||
1995 | struct of_endpoint *endpoint) | ||
1996 | { | ||
1997 | struct device_node *port_node = of_get_parent(node); | ||
1998 | |||
1999 | memset(endpoint, 0, sizeof(*endpoint)); | ||
2000 | |||
2001 | endpoint->local_node = node; | ||
2002 | /* | ||
2003 | * It doesn't matter whether the two calls below succeed. | ||
2004 | * If they don't then the default value 0 is used. | ||
2005 | */ | ||
2006 | of_property_read_u32(port_node, "reg", &endpoint->port); | ||
2007 | of_property_read_u32(node, "reg", &endpoint->id); | ||
2008 | |||
2009 | of_node_put(port_node); | ||
2010 | |||
2011 | return 0; | ||
2012 | } | ||
2013 | EXPORT_SYMBOL(of_graph_parse_endpoint); | ||
2014 | |||
2015 | /** | ||
1988 | * of_graph_get_next_endpoint() - get next endpoint node | 2016 | * of_graph_get_next_endpoint() - get next endpoint node |
1989 | * @parent: pointer to the parent device node | 2017 | * @parent: pointer to the parent device node |
1990 | * @prev: previous endpoint node, or NULL to get first | 2018 | * @prev: previous endpoint node, or NULL to get first |