diff mbox

drm/imx: parallel-display: fix drm_panel support

Message ID 1432045692-2458-1-git-send-email-p.zabel@pengutronix.de
State Needs Review / ACK, archived
Headers show

Checks

Context Check Description
robh/checkpatch warning total: 1 errors, 0 warnings, 0 lines checked
robh/patch-applied success

Commit Message

Philipp Zabel May 19, 2015, 2:28 p.m. UTC
The parallel-display driver used an undocumented, non-standard property
"fsl,panel" to optionally associate with a drm_panel device. This patch
fixes the driver to use the same OF graph bindings as the LDB driver
instead:

    parallel-display {
            compatible = "fsl,imx-parallel-display";
            ...

            port@1 {
                    reg = <1>;

                    parallel_out: endpoint {
                            remote_endpoint = <&panel_in>;
                    };
            };
    };

    panel {
            ...

            port {
                    panel_in: endpoint {
                            remote-endpoint = <&parallel_out>;
                    };
            };
    };

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 .../devicetree/bindings/drm/imx/fsl-imx-drm.txt    | 26 ++++++++++++++++++++--
 drivers/gpu/drm/imx/parallel-display.c             | 21 ++++++++++++-----
 2 files changed, 39 insertions(+), 8 deletions(-)

Comments

Gary Bisson July 9, 2015, 6:22 p.m. UTC | #1
Hi Philipp

On Tue, May 19, 2015 at 04:28:12PM +0200, Philipp Zabel wrote:
> The parallel-display driver used an undocumented, non-standard property
> "fsl,panel" to optionally associate with a drm_panel device. This patch
> fixes the driver to use the same OF graph bindings as the LDB driver
> instead:
> 
>     parallel-display {
>             compatible = "fsl,imx-parallel-display";
>             ...
> 
>             port@1 {
>                     reg = <1>;
> 
>                     parallel_out: endpoint {
>                             remote_endpoint = <&panel_in>;
>                     };
>             };
>     };
> 
>     panel {
>             ...
> 
>             port {
>                     panel_in: endpoint {
>                             remote-endpoint = <&parallel_out>;
>                     };
>             };
>     };
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> 
> ---

Tested on Nitrogen6x and Sabrelite using a Okaya RS800480T-7X0GP
display. Below are the different patches submitted that make use of this
change:
https://patchwork.kernel.org/patch/6585541/
https://patchwork.kernel.org/patch/6585551/
https://patchwork.kernel.org/patch/6504711/
https://patchwork.kernel.org/patch/6504731/

Tested-by: Gary Bisson <gary.bisson@boundarydevices.com>

Regards,
Gary
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Philipp Zabel July 14, 2015, 9:53 a.m. UTC | #2
Hi Gary,

Am Donnerstag, den 09.07.2015, 20:22 +0200 schrieb Gary Bisson:
[...]
> Tested on Nitrogen6x and Sabrelite using a Okaya RS800480T-7X0GP
> display. Below are the different patches submitted that make use of this
> change:
> https://patchwork.kernel.org/patch/6585541/
> https://patchwork.kernel.org/patch/6585551/
> https://patchwork.kernel.org/patch/6504711/
> https://patchwork.kernel.org/patch/6504731/
> 
> Tested-by: Gary Bisson <gary.bisson@boundarydevices.com>

Thank you for testing, I have sent a pull request that includes this
patch.

regards
Philipp

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt
index f349703..29c0467 100644
--- a/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt
+++ b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt
@@ -65,8 +65,10 @@  Optional properties:
 - edid: verbatim EDID data block describing attached display.
 - ddc: phandle describing the i2c bus handling the display data
   channel
-- port: A port node with endpoint definitions as defined in
+- port@[0-1]: Port nodes with endpoint definitions as defined in
   Documentation/devicetree/bindings/media/video-interfaces.txt.
+  Port 0 is the input port connected to the IPU display interface,
+  port 1 is the output port connected to a panel.
 
 example:
 
@@ -75,9 +77,29 @@  display@di0 {
 	edid = [edid-data];
 	interface-pix-fmt = "rgb24";
 
-	port {
+	port@0 {
+		reg = <0>;
+
 		display_in: endpoint {
 			remote-endpoint = <&ipu_di0_disp0>;
 		};
 	};
+
+	port@1 {
+		reg = <1>;
+
+		display_out: endpoint {
+			remote-endpoint = <&panel_in>;
+		};
+	};
+};
+
+panel {
+	...
+
+	port {
+		panel_in: endpoint {
+			remote-endpoint = <&display_out>;
+		};
+	};
 };
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 78db5d4..c663099 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -21,6 +21,7 @@ 
 #include <drm/drm_panel.h>
 #include <linux/videodev2.h>
 #include <video/of_display_timing.h>
+#include <linux/of_graph.h>
 
 #include "imx-drm.h"
 
@@ -216,7 +217,7 @@  static int imx_pd_bind(struct device *dev, struct device *master, void *data)
 {
 	struct drm_device *drm = data;
 	struct device_node *np = dev->of_node;
-	struct device_node *panel_node;
+	struct device_node *port;
 	const u8 *edidp;
 	struct imx_parallel_display *imxpd;
 	int ret;
@@ -245,11 +246,19 @@  static int imx_pd_bind(struct device *dev, struct device *master, void *data)
 			imxpd->interface_pix_fmt = V4L2_PIX_FMT_BGR24;
 	}
 
-	panel_node = of_parse_phandle(np, "fsl,panel", 0);
-	if (panel_node) {
-		imxpd->panel = of_drm_find_panel(panel_node);
-		if (!imxpd->panel)
-			return -EPROBE_DEFER;
+	/* port@1 is the output port */
+	port = of_graph_get_port_by_id(np, 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)
+				imxpd->panel = of_drm_find_panel(remote);
+			if (!imxpd->panel)
+				return -EPROBE_DEFER;
+		}
 	}
 
 	imxpd->dev = dev;