[RFC 2/2] drm/bridge/ptn3460: add panel support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Rob Clark <robdclark@xxxxxxxxx>
---
 drivers/gpu/drm/bridge/ptn3460.c | 39 +++++++++++++++++++++++++++++++++------
 include/drm/bridge/ptn3460.h     |  6 ++++--
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index b171901..e3e6b46 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -26,6 +26,7 @@
 #include "drm_crtc_helper.h"
 
 #include "bridge/ptn3460.h"
+#include "drm_bridge_util.h"
 
 #define PTN3460_EDID_ADDR			0x0
 #define PTN3460_EDID_EMULATION_ADDR		0x84
@@ -112,7 +113,6 @@ static int ptn3460_select_edid(struct ptn3460_bridge *ptn_bridge)
 static void ptn3460_pre_enable(struct drm_bridge *bridge)
 {
 	struct ptn3460_bridge *ptn_bridge = bridge->driver_private;
-	int ret;
 
 	if (ptn_bridge->enabled)
 		return;
@@ -132,6 +132,15 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 	 * time specified in the chip's datasheet to make sure we're really up.
 	 */
 	msleep(90);
+}
+
+static void ptn3460_enable(struct drm_bridge *bridge)
+{
+	struct ptn3460_bridge *ptn_bridge = bridge->driver_private;
+	int ret;
+
+	if (ptn_bridge->enabled)
+		return;
 
 	ret = ptn3460_select_edid(ptn_bridge);
 	if (ret)
@@ -140,10 +149,6 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 	ptn_bridge->enabled = true;
 }
 
-static void ptn3460_enable(struct drm_bridge *bridge)
-{
-}
-
 static void ptn3460_disable(struct drm_bridge *bridge)
 {
 	struct ptn3460_bridge *ptn_bridge = bridge->driver_private;
@@ -265,7 +270,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = {
 };
 
 int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
-		struct i2c_client *client, struct device_node *node)
+		struct i2c_client *client, struct device_node *node,
+		struct drm_panel *panel)
 {
 	int ret;
 	struct drm_bridge *bridge;
@@ -324,6 +330,27 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 		goto err;
 	}
 
+	if (panel) {
+		struct drm_bridge *cbridge, *pbridge;
+
+		pbridge = drm_panel_bridge_init(panel);
+		if (IS_ERR(pbridge)) {
+			ret = PTR_ERR(pbridge);
+			goto err;
+		}
+
+		/* panel sequence is after ptn4360 bridge bridge in
+		 * enable path, before in disable path:
+		 */
+		cbridge = drm_composite_bridge_init(bridge, pbridge);
+		if (IS_ERR(cbridge)) {
+			ret = PTR_ERR(cbridge);
+			goto err;
+		}
+
+		bridge = cbridge;
+	}
+
 	bridge->driver_private = ptn_bridge;
 	encoder->bridge = bridge;
 
diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h
index ff62344..9a557da 100644
--- a/include/drm/bridge/ptn3460.h
+++ b/include/drm/bridge/ptn3460.h
@@ -16,18 +16,20 @@
 
 struct drm_device;
 struct drm_encoder;
+struct drm_panel;
 struct i2c_client;
 struct device_node;
 
 #if defined(CONFIG_DRM_PTN3460) || defined(CONFIG_DRM_PTN3460_MODULE)
 
 int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
-		struct i2c_client *client, struct device_node *node);
+		struct i2c_client *client, struct device_node *node,
+		struct drm_panel *panel);
 #else
 
 static inline int ptn3460_init(struct drm_device *dev,
 		struct drm_encoder *encoder, struct i2c_client *client,
-		struct device_node *node)
+		struct device_node *node, struct drm_panel *panel)
 {
 	return 0;
 }
-- 
1.9.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux