Skip to contentSkip to conversation

splash screen on the stm32f769 & stm32mp1 boards

PATCH Superseded Yannick Fertré 3 participants 20 messages Sep 13, 2019 – Sep 24, 2019

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover splash screen on the stm32f769 & stm32mp1 boards

Version 1:
- Initial commit.

Version 2:
- swap patches to avoid compilation issue.
- remove panel timings from device tree.

Version 3:
- Share same include file mipi_display.h with kernel linux.
- Rework ltdc driver with last comments of Anatolij Gustshin.
- Check ordering (file dw_mipi_dsi.c).
- Rename mipi_display.c to mipi_dsi.c.

Version 4:
- Add physical set mode operation
- Improve debug trace (display controller ltdc)
- Refresh timings of panels
- Add regulator (dsi controller)
- Add new class DSI_HOST
- Support of panels OTM800A & RM68200

This serie contains all patchsets needed for displaying a splash screen on the stm32f769 & stm32mp1 boards.
A new config has been created configs/stm32f769-disco_defconfig. This is necessary due to the difference of panels between stm32f769-disco, stm32f746-disco boards & stm32mp1 boards.
A new class DSI_HOST have been created to manage a dsi host between the dsi controller & display controller.

Yannick Fertré (15):
video: bmp: check resolutions of panel/bitmap
video: stm32: stm32_ltdc: add bridge to display controller
include: Add new DCS commands in the enum list
video: add support of MIPI DSI interface
dm: Add a dsi host uclass
video: add MIPI DSI host controller bridge
video: add support of STM32 MIPI DSI controller driver
video: add support of panel OTM8009A
video: add support of panel RM68200
board: Add STM32F769 SoC, discovery board support
ARM: dts: stm32f769: add display for STM32F769 disco board
ARM: dts: stm32mp1: add dsi host for stm32mp157c-ev1 board
ARM: dts: stm32mp1: add dsi host for stm32mp157c-dk2 board
stm32mp1: configs: update video
stm32mp1: configs: add display devices

 arch/arm/dts/stm32f769-disco-u-boot.dtsi |  62 +++
 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi |   7 +
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |   5 +
 arch/sandbox/dts/sandbox.dts             |   6 +-
 configs/sandbox_defconfig                |   1 +
 configs/stm32f769-disco_defconfig        |  63 +++
 configs/stm32mp15_basic_defconfig        |   6 +
 configs/stm32mp15_optee_defconfig        |   6 +
 configs/stm32mp15_trusted_defconfig      |   6 +
 drivers/video/Kconfig                    |  43 ++
 drivers/video/Makefile                   |   6 +
 drivers/video/dsi-host-uclass.c          |  39 ++
 drivers/video/dw_mipi_dsi.c              | 838 +++++++++++++++++++++++++++++++
 drivers/video/mipi_dsi.c                 | 828 ++++++++++++++++++++++++++++++
 drivers/video/orisetech_otm8009a.c       | 379 ++++++++++++++
 drivers/video/raydium-rm68200.c          | 351 +++++++++++++
 drivers/video/sandbox_dsi_host.c         |  83 +++
 drivers/video/stm32/Kconfig              |   9 +
 drivers/video/stm32/Makefile             |   1 +
 drivers/video/stm32/stm32_dsi.c          | 490 ++++++++++++++++++
 drivers/video/stm32/stm32_ltdc.c         | 143 +++---
 drivers/video/video_bmp.c                |  14 +
 include/configs/stm32mp1.h               |   7 +
 include/dm/uclass-id.h                   |   1 +
 include/dsi_host.h                       |  57 +++
 include/mipi_display.h                   |   8 +
 include/mipi_dsi.h                       | 466 +++++++++++++++++
 test/dm/Makefile                         |   1 +
 test/dm/dsi_host.c                       |  58 +++
 29 files changed, 3923 insertions(+), 61 deletions(-)
 create mode 100644 configs/stm32f769-disco_defconfig
 create mode 100644 drivers/video/dsi-host-uclass.c
 create mode 100644 drivers/video/dw_mipi_dsi.c
 create mode 100644 drivers/video/mipi_dsi.c
 create mode 100644 drivers/video/orisetech_otm8009a.c
 create mode 100644 drivers/video/raydium-rm68200.c
 create mode 100644 drivers/video/sandbox_dsi_host.c
 create mode 100644 drivers/video/stm32/stm32_dsi.c
 create mode 100644 include/dsi_host.h
 create mode 100644 include/mipi_dsi.h
 create mode 100644 test/dm/dsi_host.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/15 video: bmp: check resolutions of panel/bitmap

If the size of the bitmap is bigger than the size of the panel then errors appear when calculating axis alignment and the copy of bitmap is done outside of framebuffer.

---
 drivers/video/video_bmp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/video/video_bmp.c +14 -0
index 193f37d..544bd5f 100644
@@ -54,6 +54,13 @@ static void video_display_rle8_bitmap(struct udevice *dev,
 	height = get_unaligned_le32(&bmp->header.height);
 	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
+	/* check if picture size exceed panel size */
+	if (priv->xsize < width)
+		width = priv->xsize;
+
+	if (priv->ysize < height)
+		height = priv->ysize;
+
 	x = 0;
 	y = height - 1;
 
@@ -249,6 +256,13 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 
 	padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
 
+	/* check if picture size exceed panel size */
+	if (pwidth < width)
+		width = pwidth;
+
+	if (priv->ysize < height)
+		height = priv->ysize;
+
 	if (align) {
 		video_splash_align_axis(&x, priv->xsize, width);
 		video_splash_align_axis(&y, priv->ysize, height);
Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 1/15 video: bmp: check resolutions of panel/bitmap

Quoted 9 lines · Yannick Fertré

If the size of the bitmap is bigger than the size of the panel then errors appear when calculating axis alignment and the copy of bitmap is done outside of framebuffer.

---
 drivers/video/video_bmp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
#3 lore raw

PATCH v4 1/15 video: bmp: check resolutions of panel/bitmap

In reply to Yannick Fertré
Quoted 14 lines · Yannick Fertré

If the size of the bitmap is bigger than the size of the panel then errors appear when calculating axis alignment and the copy of bitmap is done outside of framebuffer.

---
  drivers/video/video_bmp.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
drivers/video/video_bmp.c +0 -0
index 193f37d..544bd5f 100644

drivers/video/video_bmp.c static void video_display_rle8_bitmap(struct udevice *dev, · line 57

Quoted 4 lines
drivers/video/video_bmp.c +1 -0
@@ -54,6 +54,13 @@ static void video_display_rle8_bitmap(struct udevice *dev,
  	height = get_unaligned_le32(&bmp->header.height);
  	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
+	/* check if picture size exceed panel size */

%s/exceed/exceeds/

drivers/video/video_bmp.c static void video_display_rle8_bitmap(struct udevice *dev, · line 59

Quoted 2 lines
drivers/video/video_bmp.c +2 -0
+	if (priv->xsize < width)
+		width = priv->xsize;

In case of BMP_RLE8_DELTA width is not checked before writing to the frame buffer. So this modification of width will lead to unexpected effects.

In the 'default' case width is checked and this may lead to decoding errors.

Quoted 8 lines
drivers/video/video_bmp.c +4 -0
+
+	if (priv->ysize < height)
+		height = priv->ysize;
+
  	x = 0;
  	y = height - 1;
 

drivers/video/video_bmp.c int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, · line 265

Quoted 10 lines
drivers/video/video_bmp.c +7 -0
@@ -249,6 +256,13 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 
  	padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
 
+	/* check if picture size exceed panel size */
+	if (pwidth < width)
+		width = pwidth;
+
+	if (priv->ysize < height)
+		height = priv->ysize;
+

You forgot to consider the position (x,y) of the picture.

Best regards

Heinrich

Quoted 4 lines
drivers/video/video_bmp.c +0 -0
  	if (align) {
  		video_splash_align_axis(&x, priv->xsize, width);
  		video_splash_align_axis(&y, priv->ysize, height);
#4 lore raw

PATCH v4 1/15 video: bmp: check resolutions of panel/bitmap

Hello Heinrich,

Thank for your review.

You're right my patch does not allow to properly protect the framebuffer.

I will push a new patch which check the bitmap size and exit in case of size error.

Yannick Fertré

Quoted 64 lines · Heinrich Schuchardt
Quoted 19 lines · Yannick Fertré

If the size of the bitmap is bigger than the size of the panel then errors appear when calculating axis alignment and the copy of bitmap is done outside of framebuffer.

---
  drivers/video/video_bmp.c | 14 ++++++++++++++

  1 file changed, 14 insertions(+)
drivers/video/video_bmp.c +0 -0
index 193f37d..544bd5f 100644
@@ -54,6 +54,13 @@ static void video_display_rle8_bitmap(struct 
 udevice *dev,
       height = get_unaligned_le32(&bmp->header.height);

      bmap = (uchar *)bmp +
get_unaligned_le32(&bmp->header.data_offset);

Quoted 1 line

+    /* check if picture size exceed panel size */

%s/exceed/exceeds/

Quoted 2 lines

+    if (priv->xsize < width)
+        width = priv->xsize;

In case of BMP_RLE8_DELTA width is not checked before writing to the frame buffer. So this modification of width will lead to unexpected effects.

In the 'default' case width is checked and this may lead to decoding errors.

Quoted 9 lines
drivers/video/video_bmp.c +4 -0
+
+    if (priv->ysize < height)
+        height = priv->ysize;
+

      x = 0;
      y = height - 1;

drivers/video/video_bmp.c +0 -0
@@ -249,6 +256,13 @@ int video_bmp_display(struct udevice *dev, ulong 
 bmp_image, int x, int y,

drivers/video/video_bmp.c int video_bmp_display(struct udevice *dev, ulong · line 266

Quoted 10 lines
drivers/video/video_bmp.c +7 -0
 
       padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
 
+    /* check if picture size exceed panel size */
+    if (pwidth < width)
+        width = pwidth;
+
+    if (priv->ysize < height)
+        height = priv->ysize;
+

You forgot to consider the position (x,y) of the picture.

Best regards

Heinrich

Quoted 4 lines
drivers/video/video_bmp.c +0 -0
       if (align) {
           video_splash_align_axis(&x, priv->xsize, width);

          video_splash_align_axis(&y, priv->ysize, height);

#5 lore raw

PATCH v4 2/15 video: stm32: stm32_ltdc: add bridge to display controller

In reply to Yannick Fertré

Manage a bridge insert between the display controller & a panel.

---
 drivers/video/stm32/stm32_ltdc.c | 143 +++++++++++++++++++++++----------------
 1 file changed, 83 insertions(+), 60 deletions(-)
drivers/video/stm32/stm32_ltdc.c +83 -60
index dc6c889..59ff692 100644
@@ -7,19 +7,18 @@
 
 #include <common.h>
 #include <clk.h>
+#include <display.h>
 #include <dm.h>
 #include <panel.h>
 #include <reset.h>
 #include <video.h>
+#include <video_bridge.h>
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
 #include <dm/device-internal.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct stm32_ltdc_priv {
 	void __iomem *regs;
-	struct display_timing timing;
 	enum video_log2_bpp l2bpp;
 	u32 bg_col_argb;
 	u32 crop_x, crop_y, crop_w, crop_h;
@@ -174,8 +173,8 @@ static u32 stm32_ltdc_get_pixel_format(enum video_log2_bpp l2bpp)
 	case VIDEO_BPP2:
 	case VIDEO_BPP4:
 	default:
-		debug("%s: warning %dbpp not supported yet, %dbpp instead\n",
-		      __func__, VNBITS(l2bpp), VNBITS(VIDEO_BPP16));
+		pr_warn("%s: warning %dbpp not supported yet, %dbpp instead\n",
+			__func__, VNBITS(l2bpp), VNBITS(VIDEO_BPP16));
 		pf = PF_RGB565;
 		break;
 	}
@@ -209,23 +208,23 @@ static void stm32_ltdc_enable(struct stm32_ltdc_priv *priv)
 	setbits_le32(priv->regs + LTDC_GCR, GCR_LTDCEN);
 }
 
-static void stm32_ltdc_set_mode(struct stm32_ltdc_priv *priv)
+static void stm32_ltdc_set_mode(struct stm32_ltdc_priv *priv,
+				struct display_timing *timings)
 {
 	void __iomem *regs = priv->regs;
-	struct display_timing *timing = &priv->timing;
 	u32 hsync, vsync, acc_hbp, acc_vbp, acc_act_w, acc_act_h;
 	u32 total_w, total_h;
 	u32 val;
 
 	/* Convert video timings to ltdc timings */
-	hsync = timing->hsync_len.typ - 1;
-	vsync = timing->vsync_len.typ - 1;
-	acc_hbp = hsync + timing->hback_porch.typ;
-	acc_vbp = vsync + timing->vback_porch.typ;
-	acc_act_w = acc_hbp + timing->hactive.typ;
-	acc_act_h = acc_vbp + timing->vactive.typ;
-	total_w = acc_act_w + timing->hfront_porch.typ;
-	total_h = acc_act_h + timing->vfront_porch.typ;
+	hsync = timings->hsync_len.typ - 1;
+	vsync = timings->vsync_len.typ - 1;
+	acc_hbp = hsync + timings->hback_porch.typ;
+	acc_vbp = vsync + timings->vback_porch.typ;
+	acc_act_w = acc_hbp + timings->hactive.typ;
+	acc_act_h = acc_vbp + timings->vactive.typ;
+	total_w = acc_act_w + timings->hfront_porch.typ;
+	total_h = acc_act_h + timings->vfront_porch.typ;
 
 	/* Synchronization sizes */
 	val = (hsync << 16) | vsync;
@@ -247,14 +246,14 @@ static void stm32_ltdc_set_mode(struct stm32_ltdc_priv *priv)
 
 	/* Signal polarities */
 	val = 0;
-	debug("%s: timing->flags 0x%08x\n", __func__, timing->flags);
-	if (timing->flags & DISPLAY_FLAGS_HSYNC_HIGH)
+	debug("%s: timing->flags 0x%08x\n", __func__, timings->flags);
+	if (timings->flags & DISPLAY_FLAGS_HSYNC_HIGH)
 		val |= GCR_HSPOL;
-	if (timing->flags & DISPLAY_FLAGS_VSYNC_HIGH)
+	if (timings->flags & DISPLAY_FLAGS_VSYNC_HIGH)
 		val |= GCR_VSPOL;
-	if (timing->flags & DISPLAY_FLAGS_DE_HIGH)
+	if (timings->flags & DISPLAY_FLAGS_DE_HIGH)
 		val |= GCR_DEPOL;
-	if (timing->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+	if (timings->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
 		val |= GCR_PCPOL;
 	clrsetbits_le32(regs + LTDC_GCR,
 			GCR_HSPOL | GCR_VSPOL | GCR_DEPOL | GCR_PCPOL, val);
@@ -330,96 +329,120 @@ static int stm32_ltdc_probe(struct udevice *dev)
 	struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
 	struct video_priv *uc_priv = dev_get_uclass_priv(dev);
 	struct stm32_ltdc_priv *priv = dev_get_priv(dev);
-	struct udevice *panel;
+	struct udevice *bridge = NULL;
+	struct udevice *panel = NULL;
+	struct display_timing timings;
 	struct clk pclk;
 	struct reset_ctl rst;
-	int rate, ret;
+	int ret;
 
 	priv->regs = (void *)dev_read_addr(dev);
 	if ((fdt_addr_t)priv->regs == FDT_ADDR_T_NONE) {
-		debug("%s: ltdc dt register address error\n", __func__);
+		dev_err(dev, "ltdc dt register address error\n");
 		return -EINVAL;
 	}
 
 	ret = clk_get_by_index(dev, 0, &pclk);
 	if (ret) {
-		debug("%s: peripheral clock get error %d\n", __func__, ret);
+		dev_err(dev, "peripheral clock get error %d\n", ret);
 		return ret;
 	}
 
 	ret = clk_enable(&pclk);
 	if (ret) {
-		debug("%s: peripheral clock enable error %d\n",
-		      __func__, ret);
+		dev_err(dev, "peripheral clock enable error %d\n", ret);
 		return ret;
 	}
 
-	ret = reset_get_by_index(dev, 0, &rst);
+	ret = uclass_first_device_err(UCLASS_PANEL, &panel);
 	if (ret) {
-		debug("%s: missing ltdc hardware reset\n", __func__);
-		return -ENODEV;
+		if (ret != -ENODEV)
+			dev_err(dev, "panel device error %d\n", ret);
+		return ret;
 	}
 
-	/* Reset */
-	reset_deassert(&rst);
-
-	ret = uclass_first_device(UCLASS_PANEL, &panel);
+	ret = panel_get_display_timing(panel, &timings);
 	if (ret) {
-		debug("%s: panel device error %d\n", __func__, ret);
-		return ret;
+		ret = fdtdec_decode_display_timing(gd->fdt_blob,
+						   dev_of_offset(panel),
+						   0, &timings);
+		if (ret) {
+			dev_err(dev, "decode display timing error %d\n", ret);
+			return ret;
+		}
 	}
 
-	ret = panel_enable_backlight(panel);
+	ret = clk_set_rate(&pclk, timings.pixelclock.typ);
+	if (ret)
+		dev_warn(dev, "fail to set pixel clock %d hz\n",
+			 timings.pixelclock.typ);
+
+	debug("%s: Set pixel clock req %d hz get %ld hz\n", __func__,
+	      timings.pixelclock.typ, clk_get_rate(&pclk));
+
+	ret = reset_get_by_index(dev, 0, &rst);
 	if (ret) {
-		debug("%s: panel %s enable backlight error %d\n",
-		      __func__, panel->name, ret);
+		dev_err(dev, "missing ltdc hardware reset\n");
 		return ret;
 	}
 
-	ret = fdtdec_decode_display_timing(gd->fdt_blob,
-					   dev_of_offset(dev), 0,
-					   &priv->timing);
-	if (ret) {
-		debug("%s: decode display timing error %d\n",
-		      __func__, ret);
-		return -EINVAL;
-	}
+	/* Reset */
+	reset_deassert(&rst);
 
-	rate = clk_set_rate(&pclk, priv->timing.pixelclock.typ);
-	if (rate < 0) {
-		debug("%s: fail to set pixel clock %d hz %d hz\n",
-		      __func__, priv->timing.pixelclock.typ, rate);
-		return rate;
+	if (IS_ENABLED(CONFIG_VIDEO_BRIDGE)) {
+		ret = uclass_get_device(UCLASS_VIDEO_BRIDGE, 0, &bridge);
+		if (ret)
+			debug("No video bridge, or no backlight on bridge\n");
+
+		if (bridge) {
+			ret = video_bridge_attach(bridge);
+			if (ret) {
+				dev_err(dev, "fail to attach bridge\n");
+				return ret;
+			}
+		}
 	}
 
-	debug("%s: Set pixel clock req %d hz get %d hz\n", __func__,
-	      priv->timing.pixelclock.typ, rate);
-
 	/* TODO Below parameters are hard-coded for the moment... */
 	priv->l2bpp = VIDEO_BPP16;
 	priv->bg_col_argb = 0xFFFFFFFF; /* white no transparency */
 	priv->crop_x = 0;
 	priv->crop_y = 0;
-	priv->crop_w = priv->timing.hactive.typ;
-	priv->crop_h = priv->timing.vactive.typ;
+	priv->crop_w = timings.hactive.typ;
+	priv->crop_h = timings.vactive.typ;
 	priv->alpha = 0xFF;
 
 	debug("%s: %dx%d %dbpp frame buffer at 0x%lx\n", __func__,
-	      priv->timing.hactive.typ, priv->timing.vactive.typ,
+	      timings.hactive.typ, timings.vactive.typ,
 	      VNBITS(priv->l2bpp), uc_plat->base);
 	debug("%s: crop %d,%d %dx%d bg 0x%08x alpha %d\n", __func__,
 	      priv->crop_x, priv->crop_y, priv->crop_w, priv->crop_h,
 	      priv->bg_col_argb, priv->alpha);
 
 	/* Configure & start LTDC */
-	stm32_ltdc_set_mode(priv);
+	stm32_ltdc_set_mode(priv, &timings);
 	stm32_ltdc_set_layer1(priv, uc_plat->base);
 	stm32_ltdc_enable(priv);
 
-	uc_priv->xsize = priv->timing.hactive.typ;
-	uc_priv->ysize = priv->timing.vactive.typ;
+	uc_priv->xsize = timings.hactive.typ;
+	uc_priv->ysize = timings.vactive.typ;
 	uc_priv->bpix = priv->l2bpp;
 
+	if (!bridge) {
+		ret = panel_enable_backlight(panel);
+		if (ret) {
+			dev_err(dev, "panel %s enable backlight error %d\n",
+				panel->name, ret);
+			return ret;
+		}
+	} else if (IS_ENABLED(CONFIG_VIDEO_BRIDGE)) {
+		ret = video_bridge_set_backlight(bridge, 80);
+		if (ret) {
+			dev_err(dev, "fail to set backlight\n");
+			return ret;
+		}
+	}
+
 	video_set_flush_dcache(dev, true);
 
 	return 0;
Signature · 1 line
2.7.4
#6 lore raw

PATCH v4 3/15 include: Add new DCS commands in the enum list

In reply to Yannick Fertré

Adding new DCS commands which are specified in the DCS 1.3 spec related to CABC.

---
 include/mipi_display.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/mipi_display.h +8 -0
index ddcc8ca..19aa65a 100644
@@ -115,6 +115,14 @@ enum {
 	MIPI_DCS_READ_MEMORY_CONTINUE	= 0x3E,
 	MIPI_DCS_SET_TEAR_SCANLINE	= 0x44,
 	MIPI_DCS_GET_SCANLINE		= 0x45,
+	MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 0x51,		/* MIPI DCS 1.3 */
+	MIPI_DCS_GET_DISPLAY_BRIGHTNESS = 0x52,		/* MIPI DCS 1.3 */
+	MIPI_DCS_WRITE_CONTROL_DISPLAY  = 0x53,		/* MIPI DCS 1.3 */
+	MIPI_DCS_GET_CONTROL_DISPLAY	= 0x54,		/* MIPI DCS 1.3 */
+	MIPI_DCS_WRITE_POWER_SAVE	= 0x55,		/* MIPI DCS 1.3 */
+	MIPI_DCS_GET_POWER_SAVE		= 0x56,		/* MIPI DCS 1.3 */
+	MIPI_DCS_SET_CABC_MIN_BRIGHTNESS = 0x5E,	/* MIPI DCS 1.3 */
+	MIPI_DCS_GET_CABC_MIN_BRIGHTNESS = 0x5F,	/* MIPI DCS 1.3 */
 	MIPI_DCS_READ_DDB_START		= 0xA1,
 	MIPI_DCS_READ_DDB_CONTINUE	= 0xA8,
 };
Signature · 1 line
2.7.4
#7 lore raw

PATCH v4 4/15 video: add support of MIPI DSI interface

In reply to Yannick Fertré

Mipi_display.c contains a set of dsi helpers. This file is a copy of file drm_mipi_dsi.c (linux kernel).

---
 drivers/video/Kconfig    |   8 +
 drivers/video/Makefile   |   1 +
 drivers/video/mipi_dsi.c | 828 +++++++++++++++++++++++++++++++++++++++++++++++
 include/mipi_dsi.h       | 466 ++++++++++++++++++++++++++
 4 files changed, 1303 insertions(+)
 create mode 100644 drivers/video/mipi_dsi.c
 create mode 100644 include/mipi_dsi.h
drivers/video/Kconfig +8 -0
index 261fa98..36f666e 100644
@@ -73,6 +73,14 @@ config VIDEO_ANSI
 	  Enable ANSI escape sequence decoding for a more fully functional
 	  console.
 
+config VIDEO_MIPI_DSI
+	bool "Support MIPI DSI interface"
+	depends on DM_VIDEO
+	help
+	  Support MIPI DSI interface for driving a MIPI compatible device.
+	  The MIPI Display Serial Interface (MIPI DSI) defines a high-speed
+	  serial interface between a host processor and a display module.
+
 config CONSOLE_NORMAL
 	bool "Support a simple text console"
 	depends on DM_VIDEO
drivers/video/Makefile +1 -0
index 349a207..7df9b0b 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-${CONFIG_VIDEO_MESON} += meson/
+obj-${CONFIG_VIDEO_MIPI_DSI} += mipi_dsi.o
 obj-$(CONFIG_VIDEO_MVEBU) += mvebu_lcd.o
 obj-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
drivers/video/mipi_dsi.c new file +828 -0

828 lines not on this page · raw message

include/mipi_dsi.h new file +466 -0

466 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH v4 5/15 dm: Add a dsi host uclass

In reply to Yannick Fertré

DSI host can usefully be modelled as their own uclass.

---
 arch/sandbox/dts/sandbox.dts     |  6 ++-
 configs/sandbox_defconfig        |  1 +
 drivers/video/Kconfig            |  7 ++++
 drivers/video/Makefile           |  2 +
 drivers/video/dsi-host-uclass.c  | 39 +++++++++++++++++++
 drivers/video/sandbox_dsi_host.c | 83 ++++++++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h           |  1 +
 include/dsi_host.h               | 57 +++++++++++++++++++++++++++
 test/dm/Makefile                 |  1 +
 test/dm/dsi_host.c               | 58 ++++++++++++++++++++++++++++
 10 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/dsi-host-uclass.c
 create mode 100644 drivers/video/sandbox_dsi_host.c
 create mode 100644 include/dsi_host.h
 create mode 100644 test/dm/dsi_host.c
arch/sandbox/dts/sandbox.dts +5 -1
index 16a33db..f1637c8 100644
@@ -25,6 +25,11 @@
 		compatible = "google,cros-ec-sandbox";
 	};
 
+	dsi_host: dsi_host {
+		compatible = "sandbox,dsi-host";
+		status = "okay";
+	};
+
 	ethrawbus {
 		compatible = "sandbox,eth-raw-bus";
 		skip-localhost = <0>;
@@ -63,7 +68,6 @@
 		compatible = "sandbox,spi";
 		cs-gpios = <0>, <&gpio_a 0>;
 	};
-
 };
 
 #include "sandbox.dtsi"
configs/sandbox_defconfig +1 -0
index 7355e3a..90f3e26 100644
@@ -205,6 +205,7 @@ CONFIG_CONSOLE_ROTATION=y
 CONFIG_CONSOLE_TRUETYPE=y
 CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
 CONFIG_VIDEO_SANDBOX_SDL=y
+CONFIG_VIDEO_DSI_HOST_SANDBOX=y
 CONFIG_OSD=y
 CONFIG_SANDBOX_OSD=y
 CONFIG_W1=y
drivers/video/Kconfig +7 -0
index 36f666e..554b7db 100644
@@ -686,6 +686,13 @@ config VIDEO_DW_HDMI
 	  rather requires a SoC-specific glue driver to call it), it
 	  can not be enabled from the configuration menu.
 
+config VIDEO_DSI_HOST_SANDBOX
+	bool "Enable sandbox for dsi host"
+	depends on SANDBOX
+	help
+	  Enable support for sandbox dsi host device used for testing
+	  purposes.
+
 config VIDEO_SIMPLE
 	bool "Simple display driver for preconfigured display"
 	help
drivers/video/Makefile +2 -0
index 7df9b0b..5ed3590 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CONSOLE_ROTATION) += console_rotate.o
 obj-$(CONFIG_CONSOLE_TRUETYPE) += console_truetype.o fonts/
 obj-$(CONFIG_DISPLAY) += display-uclass.o
 obj-$(CONFIG_DM_VIDEO) += backlight-uclass.o
+obj-$(CONFIG_DM_VIDEO) += dsi-host-uclass.o
 obj-$(CONFIG_DM_VIDEO) += panel-uclass.o simple_panel.o
 obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video_bmp.o
@@ -58,6 +59,7 @@ obj-$(CONFIG_VIDEO_MVEBU) += mvebu_lcd.o
 obj-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
 obj-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
+obj-$(CONFIG_VIDEO_DSI_HOST_SANDBOX) += sandbox_dsi_host.o
 obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
 obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
 obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o
drivers/video/dsi-host-uclass.c new file +39 -0
new file mode 100644
index 0000000..1db1f88
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre <[email protected]> for STMicroelectronics.
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dsi_host.h>
+
+int dsi_host_init(struct udevice *dev,
+		  struct mipi_dsi_device *device,
+		  struct display_timing *timings,
+		  unsigned int max_data_lanes,
+		  const struct mipi_dsi_phy_ops *phy_ops)
+{
+	struct dsi_host_ops *ops = dsi_host_get_ops(dev);
+
+	if (!ops->init)
+		return -ENOSYS;
+
+	return ops->init(dev, device, timings, max_data_lanes, phy_ops);
+}
+
+int dsi_host_enable(struct udevice *dev)
+{
+	struct dsi_host_ops *ops = dsi_host_get_ops(dev);
+
+	if (!ops->enable)
+		return -ENOSYS;
+
+	return ops->enable(dev);
+}
+
+UCLASS_DRIVER(dsi_host) = {
+	.id		= UCLASS_DSI_HOST,
+	.name		= "dsi_host",
+};
drivers/video/sandbox_dsi_host.c new file +83 -0

83 lines not on this page · raw message

include/dm/uclass-id.h +1 -0
index d4d9610..06989c7 100644
@@ -39,6 +39,7 @@ enum uclass_id {
 	UCLASS_CPU,		/* CPU, typically part of an SoC */
 	UCLASS_CROS_EC,		/* Chrome OS EC */
 	UCLASS_DISPLAY,		/* Display (e.g. DisplayPort, HDMI) */
+	UCLASS_DSI_HOST,	/* Dsi host device */
 	UCLASS_DMA,		/* Direct Memory Access */
 	UCLASS_EFI,		/* EFI managed devices */
 	UCLASS_ETH,		/* Ethernet device */
include/dsi_host.h new file +57 -0

57 lines not on this page · raw message

test/dm/Makefile +1 -0
index 55a7940..75c4cae 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_BLK) += blk.o
 obj-$(CONFIG_BOARD) += board.o
 obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o
 obj-$(CONFIG_CLK) += clk.o clk_ccf.o
+obj-$(CONFIG_DM_VIDEO) += dsi_host.o
 obj-$(CONFIG_DM_ETH) += eth.o
 obj-$(CONFIG_FIRMWARE) += firmware.o
 obj-$(CONFIG_DM_GPIO) += gpio.o
test/dm/dsi_host.c new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.7.4
#9 lore raw

PATCH v4 5/15 dm: Add a dsi host uclass

Hi,

Quoted 2 lines · Yannick Fertré

DSI host can usefully be modelled as their own uclass.

What is DSI?

Quoted 60 lines
---
 arch/sandbox/dts/sandbox.dts     |  6 ++-
 configs/sandbox_defconfig        |  1 +
 drivers/video/Kconfig            |  7 ++++
 drivers/video/Makefile           |  2 +
 drivers/video/dsi-host-uclass.c  | 39 +++++++++++++++++++
 drivers/video/sandbox_dsi_host.c | 83 ++++++++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h           |  1 +
 include/dsi_host.h               | 57 +++++++++++++++++++++++++++
 test/dm/Makefile                 |  1 +
 test/dm/dsi_host.c               | 58 ++++++++++++++++++++++++++++
 10 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/dsi-host-uclass.c
 create mode 100644 drivers/video/sandbox_dsi_host.c
 create mode 100644 include/dsi_host.h
 create mode 100644 test/dm/dsi_host.c
arch/sandbox/dts/sandbox.dts +5 -1
index 16a33db..f1637c8 100644
@@ -25,6 +25,11 @@
                compatible = "google,cros-ec-sandbox";
        };
 
+       dsi_host: dsi_host {
+               compatible = "sandbox,dsi-host";
+               status = "okay";
+       };
+
        ethrawbus {
                compatible = "sandbox,eth-raw-bus";
                skip-localhost = <0>;
@@ -63,7 +68,6 @@
                compatible = "sandbox,spi";
                cs-gpios = <0>, <&gpio_a 0>;
        };
-
 };
 
 #include "sandbox.dtsi"
configs/sandbox_defconfig +1 -0
index 7355e3a..90f3e26 100644
@@ -205,6 +205,7 @@ CONFIG_CONSOLE_ROTATION=y
 CONFIG_CONSOLE_TRUETYPE=y
 CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
 CONFIG_VIDEO_SANDBOX_SDL=y
+CONFIG_VIDEO_DSI_HOST_SANDBOX=y
 CONFIG_OSD=y
 CONFIG_SANDBOX_OSD=y
 CONFIG_W1=y
drivers/video/Kconfig +0 -0
index 36f666e..554b7db 100644

drivers/video/Kconfig config VIDEO_DW_HDMI · line 690

Quoted 5 lines
drivers/video/Kconfig +2 -0
@@ -686,6 +686,13 @@ config VIDEO_DW_HDMI
          rather requires a SoC-specific glue driver to call it), it
          can not be enabled from the configuration menu.
 
+config VIDEO_DSI_HOST_SANDBOX
+       bool "Enable sandbox for dsi host"

What is DSI?

drivers/video/Kconfig config VIDEO_DW_HDMI · line 694

Quoted 4 lines
drivers/video/Kconfig +4 -0
+       depends on SANDBOX
+       help
+         Enable support for sandbox dsi host device used for testing
+         purposes.

Should have help here explaining what DSI is

Quoted 75 lines
drivers/video/Kconfig +1 -0
+
 config VIDEO_SIMPLE
        bool "Simple display driver for preconfigured display"
        help
drivers/video/Makefile +2 -0
index 7df9b0b..5ed3590 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CONSOLE_ROTATION) += console_rotate.o
 obj-$(CONFIG_CONSOLE_TRUETYPE) += console_truetype.o fonts/
 obj-$(CONFIG_DISPLAY) += display-uclass.o
 obj-$(CONFIG_DM_VIDEO) += backlight-uclass.o
+obj-$(CONFIG_DM_VIDEO) += dsi-host-uclass.o
 obj-$(CONFIG_DM_VIDEO) += panel-uclass.o simple_panel.o
 obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video_bmp.o
@@ -58,6 +59,7 @@ obj-$(CONFIG_VIDEO_MVEBU) += mvebu_lcd.o
 obj-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
 obj-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
+obj-$(CONFIG_VIDEO_DSI_HOST_SANDBOX) += sandbox_dsi_host.o
 obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
 obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
 obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o
drivers/video/dsi-host-uclass.c new file +39 -0
new file mode 100644
index 0000000..1db1f88
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre <[email protected]> for STMicroelectronics.
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dsi_host.h>
+
+int dsi_host_init(struct udevice *dev,
+                 struct mipi_dsi_device *device,
+                 struct display_timing *timings,
+                 unsigned int max_data_lanes,
+                 const struct mipi_dsi_phy_ops *phy_ops)
+{
+       struct dsi_host_ops *ops = dsi_host_get_ops(dev);
+
+       if (!ops->init)
+               return -ENOSYS;
+
+       return ops->init(dev, device, timings, max_data_lanes, phy_ops);
+}
+
+int dsi_host_enable(struct udevice *dev)
+{
+       struct dsi_host_ops *ops = dsi_host_get_ops(dev);
+
+       if (!ops->enable)
+               return -ENOSYS;
+
+       return ops->enable(dev);
+}
+
+UCLASS_DRIVER(dsi_host) = {
+       .id             = UCLASS_DSI_HOST,
+       .name           = "dsi_host",
+};
drivers/video/sandbox_dsi_host.c new file +0 -0
new file mode 100644
index 0000000..ee01ed1

drivers/video/sandbox_dsi_host.c line 10

Quoted 10 lines
drivers/video/sandbox_dsi_host.c new file +10 -0
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
+ */
+
+#include <common.h>
+#include <display.h>
+#include <dm.h>
+#include <dsi_host.h>
+

Please add struct comment

Quoted 78 lines
drivers/video/sandbox_dsi_host.c new file +73 -0
+struct sandbox_dsi_host_priv {
+       struct mipi_dsi_device *device;
+       struct display_timing *timings;
+       unsigned int max_data_lanes;
+       const struct mipi_dsi_phy_ops *phy_ops;
+};
+
+static int sandbox_dsi_host_init(struct udevice *dev,
+                                struct mipi_dsi_device *device,
+                                struct display_timing *timings,
+                                unsigned int max_data_lanes,
+                                const struct mipi_dsi_phy_ops *phy_ops)
+{
+       struct sandbox_dsi_host_priv *priv = dev_get_priv(dev);
+
+       if (!device)
+               return -1;
+
+       if (!timings)
+               return -2;
+
+       if (max_data_lanes == 0)
+               return -3;
+
+       if (!phy_ops)
+               return -4;
+
+       if (!phy_ops->init || !phy_ops->get_lane_mbps ||
+           !phy_ops->post_set_mode)
+               return -5;
+
+       priv->max_data_lanes = max_data_lanes;
+       priv->phy_ops = phy_ops;
+       priv->timings = timings;
+       priv->device = device;
+
+       return 0;
+}
+
+static int sandbox_dsi_host_enable(struct udevice *dev)
+{
+       struct sandbox_dsi_host_priv *priv = dev_get_priv(dev);
+       unsigned int lane_mbps;
+       int ret;
+
+       priv->phy_ops->init(priv->device);
+       ret = priv->phy_ops->get_lane_mbps(priv->device, priv->timings, 2,
+                                          MIPI_DSI_FMT_RGB888, &lane_mbps);
+       if (ret)
+               return -1;
+
+       priv->phy_ops->post_set_mode(priv->device, MIPI_DSI_MODE_VIDEO);
+
+       return 0;
+}
+
+struct dsi_host_ops sandbox_dsi_host_ops = {
+       .init = sandbox_dsi_host_init,
+       .enable = sandbox_dsi_host_enable,
+};
+
+static const struct udevice_id sandbox_dsi_host_ids[] = {
+       { .compatible = "sandbox,dsi-host"},
+       { }
+};
+
+U_BOOT_DRIVER(sandbox_dsi_host) = {
+       .name                 = "sandbox-dsi-host",
+       .id                   = UCLASS_DSI_HOST,
+       .of_match             = sandbox_dsi_host_ids,
+       .ops                  = &sandbox_dsi_host_ops,
+       .priv_auto_alloc_size = sizeof(struct sandbox_dsi_host_priv),
+};
include/dm/uclass-id.h +0 -0
index d4d9610..06989c7 100644

include/dm/uclass-id.h enum uclass_id { · line 42

Quoted 4 lines
include/dm/uclass-id.h +1 -0
@@ -39,6 +39,7 @@ enum uclass_id {
        UCLASS_CPU,             /* CPU, typically part of an SoC */
        UCLASS_CROS_EC,         /* Chrome OS EC */
        UCLASS_DISPLAY,         /* Display (e.g. DisplayPort, HDMI) */
+       UCLASS_DSI_HOST,        /* Dsi host device */

Do you have room to write out DSI in full?

Quoted 16 lines
include/dm/uclass-id.h +0 -0
        UCLASS_DMA,             /* Direct Memory Access */
        UCLASS_EFI,             /* EFI managed devices */
        UCLASS_ETH,             /* Ethernet device */
include/dsi_host.h new file +7 -0
new file mode 100644
index 0000000..9ff226f
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre <[email protected]> for STMicroelectronics.
+ *
+ */
+

include/dsi_host.h line 17

Quoted 10 lines
include/dsi_host.h new file +10 -0
+#ifndef _DSI_HOST_H
+#define _DSI_HOST_H
+
+#include <mipi_dsi.h>
+
+struct dsi_host_ops {
+       /**
+        * init() - Enable the dsi_host
+        *
+        * @dev: dsi host device

add the rest of the args

Quoted 5 lines
include/dsi_host.h new file +5 -0
+        * @return 0 if OK, -ve on error
+        */
+       int (*init)(struct udevice *dev,
+                   struct mipi_dsi_device *device,
+                   struct display_timing *timings,

include/dsi_host.h line 32

Quoted 10 lines
include/dsi_host.h new file +10 -0
+                   unsigned int max_data_lanes,
+                   const struct mipi_dsi_phy_ops *phy_ops);
+
+       /**
+        * enable() - Enable the dsi_host
+        *
+        * @dev: dsi host device
+        * @return 0 if OK, -ve on error
+        */
+       int (*enable)(struct udevice *dev);

How can I disable it?

include/dsi_host.h line 40

Quoted 8 lines
include/dsi_host.h new file +8 -0
+};
+
+#define dsi_host_get_ops(dev)  ((struct dsi_host_ops *)(dev)->driver->ops)
+
+/**
+ * dsi_host_init
+ *
+ * @dev:       dsi host device

missing args

Quoted 22 lines
include/dsi_host.h new file +17 -0
+ * @return 0 if OK, -ve on error
+ */
+int dsi_host_init(struct udevice *dev,
+                 struct mipi_dsi_device *device,
+                 struct display_timing *timings,
+                 unsigned int max_data_lanes,
+                 const struct mipi_dsi_phy_ops *phy_ops);
+
+/**
+ * dsi_host_enable
+ *
+ * @dev:       dsi host device
+ * @return 0 if OK, -ve on error
+ */
+int dsi_host_enable(struct udevice *dev);
+
+#endif
test/dm/Makefile +0 -0
index 55a7940..75c4cae 100644

test/dm/Makefile obj-$(CONFIG_BLK) += blk.o · line 21

Quoted 4 lines
test/dm/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_BLK) += blk.o
 obj-$(CONFIG_BOARD) += board.o
 obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o
 obj-$(CONFIG_CLK) += clk.o clk_ccf.o
+obj-$(CONFIG_DM_VIDEO) += dsi_host.o

Shouldn't this have its own CONFIG? Not all boards will need this

Quoted 68 lines
test/dm/Makefile +0 -0
 obj-$(CONFIG_DM_ETH) += eth.o
 obj-$(CONFIG_FIRMWARE) += firmware.o
 obj-$(CONFIG_DM_GPIO) += gpio.o
test/dm/dsi_host.c new file +58 -1
new file mode 100644
index 0000000..59fcd55
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2019 STMicroelectronics - All Rights Reserved
+ * Author(s): Yannick Fertre <[email protected]> for STMicroelectronics.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dsi_host.h>
+#include <asm/state.h>
+#include <asm/test.h>
+#include <dm/test.h>
+#include <test/ut.h>
+
+static int dm_test_dsi_host_phy_init(void *priv_data)
+{
+       return 0;
+}
+
+static void dm_test_dsi_host_phy_post_set_mode(void *priv_data,
+                                              unsigned long mode_flags)
+{
+}
+
+static int dm_test_dsi_host_phy_get_lane_mbps(void *priv_data,
+                                             struct display_timing *timings,
+                                             u32 lanes,
+                                             u32 format,
+                                             unsigned int *lane_mbps)
+{
+       return 0;
+}
+
+static const struct mipi_dsi_phy_ops dm_test_dsi_host_phy_ops = {
+       .init = dm_test_dsi_host_phy_init,
+       .get_lane_mbps = dm_test_dsi_host_phy_get_lane_mbps,
+       .post_set_mode = dm_test_dsi_host_phy_post_set_mode,
+};
+
+/* Test that dsi_host driver functions are called */
+static int dm_test_dsi_host(struct unit_test_state *uts)
+{
+       struct udevice *dev;
+       struct mipi_dsi_device device;
+       struct display_timing timings;
+       unsigned int max_data_lanes = 4;
+
+       ut_assertok(uclass_first_device_err(UCLASS_DSI_HOST, &dev));
+
+       ut_assertok(dsi_host_init(dev, &device, &timings, max_data_lanes,
+                                 &dm_test_dsi_host_phy_ops));
+
+       ut_assertok(dsi_host_enable(dev));
+
+       return 0;
+}
+
+DM_TEST(dm_test_dsi_host, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
--
Quoted 2 lines

2.7.4

Apart from these nits it looks OK.

Regards,
Simon

#10 lore raw

PATCH v4 6/15 video: add MIPI DSI host controller bridge

In reply to Yannick Fertré

Add a Synopsys Designware MIPI DSI host bridge driver, based on the Rockchip version from rockchip/dw-mipi-dsi.c with phy & bridge APIs.

---
 drivers/video/Kconfig       |  10 +
 drivers/video/Makefile      |   1 +
 drivers/video/dw_mipi_dsi.c | 838 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 849 insertions(+)
 create mode 100644 drivers/video/dw_mipi_dsi.c
drivers/video/Kconfig +10 -0
index 554b7db..a55cdc6 100644
@@ -693,6 +693,16 @@ config VIDEO_DSI_HOST_SANDBOX
 	  Enable support for sandbox dsi host device used for testing
 	  purposes.
 
+config VIDEO_DW_MIPI_DSI
+	bool
+	select VIDEO_MIPI_DSI
+	help
+	  Enables the common driver code for the Synopsis Designware
+	  MIPI DSI block found in SoCs from various vendors.
+	  As this does not provide any functionality by itself (but
+	  rather requires a SoC-specific glue driver to call it), it
+	  can not be enabled from the configuration menu.
+
 config VIDEO_SIMPLE
 	bool "Simple display driver for preconfigured display"
 	help
drivers/video/Makefile +1 -0
index 5ed3590..58210ec 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_VIDEO_BROADWELL_IGD) += broadwell_igd.o
 obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o
 obj-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o
 obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
+obj-$(CONFIG_VIDEO_DW_MIPI_DSI) += dw_mipi_dsi.o
 obj-$(CONFIG_VIDEO_EFI) += efi.o
 obj-$(CONFIG_VIDEO_FSL_DCU_FB) += fsl_dcu_fb.o videomodes.o
 obj-$(CONFIG_VIDEO_IPUV3) += imx/
drivers/video/dw_mipi_dsi.c new file +838 -0

838 lines not on this page · raw message

Signature · 1 line
2.7.4
#11 lore raw

PATCH v4 7/15 video: add support of STM32 MIPI DSI controller driver

In reply to Yannick Fertré

Add the STM32 DSI controller driver that uses the Synopsys DesignWare MIPI DSI host controller bridge.

---
 drivers/video/stm32/Kconfig     |   9 +
 drivers/video/stm32/Makefile    |   1 +
 drivers/video/stm32/stm32_dsi.c | 490 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 500 insertions(+)
 create mode 100644 drivers/video/stm32/stm32_dsi.c
drivers/video/stm32/Kconfig +9 -0
index 78b1fac..95d51bb 100644
@@ -13,6 +13,15 @@ menuconfig VIDEO_STM32
 	  DSI. This option enables these supports which can be used on
 	  devices which have RGB TFT or DSI display connected.
 
+config VIDEO_STM32_DSI
+	bool "Enable STM32 DSI video support"
+	depends on VIDEO_STM32
+	select VIDEO_BRIDGE
+	select VIDEO_DW_MIPI_DSI
+	help
+	  This option enables support DSI internal bridge which can be used on
+	  devices which have DSI devices connected.
+
 config VIDEO_STM32_MAX_XRES
 	int "Maximum horizontal resolution (for memory allocation purposes)"
 	depends on VIDEO_STM32
drivers/video/stm32/Makefile +1 -0
index 7297e5f..f8b42d1 100644
@@ -6,3 +6,4 @@
 #          Yannick Fertre <[email protected]>
 
 obj-${CONFIG_VIDEO_STM32} = stm32_ltdc.o
+obj-${CONFIG_VIDEO_STM32_DSI} += stm32_dsi.o
drivers/video/stm32/stm32_dsi.c new file +490 -0

490 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH v4 8/15 video: add support of panel OTM8009A

In reply to Yannick Fertré

Support for Orise Tech otm8009a 480p dsi 2dl video mode panel.

---
 drivers/video/Kconfig              |   9 +
 drivers/video/Makefile             |   1 +
 drivers/video/orisetech_otm8009a.c | 379 +++++++++++++++++++++++++++++++++++++
 3 files changed, 389 insertions(+)
 create mode 100644 drivers/video/orisetech_otm8009a.c
drivers/video/Kconfig +9 -0
index a55cdc6..0bcadd9 100644
@@ -328,6 +328,15 @@ config VIDEO_LCD_ANX9804
 	from a parallel LCD interface and translate it on the fy into a DP
 	interface for driving eDP TFT displays. It uses I2C for configuration.
 
+config VIDEO_LCD_ORISETECH_OTM8009A
+	bool "OTM8009A DSI LCD panel support"
+	depends on DM_VIDEO
+	select VIDEO_MIPI_DSI
+	default n
+	help
+	Say Y here if you want to enable support for Orise Technology
+	otm8009a 480x800 dsi 2dl panel.
+
 config VIDEO_LCD_SSD2828
 	bool "SSD2828 bridge chip"
 	default n
drivers/video/Makefile +1 -0
index 58210ec..f8785cb 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_IPUV3) += imx/
 obj-$(CONFIG_VIDEO_IVYBRIDGE_IGD) += ivybridge_igd.o
 obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
+obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-${CONFIG_VIDEO_MESON} += meson/
drivers/video/orisetech_otm8009a.c new file +379 -0

379 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw

PATCH v4 9/15 video: add support of panel RM68200

In reply to Yannick Fertré

Support for Raydium RM68200 720p dsi 2dl video mode panel. This rm68200 panel driver is based on the Linux Kernel driver from drivers/gpu/drm/panel/panel-raydium-rm68200.c.

---
 drivers/video/Kconfig           |   9 ++
 drivers/video/Makefile          |   1 +
 drivers/video/raydium-rm68200.c | 351 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 361 insertions(+)
 create mode 100644 drivers/video/raydium-rm68200.c
drivers/video/Kconfig +9 -0
index 0bcadd9..aafb3b4 100644
@@ -337,6 +337,15 @@ config VIDEO_LCD_ORISETECH_OTM8009A
 	Say Y here if you want to enable support for Orise Technology
 	otm8009a 480x800 dsi 2dl panel.
 
+config VIDEO_LCD_RAYDIUM_RM68200
+	bool "RM68200 DSI LCD panel support"
+	depends on DM_VIDEO
+	select VIDEO_MIPI_DSI
+	default n
+	help
+	Say Y here if you want to enable support for Raydium RM68200
+	720x1280 DSI video mode panel.
+
 config VIDEO_LCD_SSD2828
 	bool "SSD2828 bridge chip"
 	default n
drivers/video/Makefile +1 -0
index f8785cb..eea59e4 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_VIDEO_IVYBRIDGE_IGD) += ivybridge_igd.o
 obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
 obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
+obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 obj-${CONFIG_VIDEO_MESON} += meson/
drivers/video/raydium-rm68200.c new file +351 -0

351 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

PATCH v4 10/15 board: Add STM32F769 SoC, discovery board support

In reply to Yannick Fertré
---
 configs/stm32f769-disco_defconfig | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 configs/stm32f769-disco_defconfig
configs/stm32f769-disco_defconfig new file +63 -0
new file mode 100644
index 0000000..887e2d5
@@ -0,0 +1,63 @@
+CONFIG_ARM=y
+CONFIG_STM32=y
+CONFIG_SYS_TEXT_BASE=0x08008000
+CONFIG_SYS_MALLOC_F_LEN=0xE00
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_STM32F7=y
+CONFIG_TARGET_STM32F746_DISCO=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk consoleblank=0 ignore_loglevel"
+# CONFIG_USE_BOOTCOMMAND is not set
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_SPL_TEXT_BASE=0x8000000
+CONFIG_SYS_PROMPT="U-Boot > "
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"
+CONFIG_AUTOBOOT_STOP_STR=" "
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_BMP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="stm32f769-disco"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_DM_MMC=y
+# CONFIG_SPL_DM_MMC is not set
+CONFIG_ARM_PL180_MMCI=y
+CONFIG_MTD=y
+CONFIG_MTD_NOR_FLASH=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
+# CONFIG_PINCTRL_FULL is not set
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_STM32_QSPI=y
+CONFIG_DM_VIDEO=y
+CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=480
+CONFIG_VIDEO_STM32_MAX_YRES=800
+CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_EFI_LOADER is not set
Signature · 1 line
2.7.4
#15 lore raw

PATCH v4 11/15 ARM: dts: stm32f769: add display for STM32F769 disco board

In reply to Yannick Fertré

Enable the display controller, mipi dsi bridge & panel. Set panel display timings.

---
 arch/arm/dts/stm32f769-disco-u-boot.dtsi | 62 ++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
arch/arm/dts/stm32f769-disco-u-boot.dtsi +62 -0
index 209a82c..c1d7d6b 100644
@@ -28,10 +28,72 @@
 		button-gpio = <&gpioa 0 0>;
 	};
 
+	dsi_host: dsi_host {
+		compatible = "synopsys,dw-mipi-dsi";
+		status = "okay";
+	};
+
 	led1 {
 		compatible = "st,led1";
 		led-gpio = <&gpioj 5 0>;
 	};
+
+	panel: panel {
+		compatible = "orisetech,otm8009a";
+		reset-gpios = <&gpioj 15 1>;
+		status = "okay";
+
+		port {
+			panel_in: endpoint {
+				remote-endpoint = <&dsi_out>;
+			};
+		};
+	};
+
+	soc {
+		dsi: dsi at 40016c00 {
+			compatible = "st,stm32-dsi";
+			reg = <0x40016C00 0x800>;
+			resets = <&rcc STM32F7_APB2_RESET(DSI)>;
+			clocks =  <&rcc 0 STM32F7_APB2_CLOCK(DSI)>,
+				  <&rcc 0 STM32F7_APB2_CLOCK(LTDC)>,
+				  <&clk_hse>;
+			clock-names = "pclk", "px_clk", "ref";
+			u-boot,dm-pre-reloc;
+			status = "okay";
+
+			ports {
+				port at 0 {
+					dsi_out: endpoint {
+						remote-endpoint = <&panel_in>;
+					};
+				};
+				port at 1 {
+					dsi_in: endpoint {
+						remote-endpoint = <&dp_out>;
+					};
+				};
+			};
+		};
+
+		ltdc: display-controller at 40016800 {
+			compatible = "st,stm32-ltdc";
+			reg = <0x40016800 0x200>;
+			resets = <&rcc STM32F7_APB2_RESET(LTDC)>;
+			clocks = <&rcc 0 STM32F7_APB2_CLOCK(LTDC)>;
+
+			status = "okay";
+			u-boot,dm-pre-reloc;
+
+			ports {
+				port at 0 {
+					dp_out: endpoint {
+						remote-endpoint = <&dsi_in>;
+					};
+				};
+			};
+		};
+	};
 };
 
 &fmc {
Signature · 1 line
2.7.4
#16 lore raw

PATCH v4 12/15 ARM: dts: stm32mp1: add dsi host for stm32mp157c-ev1 board

In reply to Yannick Fertré

The new class dsi host allows the management of the bridge DPI to DSI. This bridge is embedded in the chipset mp1 (come from synopsys company).

---
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +5 -0
index ec60486..af5945d 100644
@@ -14,6 +14,11 @@
 		spi0 = &qspi;
 		usb0 = &usbotg_hs;
 	};
+
+	dsi_host: dsi_host {
+		compatible = "synopsys,dw-mipi-dsi";
+		status = "okay";
+	};
 };
 
 &flash0 {
Signature · 1 line
2.7.4
#17 lore raw

PATCH v4 13/15 ARM: dts: stm32mp1: add dsi host for stm32mp157c-dk2 board

In reply to Yannick Fertré

The new class dsi host allows the management of the bridge DPI to DSI. This bridge is embedded in the chipset mp1 (come from synopsys company).

---
 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi +7 -0
index 18ac1e3..cd9947f 100644
@@ -5,6 +5,13 @@
 
 #include "stm32mp157a-dk1-u-boot.dtsi"
 
+/ {
+	dsi_host: dsi_host {
+		compatible = "synopsys,dw-mipi-dsi";
+		status = "okay";
+	};
+};
+
 &i2c1 {
 	hdmi-transmitter at 39 {
 		reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
Signature · 1 line
2.7.4
#18 lore raw

PATCH v4 14/15 stm32mp1: configs: update video

In reply to Yannick Fertré

Update video configs to support bitmap 16bpp, 24bpp, 32bpp & RLE8.

---
 include/configs/stm32mp1.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/configs/stm32mp1.h +7 -0
index 92660fe..988992b 100644
@@ -83,6 +83,13 @@
 #define CONFIG_SYS_MTDPARTS_RUNTIME
 #endif
 
+#ifdef CONFIG_DM_VIDEO
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_BMP_16BPP
+#define CONFIG_BMP_24BPP
+#define CONFIG_BMP_32BPP
+#endif
+
 /*****************************************************************************/
 #ifdef CONFIG_DISTRO_DEFAULTS
 /*****************************************************************************/
Signature · 1 line
2.7.4
#19 lore raw

PATCH v4 15/15 stm32mp1: configs: add display devices

In reply to Yannick Fertré

Add support of panels otm8009A, RM68200 & DSI controller. Limit resolution to 1280x800.

---
 configs/stm32mp15_basic_defconfig   | 6 ++++++
 configs/stm32mp15_optee_defconfig   | 6 ++++++
 configs/stm32mp15_trusted_defconfig | 6 ++++++
 3 files changed, 18 insertions(+)
configs/stm32mp15_basic_defconfig +6 -0
index 09785b5..6d1e208 100644
@@ -124,4 +124,10 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=800
 CONFIG_FDT_FIXUP_PARTITIONS=y
configs/stm32mp15_optee_defconfig +6 -0
index 177cbc7..491174f 100644
@@ -109,4 +109,10 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=800
 CONFIG_FDT_FIXUP_PARTITIONS=y
configs/stm32mp15_trusted_defconfig +6 -0
index 71ad115..a8a7eec 100644
@@ -108,4 +108,10 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_BACKLIGHT_GPIO=y
+CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
+CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_DSI=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=800
 CONFIG_FDT_FIXUP_PARTITIONS=y
Signature · 1 line
2.7.4