drm/omap: dss: Rework output lookup by port node
The omap_dss_find_output_by_port_node() function defined in output.c looks up an output from its port node. To do so it needs to call helper functions from dss-of.c to lookup the port parent and the port number. As omap_dss_find_output_by_port_node() is only called by omapdss_of_find_source_for_first_ep() from dss-of.c this goes back and forth between the to source files and isn't very clear. Simplify the code by passing both the parent and the port number to omap_dss_find_output_by_port_node() instead of the port node, and rename the function to omap_dss_find_output_by_port(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:

committed by
Tomi Valkeinen

parent
9184f8d94c
commit
a7e82a67c1
@@ -21,7 +21,8 @@
|
||||
|
||||
#include "omapdss.h"
|
||||
|
||||
struct device_node *dss_of_port_get_parent_device(struct device_node *port)
|
||||
static struct device_node *
|
||||
dss_of_port_get_parent_device(struct device_node *port)
|
||||
{
|
||||
struct device_node *np;
|
||||
int i;
|
||||
@@ -45,40 +46,36 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 dss_of_port_get_port_number(struct device_node *port)
|
||||
{
|
||||
int r;
|
||||
u32 reg;
|
||||
|
||||
r = of_property_read_u32(port, "reg", ®);
|
||||
if (r)
|
||||
reg = 0;
|
||||
|
||||
return reg;
|
||||
}
|
||||
|
||||
struct omap_dss_device *
|
||||
omapdss_of_find_source_for_first_ep(struct device_node *node)
|
||||
{
|
||||
struct device_node *ep;
|
||||
struct device_node *src_node;
|
||||
struct device_node *src_port;
|
||||
struct device_node *ep;
|
||||
struct omap_dss_device *src;
|
||||
u32 port_number = 0;
|
||||
|
||||
/* Get the endpoint... */
|
||||
ep = of_graph_get_endpoint_by_regs(node, 0, 0);
|
||||
if (!ep)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
/* ... and its remote port... */
|
||||
src_port = of_graph_get_remote_port(ep);
|
||||
if (!src_port) {
|
||||
of_node_put(ep);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
of_node_put(ep);
|
||||
if (!src_port)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
src = omap_dss_find_output_by_port_node(src_port);
|
||||
|
||||
/* ... and the remote port's number and parent... */
|
||||
of_property_read_u32(src_port, "reg", &port_number);
|
||||
src_node = dss_of_port_get_parent_device(src_port);
|
||||
of_node_put(src_port);
|
||||
if (!src_node)
|
||||
return NULL;
|
||||
|
||||
/* ... and finally the source. */
|
||||
src = omap_dss_find_output_by_port(src_node, port_number);
|
||||
of_node_put(src_node);
|
||||
|
||||
return src ? src : ERR_PTR(-EPROBE_DEFER);
|
||||
}
|
||||
|
Reference in New Issue
Block a user