Skip to content

Commit 4bc390c

Browse files
committed
drm/fsl-dcu: use mode flags for hsync/vsync polarity
The current default configuration is as follows: - Invert VSYNC signal (active LOW) - Invert HSYNC signal (active LOW) The mode flags allow to specify the required polarity per mode. Furthermore, none of the current driver settings is actually a standard polarity. This patch applies the current driver default polarities as explicit flags to the display which has been introduced with the driver (NEC WQVGA "nec,nl4827hc19-05b"). The driver now also parses the flags field and applies the configuration accordingly, by using the following values as standard polarities: (e.g. when no flags are specified): - VSYNC signal not inverted (active HIGH) - HSYNC signal not inverted (active HIGH) Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Stefan Agner <stefan@agner.ch>
1 parent 6985581 commit 4bc390c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
7474
struct drm_device *dev = crtc->dev;
7575
struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
7676
struct drm_display_mode *mode = &crtc->state->mode;
77-
unsigned int hbp, hfp, hsw, vbp, vfp, vsw, div, index;
77+
unsigned int hbp, hfp, hsw, vbp, vfp, vsw, div, index, pol = 0;
7878
unsigned long dcuclk;
7979

8080
index = drm_crtc_index(crtc);
@@ -89,6 +89,12 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
8989
vfp = mode->vsync_start - mode->vdisplay;
9090
vsw = mode->vsync_end - mode->vsync_start;
9191

92+
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
93+
pol |= DCU_SYN_POL_INV_HS_LOW;
94+
95+
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
96+
pol |= DCU_SYN_POL_INV_VS_LOW;
97+
9298
regmap_write(fsl_dev->regmap, DCU_HSYN_PARA,
9399
DCU_HSYN_PARA_BP(hbp) |
94100
DCU_HSYN_PARA_PW(hsw) |
@@ -101,8 +107,7 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
101107
DCU_DISP_SIZE_DELTA_Y(mode->vdisplay) |
102108
DCU_DISP_SIZE_DELTA_X(mode->hdisplay));
103109
regmap_write(fsl_dev->regmap, DCU_DIV_RATIO, div);
104-
regmap_write(fsl_dev->regmap, DCU_SYN_POL,
105-
DCU_SYN_POL_INV_VS_LOW | DCU_SYN_POL_INV_HS_LOW);
110+
regmap_write(fsl_dev->regmap, DCU_SYN_POL, pol);
106111
regmap_write(fsl_dev->regmap, DCU_BGND, DCU_BGND_R(0) |
107112
DCU_BGND_G(0) | DCU_BGND_B(0));
108113
regmap_write(fsl_dev->regmap, DCU_DCU_MODE,

drivers/gpu/drm/panel/panel-simple.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@ static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
10161016
.vsync_end = 272 + 2 + 4,
10171017
.vtotal = 272 + 2 + 4 + 2,
10181018
.vrefresh = 74,
1019+
.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
10191020
};
10201021

10211022
static const struct panel_desc nec_nl4827hc19_05b = {

0 commit comments

Comments
 (0)