Skip to contentSkip to conversation

video: dw_hdmi: fix HSYNC and VSYNC polarity settings

PATCH New Vasily Khoruzhick 3 participants 6 messages Apr 28, 2018 – May 2, 2018

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

cover video: dw_hdmi: fix HSYNC and VSYNC polarity settings

Previous attempt to fix HSYNC and VSYNC polarity settings for dw_hdmi was wrong - actual root cause wasn't in sunxi dw_hdmi glue code, but in dw_hdmi driver itself. This series reverts previous attempt to fix the issue and applies proper fix

Vasily Khoruzhick (2):
Revert "sunxi: video: HDMI: split VSYNC and HSYNC polarity settings"
video: dw_hdmi: fix HSYNC and VSYNC polarity settings

 drivers/video/dw_hdmi.c             |  4 ++--
 drivers/video/sunxi/sunxi_dw_hdmi.c | 14 +++++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/2 Revert "sunxi: video: HDMI: split VSYNC and HSYNC polarity settings"

This reverts commit 64089178219371a512ddca8016d78bfdbe84565d.

---
 drivers/video/sunxi/sunxi_dw_hdmi.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/video/sunxi/sunxi_dw_hdmi.c +9 -5
index 4f01d1bded..33920a2b67 100644
@@ -304,11 +304,15 @@ static int sunxi_dw_hdmi_enable(struct udevice *dev, int panel_bpp,
 
 	sunxi_dw_hdmi_lcdc_init(priv->mux, edid, panel_bpp);
 
-	if (edid->flags & DISPLAY_FLAGS_HSYNC_LOW)
-		setbits_le32(&phy->pol, 0x200);
-
-	if (edid->flags & DISPLAY_FLAGS_VSYNC_LOW)
-		setbits_le32(&phy->pol, 0x100);
+	/*
+	 * Condition in original code is a bit weird. This is attempt
+	 * to make it more reasonable and it works. It could be that
+	 * bits and conditions are related and should be separated.
+	 */
+	if (!((edid->flags & DISPLAY_FLAGS_HSYNC_HIGH) &&
+	      (edid->flags & DISPLAY_FLAGS_VSYNC_HIGH))) {
+		setbits_le32(&phy->pol, 0x300);
+	}
 
 	setbits_le32(&phy->ctrl, 0xf << 12);
 
Signature · 1 line
2.17.0
#2 lore raw

PATCH 2/2 video: dw_hdmi: fix HSYNC and VSYNC polarity settings

In reply to Vasily Khoruzhick

Currently dw_hdmi configures HSYNC polarity using VSYNC setting from EDID and vice versa. Fix it, since it breaks displays where HSYNC and VSYNC polarity differs

---
 drivers/video/dw_hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/dw_hdmi.c +2 -2
index 6039d676c5..809e29b45f 100644
@@ -402,11 +402,11 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
 	/* set up hdmi_fc_invidconf */
 	inv_val = HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE;
 
-	inv_val |= (edid->flags & DISPLAY_FLAGS_HSYNC_HIGH ?
+	inv_val |= (edid->flags & DISPLAY_FLAGS_VSYNC_HIGH ?
 		   HDMI_FC_INVIDCONF_VSYNC_IN_POLARITY_ACTIVE_HIGH :
 		   HDMI_FC_INVIDCONF_VSYNC_IN_POLARITY_ACTIVE_LOW);
 
-	inv_val |= (edid->flags & DISPLAY_FLAGS_VSYNC_HIGH ?
+	inv_val |= (edid->flags & DISPLAY_FLAGS_HSYNC_HIGH ?
 		   HDMI_FC_INVIDCONF_HSYNC_IN_POLARITY_ACTIVE_HIGH :
 		   HDMI_FC_INVIDCONF_HSYNC_IN_POLARITY_ACTIVE_LOW);
 
Signature · 1 line
2.17.0
#3 lore raw

cover video: dw_hdmi: fix HSYNC and VSYNC polarity settings

In reply to Vasily Khoruzhick

Hi,

Quoted 7 lines · On Sat, 28 Apr 2018 14:57:27 -0700 Vasily Khoruzhick anarsoul at gmail.com…

Previous attempt to fix HSYNC and VSYNC polarity settings for dw_hdmi was wrong - actual root cause wasn't in sunxi dw_hdmi glue code, but in dw_hdmi driver itself. This series reverts previous attempt to fix the issue and applies proper fix

Vasily Khoruzhick (2):
Revert "sunxi: video: HDMI: split VSYNC and HSYNC polarity settings"

is this revert needed? Shouldn't the flags be set separately like this commit does?

--
Anatolij

#4 lore raw

cover video: dw_hdmi: fix HSYNC and VSYNC polarity settings

Quoted 10 lines · Anatolij Gustschin

Hi,

Quoted 5 lines · On Sat, 28 Apr 2018 14:57:27 -0700 Vasily Khoruzhick anarsoul at gmail.com…

Previous attempt to fix HSYNC and VSYNC polarity settings for dw_hdmi was wrong - actual root cause wasn't in sunxi dw_hdmi glue code, but in dw_hdmi driver itself. This series reverts previous attempt to fix the issue and applies proper fix

Quoted 5 lines
Quoted 2 lines

Vasily Khoruzhick (2):
Revert "sunxi: video: HDMI: split VSYNC and HSYNC polarity settings"

is this revert needed? Shouldn't the flags be set separately like this commit does?

Yes, revert is needed. Driver works fine without setting flags separately.

Quoted 3 lines

--
Anatolij

#5 lore raw

cover video: dw_hdmi: fix HSYNC and VSYNC polarity settings

Hi,

Dne sreda, 02. maj 2018 ob 16:47:07 CEST je Vasily Khoruzhick napisal(a):

Quoted 11 lines · Anatolij Gustschin
Quoted 10 lines

Hi,

On Sat, 28 Apr 2018 14:57:27 -0700

Quoted 5 lines · Vasily Khoruzhick anarsoul at gmail.com

Previous attempt to fix HSYNC and VSYNC polarity settings for dw_hdmi was wrong - actual root cause wasn't in sunxi dw_hdmi glue code, but in dw_hdmi driver itself. This series reverts previous attempt to fix the issue and applies proper fix

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Vasily Khoruzhick (2):
Revert "sunxi: video: HDMI: split VSYNC and HSYNC polarity settings"

is this revert needed? Shouldn't the flags be set separately like this commit does?

Yes, revert is needed. Driver works fine without setting flags separately.

I think patch is still needed. Code should be done in this way:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?
id=e420ccd66d36e4ac2035620286495ce13a40b7f7

Without this, different polarities didn't work for me in Linux DRM driver.

Best regards,
Jernej