Skip to contentSkip to conversation

drm/mxsfb: fix pixel clock polarity

PATCH Superseded Stefan Agner 2 participants 11 messages Dec 8, 2016 – Dec 14, 2016

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Stefan Agner

author maintainer
#0 lore raw

PATCH 1/1 drm/mxsfb: fix pixel clock polarity

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

---
Hi Marek,

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

--
Stefan

 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +9 -2
index 0818903..4bcc8a3 100644
@@ -168,9 +168,16 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 		vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH;
 	if (m->flags & DRM_MODE_FLAG_PVSYNC)
 		vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+	/* Data Enable should be high active by default */
+	if (!(bus_flags & DRM_BUS_FLAG_DE_LOW))
 		vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+	/*
+	 * Note: DRM_BUS_FLAG_PIXDATA defines are controller centric,
+	 * controllers VDCTRL0_DOTCLK is display centric.
+	 * Drive on positive edige      -> display samples on falling edge
+	 * DRM_BUS_FLAG_PIXDATA_POSEDGE -> VDCTRL0_DOTCLK_ACT_FALLING
+	 */
+	if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
 		vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
 
 	writel(vdctrl0, mxsfb->base + LCDC_VDCTRL0);
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#1 lore raw
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Quoted 7 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

Quoted 30 lines

--
Stefan

 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +9 -2
index 0818903..4bcc8a3 100644
@@ -168,9 +168,16 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 		vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH;
 	if (m->flags & DRM_MODE_FLAG_PVSYNC)
 		vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+	/* Data Enable should be high active by default */
+	if (!(bus_flags & DRM_BUS_FLAG_DE_LOW))
 		vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+	/*
+	 * Note: DRM_BUS_FLAG_PIXDATA defines are controller centric,
+	 * controllers VDCTRL0_DOTCLK is display centric.
+	 * Drive on positive edige      -> display samples on falling edge
+	 * DRM_BUS_FLAG_PIXDATA_POSEDGE -> VDCTRL0_DOTCLK_ACT_FALLING
+	 */
+	if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
 		vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
 
 	writel(vdctrl0, mxsfb->base + LCDC_VDCTRL0);
Signature · 2 lines
Best regards,
Marek Vasut
author maintainer
#2 lore raw
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

The default change: Data enable should be high by default because that is what most displays require, including yours. This won't break your display, since you request DRM_BUS_FLAG_DE_HIGH anyway...

We could debate whether that default change is necessary, but since it also won't affect your display, I think it is a worthwhile change.

--
Stefan

Quoted 29 lines
Quoted 29 lines

--
Stefan

 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +9 -2
index 0818903..4bcc8a3 100644
@@ -168,9 +168,16 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 		vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH;
 	if (m->flags & DRM_MODE_FLAG_PVSYNC)
 		vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+	/* Data Enable should be high active by default */
+	if (!(bus_flags & DRM_BUS_FLAG_DE_LOW))
 		vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+	/*
+	 * Note: DRM_BUS_FLAG_PIXDATA defines are controller centric,
+	 * controllers VDCTRL0_DOTCLK is display centric.
+	 * Drive on positive edige      -> display samples on falling edge
+	 * DRM_BUS_FLAG_PIXDATA_POSEDGE -> VDCTRL0_DOTCLK_ACT_FALLING
+	 */
+	if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
 		vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
 
Quoted 2 lines

drivers/gpu/drm/mxsfb/mxsfb_crtc.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) · line 183

Quoted 2 lines
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +0 -0
 	writel(vdctrl0, mxsfb->base + LCDC_VDCTRL0);

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

author maintainer
#3 lore raw
Quoted 41 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

Quoted 7 lines

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

--
Stefan

Quoted 40 lines

The default change: Data enable should be high by default because that is what most displays require, including yours. This won't break your display, since you request DRM_BUS_FLAG_DE_HIGH anyway...

We could debate whether that default change is necessary, but since it also won't affect your display, I think it is a worthwhile change.

--
Stefan

Quoted 29 lines
Quoted 29 lines

--
Stefan

 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +9 -2
index 0818903..4bcc8a3 100644
@@ -168,9 +168,16 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
 		vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH;
 	if (m->flags & DRM_MODE_FLAG_PVSYNC)
 		vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+	/* Data Enable should be high active by default */
+	if (!(bus_flags & DRM_BUS_FLAG_DE_LOW))
 		vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH;
-	if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+	/*
+	 * Note: DRM_BUS_FLAG_PIXDATA defines are controller centric,
+	 * controllers VDCTRL0_DOTCLK is display centric.
+	 * Drive on positive edige      -> display samples on falling edge
+	 * DRM_BUS_FLAG_PIXDATA_POSEDGE -> VDCTRL0_DOTCLK_ACT_FALLING
+	 */
+	if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
 		vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
 
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/mxsfb/mxsfb_crtc.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) · line 183

Quoted 2 lines
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +0 -0
 	writel(vdctrl0, mxsfb->base + LCDC_VDCTRL0);

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

maintainer
#4 lore raw
Quoted 46 lines · Stefan Agner
Quoted 45 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

Quoted 8 lines
Quoted 3 lines

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Signature · 2 lines
Best regards,
Marek Vasut
author maintainer
#5 lore raw
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Stefan Agner
Quoted 48 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

Quoted 8 lines
Quoted 4 lines

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Ok, lets create facts here:
1. SoloX Refrence Manual, Figure 37-13. shows DOTCLK_POL=0, and it shows that the controller drives signals on falling edge of the pixel clock. The i.MX 7 has the same figure.
2. Just to verify, I hooked up an oscilloscope on my i.MX 7: It shows that with DOTCLK_POL=0 the controller drives on falling edge:
http://imgur.com/a/2f2Xt

So my measurements verify what is in the i.MX data sheets.

The current code sets the bit when negative edge (falling edge) is requested, which is wrong:
#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
...
if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)

     vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;

Not sure what is going on with your display, maybe the datasheet is just wrong (it requires DRM_BUS_FLAG_PIXDATA_NEGEDGE in fact) or it is some other artifact.

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

maintainer
#6 lore raw
Quoted 69 lines · Stefan Agner
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Stefan Agner
Quoted 48 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

Quoted 8 lines
Quoted 4 lines

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Ok, lets create facts here:
1. SoloX Refrence Manual, Figure 37-13. shows DOTCLK_POL=0, and it shows that the controller drives signals on falling edge of the pixel clock. The i.MX 7 has the same figure.
2. Just to verify, I hooked up an oscilloscope on my i.MX 7: It shows that with DOTCLK_POL=0 the controller drives on falling edge:
http://imgur.com/a/2f2Xt

Quoted 1 line

So my measurements verify what is in the i.MX data sheets.

Good

Quoted 10 lines

The current code sets the bit when negative edge (falling edge) is requested, which is wrong:
#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
...
if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)

     vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;

Not sure what is going on with your display, maybe the datasheet is just wrong (it requires DRM_BUS_FLAG_PIXDATA_NEGEDGE in fact) or it is some other artifact.

This is probably where the problem crept in [1], droping PIXDATA_POSEDGE actually makes this patch work for me. CCing Philipp.

[1] https://patchwork.kernel.org/patch/9301517/

Signature · 2 lines
Best regards,
Marek Vasut
author maintainer
#7 lore raw
Quoted 81 lines · Marek Vasut
Quoted 69 lines · Stefan Agner
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Stefan Agner
Quoted 48 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

Quoted 8 lines
Quoted 4 lines

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Ok, lets create facts here:
1. SoloX Refrence Manual, Figure 37-13. shows DOTCLK_POL=0, and it shows that the controller drives signals on falling edge of the pixel clock. The i.MX 7 has the same figure.
2. Just to verify, I hooked up an oscilloscope on my i.MX 7: It shows that with DOTCLK_POL=0 the controller drives on falling edge:
http://imgur.com/a/2f2Xt

Quoted 1 line

So my measurements verify what is in the i.MX data sheets.

Good

Quoted 7 lines

The current code sets the bit when negative edge (falling edge) is requested, which is wrong:
#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
...
if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)

     vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
Quoted 8 lines
Quoted 3 lines

Not sure what is going on with your display, maybe the datasheet is just wrong (it requires DRM_BUS_FLAG_PIXDATA_NEGEDGE in fact) or it is some other artifact.

This is probably where the problem crept in [1], droping PIXDATA_POSEDGE actually makes this patch work for me. CCing Philipp.

[1] https://patchwork.kernel.org/patch/9301517/

I looked at a old data sheet of that display and it seemed that PIXDATA_POSEDGE is the right thing. Panelook.cn lists newer data sheets, but I couldn't find them on the open internet, do you have access to a newer one?

http://www.panelook.cn/COM43H4M85ULC_ORTUSTECH_4.3_LCM_overview_17296.html

I guess in the end it doesn't matter: Given that it is verified that the controllers data sheet is right, I vote for merging that patch and fix the displays polarity...

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

maintainer
#8 lore raw
Quoted 89 lines · Stefan Agner
Quoted 88 lines · Marek Vasut
Quoted 69 lines · Stefan Agner
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Stefan Agner
Quoted 48 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

Quoted 8 lines
Quoted 4 lines

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Ok, lets create facts here:
1. SoloX Refrence Manual, Figure 37-13. shows DOTCLK_POL=0, and it shows that the controller drives signals on falling edge of the pixel clock. The i.MX 7 has the same figure.
2. Just to verify, I hooked up an oscilloscope on my i.MX 7: It shows that with DOTCLK_POL=0 the controller drives on falling edge:
http://imgur.com/a/2f2Xt

Quoted 1 line

So my measurements verify what is in the i.MX data sheets.

Good

Quoted 10 lines

The current code sets the bit when negative edge (falling edge) is requested, which is wrong:
#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
...
if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)

     vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;

Not sure what is going on with your display, maybe the datasheet is just wrong (it requires DRM_BUS_FLAG_PIXDATA_NEGEDGE in fact) or it is some other artifact.

This is probably where the problem crept in [1], droping PIXDATA_POSEDGE actually makes this patch work for me. CCing Philipp.

Quoted 6 lines
Quoted 1 line

[1] https://patchwork.kernel.org/patch/9301517/

I looked at a old data sheet of that display and it seemed that PIXDATA_POSEDGE is the right thing. Panelook.cn lists newer data sheets, but I couldn't find them on the open internet, do you have access to a newer one?

Which "version" do you have ? Probably not though.

Quoted 5 lines

http://www.panelook.cn/COM43H4M85ULC_ORTUSTECH_4.3_LCM_overview_17296.html

I guess in the end it doesn't matter: Given that it is verified that the controllers data sheet is right, I vote for merging that patch and fix the displays polarity...

Merging which patch ?

Signature · 2 lines
Best regards,
Marek Vasut
author maintainer
#9 lore raw
Quoted 90 lines · Marek Vasut
Quoted 89 lines · Stefan Agner
Quoted 88 lines · Marek Vasut
Quoted 69 lines · Stefan Agner
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Stefan Agner
Quoted 48 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

Quoted 8 lines
Quoted 4 lines

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Ok, lets create facts here:
1. SoloX Refrence Manual, Figure 37-13. shows DOTCLK_POL=0, and it shows that the controller drives signals on falling edge of the pixel clock. The i.MX 7 has the same figure.
2. Just to verify, I hooked up an oscilloscope on my i.MX 7: It shows that with DOTCLK_POL=0 the controller drives on falling edge:
http://imgur.com/a/2f2Xt

Quoted 1 line

So my measurements verify what is in the i.MX data sheets.

Good

Quoted 10 lines

The current code sets the bit when negative edge (falling edge) is requested, which is wrong:
#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
...
if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)

     vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;

Not sure what is going on with your display, maybe the datasheet is just wrong (it requires DRM_BUS_FLAG_PIXDATA_NEGEDGE in fact) or it is some other artifact.

This is probably where the problem crept in [1], droping PIXDATA_POSEDGE actually makes this patch work for me. CCing Philipp.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

[1] https://patchwork.kernel.org/patch/9301517/

I looked at a old data sheet of that display and it seemed that PIXDATA_POSEDGE is the right thing. Panelook.cn lists newer data sheets, but I couldn't find them on the open internet, do you have access to a newer one?

Which "version" do you have ? Probably not though.

I couldn't find it anymore, but I think it said Rev. 0

Quoted 7 lines
Quoted 5 lines

http://www.panelook.cn/COM43H4M85ULC_ORTUSTECH_4.3_LCM_overview_17296.html

I guess in the end it doesn't matter: Given that it is verified that the controllers data sheet is right, I vote for merging that patch and fix the displays polarity...

Merging which patch ?

This patch.

And I guess, to keep your display working, a patch which changes the Ortustech pixel clock flag...

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

maintainer
#10 lore raw
Quoted 109 lines · Stefan Agner
Quoted 90 lines · Marek Vasut
Quoted 89 lines · Stefan Agner
Quoted 88 lines · Marek Vasut
Quoted 69 lines · Stefan Agner
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Stefan Agner
Quoted 48 lines · Stefan Agner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Stefan Agner

The DRM subsystem specifies the pixel clock polarity from a controllers perspective: DRM_BUS_FLAG_PIXDATA_NEGEDGE means the controller drives the data on pixel clocks falling edge. That is the controllers DOTCLK_POL=0 (Default is data launched at negative edge).

Also change the data enable logic to be high active by default and only change if explicitly requested via bus_flags. With that defaults are:
- Data enable: high active
- Pixel clock polarity: controller drives data on negative edge

Quoted 5 lines
Quoted 3 lines

---
Hi Marek,

Hi, that was quick, thanks for checking this.

Yeah, I couldn't wait seeing it flying :-)

Quoted 9 lines
Quoted 8 lines

I discovered this while testing on a i.MX 7 eLCDIF IP. Particularly the non-standard DE polarity was causing issues. I was using a EDT display which is part of simple panel driver since a while now and does not specify any bus_flags currently... Of course I could (and probably should) add the proper bus_flags there too, but there are several displays which do not specify any polarity and likely rely on sensible driver standards (which is afact high active for the DE signal).

Quoted 4 lines

I actually use a panel which requires correct settings of the flags, see e0932f9d7ba9a16f99a84943b720f109de8e3e06 in mainline , so this patch would break things for me. So I wonder whether you should fix the panel driver or whether the mxsfb should be fixed ?

If you ask me, mxsfb.

Ok, there are actually two things, one is a bug, one is a default change.

The bug: Pixel clock polarity is clearly defined to be controller centric (see comments around DRM_BUS_FLAG_PIXDATA_*EDGE in include/drm/drm_connector.h). The driver does it wrong currently.

This might affect your display, and if it does, it is actually wrong also in your display... However, since it is a bug, I think it is not really a debate, it should be fixed...

Quoted 8 lines
Quoted 4 lines

FWIW, it seems that Ortustech com43h4m85ulc samples on falling edge, so DRM_BUS_FLAG_PIXDATA_POSEDGE seems right. And it means that DOTCLK_POL should be 1 (inverted), so with this patch the polarity should actually be correct for that panel.

Well, if I apply this patch, my image is shifted by 1 px to the left and there is a 1px white bar on the right side, so I think I have some polarity problem now ?

Ok, lets create facts here:
1. SoloX Refrence Manual, Figure 37-13. shows DOTCLK_POL=0, and it shows that the controller drives signals on falling edge of the pixel clock. The i.MX 7 has the same figure.
2. Just to verify, I hooked up an oscilloscope on my i.MX 7: It shows that with DOTCLK_POL=0 the controller drives on falling edge:
http://imgur.com/a/2f2Xt

Quoted 1 line

So my measurements verify what is in the i.MX data sheets.

Good

Quoted 10 lines

The current code sets the bit when negative edge (falling edge) is requested, which is wrong:
#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
...
if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)

     vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;

Not sure what is going on with your display, maybe the datasheet is just wrong (it requires DRM_BUS_FLAG_PIXDATA_NEGEDGE in fact) or it is some other artifact.

This is probably where the problem crept in [1], droping PIXDATA_POSEDGE actually makes this patch work for me. CCing Philipp.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

[1] https://patchwork.kernel.org/patch/9301517/

I looked at a old data sheet of that display and it seemed that PIXDATA_POSEDGE is the right thing. Panelook.cn lists newer data sheets, but I couldn't find them on the open internet, do you have access to a newer one?

Which "version" do you have ? Probably not though.

I couldn't find it anymore, but I think it said Rev. 0

Quoted 6 lines
Quoted 5 lines

http://www.panelook.cn/COM43H4M85ULC_ORTUSTECH_4.3_LCM_overview_17296.html

I guess in the end it doesn't matter: Given that it is verified that the controllers data sheet is right, I vote for merging that patch and fix the displays polarity...

Quoted 6 lines
Quoted 1 line

Merging which patch ?

This patch.

And I guess, to keep your display working, a patch which changes the Ortustech pixel clock flag...

Well, let's do that. Btw can you send a V2 with s/edige/edge/ ? ;-)

Thanks!

Signature · 2 lines
Best regards,
Marek Vasut