aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-03-18 06:29:31 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2009-08-07 06:10:56 -0400
commitf497d0153a6b53b4cfd004de5f10b14bf630d852 (patch)
treec541967f2612fb28402a4bab3609462856da3ac5
parent9b0e6db0da1ea433f38b8d952108746f3fc67304 (diff)
imxfb: calculate bpix value from bits_per_pixel
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/plat-mxc/include/mach/imxfb.h3
-rw-r--r--drivers/video/imxfb.c19
2 files changed, 20 insertions, 2 deletions
diff --git a/arch/arm/plat-mxc/include/mach/imxfb.h b/arch/arm/plat-mxc/include/mach/imxfb.h
index 9f0101157ec1..66259f6158e0 100644
--- a/arch/arm/plat-mxc/include/mach/imxfb.h
+++ b/arch/arm/plat-mxc/include/mach/imxfb.h
@@ -13,7 +13,8 @@
13#define PCR_BPIX_4 (2 << 25) 13#define PCR_BPIX_4 (2 << 25)
14#define PCR_BPIX_8 (3 << 25) 14#define PCR_BPIX_8 (3 << 25)
15#define PCR_BPIX_12 (4 << 25) 15#define PCR_BPIX_12 (4 << 25)
16#define PCR_BPIX_16 (4 << 25) 16#define PCR_BPIX_16 (5 << 25)
17#define PCR_BPIX_18 (6 << 25)
17#define PCR_PIXPOL (1 << 24) 18#define PCR_PIXPOL (1 << 24)
18#define PCR_FLMPOL (1 << 23) 19#define PCR_FLMPOL (1 << 23)
19#define PCR_LPPOL (1 << 22) 20#define PCR_LPPOL (1 << 22)
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 15a0ee6d8e23..a8c41cb60fff 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -33,6 +33,7 @@
33#include <linux/math64.h> 33#include <linux/math64.h>
34 34
35#include <mach/imxfb.h> 35#include <mach/imxfb.h>
36#include <mach/hardware.h>
36 37
37/* 38/*
38 * Complain if VAR is out of range. 39 * Complain if VAR is out of range.
@@ -530,8 +531,24 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
530 lcd_clk / pcr); 531 lcd_clk / pcr);
531 } 532 }
532 533
534 switch (var->bits_per_pixel) {
535 case 32:
536 pcr |= PCR_BPIX_18;
537 break;
538 case 16:
539 default:
540 if (cpu_is_mx1())
541 pcr |= PCR_BPIX_12;
542 else
543 pcr |= PCR_BPIX_16;
544 break;
545 case 8:
546 pcr |= PCR_BPIX_8;
547 break;
548 }
549
533 /* add sync polarities */ 550 /* add sync polarities */
534 pcr |= fbi->pcr & ~0x3F; 551 pcr |= fbi->pcr & ~(0x3f | (7 << 25));
535 552
536 writel(pcr, fbi->regs + LCDC_PCR); 553 writel(pcr, fbi->regs + LCDC_PCR);
537 writel(fbi->pwmr, fbi->regs + LCDC_PWMR); 554 writel(fbi->pwmr, fbi->regs + LCDC_PWMR);