Skip to contentSkip to conversation

drm/fsl-dcu: rework codes to support of_graph dt binding for panel

PATCH Superseded Meng Yi 1 participant 2 messages Jul 15, 2016

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Meng Yi

author
#0 lore raw

PATCH v4 1/2 drm/fsl-dcu: rework codes to support of_graph dt binding for panel

This patch rework the output code to add of_graph dt binding support for panel device and also keeps the backward compatibility

---
Changes in V4:
-simplify return value statements
-merge corresponding documentation to this patch
Changes in V3:
-simplify return value statements
Changes in V2:
-fix some coding style issue
-add fsl_dev->connector.panel check
-use fsl_dev->np and drop fsl_dev->dev->of_node
-return 'ret' when fsl_dcu_attach_panel failed

---
 .../devicetree/bindings/display/fsl,dcu.txt        |  9 ++-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c          |  2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h       |  3 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          | 69 +++++++++++++++-------
 4 files changed, 58 insertions(+), 25 deletions(-)
Documentation/devicetree/bindings/display/fsl,dcu.txt +7 -2
index ae55cde..63ec2a6 100644
@@ -12,7 +12,7 @@ Required properties:
 - clock-names:		Should be "dcu" and "pix"
 			See ../clocks/clock-bindings.txt for details.
 - big-endian		Boolean property, LS1021A DCU registers are big-endian.
-- fsl,panel:		The phandle to panel node.
+- port			Video port for the panel output
 
 Optional properties:
 - fsl,tcon:		The phandle to the timing controller node.
@@ -24,6 +24,11 @@ dcu: dcu@2ce0000 {
 	clocks = <&platform_clk 0>, <&platform_clk 0>;
 	clock-names = "dcu", "pix";
 	big-endian;
-	fsl,panel = <&panel>;
 	fsl,tcon = <&tcon>;
+
+	port {
+		dcu_out: endpoint {
+			remote-endpoint = <&panel_out>;
+	     };
+	};
 };
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c +1 -1
index a6e4cd5..d9d6cc1 100644
@@ -43,7 +43,7 @@ int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev)
 	if (ret)
 		goto err;
 
-	ret = fsl_dcu_drm_connector_create(fsl_dev, &fsl_dev->encoder);
+	ret = fsl_dcu_create_outputs(fsl_dev);
 	if (ret)
 		goto err;
 
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h +1 -2
index 7093109..5a7b88e 100644
@@ -25,9 +25,8 @@ to_fsl_dcu_connector(struct drm_connector *con)
 		     : NULL;
 }
 
-int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev,
-				 struct drm_encoder *encoder);
 int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device *fsl_dev,
 			       struct drm_crtc *crtc);
+int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev);
 
 #endif /* __FSL_DCU_DRM_CONNECTOR_H__ */
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +49 -20

99 lines not on this page · raw message

Signature · 6 lines
2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH v4 2/2 drm/fsl-dcu: add support for drm bridge

The current output code only supports connection to drm panels. Add code to support drm bridge, to support connections to external connectors.

---
Changes since V1:
-no change

---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +13 -3
index ef34436..56f6991 100644
@@ -180,17 +180,27 @@ err_cleanup:
 static int fsl_dcu_attach_endpoint(struct fsl_dcu_drm_device *fsl_dev,
 				    const struct of_endpoint *ep)
 {
+	struct drm_bridge *bridge;
 	struct device_node *np;
 	int ret;
 
 	np = of_graph_get_remote_port_parent(ep->local_node);
 
 	fsl_dev->connector.panel = of_drm_find_panel(np);
-	of_node_put(np);
-	if (fsl_dev->connector.panel)
+	if (fsl_dev->connector.panel) {
+		of_node_put(np);
 		return fsl_dcu_attach_panel(fsl_dev, fsl_dev->connector.panel);
+	}
+
+	bridge = of_drm_find_bridge(np);
+	of_node_put(np);
+	if (!bridge)
+		return -ENODEV;
+
+	fsl_dev->encoder.bridge = bridge;
+	bridge->encoder = &fsl_dev->encoder;
 
-	return -ENODEV;
+	return drm_bridge_attach(fsl_dev->drm, bridge);
 }
 
 int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev)
Signature · 6 lines
2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel