Skip to contentSkip to conversation

drm: Add LCD display clock polarity flags

PATCH In review Marek Vasut 5 participants 10 messages Dec 2, 2013 – Dec 9, 2013

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

PATCH 1/3 drm: Add LCD display clock polarity flags

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

Cc Dave Airlie <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/gpu/drm/drm_modes.c | 5 +++++
 include/uapi/drm/drm_mode.h | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/drm_modes.c +5 -0
index 85071a1..d1f3bfc 100644
@@ -537,6 +537,11 @@ int drm_display_mode_from_videomode(const struct videomode *vm,
 		dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
 	if (vm->flags & DISPLAY_FLAGS_DOUBLECLK)
 		dmode->flags |= DRM_MODE_FLAG_DBLCLK;
+	if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_PPOL;
+	else if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_NPOL;
+
 	drm_mode_set_name(dmode);
 
 	return 0;
include/uapi/drm/drm_mode.h +3 -0
index f104c26..a6169ca 100644
@@ -73,6 +73,9 @@
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
 
+/* CRTC LCD clock polarity flags. */
+#define DRM_MODE_FLAG_PIXELCLK_PPOL		(1<<19)
+#define DRM_MODE_FLAG_PIXELCLK_NPOL		(1<<20)
 
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 2/3 imx-drm: ipuv3-crtc: Make DISP_CLK polarity configurable

This patch makes the LCD display clock polarity configurable via DT so in case board needs different DISP_CLK clock polarity, it can use the 'pixelclk-active' DT prop to do such adjustment.

Cc Dave Airlie <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/staging/imx-drm/ipuv3-crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/imx-drm/ipuv3-crtc.c +1 -1
index ce6ba98..1d8223e 100644
@@ -157,7 +157,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 = !!(mode->flags & DRM_MODE_FLAG_PIXELCLK_NPOL);
 	sig_cfg.width = mode->hdisplay;
 	sig_cfg.height = mode->vdisplay;
 	sig_cfg.pixel_fmt = out_pixel_fmt;
Signature · 1 line
1.8.4.2
#2 lore raw

PATCH 3/3 ARM: dts: imx53: Switch DISP_CLK polarity on M53EVK

In reply to Marek Vasut

Change the DISP_CLK line polarity on M53EVK to work correctly after the following commit:

commit f0ac9bebf19001f38afbb93e2dc719a15dfb75e5

Author: Fabio Estevam <[email protected]>
Date:   Tue Oct 29 19:42:22 2013 -0200

imx-drm: ipuv3-crtc: Invert IPU DI0 clock polarity

Cc Dave Airlie <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 arch/arm/boot/dts/imx53-m53evk.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/imx53-m53evk.dts +1 -0
index 84a2cdc..97ec9c7 100644
@@ -41,6 +41,7 @@
 					vfront-porch = <9>;
 					vsync-len = <3>;
 					vsync-active = <1>;
+					pixelclk-active = <1>;
 				};
 			};
 		};
Signature · 1 line
1.8.4.2
#3 lore raw
In reply to Marek Vasut
Quoted 2 lines · Marek Vasut

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

I still say that not even this should be part of the DRM mode API to userspace. The hint that you're changing the user API is that you're modifying a header file below a 'uapi' directory.

The settings of double scan, sync polarity etc are all part of the display mode specification (check CEA-861 documents). Things like pixel clock polarity are not part of the mode specification, they're a property of the display itself and are independent of the mode.

Therefore, they should not be part of struct drm_mode_modeinfo.

#4 lore raw
Quoted 8 lines · Russell King - ARM Linux
Quoted 2 lines · Marek Vasut

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

I still say that not even this should be part of the DRM mode API to userspace. The hint that you're changing the user API is that you're modifying a header file below a 'uapi' directory.

Quoted 6 lines

The settings of double scan, sync polarity etc are all part of the display mode specification (check CEA-861 documents). Things like pixel clock polarity are not part of the mode specification, they're a property of the display itself and are independent of the mode.

Therefore, they should not be part of struct drm_mode_modeinfo.

Note that we could make them part of drm_display_mode (but drm_crtc_convert_to_umode() should filter them out when copying from drm_mode_modeinfo.. I agree this information should not be coming from userspace). Seems like the sort of thing that the bridge or encoder could set on the adjusted_mode.

BR,
-R

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw
Quoted 15 lines · Rob Clark
Quoted 13 lines · Russell King - ARM Linux
Quoted 2 lines · Marek Vasut

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

I still say that not even this should be part of the DRM mode API to userspace. The hint that you're changing the user API is that you're modifying a header file below a 'uapi' directory.

The settings of double scan, sync polarity etc are all part of the display mode specification (check CEA-861 documents). Things like pixel clock polarity are not part of the mode specification, they're a property of the display itself and are independent of the mode.

Quoted 7 lines
Quoted 1 line

Therefore, they should not be part of struct drm_mode_modeinfo.

Note that we could make them part of drm_display_mode (but drm_crtc_convert_to_umode() should filter them out when copying from drm_mode_modeinfo.. I agree this information should not be coming from userspace). Seems like the sort of thing that the bridge or encoder could set on the adjusted_mode.

Probably better to not mix user visible and internal flags in drm_display_mode.flags. Just makes it more difficult to add real flags. Maybe just stick them into private_flags for the drivers that care.

Signature · 2 lines
Ville Syrj?l?
Intel OTC
#6 lore raw
In reply to Russell King - ARM Linux

Hello Russell,

Quoted 7 lines · Marek Vasut
Quoted 2 lines

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

I still say that not even this should be part of the DRM mode API to userspace. The hint that you're changing the user API is that you're modifying a header file below a 'uapi' directory.

OK, you are right.

Quoted 6 lines

The settings of double scan, sync polarity etc are all part of the display mode specification (check CEA-861 documents). Things like pixel clock polarity are not part of the mode specification, they're a property of the display itself and are independent of the mode.

Therefore, they should not be part of struct drm_mode_modeinfo.

Can you please provide me with some more hint here ? As for as I understand, using the 'pixelclk-active' DT prop in the 'display-timings' node for this purpose is correct, yes ? What I don't quite grok down is how do I get this information from DT into the imx-drm driver.

Thanks!

Best regards,
Marek Vasut

#7 lore raw
In reply to Marek Vasut
Quoted 35 lines · Marek Vasut

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

Cc Dave Airlie <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/gpu/drm/drm_modes.c | 5 +++++
 include/uapi/drm/drm_mode.h | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/drm_modes.c +5 -0
index 85071a1..d1f3bfc 100644
@@ -537,6 +537,11 @@ int drm_display_mode_from_videomode(const struct videomode *vm,
 		dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
 	if (vm->flags & DISPLAY_FLAGS_DOUBLECLK)
 		dmode->flags |= DRM_MODE_FLAG_DBLCLK;
+	if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_PPOL;
+	else if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_NPOL;
+
 	drm_mode_set_name(dmode);
 
 	return 0;
include/uapi/drm/drm_mode.h +0 -0
index f104c26..a6169ca 100644

include/uapi/drm/drm_mode.h line 78

Quoted 6 lines
include/uapi/drm/drm_mode.h +3 -0
@@ -73,6 +73,9 @@
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
 
+/* CRTC LCD clock polarity flags. */
+#define DRM_MODE_FLAG_PIXELCLK_PPOL		(1<<19)
+#define DRM_MODE_FLAG_PIXELCLK_NPOL		(1<<20)

Marek,

It looks that Denis (copied) is working on the same problem, so you may want to be aware of his effort [1][2].

Shawn

[1] http://thread.gmane.org/gmane.linux.drivers.driver-project.devel/42832
[2] http://thread.gmane.org/gmane.linux.drivers.driver-project.devel/42850/focus=279646

Quoted 6 lines
include/uapi/drm/drm_mode.h +0 -0
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
Signature · 1 line
1.8.4.2
#8 lore raw
Quoted 39 lines · Shawn Guo
Quoted 38 lines · Marek Vasut

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

Cc Dave Airlie <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/gpu/drm/drm_modes.c | 5 +++++
 include/uapi/drm/drm_mode.h | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/drm_modes.c +5 -0
index 85071a1..d1f3bfc 100644
@@ -537,6 +537,11 @@ int drm_display_mode_from_videomode(const struct videomode *vm,
 		dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
 	if (vm->flags & DISPLAY_FLAGS_DOUBLECLK)
 		dmode->flags |= DRM_MODE_FLAG_DBLCLK;
+	if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_PPOL;
+	else if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_NPOL;
+
 	drm_mode_set_name(dmode);
 
 	return 0;
include/uapi/drm/drm_mode.h +0 -0
index f104c26..a6169ca 100644
@@ -73,6 +73,9 @@
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
 
Quoted 8 lines

include/uapi/drm/drm_mode.h line 78

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+/* CRTC LCD clock polarity flags. */
+#define DRM_MODE_FLAG_PIXELCLK_PPOL		(1<<19)
+#define DRM_MODE_FLAG_PIXELCLK_NPOL		(1<<20)

Marek,

It looks that Denis (copied) is working on the same problem, so you may want to be aware of his effort [1][2].

Indeed, and I made very similar comments in that thread.

#9 lore raw
In reply to Shawn Guo
Quoted 48 lines · Shawn Guo
Quoted 47 lines · Marek Vasut

Add DRM flags for the LCD display clock polarity so the pixelclk-active DT property can be properly handled by drivers using the DRM API.

Cc Dave Airlie <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>

---

 drivers/gpu/drm/drm_modes.c | 5 +++++
 include/uapi/drm/drm_mode.h | 3 +++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/drm_modes.c +5 -0
index 85071a1..d1f3bfc 100644
@@ -537,6 +537,11 @@ int drm_display_mode_from_videomode(const struct
 videomode *vm,
 
 		dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
 
 	if (vm->flags & DISPLAY_FLAGS_DOUBLECLK)
 
 		dmode->flags |= DRM_MODE_FLAG_DBLCLK;
 
+	if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_PPOL;
+	else if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+		dmode->flags |= DRM_MODE_FLAG_PIXELCLK_NPOL;
+
 
 	drm_mode_set_name(dmode);
 
 	return 0;
include/uapi/drm/drm_mode.h +0 -0
index f104c26..a6169ca 100644
@@ -73,6 +73,9 @@
 
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
 
Quoted 8 lines

include/uapi/drm/drm_mode.h line 78

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+/* CRTC LCD clock polarity flags. */
+#define DRM_MODE_FLAG_PIXELCLK_PPOL		(1<<19)
+#define DRM_MODE_FLAG_PIXELCLK_NPOL		(1<<20)

Marek,

It looks that Denis (copied) is working on the same problem, so you may want to be aware of his effort [1][2].

He also just sent a new patchset, so I would focus on his work instead. It makes more sense as he is not breaking the userland stuff.

Thank you Shawn, Russell!

Best regards,
Marek Vasut