Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: sti: fix delay in VTG programming

The HDMI path introduce a delay of 6 pixels.
This delay should be take into account while programming
VTG for the HDMI. Without this delay, the HDMI active
window area is shift of 6 pixel on the right.

Set also timing for DVO output.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

+28 -3
+28 -3
drivers/gpu/drm/sti/sti_vtg.c
··· 51 51 #define VTG_TOP_V_HD_3 0x010C 52 52 #define VTG_BOT_V_HD_3 0x0110 53 53 54 + #define VTG_H_HD_4 0x0120 55 + #define VTG_TOP_V_VD_4 0x0124 56 + #define VTG_BOT_V_VD_4 0x0128 57 + #define VTG_TOP_V_HD_4 0x012c 58 + #define VTG_BOT_V_HD_4 0x0130 59 + 54 60 #define VTG_IRQ_BOTTOM BIT(0) 55 61 #define VTG_IRQ_TOP BIT(1) 56 62 #define VTG_IRQ_MASK (VTG_IRQ_TOP | VTG_IRQ_BOTTOM) 63 + 64 + /* Delay introduced by the HDMI in nb of pixel */ 65 + #define HDMI_DELAY (6) 57 66 58 67 /* delay introduced by the Arbitrary Waveform Generator in nb of pixels */ 59 68 #define AWG_DELAY_HD (-9) ··· 142 133 writel(tmp, vtg->regs + VTG_VID_TFS); 143 134 writel(tmp, vtg->regs + VTG_VID_BFS); 144 135 145 - /* prepare VTG set 1 and 2 for HDMI and VTG set 3 for HD DAC */ 146 - tmp = (mode->hsync_end - mode->hsync_start) << 16; 136 + /* prepare VTG set 1 for HDMI */ 137 + tmp = (mode->hsync_end - mode->hsync_start + HDMI_DELAY) << 16; 138 + tmp |= HDMI_DELAY; 147 139 writel(tmp, vtg->regs + VTG_H_HD_1); 148 - writel(tmp, vtg->regs + VTG_H_HD_2); 149 140 150 141 tmp = (mode->vsync_end - mode->vsync_start + 1) << 16; 151 142 tmp |= 1; ··· 155 146 writel(0, vtg->regs + VTG_BOT_V_HD_1); 156 147 157 148 /* prepare VTG set 2 for for HD DCS */ 149 + tmp = (mode->hsync_end - mode->hsync_start) << 16; 150 + writel(tmp, vtg->regs + VTG_H_HD_2); 151 + 152 + tmp = (mode->vsync_end - mode->vsync_start + 1) << 16; 153 + tmp |= 1; 158 154 writel(tmp, vtg->regs + VTG_TOP_V_VD_2); 159 155 writel(tmp, vtg->regs + VTG_BOT_V_VD_2); 160 156 writel(0, vtg->regs + VTG_TOP_V_HD_2); ··· 179 165 tmp |= mode->htotal + AWG_DELAY_HD; 180 166 writel(tmp, vtg->regs + VTG_TOP_V_HD_3); 181 167 writel(tmp, vtg->regs + VTG_BOT_V_HD_3); 168 + 169 + /* Prepare VTG set 4 for DVO */ 170 + tmp = (mode->hsync_end - mode->hsync_start) << 16; 171 + writel(tmp, vtg->regs + VTG_H_HD_4); 172 + 173 + tmp = (mode->vsync_end - mode->vsync_start + 1) << 16; 174 + tmp |= 1; 175 + writel(tmp, vtg->regs + VTG_TOP_V_VD_4); 176 + writel(tmp, vtg->regs + VTG_BOT_V_VD_4); 177 + writel(0, vtg->regs + VTG_TOP_V_HD_4); 178 + writel(0, vtg->regs + VTG_BOT_V_HD_4); 182 179 183 180 /* mode */ 184 181 writel(type, vtg->regs + VTG_MODE);