mirror of https://gitee.com/openkylin/linux.git
[PATCH] ARM: Fix AMBA CLCD fb driver for 1bpp/STN mono panels
Fix the AMBA CLCD framebuffer driver for 1bpp modes and STN monochrome LCD panels. Signed-off-by: Russell King <rmk@arm.linux.org.uk>
This commit is contained in:
parent
ea3f4eaca0
commit
c4d12b98ea
|
@ -125,11 +125,11 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
|
||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
case 8:
|
case 8:
|
||||||
var->red.length = 8;
|
var->red.length = var->bits_per_pixel;
|
||||||
var->red.offset = 0;
|
var->red.offset = 0;
|
||||||
var->green.length = 8;
|
var->green.length = var->bits_per_pixel;
|
||||||
var->green.offset = 0;
|
var->green.offset = 0;
|
||||||
var->blue.length = 8;
|
var->blue.length = var->bits_per_pixel;
|
||||||
var->blue.offset = 0;
|
var->blue.offset = 0;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
|
|
|
@ -153,7 +153,7 @@ struct clcd_fb {
|
||||||
|
|
||||||
static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
|
static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val, cpl;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Program the CLCD controller registers and start the CLCD
|
* Program the CLCD controller registers and start the CLCD
|
||||||
|
@ -164,7 +164,10 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
|
||||||
val |= (fb->fb.var.left_margin - 1) << 24;
|
val |= (fb->fb.var.left_margin - 1) << 24;
|
||||||
regs->tim0 = val;
|
regs->tim0 = val;
|
||||||
|
|
||||||
val = fb->fb.var.yres - 1;
|
val = fb->fb.var.yres;
|
||||||
|
if (fb->panel->cntl & CNTL_LCDDUAL)
|
||||||
|
val /= 2;
|
||||||
|
val -= 1;
|
||||||
val |= (fb->fb.var.vsync_len - 1) << 10;
|
val |= (fb->fb.var.vsync_len - 1) << 10;
|
||||||
val |= fb->fb.var.lower_margin << 16;
|
val |= fb->fb.var.lower_margin << 16;
|
||||||
val |= fb->fb.var.upper_margin << 24;
|
val |= fb->fb.var.upper_margin << 24;
|
||||||
|
@ -174,13 +177,17 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
|
||||||
val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
|
val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
|
||||||
val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
|
val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
|
||||||
|
|
||||||
if (fb->panel->cntl & CNTL_LCDTFT)
|
cpl = fb->fb.var.xres_virtual;
|
||||||
val |= (fb->fb.var.xres_virtual - 1) << 16;
|
if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
|
||||||
else if (fb->panel->cntl & CNTL_LCDBW)
|
/* / 1 */;
|
||||||
printk("what value for CPL for stnmono panels?");
|
else if (!fb->fb.var.grayscale) /* STN color */
|
||||||
else
|
cpl = cpl * 8 / 3;
|
||||||
val |= ((fb->fb.var.xres_virtual * 8 / 3) - 1) << 16;
|
else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
|
||||||
regs->tim2 = val;
|
cpl /= 8;
|
||||||
|
else /* STN monochrome, 4bit */
|
||||||
|
cpl /= 4;
|
||||||
|
|
||||||
|
regs->tim2 = val | ((cpl - 1) << 16);
|
||||||
|
|
||||||
regs->tim3 = fb->panel->tim3;
|
regs->tim3 = fb->panel->tim3;
|
||||||
|
|
||||||
|
@ -216,7 +223,7 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
|
||||||
static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
|
static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
|
||||||
{
|
{
|
||||||
var->xres_virtual = var->xres = (var->xres + 7) & ~7;
|
var->xres_virtual = var->xres = (var->xres + 7) & ~7;
|
||||||
var->yres_virtual = var->yres;
|
var->yres_virtual = var->yres = (var->yres + 1) & ~1;
|
||||||
|
|
||||||
#define CHECK(e,l,h) (var->e < l || var->e > h)
|
#define CHECK(e,l,h) (var->e < l || var->e > h)
|
||||||
if (CHECK(right_margin, (5+1), 256) || /* back porch */
|
if (CHECK(right_margin, (5+1), 256) || /* back porch */
|
||||||
|
|
Loading…
Reference in New Issue