Skip to content

Commit 03d14c3

Browse files
Linus Walleijtomba
authored andcommitted
video: ARM CLCD: support pads connected in reverse order
There are CLCDs connected with the pads in BGR rather than RGB order. It really doesn't matter since the CLCD has a flag and a bit to switch the position of the RGB and BGR components. This is needed to put something logical into the arm,pl11x,tft-r0g0b0-pads property of the device tree on the Nomadik which will then be <16 8 0>. Cc: Pawel Moll <pawel.moll@arm.com> Cc: Rob Herring <robh@kernel.org> Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent af29897 commit 03d14c3

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎drivers/video/fbdev/amba-clcd.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0)
675675
} panels[] = {
676676
{ 0x110, 1, 7, 13, CLCD_CAP_5551 },
677677
{ 0x110, 0, 8, 16, CLCD_CAP_888 },
678+
{ 0x110, 16, 8, 0, CLCD_CAP_888 },
678679
{ 0x111, 4, 14, 20, CLCD_CAP_444 },
679680
{ 0x111, 3, 11, 19, CLCD_CAP_444 | CLCD_CAP_5551 },
680681
{ 0x111, 3, 10, 19, CLCD_CAP_444 | CLCD_CAP_5551 |
@@ -702,6 +703,13 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0)
702703
fb->panel->caps = panels[i].caps;
703704
}
704705

706+
/*
707+
* If we actually physically connected the R lines to B and
708+
* vice versa
709+
*/
710+
if (r0 != 0 && b0 == 0)
711+
fb->panel->bgr_connection = true;
712+
705713
return fb->panel->caps ? 0 : -EINVAL;
706714
}
707715

‎include/linux/amba/clcd.h‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ struct clcd_panel {
108108
grayscale:1;
109109
unsigned int connector;
110110
struct backlight_device *backlight;
111+
/*
112+
* If the B/R lines are switched between the CLCD
113+
* and the panel we need to know this and not try to
114+
* compensate with the BGR bit in the control register.
115+
*/
116+
bool bgr_connection;
111117
};
112118

113119
struct clcd_regs {
@@ -234,16 +240,22 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
234240
if (var->grayscale)
235241
val |= CNTL_LCDBW;
236242

237-
if (fb->panel->caps && fb->board->caps &&
238-
var->bits_per_pixel >= 16) {
243+
if (fb->panel->caps && fb->board->caps && var->bits_per_pixel >= 16) {
239244
/*
240245
* if board and panel supply capabilities, we can support
241-
* changing BGR/RGB depending on supplied parameters
246+
* changing BGR/RGB depending on supplied parameters. Here
247+
* we switch to what the framebuffer is providing if need
248+
* be, so if the framebuffer is BGR but the display connection
249+
* is RGB (first case) we switch it around. Vice versa mutatis
250+
* mutandis if the framebuffer is RGB but the display connection
251+
* is BGR, we flip it around.
242252
*/
243253
if (var->red.offset == 0)
244254
val &= ~CNTL_BGR;
245255
else
246256
val |= CNTL_BGR;
257+
if (fb->panel->bgr_connection)
258+
val ^= CNTL_BGR;
247259
}
248260

249261
switch (var->bits_per_pixel) {

0 commit comments

Comments
 (0)