Skip to content

Commit 8ded3a8

Browse files
6by9popcornmix
authored andcommitted
drm/bridge: tc358762: Program the DPI mode into the chip
The autodetection of resolution/timing by the TC358762 can lead to the display being shifted by a pixel or two. Program the TC358762 with the requested mode timing so that it can reproduce it accurately. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent f5df844 commit 8ded3a8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpu/drm/bridge/tc358762.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
#define LCDCTRL_VSPOL BIT(19) /* Polarity of VSYNC signal */
5454
#define LCDCTRL_VSDELAY(v) (((v) & 0xfff) << 20) /* VSYNC delay */
5555

56+
/* First parameter is in the 16bits, second is in the top 16bits */
57+
#define LCD_HS_HBP 0x0424
58+
#define LCD_HDISP_HFP 0x0428
59+
#define LCD_VS_VBP 0x042c
60+
#define LCD_VDISP_VFP 0x0430
61+
5662
/* SPI Master Registers */
5763
#define SPICMR 0x0450
5864
#define SPITCR 0x0454
@@ -139,6 +145,15 @@ static int tc358762_init(struct tc358762 *ctx)
139145
tc358762_write(ctx, LCDCTRL, lcdctrl);
140146

141147
tc358762_write(ctx, SYSCTRL, 0x040f);
148+
149+
tc358762_write(ctx, LCD_HS_HBP, (ctx->mode.hsync_end - ctx->mode.hsync_start) |
150+
((ctx->mode.htotal - ctx->mode.hsync_end) << 16));
151+
tc358762_write(ctx, LCD_HDISP_HFP, ctx->mode.hdisplay |
152+
((ctx->mode.hsync_start - ctx->mode.hdisplay) << 16));
153+
tc358762_write(ctx, LCD_VS_VBP, (ctx->mode.vsync_end - ctx->mode.vsync_start) |
154+
((ctx->mode.vtotal - ctx->mode.vsync_end) << 16));
155+
tc358762_write(ctx, LCD_VDISP_VFP, ctx->mode.vdisplay |
156+
((ctx->mode.vsync_start - ctx->mode.vdisplay) << 16));
142157
msleep(100);
143158

144159
tc358762_write(ctx, PPI_STARTPPI, PPI_START_FUNCTION);

0 commit comments

Comments
 (0)