aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2018-11-07 13:18:38 -0500
committerMaxime Ripard <maxime.ripard@bootlin.com>2018-11-09 02:31:28 -0500
commit65bf2d54f062474d43834cebbf48ff03c4b00080 (patch)
treeba66971e44d5f57df6ba521f364cad34ddfb6bf9
parent4843c9a208c05662811cbd0e3a0fd3e43a0ae965 (diff)
drm/sun4i: tcon: Support an active-low DE signal with RGB interface
Some panels need an active-low data enable (DE) signal for the RGB interface. This requires flipping a bit in the TCON0 polarity register when setting up the mode for the RGB interface. Match the associated bus flag and use it to set the polarity inversion bit for the DE signal when required. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181107181843.27628-4-contact@paulk.fr
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c7
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 262ffb6b0f82..0420f5c978b9 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -543,6 +543,9 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
543 if (mode->flags & DRM_MODE_FLAG_PVSYNC) 543 if (mode->flags & DRM_MODE_FLAG_PVSYNC)
544 val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE; 544 val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE;
545 545
546 if (display_info.bus_flags & DRM_BUS_FLAG_DE_LOW)
547 val |= SUN4I_TCON0_IO_POL_DE_NEGATIVE;
548
546 /* 549 /*
547 * On A20 and similar SoCs, the only way to achieve Positive Edge 550 * On A20 and similar SoCs, the only way to achieve Positive Edge
548 * (Rising Edge), is setting dclk clock phase to 2/3(240°). 551 * (Rising Edge), is setting dclk clock phase to 2/3(240°).
@@ -565,7 +568,9 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
565 clk_set_phase(tcon->dclk, 0); 568 clk_set_phase(tcon->dclk, 0);
566 569
567 regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG, 570 regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
568 SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE, 571 SUN4I_TCON0_IO_POL_HSYNC_POSITIVE |
572 SUN4I_TCON0_IO_POL_VSYNC_POSITIVE |
573 SUN4I_TCON0_IO_POL_DE_NEGATIVE,
569 val); 574 val);
570 575
571 /* Map output pins to channel 0 */ 576 /* Map output pins to channel 0 */
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 3d492c8be1fc..b5214d71610f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -116,6 +116,7 @@
116 116
117#define SUN4I_TCON0_IO_POL_REG 0x88 117#define SUN4I_TCON0_IO_POL_REG 0x88
118#define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase) ((phase & 3) << 28) 118#define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase) ((phase & 3) << 28)
119#define SUN4I_TCON0_IO_POL_DE_NEGATIVE BIT(27)
119#define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE BIT(25) 120#define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE BIT(25)
120#define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE BIT(24) 121#define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE BIT(24)
121 122