Skip to contentSkip to conversation

drm/mipi-dsi: support LPM (Low Power Mode) transfer

PATCH Superseded Inki Dae 2 participants 7 messages Jul 18, 2014 – Jul 25, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Inki Dae

author maintainer
#0 lore raw

cover drm/mipi-dsi: support LPM (Low Power Mode) transfer

This patch series adds LPM tranfer support for video and command data.

For this, this patch adds two flags, and makes MIPI DSI host to send commands to LCD Panel device with LPM if mode_flags of LCD Panel driver includes LPM flag.

And also it applies this feature to Exynos MIPI DSI driver.

Inki Dae (2):
drm/mipi-dsi: add (LPM) Low Power Mode transfer support drm/exynos: dsi: add LPM (Low Power Mode) transfer support

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

PATCH 1/2 drm/mipi-dsi: add (LPM) Low Power Mode transfer support

This patch adds below two flags for LPM transfer, and it attaches LPM flags to a msg in accordance with master's mode_flags set by LCD Panel driver.

MIPI_DSI_MODE_CMD_LPM: low power command transfer
MIPI_DSI_MODE_VIDEO_LPM: low power video transfer

MIPI DSI spec says,
"the host processor controls the desired mode of clock operation.
Host protocol and applications control Clock Lane operating mode (High Speed or Low Power mode). System designers are responsible for understanding the clock requirements for peripherals attached to DSI and controlling clock behavior in accordance with those requirements."

Some LCD Panel devices, nt35502a, would need LPM transfer support because they should receive some initial commands with LPM by default hardware setting.

---
 drivers/gpu/drm/drm_mipi_dsi.c |    3 +++
 include/drm/drm_mipi_dsi.h     |    4 ++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +3 -0
index e633df2..6b2bbda 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_CMD_LPM)
+		msg.flags = MIPI_DSI_MSG_USE_LPM;
+
 	return ops->transfer(dsi->host, &msg);
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_write);
include/drm/drm_mipi_dsi.h +4 -0
index 944f33f..1c41e49 100644
@@ -94,6 +94,10 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
 #define MIPI_DSI_MODE_VSYNC_FLUSH	BIT(8)
 /* disable EoT packets in HS mode */
 #define MIPI_DSI_MODE_EOT_PACKET	BIT(9)
+/* command low power mode */
+#define MIPI_DSI_MODE_CMD_LPM		BIT(10)
+/* video low power mode */
+#define MIPI_DSI_MODE_VIDEO_LPM		BIT(11)
 
 enum mipi_dsi_pixel_format {
 	MIPI_DSI_FMT_RGB888,
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/2] drm/mipi-dsi: add (LPM) Low Power Mode transfer support

Hi Inki,

+CC: Thierry and Alexandre

Quoted 5 lines · Inki Dae

This patch adds below two flags for LPM transfer, and it attaches LPM flags to a msg in accordance with master's mode_flags set by LCD Panel driver.

MIPI_DSI_MODE_CMD_LPM: low power command transfer
MIPI_DSI_MODE_VIDEO_LPM: low power video transfer

What is the difference between these two?
Why not just MIPI_DSI_MODE_LPM combined optionally with MIPI_DSI_MODE_VIDEO ?
Anyway as I understand the only role of this flag is to always trigger MIPI_DSI_MSG_USE_LPM flag in DSI message. Maybe better is to check both flags in DSI host, using some helper function.

Quoted 9 lines

MIPI DSI spec says,
"the host processor controls the desired mode of clock operation.
Host protocol and applications control Clock Lane operating mode (High Speed or Low Power mode). System designers are responsible for understanding the clock requirements for peripherals attached to DSI and controlling clock behavior in accordance with those requirements."

Quoted 3 lines

Some LCD Panel devices, nt35502a, would need LPM transfer support because they should receive some initial commands with LPM by default hardware setting.

It would be good to see usage of this flag in the driver. Is it possible to post it?

I have posted few months ago TC358764 driver[1] which also uses LPM for initialization, have you look at it.

[1]:
http://lists.freedesktop.org/archives/dri-devel/2014-February/053713.html

Regards
Andrzej

Quoted 37 lines
---
 drivers/gpu/drm/drm_mipi_dsi.c |    3 +++
 include/drm/drm_mipi_dsi.h     |    4 ++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +3 -0
index e633df2..6b2bbda 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_CMD_LPM)
+		msg.flags = MIPI_DSI_MSG_USE_LPM;
+
 	return ops->transfer(dsi->host, &msg);
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_write);
include/drm/drm_mipi_dsi.h +4 -0
index 944f33f..1c41e49 100644
@@ -94,6 +94,10 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
 #define MIPI_DSI_MODE_VSYNC_FLUSH	BIT(8)
 /* disable EoT packets in HS mode */
 #define MIPI_DSI_MODE_EOT_PACKET	BIT(9)
+/* command low power mode */
+#define MIPI_DSI_MODE_CMD_LPM		BIT(10)
+/* video low power mode */
+#define MIPI_DSI_MODE_VIDEO_LPM		BIT(11)
 
 enum mipi_dsi_pixel_format {
 	MIPI_DSI_FMT_RGB888,
author maintainer
#3 lore raw

Re: [PATCH 1/2] drm/mipi-dsi: add (LPM) Low Power Mode transfer support

Quoted 11 lines · Andrzej Hajda

Hi Inki,

+CC: Thierry and Alexandre

Quoted 5 lines · Inki Dae

This patch adds below two flags for LPM transfer, and it attaches LPM flags to a msg in accordance with master's mode_flags set by LCD Panel driver.

MIPI_DSI_MODE_CMD_LPM: low power command transfer
MIPI_DSI_MODE_VIDEO_LPM: low power video transfer

What is the difference between these two?

They mean that MIPI DSI controller have to transfer command or video to Panel in Low Power Mode according to these flags.

Quoted 5 lines

Why not just MIPI_DSI_MODE_LPM combined optionally with MIPI_DSI_MODE_VIDEO ?
Anyway as I understand the only role of this flag is to always trigger MIPI_DSI_MSG_USE_LPM flag in DSI message. Maybe better is to check both flags in DSI host, using some helper function.

No any flag would mean that video and command data have to be transferred in HS mode. On the other hands, if there is one of above flags, the data would be transferred in Low Power Mode. So I think separated flags, MIPI_DSI_MODE_VIDEO/COMMAND and MIPI_DSI_MODE_LPM causes unnecessary flag combination.

Quoted 10 lines
Quoted 10 lines

MIPI DSI spec says,
"the host processor controls the desired mode of clock operation.
Host protocol and applications control Clock Lane operating mode (High Speed or Low Power mode). System designers are responsible for understanding the clock requirements for peripherals attached to DSI and controlling clock behavior in accordance with those requirements."

Quoted 6 lines
Quoted 3 lines

Some LCD Panel devices, nt35502a, would need LPM transfer support because they should receive some initial commands with LPM by default hardware setting.

It would be good to see usage of this flag in the driver. Is it possible to post it?

Yes, but that driver is needed for more cleanup works. Anyway I will post it in the near future.

Quoted 49 lines

I have posted few months ago TC358764 driver[1] which also uses LPM for initialization, have you look at it.

[1]:
http://lists.freedesktop.org/archives/dri-devel/2014-February/053713.html

Regards
Andrzej

Quoted 37 lines
---
 drivers/gpu/drm/drm_mipi_dsi.c |    3 +++
 include/drm/drm_mipi_dsi.h     |    4 ++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +3 -0
index e633df2..6b2bbda 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_CMD_LPM)
+		msg.flags = MIPI_DSI_MSG_USE_LPM;
+
 	return ops->transfer(dsi->host, &msg);
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_write);
include/drm/drm_mipi_dsi.h +4 -0
index 944f33f..1c41e49 100644
@@ -94,6 +94,10 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
 #define MIPI_DSI_MODE_VSYNC_FLUSH	BIT(8)
 /* disable EoT packets in HS mode */
 #define MIPI_DSI_MODE_EOT_PACKET	BIT(9)
+/* command low power mode */
+#define MIPI_DSI_MODE_CMD_LPM		BIT(10)
+/* video low power mode */
+#define MIPI_DSI_MODE_VIDEO_LPM		BIT(11)
 
 enum mipi_dsi_pixel_format {
 	MIPI_DSI_FMT_RGB888,
author maintainer
#4 lore raw

PATCH 2/2 drm/exynos: dsi: add LPM (Low Power Mode) transfer support

In reply to Inki Dae

This patch adds LPM transfer support for video or command data.

With this patch, Exynos MIPI DSI controller can transfer command or video data with HS or LP mode in accordance with mode_flags set by LCD Panel driver.

---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dsi.c +20 -2
index 2df3592..b120554 100644
@@ -426,13 +426,28 @@ 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);
+
+	if (!(dsi->mode_flags & MIPI_DSI_MODE_CMD_LPM))
+		reg |= DSIM_TX_REQUEST_HSCLK;
+
 	writel(reg, dsi->reg_base + DSIM_CLKCTRL_REG);
 
 	return 0;
 }
 
+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_disable_clock(struct exynos_dsi *dsi)
 {
 	u32 reg;
@@ -575,6 +590,9 @@ static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable)
 {
 	u32 reg;
 
+	if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_LPM))
+		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
#5 lore raw

Re: [PATCH 2/2] drm/exynos: dsi: add LPM (Low Power Mode) transfer support

+CC: Thierry and Alexandre

Quoted 17 lines · Inki Dae

This patch adds LPM transfer support for video or command data.

With this patch, Exynos MIPI DSI controller can transfer command or video data with HS or LP mode in accordance with mode_flags set by LCD Panel driver.

---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dsi.c +0 -0
index 2df3592..b120554 100644

drivers/gpu/drm/exynos/exynos_drm_dsi.c static int exynos_dsi_enable_clock(struct exynos_dsi *dsi) · line 433

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +5 -2
@@ -426,13 +426,28 @@ 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);
+
+	if (!(dsi->mode_flags & MIPI_DSI_MODE_CMD_LPM))
+		reg |= DSIM_TX_REQUEST_HSCLK;
+

Maybe I missed sth but it seems to me slightly unrelated to LPM flag. According to specs some panels can require this clock even in LPM mode. I wonder if recently introduced MIPI_DSI_CLOCK_NON_CONTINUOUS wouldn't handle it.

Quoted 21 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +12 -0
 	writel(reg, dsi->reg_base + DSIM_CLKCTRL_REG);
 
 	return 0;
 }
 
+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_disable_clock(struct exynos_dsi *dsi)
 {
 	u32 reg;

drivers/gpu/drm/exynos/exynos_drm_dsi.c static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable) · line 595

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +3 -0
@@ -575,6 +590,9 @@ static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable)
 {
 	u32 reg;
 
+	if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_LPM))
+		exynos_dsi_enable_hs_clock(dsi, true);
+

It does not care about enable argument of the function, I guess it should.

Regards
Andrzej

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +0 -0
 	reg = readl(dsi->reg_base + DSIM_MDRESOL_REG);
 	if (enable)
 		reg |= DSIM_MAIN_STAND_BY;
author maintainer
#6 lore raw

Re: [PATCH 2/2] drm/exynos: dsi: add LPM (Low Power Mode) transfer support

Quoted 27 lines · Andrzej Hajda

+CC: Thierry and Alexandre

Quoted 24 lines · Inki Dae

This patch adds LPM transfer support for video or command data.

With this patch, Exynos MIPI DSI controller can transfer command or video data with HS or LP mode in accordance with mode_flags set by LCD Panel driver.

---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dsi.c +2 -2
index 2df3592..b120554 100644
@@ -426,13 +426,28 @@ 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);
+
Quoted 8 lines

drivers/gpu/drm/exynos/exynos_drm_dsi.c static int exynos_dsi_enable_clock(struct exynos_dsi *dsi) · line 433

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +3 -0
+	if (!(dsi->mode_flags & MIPI_DSI_MODE_CMD_LPM))
+		reg |= DSIM_TX_REQUEST_HSCLK;
+

Maybe I missed sth but it seems to me slightly unrelated to LPM flag. According to specs some panels can require this clock even in LPM mode. I wonder if recently introduced MIPI_DSI_CLOCK_NON_CONTINUOUS wouldn't handle it.

It's different. MIPI DSI spec says,
"For continuous clock behaviour, the Clock Lane remains in high-speed mode generating active clock signals between HS data packet transmissions. For non-continuous clock behaviour, *the Clock Lane enters the LP-11 state between HS data packet transmissions*."

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +12 -0
 	writel(reg, dsi->reg_base + DSIM_CLKCTRL_REG);
 
 	return 0;
 }
 
+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_disable_clock(struct exynos_dsi *dsi)
 {
 	u32 reg;
@@ -575,6 +590,9 @@ static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable)
 {
 	u32 reg;
 
Quoted 6 lines

drivers/gpu/drm/exynos/exynos_drm_dsi.c static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable) · line 595

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +3 -0
+	if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_LPM))
+		exynos_dsi_enable_hs_clock(dsi, true);
+

It does not care about enable argument of the function, I guess it should.

Yes, it's better to enable HS clock only in case of enabling. So will add one more flag like below,

if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_LPM) && enable)

Thank,
Inki Dae

Quoted 12 lines

Regards
Andrzej

drivers/gpu/drm/exynos/exynos_drm_dsi.c static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable) · line 598

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_dsi.c +0 -0
 	reg = readl(dsi->reg_base + DSIM_MDRESOL_REG);
 	if (enable)
 		reg |= DSIM_MAIN_STAND_BY;

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

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