Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eaaedaf6 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 4e20bda6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -47,10 +47,10 @@ static int tvc_connect(struct omap_dss_device *dssdev)
	struct omap_dss_device *src;
	int r;

	src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
	if (IS_ERR(src)) {
	src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
	if (IS_ERR_OR_NULL(src)) {
		dev_err(ddata->dev, "failed to find video source\n");
		return PTR_ERR(src);
		return src ? PTR_ERR(src) : -EINVAL;
	}

	r = omapdss_device_connect(dssdev->dss, src, dssdev);
+3 −3
Original line number Diff line number Diff line
@@ -61,10 +61,10 @@ static int dvic_connect(struct omap_dss_device *dssdev)
	struct omap_dss_device *src;
	int r;

	src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
	if (IS_ERR(src)) {
	src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
	if (IS_ERR_OR_NULL(src)) {
		dev_err(dssdev->dev, "failed to find video source\n");
		return PTR_ERR(src);
		return src ? PTR_ERR(src) : -EINVAL;
	}

	r = omapdss_device_connect(dssdev->dss, src, dssdev);
+3 −3
Original line number Diff line number Diff line
@@ -57,10 +57,10 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
	struct omap_dss_device *src;
	int r;

	src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
	if (IS_ERR(src)) {
	src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
	if (IS_ERR_OR_NULL(src)) {
		dev_err(ddata->dev, "failed to find video source\n");
		return PTR_ERR(src);
		return src ? PTR_ERR(src) : -EINVAL;
	}

	r = omapdss_device_connect(dssdev->dss, src, dssdev);
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
	struct omap_dss_device *src;
	int r;

	src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
	src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
	if (IS_ERR(src)) {
		dev_err(dssdev->dev, "failed to find video source\n");
		return PTR_ERR(src);
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
	struct omap_dss_device *src;
	int r;

	src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
	src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
	if (IS_ERR(src)) {
		dev_err(dssdev->dev, "failed to find video source\n");
		return PTR_ERR(src);
Loading