diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-03-02 21:11:06 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-09-03 16:13:27 +0300 |
commit | eaaedaf6a1de3be2f62feefc40fa6a711382f1ca (patch) | |
tree | 525f0e7462e3a856507650319cd66369262609b8 /drivers/gpu/drm/omapdrm/dss/dss-of.c | |
parent | 4e20bda68e01f723d7fcc4e7d55a4afc78223fb7 (diff) | |
download | linux-stable-eaaedaf6a1de3be2f62feefc40fa6a711382f1ca.tar.gz linux-stable-eaaedaf6a1de3be2f62feefc40fa6a711382f1ca.tar.bz2 linux-stable-eaaedaf6a1de3be2f62feefc40fa6a711382f1ca.zip |
drm/omap: dss: Extend omapdss_of_find_source_for_first_ep() to sinks
The omapdss_of_find_source_for_first_ep() function locates the source
corresponding to the first endpoint of the first port of a device node.
We can easily extend it to locate sinks as well by passing the port
number as a parameter. This will be useful to find sinks in encoders
drivers.
Extend the function and rename it to omapdss_of_find_connected_device()
to reflect its new extended purpose.
Additionally, it is useful to differentiate between failures to return
the connected device because no link exists in the device tree for the
requested port, or because the connected device as described in the
device tree is invalid or not probed yet. Return NULL in the first case
and an error code in the second case, and update the callers
accordingly.
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>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss/dss-of.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dss-of.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c b/drivers/gpu/drm/omapdrm/dss/dss-of.c index 771b20db2d98..0422597ac6b0 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss-of.c +++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c @@ -47,7 +47,7 @@ dss_of_port_get_parent_device(struct device_node *port) } struct omap_dss_device * -omapdss_of_find_source_for_first_ep(struct device_node *node) +omapdss_of_find_connected_device(struct device_node *node, unsigned int port) { struct device_node *src_node; struct device_node *src_port; @@ -56,27 +56,27 @@ omapdss_of_find_source_for_first_ep(struct device_node *node) u32 port_number = 0; /* Get the endpoint... */ - ep = of_graph_get_endpoint_by_regs(node, 0, 0); + ep = of_graph_get_endpoint_by_regs(node, port, 0); if (!ep) - return ERR_PTR(-EINVAL); + return NULL; /* ... and its remote port... */ src_port = of_graph_get_remote_port(ep); of_node_put(ep); if (!src_port) - return ERR_PTR(-EINVAL); + return NULL; /* ... 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; + return ERR_PTR(-EINVAL); - /* ... and finally the source. */ + /* ... and finally the connected device. */ src = omapdss_find_device_by_port(src_node, port_number); of_node_put(src_node); return src ? src : ERR_PTR(-EPROBE_DEFER); } -EXPORT_SYMBOL_GPL(omapdss_of_find_source_for_first_ep); +EXPORT_SYMBOL_GPL(omapdss_of_find_connected_device); |