Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208500
b: refs/heads/master
c: f676ec2
h: refs/heads/master
v: v3
  • Loading branch information
Pawel Osciak authored and Linus Torvalds committed Aug 11, 2010
1 parent 9a398e4 commit 8c82f2d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f5ec546f1f5e21bfc84ce7a1ac7408702082c65a
refs/heads/master: f676ec2a3526465dfa7b5c513a0c2bb22fb70b80
54 changes: 47 additions & 7 deletions trunk/drivers/video/s3c-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,21 @@ struct s3c_fb_variant {
* struct s3c_fb_win_variant
* @has_osd_c: Set if has OSD C register.
* @has_osd_d: Set if has OSD D register.
* @has_osd_alpha: Set if can change alpha transparency for a window.
* @palette_sz: Size of palette in entries.
* @palette_16bpp: Set if palette is 16bits wide.
* @osd_size_off: If != 0, supports setting up OSD for a window; the appropriate
* register is located at the given offset from OSD_BASE.
* @valid_bpp: 1 bit per BPP setting to show valid bits-per-pixel.
*
* valid_bpp bit x is set if (x+1)BPP is supported.
*/
struct s3c_fb_win_variant {
unsigned int has_osd_c:1;
unsigned int has_osd_d:1;
unsigned int has_osd_alpha:1;
unsigned int palette_16bpp:1;
unsigned short osd_size_off;
unsigned short palette_sz;
u32 valid_bpp;
};
Expand Down Expand Up @@ -364,6 +369,36 @@ static int s3c_fb_align_word(unsigned int bpp, unsigned int pix)
return ALIGN(pix, pix_per_word);
}

/**
* vidosd_set_size() - set OSD size for a window
*
* @win: the window to set OSD size for
* @size: OSD size register value
*/
static void vidosd_set_size(struct s3c_fb_win *win, u32 size)
{
struct s3c_fb *sfb = win->parent;

/* OSD can be set up if osd_size_off != 0 for this window */
if (win->variant.osd_size_off)
writel(size, sfb->regs + OSD_BASE(win->index, sfb->variant)
+ win->variant.osd_size_off);
}

/**
* vidosd_set_alpha() - set alpha transparency for a window
*
* @win: the window to set OSD size for
* @alpha: alpha register value
*/
static void vidosd_set_alpha(struct s3c_fb_win *win, u32 alpha)
{
struct s3c_fb *sfb = win->parent;

if (win->variant.has_osd_alpha)
writel(alpha, sfb->regs + VIDOSD_C(win->index, sfb->variant));
}

/**
* shadow_protect_win() - disable updating values from shadow registers at vsync
*
Expand Down Expand Up @@ -408,7 +443,7 @@ static int s3c_fb_set_par(struct fb_info *info)
void __iomem *regs = sfb->regs;
void __iomem *buf = regs;
int win_no = win->index;
u32 osdc_data = 0;
u32 alpha = 0;
u32 data;
u32 pagewidth;
int clkdiv;
Expand Down Expand Up @@ -511,15 +546,12 @@ static int s3c_fb_set_par(struct fb_info *info)

data = var->xres * var->yres;

osdc_data = VIDISD14C_ALPHA1_R(0xf) |
alpha = VIDISD14C_ALPHA1_R(0xf) |
VIDISD14C_ALPHA1_G(0xf) |
VIDISD14C_ALPHA1_B(0xf);

if (win->variant.has_osd_d) {
writel(data, regs + VIDOSD_D(win_no, sfb->variant));
writel(osdc_data, regs + VIDOSD_C(win_no, sfb->variant));
} else
writel(data, regs + VIDOSD_C(win_no, sfb->variant));
vidosd_set_alpha(win, alpha);
vidosd_set_size(win, data);

data = WINCONx_ENWIN;

Expand Down Expand Up @@ -1442,12 +1474,15 @@ static int s3c_fb_resume(struct platform_device *pdev)
static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
[0] = {
.has_osd_c = 1,
.osd_size_off = 0x8,
.palette_sz = 256,
.valid_bpp = VALID_BPP1248 | VALID_BPP(16) | VALID_BPP(24),
},
[1] = {
.has_osd_c = 1,
.has_osd_d = 1,
.osd_size_off = 0x12,
.has_osd_alpha = 1,
.palette_sz = 256,
.valid_bpp = (VALID_BPP1248 | VALID_BPP(16) |
VALID_BPP(18) | VALID_BPP(19) |
Expand All @@ -1456,6 +1491,8 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
[2] = {
.has_osd_c = 1,
.has_osd_d = 1,
.osd_size_off = 0x12,
.has_osd_alpha = 1,
.palette_sz = 16,
.palette_16bpp = 1,
.valid_bpp = (VALID_BPP1248 | VALID_BPP(16) |
Expand All @@ -1464,6 +1501,7 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
},
[3] = {
.has_osd_c = 1,
.has_osd_alpha = 1,
.palette_sz = 16,
.palette_16bpp = 1,
.valid_bpp = (VALID_BPP124 | VALID_BPP(16) |
Expand All @@ -1472,6 +1510,7 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] __devinitdata = {
},
[4] = {
.has_osd_c = 1,
.has_osd_alpha = 1,
.palette_sz = 4,
.palette_16bpp = 1,
.valid_bpp = (VALID_BPP(1) | VALID_BPP(2) |
Expand Down Expand Up @@ -1597,6 +1636,7 @@ static struct s3c_fb_driverdata s3c_fb_data_s3c2443 __devinitdata = {
},
.win[1] = &(struct s3c_fb_win_variant) {
.has_osd_c = 1,
.has_osd_alpha = 1,
.palette_sz = 256,
.valid_bpp = (VALID_BPP1248 | VALID_BPP(16) |
VALID_BPP(18) | VALID_BPP(19) |
Expand Down

0 comments on commit 8c82f2d

Please sign in to comment.