[PATCH 0/2] sunxi: video: Fix lcdc polarity display flags

The current LCD controller driver has incorrect polarity masks, so I've provided a fix for that. While I was there I also added support for two new display flags related to polarities.
Signed-off-by: John Watts contact@jookia.org --- John Watts (2): sunxi: video: Properly invert hsync and vsync polarity sunxi: video: Support DE_LOW and PIXDATA_NEGEDGE display flags
arch/arm/include/asm/arch-sunxi/lcdc.h | 2 ++ drivers/video/sunxi/lcdc.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) --- base-commit: c0ea27bccfb7d2d37fd36806ac2a2f7389099420 change-id: 20240614-sunxipolarities-a9a21c30c82b
Best regards,

The current code assumes hsync and vsync are active high by default, but they are actually active low by default. This results in panels being driven with the wrong sync polarities. Invert the check to fix it.
Signed-off-by: John Watts contact@jookia.org --- drivers/video/sunxi/lcdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/sunxi/lcdc.c b/drivers/video/sunxi/lcdc.c index 73033c3b85..4fcea6050a 100644 --- a/drivers/video/sunxi/lcdc.c +++ b/drivers/video/sunxi/lcdc.c @@ -133,9 +133,9 @@ void lcdc_tcon0_mode_set(struct sunxi_lcdc_reg * const lcdc, }
val = SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE(dclk_phase); - if (mode->flags & DISPLAY_FLAGS_HSYNC_LOW) + if (mode->flags & DISPLAY_FLAGS_HSYNC_HIGH) val |= SUNXI_LCDC_TCON_HSYNC_MASK; - if (mode->flags & DISPLAY_FLAGS_VSYNC_LOW) + if (mode->flags & DISPLAY_FLAGS_VSYNC_HIGH) val |= SUNXI_LCDC_TCON_VSYNC_MASK;
#ifdef CONFIG_VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH

Implement these by inverting the DE and PCLK polarities.
Signed-off-by: John Watts contact@jookia.org --- arch/arm/include/asm/arch-sunxi/lcdc.h | 2 ++ drivers/video/sunxi/lcdc.c | 4 ++++ 2 files changed, 6 insertions(+)
diff --git a/arch/arm/include/asm/arch-sunxi/lcdc.h b/arch/arm/include/asm/arch-sunxi/lcdc.h index 90216bcfd5..580cd6af20 100644 --- a/arch/arm/include/asm/arch-sunxi/lcdc.h +++ b/arch/arm/include/asm/arch-sunxi/lcdc.h @@ -64,6 +64,8 @@ struct sunxi_lcdc_reg { #define SUNXI_LCDC_Y(y) (((y) - 1) << 0) #define SUNXI_LCDC_TCON_VSYNC_MASK (1 << 24) #define SUNXI_LCDC_TCON_HSYNC_MASK (1 << 25) +#define SUNXI_LCDC_TCON_PIXDATA_MASK (1 << 26) +#define SUNXI_LCDC_TCON_DE_MASK (1 << 27) #define SUNXI_LCDC_CTRL_IO_MAP_MASK (1 << 0) #define SUNXI_LCDC_CTRL_IO_MAP_TCON0 (0 << 0) #define SUNXI_LCDC_CTRL_IO_MAP_TCON1 (1 << 0) diff --git a/drivers/video/sunxi/lcdc.c b/drivers/video/sunxi/lcdc.c index 4fcea6050a..169da7654e 100644 --- a/drivers/video/sunxi/lcdc.c +++ b/drivers/video/sunxi/lcdc.c @@ -137,6 +137,10 @@ void lcdc_tcon0_mode_set(struct sunxi_lcdc_reg * const lcdc, val |= SUNXI_LCDC_TCON_HSYNC_MASK; if (mode->flags & DISPLAY_FLAGS_VSYNC_HIGH) val |= SUNXI_LCDC_TCON_VSYNC_MASK; + if (mode->flags & DISPLAY_FLAGS_DE_LOW) + val |= SUNXI_LCDC_TCON_DE_MASK; + if (mode->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) + val |= SUNXI_LCDC_TCON_PIXDATA_MASK;
#ifdef CONFIG_VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH if (for_ext_vga_dac)
participants (1)
-
John Watts