Skip to contentSkip to conversation

drm/mipi-dsi: consider low power transmission

PATCH New Inki Dae 1 participant 3 messages Aug 12, 2014

Subsystems (4)
lore
Share & tools
lore

Inki Dae

author maintainer
#0 lore raw

cover drm/mipi-dsi: consider low power transmission

This patch considers low power transmisson to two clock behaviors, non-continuous and continuous clock mode.

These two clock behaviors can transmit data in high speed or low power. So this patch series adds a new flag, MIPI_DSI_MODE_LPM so that each host driver can setup its host controller properly.

Patch 1:
Add MIPI_DSI_MODE_LPM flag, and with this flag, mipi-dsi framework will set MIPI_DSI_MSG_USE_LPM.

Patch 2:
Just exynos part for supporting non-continuous and continuous clock mode.

Inki Dae (2):
drm/mipi-dsi: consider low power transmission. drm/exynos: mipi-dsi: consider non-continuous clock mode

 drivers/gpu/drm/drm_mipi_dsi.c          |    6 ++++++
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   32 +++++++++++++++++++++++++++++--
 include/drm/drm_mipi_dsi.h              |    2 ++
 3 files changed, 38 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
author maintainer
#1 lore raw

PATCH 1/2 drm/mipi-dsi: consider low power transmission.

This patch adds a new flag, MIPI_DSI_MODE_LPM, to transmit data in low power. With this flag, msg.flags has MIPI_DSI_MSG_USE_LPM so that host driver of each SoC can clear or set relevant register bit for low power transmission.

All host controllers shall support continuous clock behavior on the Clock Lane, and optionally may support non-continuous clock behavior. Both of them can transmit data in high speed or low power.

With each clock behavior, non-continuous or continuous clock mode, host controller will transmit data in high speed by default so if peripheral want to receive data in low power, the peripheral driver should set MIPI_DSI_MODE_LPM flag.

---
 drivers/gpu/drm/drm_mipi_dsi.c |    6 ++++++
 include/drm/drm_mipi_dsi.h     |    2 ++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +6 -0
index e633df2..6cc0720 100644
@@ -232,6 +232,9 @@ int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel,
 		break;
 	}
 
+	if (dsi->mode_flags & MIPI_DSI_MODE_LPM)
+		msg.flags = MIPI_DSI_MSG_USE_LPM;
+
 	return ops->transfer(dsi->host, &msg);
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_write);
@@ -262,6 +265,9 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
 	if (!ops || !ops->transfer)
 		return -ENOSYS;
 
+	if (dsi->mode_flags & MIPI_DSI_MODE_LPM)
+		msg.flags = MIPI_DSI_MSG_USE_LPM;
+
 	return ops->transfer(dsi->host, &msg);
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_read);
include/drm/drm_mipi_dsi.h +2 -0
index efa1b55..90d9f71 100644
@@ -96,6 +96,8 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
 #define MIPI_DSI_MODE_EOT_PACKET	BIT(9)
 /* device supports non-continuous clock behavior (DSI spec 5.6.1) */
 #define MIPI_DSI_CLOCK_NON_CONTINUOUS	BIT(10)
+/* transmit data in low power */
+#define MIPI_DSI_MODE_LPM		BIT(11)
 
 enum mipi_dsi_pixel_format {
 	MIPI_DSI_FMT_RGB888,
Signature · 1 line
1.7.9.5
author maintainer
#2 lore raw

PATCH 2/2 drm/exynos: mipi-dsi: consider non-continuous clock mode

In reply to Inki Dae

This patch adds non-continuous clock mode support.

Clock mode on Clock Lane is continuous clock by default. So if we want to transmit data in non-continuous clock mode to reduce power consumption, then host driver should clear DSIM_TX_REQUEST_HSCLK.

For this, this patch makes the host driver set DSIM_TX_REQUEST_HSCLK only in case that dsi->mode_flags has no MIPI_DSI_CLOCK_NON_CONTINUOUS flag.

---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   32 +++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dsi.c +30 -2
index 86aebd8..8c43c96 100644
@@ -493,8 +493,17 @@ static int exynos_dsi_enable_clock(struct exynos_dsi *dsi)
 			| DSIM_ESC_PRESCALER(esc_div)
 			| DSIM_LANE_ESC_CLK_EN_CLK
 			| DSIM_LANE_ESC_CLK_EN_DATA(BIT(dsi->lanes) - 1)
-			| DSIM_BYTE_CLK_SRC(0)
-			| DSIM_TX_REQUEST_HSCLK;
+			| DSIM_BYTE_CLK_SRC(0);
+
+	/*
+	 * Set DSIM_TX_REQUEST_HSCLK only in case of not requesting
+	 * non-continous clock mode. So if MIPI_DSI_CLOCK_NON_CONTINUOUS,
+	 * then host controller will turn off the HS clock between high-speed
+	 * transmissions.
+	 */
+	if (!(dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
+		reg |= DSIM_TX_REQUEST_HSCLK;
+
 	writel(reg, dsi->reg_base + DSIM_CLKCTRL_REG);
 
 	return 0;
@@ -701,10 +710,29 @@ static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi)
 	dev_dbg(dsi->dev, "LCD size = %dx%d\n", vm->hactive, vm->vactive);
 }
 
+static void exynos_dsi_enable_hs_clock(struct exynos_dsi *dsi,
+					bool enable)
+{
+	u32 reg = readl(dsi->reg_base + DSIM_CLKCTRL_REG);
+
+	reg &= ~DSIM_TX_REQUEST_HSCLK;
+	if (enable)
+		reg |= DSIM_TX_REQUEST_HSCLK;
+
+	writel(reg, dsi->reg_base + DSIM_CLKCTRL_REG);
+}
+
 static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable)
 {
 	u32 reg;
 
+	/*
+	 * Set DSIM_TX_REQUEST_HSCLK. In case of video data, host controller
+	 * will transmit the data in HS mode always.
+	 */
+	if (enable)
+		exynos_dsi_enable_hs_clock(dsi, true);
+
 	reg = readl(dsi->reg_base + DSIM_MDRESOL_REG);
 	if (enable)
 		reg |= DSIM_MAIN_STAND_BY;
Signature · 1 line
1.7.9.5