Skip to contentSkip to conversation

Current imx-drm queue

PATCH New Russell King - ARM Linux 2 participants 9 messages Apr 9, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Current imx-drm queue

Hi,

The following patches are those which I currently have queued up for Greg for merging into his stable tree when he's next accepting patches. If you have any concerns about these patches, please let me know in a timely fashion.

I've re-ordered and cherry-picked some of Denis' patches, as I can't take the patches which touch arch/arm/boot/dts. Some other method is going to have to be found to deal with those changes.

The unfortunate thing is that without the DT changes able to be merged in a timely and sane manner, in a way which does not result in breaking this driver, it pushes the point where we can finally think about moving this driver out of drivers/staging back even further.

It seems arm-soc want to be obtuse, so let's let them be obtuse and show what damage it does to being able to make progress.

Thanks.

Denis Carikli (3):
imx-drm: Match ipu_di_signal_cfg's clk_pol with its description.
v4l2: add new V4L2_PIX_FMT_RGB666 pixel format.
imx-drm: Add RGB666 support for parallel display.

Fabio Estevam (2):
imx-drm: ipu-dmfc: Remove unneeded 'dmfc' check
imx-drm: imx-ldb: Use snprintf()

Philipp Zabel (3):
imx-drm: Move IPU_PIX_FMT_GBR24 definition into imx-ipu-v3.h
imx-drm: ipu-dc: Use usleep_range instead of msleep
imx-drm: imx-ldb: Add drm_panel support

 Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml             | 39 +++++++++++++++++++++++++++++++++++++++
 Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt |  3 ++-
 drivers/staging/imx-drm/Kconfig                                   |  1 +
 drivers/staging/imx-drm/imx-drm.h                                 |  4 ----
 drivers/staging/imx-drm/imx-ldb.c                                 | 25 +++++++++++++++++++++++--
 drivers/staging/imx-drm/imx-tve.c                                 |  1 +
 drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h                       |  2 ++
 drivers/staging/imx-drm/ipu-v3/ipu-dc.c                           | 11 ++++++++++-
 drivers/staging/imx-drm/ipu-v3/ipu-di.c                           |  2 +-
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c                         |  3 ---
 drivers/staging/imx-drm/ipuv3-crtc.c                              |  2 +-
 drivers/staging/imx-drm/parallel-display.c                        |  2 ++
 include/uapi/linux/videodev2.h                                    |  1 +
 13 files changed, 83 insertions(+), 13 deletions(-)
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
#1 lore raw

PATCH 1/8 imx-drm: Move IPU_PIX_FMT_GBR24 definition into imx-ipu-v3.h

From: Philipp Zabel <[email protected]>
To: linux-arm-kernel at lists.infradead.org

The IPU display controller supports a non-standard green-red-blue ordered format that is used on the connection between IPU display interface 1 and the TV encoder on i.MX53.
In preparation for the move of IPU core code out of staging, place the IPU_PIX_FMT_GBR24 definition in imx-ipu-v3.h, so that both the IPU display interface driver and the TVE encoder driver can access it.

---
 drivers/staging/imx-drm/imx-drm.h           | 4 ----
 drivers/staging/imx-drm/imx-tve.c           | 1 +
 drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h | 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/staging/imx-drm/imx-drm.h +0 -4
index a24d46ad3dce..a322bac55414 100644
@@ -1,10 +1,6 @@
 #ifndef _IMX_DRM_H_
 #define _IMX_DRM_H_
 
-#include <linux/videodev2.h>
-
-#define IPU_PIX_FMT_GBR24	v4l2_fourcc('G', 'B', 'R', '3')
-
 struct device_node;
 struct drm_crtc;
 struct drm_connector;
drivers/staging/imx-drm/imx-tve.c +1 -0
index 7002ae0a08ca..575533f4fd64 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 
+#include "ipu-v3/imx-ipu-v3.h"
 #include "imx-drm.h"
 
 #define TVE_COM_CONF_REG	0x00
drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h +2 -0
index 4826b5c0249d..c4d14ead5837 100644
@@ -25,6 +25,8 @@ enum ipuv3_type {
 	IPUV3H,
 };
 
+#define IPU_PIX_FMT_GBR24	v4l2_fourcc('G', 'B', 'R', '3')
+
 /*
  * Bitfield of Display Interface signal polarities.
  */
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/8 imx-drm: ipu-dc: Use usleep_range instead of msleep

In reply to Russell King - ARM Linux

From: Philipp Zabel <[email protected]>
To: linux-arm-kernel at lists.infradead.org

Since msleep(2) can sleep up to 20ms anyway, make this explicit by using usleep_range(2000, 20000).

---
 drivers/staging/imx-drm/ipu-v3/ipu-dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/imx-drm/ipu-v3/ipu-dc.c +1 -1
index d0e3bc3c53e7..d5de8bb5c803 100644
@@ -262,7 +262,7 @@ void ipu_dc_disable_channel(struct ipu_dc *dc)
 
 	/* Wait for DC triple buffer to empty */
 	while ((readl(priv->dc_reg + DC_STAT) & val) != val) {
-		msleep(2);
+		usleep_range(2000, 20000);
 		timeout -= 2;
 		if (timeout <= 0)
 			break;
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/8 imx-drm: ipu-dmfc: Remove unneeded 'dmfc' check

In reply to Russell King - ARM Linux

From: Fabio Estevam <[email protected]>
To: linux-arm-kernel at lists.infradead.org

Fix the following static checker warning:

drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c:164 ipu_dmfc_setup_channel() warn: variable dereferenced before check 'dmfc' (see line 157)

As 'dmfc' could never be null, there is no need to do such check.

---
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c +0 -3
index 98070dd8c920..45213017fa4b 100644
@@ -161,9 +161,6 @@ static int ipu_dmfc_setup_channel(struct dmfc_channel *dmfc, int slots,
 			"dmfc: using %d slots starting from segment %d for IPU channel %d\n",
 			slots, segment, dmfc->data->ipu_channel);
 
-	if (!dmfc)
-		return -EINVAL;
-
 	switch (slots) {
 	case 1:
 		field = DMFC_FIFO_SIZE_64;
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/8 imx-drm: imx-ldb: Use snprintf()

In reply to Russell King - ARM Linux

From: Fabio Estevam <[email protected]>
To: linux-arm-kernel at lists.infradead.org

Use snprintf() in order to fix the following static checker warning:

drivers/staging/imx-drm/imx-ldb.c:340 imx_ldb_get_clk() error: format string overflow. buf_size: 16 length: 18 probably 18 is theory and not real life, but 16 is based on
theory as well.

---
 drivers/staging/imx-drm/imx-ldb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/imx-drm/imx-ldb.c +2 -2
index 301c4300aa55..0518a32520b4 100644
@@ -332,12 +332,12 @@ static int imx_ldb_get_clk(struct imx_ldb *ldb, int chno)
 {
 	char clkname[16];
 
-	sprintf(clkname, "di%d", chno);
+	snprintf(clkname, sizeof(clkname), "di%d", chno);
 	ldb->clk[chno] = devm_clk_get(ldb->dev, clkname);
 	if (IS_ERR(ldb->clk[chno]))
 		return PTR_ERR(ldb->clk[chno]);
 
-	sprintf(clkname, "di%d_pll", chno);
+	snprintf(clkname, sizeof(clkname), "di%d_pll", chno);
 	ldb->clk_pll[chno] = devm_clk_get(ldb->dev, clkname);
 
 	return PTR_ERR_OR_ZERO(ldb->clk_pll[chno]);
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 5/8 imx-drm: imx-ldb: Add drm_panel support

In reply to Russell King - ARM Linux

From: Philipp Zabel <[email protected]>
To: linux-arm-kernel at lists.infradead.org

This patch allows to optionally attach the lvds-channel to a panel supported by a drm_panel driver instead of supplying the modes via device tree.

Before:

	ldb {
		...

		lvds-channel at 0 {
			...

			display-timings {
				native-timing = <&timing1>;
				timing1: etm0700g0dh6 {
					hactive = <800>;
					vactive = <480>;
					clock-frequency = <33260000>;
					hsync-len = <128>;
					hback-porch = <88>;
					hfront-porch = <40>;
					vsync-len = <2>;
					vback-porch = <33>;
					vfront-porch = <10>;
					hsync-active = <0>;
					vsync-active = <0>;
					...
				};
			};
			...
		};
	};

After:

	ldb {
		...

		lvds-channel at 0 {
			fsl,panel = <&panel>;
			...
		};
	};

	panel: panel {
		compatible = "edt,etm0700g0dh6", "simple-panel";
	};
[Fixed build error due to missing select on DRM_PANEL --rmk]
---
 drivers/staging/imx-drm/Kconfig   |  1 +
 drivers/staging/imx-drm/imx-ldb.c | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
drivers/staging/imx-drm/Kconfig +1 -0
index 78319ad176cd..bb54c450e077 100644
@@ -34,6 +34,7 @@ config DRM_IMX_TVE
 config DRM_IMX_LDB
 	tristate "Support for LVDS displays"
 	depends on DRM_IMX && MFD_SYSCON
+	select DRM_PANEL
 	help
 	  Choose this to enable the internal LVDS Display Bridge (LDB)
 	  found on i.MX53 and i.MX6 processors.
drivers/staging/imx-drm/imx-ldb.c +21 -0
index 0518a32520b4..4c77904976cc 100644
@@ -24,6 +24,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_panel.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
 #include <linux/of_address.h>
@@ -60,6 +61,7 @@ struct imx_ldb_channel {
 	struct imx_ldb *ldb;
 	struct drm_connector connector;
 	struct drm_encoder encoder;
+	struct drm_panel *panel;
 	struct device_node *child;
 	int chno;
 	void *edid;
@@ -96,6 +98,13 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
 	struct imx_ldb_channel *imx_ldb_ch = con_to_imx_ldb_ch(connector);
 	int num_modes = 0;
 
+	if (imx_ldb_ch->panel && imx_ldb_ch->panel->funcs &&
+	    imx_ldb_ch->panel->funcs->get_modes) {
+		num_modes = imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
+		if (num_modes > 0)
+			return num_modes;
+	}
+
 	if (imx_ldb_ch->edid) {
 		drm_mode_connector_update_edid_property(connector,
 							imx_ldb_ch->edid);
@@ -238,6 +247,8 @@ static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
 	}
 
 	regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl);
+
+	drm_panel_enable(imx_ldb_ch->panel);
 }
 
 static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder,
@@ -289,6 +300,8 @@ static void imx_ldb_encoder_disable(struct drm_encoder *encoder)
 		 (ldb->ldb_ctrl & LDB_CH1_MODE_EN_MASK) == 0)
 		return;
 
+	drm_panel_disable(imx_ldb_ch->panel);
+
 	if (imx_ldb_ch == &ldb->channel[0])
 		ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK;
 	else if (imx_ldb_ch == &ldb->channel[1])
@@ -374,6 +387,9 @@ static int imx_ldb_register(struct drm_device *drm,
 	drm_connector_init(drm, &imx_ldb_ch->connector,
 			   &imx_ldb_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
 
+	if (imx_ldb_ch->panel)
+		drm_panel_attach(imx_ldb_ch->panel, &imx_ldb_ch->connector);
+
 	drm_mode_connector_attach_encoder(&imx_ldb_ch->connector,
 			&imx_ldb_ch->encoder);
 
@@ -488,6 +504,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 
 	for_each_child_of_node(np, child) {
 		struct imx_ldb_channel *channel;
+		struct device_node *panel_node;
 
 		ret = of_property_read_u32(child, "reg", &i);
 		if (ret || i < 0 || i > 1)
@@ -547,6 +564,10 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 			return -EINVAL;
 		}
 
+		panel_node = of_parse_phandle(child, "fsl,panel", 0);
+		if (panel_node)
+			channel->panel = of_drm_find_panel(panel_node);
+
 		ret = imx_ldb_register(drm, channel);
 		if (ret)
 			return ret;
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 6/8 imx-drm: Match ipu_di_signal_cfg's clk_pol with its description.

In reply to Russell King - ARM Linux

From: Denis Carikli <[email protected]>
To: linux-arm-kernel at lists.infradead.org

According to the datasheet, setting the di0_polarity_disp_clk field in the GENERAL di register sets the output clock polarity to active high.

---
 drivers/staging/imx-drm/ipu-v3/ipu-di.c | 2 +-
 drivers/staging/imx-drm/ipuv3-crtc.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/imx-drm/ipu-v3/ipu-di.c +1 -1
index 82a9ebad697c..849b3e120ef0 100644
@@ -595,7 +595,7 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct ipu_di_signal_cfg *sig)
 		}
 	}
 
-	if (!sig->clk_pol)
+	if (sig->clk_pol)
 		di_gen |= DI_GEN_POLARITY_DISP_CLK;
 
 	ipu_di_write(di, di_gen, DI_GENERAL);
drivers/staging/imx-drm/ipuv3-crtc.c +1 -1
index a8d017854615..db6bd64efe98 100644
@@ -158,7 +158,7 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
 		sig_cfg.Vsync_pol = 1;
 
 	sig_cfg.enable_pol = 1;
-	sig_cfg.clk_pol = 1;
+	sig_cfg.clk_pol = 0;
 	sig_cfg.width = mode->hdisplay;
 	sig_cfg.height = mode->vdisplay;
 	sig_cfg.pixel_fmt = out_pixel_fmt;
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH 7/8 v4l2: add new V4L2_PIX_FMT_RGB666 pixel format.

In reply to Russell King - ARM Linux

From: Denis Carikli <[email protected]>
To: linux-arm-kernel at lists.infradead.org

That new macro is needed by the imx_drm staging driver
for supporting the QVGA display of the eukrea-cpuimx51 board.

---
 .../DocBook/media/v4l/pixfmt-packed-rgb.xml        | 39 ++++++++++++++++++++++
 include/uapi/linux/videodev2.h                     |  1 +
 2 files changed, 40 insertions(+)
Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml +39 -0
index 166c8d65e4f7..3207295c15fa 100644
@@ -279,6 +279,45 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>
 	    <entry></entry>
 	    <entry></entry>
 	  </row>
+	  <row id="V4L2-PIX-FMT-RGB666">
+	    <entry><constant>V4L2_PIX_FMT_RGB666</constant></entry>
+	    <entry>'RGBH'</entry>
+	    <entry></entry>
+	    <entry>r<subscript>5</subscript></entry>
+	    <entry>r<subscript>4</subscript></entry>
+	    <entry>r<subscript>3</subscript></entry>
+	    <entry>r<subscript>2</subscript></entry>
+	    <entry>r<subscript>1</subscript></entry>
+	    <entry>r<subscript>0</subscript></entry>
+	    <entry>g<subscript>5</subscript></entry>
+	    <entry>g<subscript>4</subscript></entry>
+	    <entry></entry>
+	    <entry>g<subscript>3</subscript></entry>
+	    <entry>g<subscript>2</subscript></entry>
+	    <entry>g<subscript>1</subscript></entry>
+	    <entry>g<subscript>0</subscript></entry>
+	    <entry>b<subscript>5</subscript></entry>
+	    <entry>b<subscript>4</subscript></entry>
+	    <entry>b<subscript>3</subscript></entry>
+	    <entry>b<subscript>2</subscript></entry>
+	    <entry></entry>
+	    <entry>b<subscript>1</subscript></entry>
+	    <entry>b<subscript>0</subscript></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	    <entry></entry>
+	  </row>
 	  <row id="V4L2-PIX-FMT-BGR24">
 	    <entry><constant>V4L2_PIX_FMT_BGR24</constant></entry>
 	    <entry>'BGR3'</entry>
include/uapi/linux/videodev2.h +1 -0
index 6ae7bbe988cc..3051d67fcf5a 100644
@@ -294,6 +294,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16  RGB-5-5-5 BE  */
 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16  RGB-5-6-5 BE  */
 #define V4L2_PIX_FMT_BGR666  v4l2_fourcc('B', 'G', 'R', 'H') /* 18  BGR-6-6-6	  */
+#define V4L2_PIX_FMT_RGB666  v4l2_fourcc('R', 'G', 'B', 'H') /* 18  RGB-6-6-6	  */
 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B', 'G', 'R', '3') /* 24  BGR-8-8-8     */
 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R', 'G', 'B', '3') /* 24  RGB-8-8-8     */
 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B', 'G', 'R', '4') /* 32  BGR-8-8-8-8   */
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 8/8 imx-drm: Add RGB666 support for parallel display.

In reply to Russell King - ARM Linux

From: Denis Carikli <[email protected]>
To: linux-arm-kernel at lists.infradead.org

---
 .../devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt          | 3 ++-
 drivers/staging/imx-drm/ipu-v3/ipu-dc.c                          | 9 +++++++++
 drivers/staging/imx-drm/parallel-display.c                       | 2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt +2 -1
index 3be5ce7a9654..83137ef5a1ba 100644
@@ -60,7 +60,8 @@ Parallel display support
 - compatible: Should be "fsl,imx-parallel-display"
 Optional properties:
 - interface_pix_fmt: How this display is connected to the
-  display interface. Currently supported types: "rgb24", "rgb565", "bgr666"
+  display interface. Currently supported types: "rgb24", "rgb565", "bgr666",
+  "rgb666"
 - edid: verbatim EDID data block describing attached display.
 - ddc: phandle describing the i2c bus handling the display data
   channel
drivers/staging/imx-drm/ipu-v3/ipu-dc.c +9 -0
index d5de8bb5c803..6f9abe8a4575 100644
@@ -92,6 +92,7 @@ enum ipu_dc_map {
 	IPU_DC_MAP_GBR24, /* TVEv2 */
 	IPU_DC_MAP_BGR666,
 	IPU_DC_MAP_BGR24,
+	IPU_DC_MAP_RGB666,
 };
 
 struct ipu_dc {
@@ -155,6 +156,8 @@ static int ipu_pixfmt_to_map(u32 fmt)
 		return IPU_DC_MAP_BGR666;
 	case V4L2_PIX_FMT_BGR24:
 		return IPU_DC_MAP_BGR24;
+	case V4L2_PIX_FMT_RGB666:
+		return IPU_DC_MAP_RGB666;
 	default:
 		return -EINVAL;
 	}
@@ -404,6 +407,12 @@ int ipu_dc_init(struct ipu_soc *ipu, struct device *dev,
 	ipu_dc_map_config(priv, IPU_DC_MAP_BGR24, 1, 15, 0xff); /* green */
 	ipu_dc_map_config(priv, IPU_DC_MAP_BGR24, 0, 23, 0xff); /* blue */
 
+	/* rgb666 */
+	ipu_dc_map_clear(priv, IPU_DC_MAP_RGB666);
+	ipu_dc_map_config(priv, IPU_DC_MAP_RGB666, 0, 5, 0xfc); /* blue */
+	ipu_dc_map_config(priv, IPU_DC_MAP_RGB666, 1, 11, 0xfc); /* green */
+	ipu_dc_map_config(priv, IPU_DC_MAP_RGB666, 2, 17, 0xfc); /* red */
+
 	return 0;
 }
 
drivers/staging/imx-drm/parallel-display.c +2 -0
index d610f0726bb2..12a1b5e54f14 100644
@@ -196,6 +196,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
 			imxpd->interface_pix_fmt = V4L2_PIX_FMT_RGB565;
 		else if (!strcmp(fmt, "bgr666"))
 			imxpd->interface_pix_fmt = V4L2_PIX_FMT_BGR666;
+		else if (!strcmp(fmt, "rgb666"))
+			imxpd->interface_pix_fmt = V4L2_PIX_FMT_RGB666;
 	}
 
 	imxpd->dev = dev;
Signature · 1 line
1.8.3.1