diff options
author | InKi Dae <daeinki@gmail.com> | 2009-06-16 18:34:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 22:47:58 -0400 |
commit | 39000d654c2a22ca51fe92a39003d5fade59e9e4 (patch) | |
tree | 889f8915bb326204d4e7f15fec56b40c371c09c0 /drivers/video | |
parent | 97b9a5a28b5fd02ceb3fcccee05e39dd62e4f474 (diff) |
Samsung SoC Framebuffer driver: add Alpha Channel support
Add support for the ARGB1888 and ARGB4888 hardware to the Samsung SoC
Framebuffer driver (s3c-fb.c).
ARGB1888 and ARGB4888 is decided by var->transp.length and this variable
is set by s3c_fb_check_var().
In s3c_fb_check_var(), if var->vits_per_pixel is 25 or 28, then
var->transp.length would be 1 or 3.
Therefore alpha mode(ARGB1888 or ARGB4888) could be decided through that
variable.
For using alpha mode, you need to set the following: This code should be
added to your machine code as platform data.
static struct s3c_fb_pd_win xxx_fb_win0 = {
/* this is to ensure we use win0 */
.win_mode = {
.pixclock = (8+8+8+240)*(38+4+38+400),
.left_margin = 8,
.right_margin = 8,
.upper_margin = 38,
.lower_margin = 38,
.hsync_len = 8,
.vsync_len = 4,
.xres = 240,
.yres = 400,
},
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win xxx_fb_win1 = {
.win_mode = {
.pixclock = (8+8+8+240)*(38+4+38+400),
.left_margin = 8,
.right_margin = 8,
.upper_margin = 38,
.lower_margin = 38,
.hsync_len = 8,
.vsync_len = 4,
.xres = 240,
.yres = 400,
},
.max_bpp = 32,
.default_bpp = 28,
};
static struct s3c_fb_platdata xxx_lcd_pdata __initdata = {
.win[0] = &ncp_fb_win0,
.win[1] = &ncp_fb_win1,
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
.setup_gpio = xxx_fb_gpio_setup,
};
s3c_fb_set_platdata(&xxx_lcd_pdata);
The above code sets pixelformat for window0 layer to RGB888 and window1
layer to ARGB4888.
Signed-off-by: InKi Dae <inki.dae@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kyungmin Park <kmpark@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/s3c-fb.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index d3a568e6b169..53bca288e836 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -358,9 +358,16 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
358 | writel(data, regs + VIDOSD_B(win_no)); | 358 | writel(data, regs + VIDOSD_B(win_no)); |
359 | 359 | ||
360 | data = var->xres * var->yres; | 360 | data = var->xres * var->yres; |
361 | |||
362 | u32 osdc_data = 0; | ||
363 | |||
364 | osdc_data = VIDISD14C_ALPHA1_R(0xf) | | ||
365 | VIDISD14C_ALPHA1_G(0xf) | | ||
366 | VIDISD14C_ALPHA1_B(0xf); | ||
367 | |||
361 | if (s3c_fb_has_osd_d(win_no)) { | 368 | if (s3c_fb_has_osd_d(win_no)) { |
362 | writel(data, regs + VIDOSD_D(win_no)); | 369 | writel(data, regs + VIDOSD_D(win_no)); |
363 | writel(0, regs + VIDOSD_C(win_no)); | 370 | writel(osdc_data, regs + VIDOSD_C(win_no)); |
364 | } else | 371 | } else |
365 | writel(data, regs + VIDOSD_C(win_no)); | 372 | writel(data, regs + VIDOSD_C(win_no)); |
366 | 373 | ||
@@ -409,8 +416,12 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
409 | data |= WINCON1_BPPMODE_19BPP_A1666; | 416 | data |= WINCON1_BPPMODE_19BPP_A1666; |
410 | else | 417 | else |
411 | data |= WINCON1_BPPMODE_18BPP_666; | 418 | data |= WINCON1_BPPMODE_18BPP_666; |
412 | } else if (var->transp.length != 0) | 419 | } else if (var->transp.length == 1) |
413 | data |= WINCON1_BPPMODE_25BPP_A1888; | 420 | data |= WINCON1_BPPMODE_25BPP_A1888 |
421 | | WINCON1_BLD_PIX; | ||
422 | else if (var->transp.length == 4) | ||
423 | data |= WINCON1_BPPMODE_28BPP_A4888 | ||
424 | | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; | ||
414 | else | 425 | else |
415 | data |= WINCON0_BPPMODE_24BPP_888; | 426 | data |= WINCON0_BPPMODE_24BPP_888; |
416 | 427 | ||
@@ -418,6 +429,20 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
418 | break; | 429 | break; |
419 | } | 430 | } |
420 | 431 | ||
432 | /* It has no color key control register for window0 */ | ||
433 | if (win_no > 0) { | ||
434 | u32 keycon0_data = 0, keycon1_data = 0; | ||
435 | |||
436 | keycon0_data = ~(WxKEYCON0_KEYBL_EN | | ||
437 | WxKEYCON0_KEYEN_F | | ||
438 | WxKEYCON0_DIRCON) | WxKEYCON0_COMPKEY(0); | ||
439 | |||
440 | keycon1_data = WxKEYCON1_COLVAL(0xffffff); | ||
441 | |||
442 | writel(keycon0_data, regs + WxKEYCONy(win_no-1, 0)); | ||
443 | writel(keycon1_data, regs + WxKEYCONy(win_no-1, 1)); | ||
444 | } | ||
445 | |||
421 | writel(data, regs + WINCON(win_no)); | 446 | writel(data, regs + WINCON(win_no)); |
422 | writel(0x0, regs + WINxMAP(win_no)); | 447 | writel(0x0, regs + WINxMAP(win_no)); |
423 | 448 | ||