aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/s3c-fb.c
diff options
context:
space:
mode:
authorPawel Osciak <p.osciak@samsung.com>2010-08-10 21:02:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:11 -0400
commitf676ec2a3526465dfa7b5c513a0c2bb22fb70b80 (patch)
treeab844e8c4136487f4daf0da6d9687103845fc62a /drivers/video/s3c-fb.c
parentf5ec546f1f5e21bfc84ce7a1ac7408702082c65a (diff)
s3c-fb: correct window osd size and alpha register handling
S3C64xx and S5P OSD registers for OSD size and alpha are as follows: VIDOSDC: win 0 - size, win 1-4: alpha VIDOSDD: win 1-2 - size; not present for windows 0, 3 and 4 Signed-off-by: Pawel Osciak <p.osciak@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: InKi Dae <inki.dae@samsung.com> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/s3c-fb.c')
-rw-r--r--drivers/video/s3c-fb.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index f76791180dbe..2173869afb49 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -103,8 +103,11 @@ struct s3c_fb_variant {
103 * struct s3c_fb_win_variant 103 * struct s3c_fb_win_variant
104 * @has_osd_c: Set if has OSD C register. 104 * @has_osd_c: Set if has OSD C register.
105 * @has_osd_d: Set if has OSD D register. 105 * @has_osd_d: Set if has OSD D register.
106 * @has_osd_alpha: Set if can change alpha transparency for a window.
106 * @palette_sz: Size of palette in entries. 107 * @palette_sz: Size of palette in entries.
107 * @palette_16bpp: Set if palette is 16bits wide. 108 * @palette_16bpp: Set if palette is 16bits wide.
109 * @osd_size_off: If != 0, supports setting up OSD for a window; the appropriate
110 * register is located at the given offset from OSD_BASE.
108 * @valid_bpp: 1 bit per BPP setting to show valid bits-per-pixel. 111 * @valid_bpp: 1 bit per BPP setting to show valid bits-per-pixel.
109 * 112 *
110 * valid_bpp bit x is set if (x+1)BPP is supported. 113 * valid_bpp bit x is set if (x+1)BPP is supported.
@@ -112,7 +115,9 @@ struct s3c_fb_variant {
112struct s3c_fb_win_variant { 115struct s3c_fb_win_variant {
113 unsigned int has_osd_c:1; 116 unsigned int has_osd_c:1;
114 unsigned int has_osd_d:1; 117 unsigned int has_osd_d:1;
118 unsigned int has_osd_alpha:1;
115 unsigned int palette_16bpp:1; 119 unsigned int palette_16bpp:1;
120 unsigned short osd_size_off;
116 unsigned short palette_sz; 121 unsigned short palette_sz;
117 u32 valid_bpp; 122 u32 valid_bpp;
118}; 123};
@@ -365,6 +370,36 @@ static int s3c_fb_align_word(unsigned int bpp, unsigned int pix)
365} 370}
366 371
367/** 372/**
373 * vidosd_set_size() - set OSD size for a window
374 *
375 * @win: the window to set OSD size for
376 * @size: OSD size register value
377 */
378static void vidosd_set_size(struct s3c_fb_win *win, u32 size)
379{
380 struct s3c_fb *sfb = win->parent;
381
382 /* OSD can be set up if osd_size_off != 0 for this window */
383 if (win->variant.osd_size_off)
384 writel(size, sfb->regs + OSD_BASE(win->index, sfb->variant)
385 + win->variant.osd_size_off);
386}
387
388/**
389 * vidosd_set_alpha() - set alpha transparency for a window
390 *
391 * @win: the window to set OSD size for
392 * @alpha: alpha register value
393 */
394static void vidosd_set_alpha(struct s3c_fb_win *win, u32 alpha)
395{
396 struct s3c_fb *sfb = win->parent;
397
398 if (win->variant.has_osd_alpha)
399 writel(alpha, sfb->regs + VIDOSD_C(win->index, sfb->variant));
400}
401
402/**
368 * shadow_protect_win() - disable updating values from shadow registers at vsync 403 * shadow_protect_win() - disable updating values from shadow registers at vsync
369 * 404 *
370 * @win: window to protect registers for 405 * @win: window to protect registers for
@@ -408,7 +443,7 @@ static int s3c_fb_set_par(struct fb_info *info)
408 void __iomem *regs = sfb->regs; 443 void __iomem *regs = sfb->regs;
409 void __iomem *buf = regs; 444 void __iomem *buf = regs;
410 int win_no = win->index; 445 int win_no = win->index;
411 u32 osdc_data = 0; 446 u32 alpha = 0;
412 u32 data; 447 u32 data;
413 u32 pagewidth; 448 u32 pagewidth;
414 int clkdiv; 449 int clkdiv;
@@ -511,15 +546,12 @@ static int s3c_fb_set_par(struct fb_info *info)
511 546
512 data = var->xres * var->yres; 547 data = var->xres * var->yres;
513 548
514 osdc_data = VIDISD14C_ALPHA1_R(0xf) | 549 alpha = VIDISD14C_ALPHA1_R(0xf) |
515 VIDISD14C_ALPHA1_G(0xf) | 550 VIDISD14C_ALPHA1_G(0xf) |
516 VIDISD14C_ALPHA1_B(0xf); 551 VIDISD14C_ALPHA1_B(0xf);
517 552
518 if (win->variant.has_osd_d) { 553 vidosd_set_alpha(win, alpha);
519 writel(data, regs + VIDOSD_D(win_no, sfb->variant)); 554 vidosd_set_size(win, data);
520 writel(osdc_data, regs + VIDOSD_C(win_no, sfb->variant));
521 } else
522 writel(data, regs + VIDOSD_C(win_no, sfb->variant));
523 555
524 data = WINCONx_ENWIN; 556 data = WINCONx_ENWIN;
525 557
@@ -1442,12 +1474,15 @@ static int s3c_fb_resume(struct platform_device *pdev)
1442static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = { 1474static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
1443 [0] = { 1475 [0] = {
1444 .has_osd_c = 1, 1476 .has_osd_c = 1,
1477 .osd_size_off = 0x8,
1445 .palette_sz = 256, 1478 .palette_sz = 256,
1446 .valid_bpp = VALID_BPP1248 | VALID_BPP(16) | VALID_BPP(24), 1479 .valid_bpp = VALID_BPP1248 | VALID_BPP(16) | VALID_BPP(24),
1447 }, 1480 },
1448 [1] = { 1481 [1] = {
1449 .has_osd_c = 1, 1482 .has_osd_c = 1,
1450 .has_osd_d = 1, 1483 .has_osd_d = 1,
1484 .osd_size_off = 0x12,
1485 .has_osd_alpha = 1,
1451 .palette_sz = 256, 1486 .palette_sz = 256,
1452 .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | 1487 .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) |
1453 VALID_BPP(18) | VALID_BPP(19) | 1488 VALID_BPP(18) | VALID_BPP(19) |
@@ -1456,6 +1491,8 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
1456 [2] = { 1491 [2] = {
1457 .has_osd_c = 1, 1492 .has_osd_c = 1,
1458 .has_osd_d = 1, 1493 .has_osd_d = 1,
1494 .osd_size_off = 0x12,
1495 .has_osd_alpha = 1,
1459 .palette_sz = 16, 1496 .palette_sz = 16,
1460 .palette_16bpp = 1, 1497 .palette_16bpp = 1,
1461 .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | 1498 .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) |
@@ -1464,6 +1501,7 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
1464 }, 1501 },
1465 [3] = { 1502 [3] = {
1466 .has_osd_c = 1, 1503 .has_osd_c = 1,
1504 .has_osd_alpha = 1,
1467 .palette_sz = 16, 1505 .palette_sz = 16,
1468 .palette_16bpp = 1, 1506 .palette_16bpp = 1,
1469 .valid_bpp = (VALID_BPP124 | VALID_BPP(16) | 1507 .valid_bpp = (VALID_BPP124 | VALID_BPP(16) |
@@ -1472,6 +1510,7 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
1472 }, 1510 },
1473 [4] = { 1511 [4] = {
1474 .has_osd_c = 1, 1512 .has_osd_c = 1,
1513 .has_osd_alpha = 1,
1475 .palette_sz = 4, 1514 .palette_sz = 4,
1476 .palette_16bpp = 1, 1515 .palette_16bpp = 1,
1477 .valid_bpp = (VALID_BPP(1) | VALID_BPP(2) | 1516 .valid_bpp = (VALID_BPP(1) | VALID_BPP(2) |
@@ -1597,6 +1636,7 @@ static struct s3c_fb_driverdata s3c_fb_data_s3c2443 __devinitdata = {
1597 }, 1636 },
1598 .win[1] = &(struct s3c_fb_win_variant) { 1637 .win[1] = &(struct s3c_fb_win_variant) {
1599 .has_osd_c = 1, 1638 .has_osd_c = 1,
1639 .has_osd_alpha = 1,
1600 .palette_sz = 256, 1640 .palette_sz = 256,
1601 .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | 1641 .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) |
1602 VALID_BPP(18) | VALID_BPP(19) | 1642 VALID_BPP(18) | VALID_BPP(19) |