diff mbox

[2/2] imx-drm: imx-ldb: Use OF graph to find connected panel

Message ID 1394114080-27223-2-git-send-email-p.zabel@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Philipp Zabel March 6, 2014, 1:54 p.m. UTC
This patch depends on the OF graph parsing helper and imx-drm-dt series.
It allows to connect the panel to the output port (port@1 on i.MX53, port@4
on i.MX6) via the OF graph bindings.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/imx-ldb.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

Comments

Philipp Zabel March 6, 2014, 2:01 p.m. UTC | #1
Am Donnerstag, den 06.03.2014, 14:54 +0100 schrieb Philipp Zabel:
> This patch depends on the OF graph parsing helper and imx-drm-dt series.
> It allows to connect the panel to the output port (port@1 on i.MX53, port@4
> on i.MX6) via the OF graph bindings.

If we postpone this until the imx-drm-dt binding series gets accepted, I
can just squash the two patches together.

regards
Philipp
Russell King - ARM Linux March 7, 2014, 5:06 p.m. UTC | #2
On Thu, Mar 06, 2014 at 02:54:40PM +0100, Philipp Zabel wrote:
> @@ -566,9 +566,18 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
>  			return -EINVAL;
>  		}
>  
> -		panel_node = of_parse_phandle(child, "fsl,panel", 0);
> -		if (panel_node)
> -			channel->panel = of_drm_find_panel(panel_node);
> +		/* The output port is port@4 with mux or port@1 without mux */
> +		port = of_graph_get_port_by_id(child, imx_ldb->lvds_mux ? 4 : 1);

I guess we're holding off on these two patches while the last bits of
the of-graph get sorted - the above function doesn't currently exist
so causes a build failure.

Thanks.
diff mbox

Patch

diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c
index 38a0795..4d1446a 100644
--- a/drivers/staging/imx-drm/imx-ldb.c
+++ b/drivers/staging/imx-drm/imx-ldb.c
@@ -27,8 +27,8 @@ 
 #include <drm/drm_panel.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
-#include <linux/of_address.h>
 #include <linux/of_device.h>
+#include <linux/of_graph.h>
 #include <video/of_videomode.h>
 #include <linux/regmap.h>
 #include <linux/videodev2.h>
@@ -506,7 +506,7 @@  static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 
 	for_each_child_of_node(np, child) {
 		struct imx_ldb_channel *channel;
-		struct device_node *panel_node;
+		struct device_node *port;
 
 		ret = of_property_read_u32(child, "reg", &i);
 		if (ret || i < 0 || i > 1)
@@ -566,9 +566,18 @@  static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 			return -EINVAL;
 		}
 
-		panel_node = of_parse_phandle(child, "fsl,panel", 0);
-		if (panel_node)
-			channel->panel = of_drm_find_panel(panel_node);
+		/* The output port is port@4 with mux or port@1 without mux */
+		port = of_graph_get_port_by_id(child, imx_ldb->lvds_mux ? 4 : 1);
+		if (port) {
+			struct device_node *endpoint, *remote;
+
+			endpoint = of_get_child_by_name(port, "endpoint");
+			if (endpoint) {
+				remote = of_graph_get_remote_port_parent(endpoint);
+				if (remote)
+					channel->panel = of_drm_find_panel(remote);
+			}
+		}
 
 		ret = imx_ldb_register(drm, channel);
 		if (ret)