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

drm/bridge: tc358762: Guess the meaning of LCDCTRL bits

The register content and behavior is very similar to TC358764 VP_CTRL.
All the bits except for unknown bit 6 also seem to match, even though
the datasheet is just not available. Add a comment and reuse the bit
definitions.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-4-marex@denx.de

authored by

Marek Vasut and committed by
Robert Foss
80382226 362fa8f6

+13 -3
+13 -3
drivers/gpu/drm/bridge/tc358762.c
··· 41 41 #define DSI_LANEENABLE 0x0210 /* Enables each lane */ 42 42 #define DSI_RX_START 1 43 43 44 - /* LCDC/DPI Host Registers */ 45 - #define LCDCTRL 0x0420 44 + /* LCDC/DPI Host Registers, based on guesswork that this matches TC358764 */ 45 + #define LCDCTRL 0x0420 /* Video Path Control */ 46 + #define LCDCTRL_MSF BIT(0) /* Magic square in RGB666 */ 47 + #define LCDCTRL_VTGEN BIT(4)/* Use chip clock for timing */ 48 + #define LCDCTRL_UNK6 BIT(6) /* Unknown */ 49 + #define LCDCTRL_EVTMODE BIT(5) /* Event mode */ 50 + #define LCDCTRL_RGB888 BIT(8) /* RGB888 mode */ 51 + #define LCDCTRL_HSPOL BIT(17) /* Polarity of HSYNC signal */ 52 + #define LCDCTRL_DEPOL BIT(18) /* Polarity of DE signal */ 53 + #define LCDCTRL_VSPOL BIT(19) /* Polarity of VSYNC signal */ 54 + #define LCDCTRL_VSDELAY(v) (((v) & 0xfff) << 20) /* VSYNC delay */ 46 55 47 56 /* SPI Master Registers */ 48 57 #define SPICMR 0x0450 ··· 123 114 tc358762_write(ctx, PPI_LPTXTIMECNT, LPX_PERIOD); 124 115 125 116 tc358762_write(ctx, SPICMR, 0x00); 126 - tc358762_write(ctx, LCDCTRL, 0x00100150); 117 + tc358762_write(ctx, LCDCTRL, LCDCTRL_VSDELAY(1) | LCDCTRL_RGB888 | 118 + LCDCTRL_UNK6 | LCDCTRL_VTGEN); 127 119 tc358762_write(ctx, SYSCTRL, 0x040f); 128 120 msleep(100); 129 121