[PATCH 2/3] drm: bridge: icn6211: Allow selection of video mode

Brandon Cheo Fusi fusibrandon13 at gmail.com
Tue Apr 18 12:22:04 UTC 2023


The DSI burst mode is more energy efficient than the DSI sync pulse mode,
but doesn't always work with some DSI controllers (like sunxi's). Let the
user specify the video mode as a dt property, like in
https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/167105/1/panel-bananapi-s070wv20-icn6211.c

Signed-off-by: Brandon Cheo Fusi <fusibrandon13 at gmail.com>
---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 29 ++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
index 39de9a7c7..ec720ca1b 100644
--- a/drivers/gpu/drm/bridge/chipone-icn6211.c
+++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
@@ -512,6 +512,7 @@ static int chipone_dsi_attach(struct chipone *icn)
 {
 	struct mipi_dsi_device *dsi = icn->dsi;
 	struct device *dev = icn->dev;
+	u32 video_mode;
 	int dsi_lanes, ret;
 
 	dsi_lanes = drm_of_get_data_lanes_count_ep(dev->of_node, 0, 0, 1, 4);
@@ -526,8 +527,32 @@ static int chipone_dsi_attach(struct chipone *icn)
 		icn->dsi->lanes = dsi_lanes;
 
 	dsi->format = MIPI_DSI_FMT_RGB888;
-	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM
+					| MIPI_DSI_MODE_NO_EOT_PACKET;
+	/*
+	 *	If the 'video-mode' property does not exist in DT or is invalid,
+	 *	default to non-burst mode with sync event
+	 */
+	ret = of_property_read_u32_index(dev->of_node, "video-mode", 0, &video_mode);
+	if (!ret) {
+		switch (video_mode) {
+		case 0:
+			/* burst mode */
+			dsi->mode_flags |= MIPI_DSI_MODE_VIDEO_BURST;
+			break;
+		case 1:
+			/* non-burst mode with sync pulse */
+			dsi->mode_flags |= MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
+			break;
+		case 2:
+			/* non-burst mode with sync event */
+			break;
+		default:
+			dev_warn(dev, "invalid video mode %d\n", video_mode);
+			break;
+		}
+	}
+
 	dsi->hs_rate = 500000000;
 	dsi->lp_rate = 16000000;
 
-- 
2.30.2



More information about the dri-devel mailing list