提交 80eee6bc 编写于 作者: S Sascha Hauer

i.MX Framebuffer: add TFT support

With TFTs we can do 5/6/5 instead of 4/4/4. Add a bitfield for this
and use it with TFTs.
Acked-by: NKrzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
上级 27889273
......@@ -116,16 +116,10 @@ struct imxfb_rgb {
struct fb_bitfield transp;
};
#define RGB_16 (0)
#define RGB_8 (1)
#define NR_RGB 2
struct imxfb_info {
struct platform_device *pdev;
void __iomem *regs;
struct imxfb_rgb *rgb[NR_RGB];
u_int max_bpp;
u_int max_xres;
u_int max_yres;
......@@ -165,7 +159,14 @@ struct imxfb_info {
#define MIN_XRES 64
#define MIN_YRES 64
static struct imxfb_rgb def_rgb_16 = {
static struct imxfb_rgb def_rgb_16_tft = {
.red = {.offset = 11, .length = 5,},
.green = {.offset = 5, .length = 6,},
.blue = {.offset = 0, .length = 5,},
.transp = {.offset = 0, .length = 0,},
};
static struct imxfb_rgb def_rgb_16_stn = {
.red = {.offset = 8, .length = 4,},
.green = {.offset = 4, .length = 4,},
.blue = {.offset = 0, .length = 4,},
......@@ -270,7 +271,7 @@ static int imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
struct imxfb_info *fbi = info->par;
int rgbidx;
struct imxfb_rgb *rgb;
if (var->xres < MIN_XRES)
var->xres = MIN_XRES;
......@@ -286,23 +287,25 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel);
switch (var->bits_per_pixel) {
case 16:
rgbidx = RGB_16;
default:
if (readl(fbi->regs + LCDC_PCR) & PCR_TFT)
rgb = &def_rgb_16_tft;
else
rgb = &def_rgb_16_stn;
break;
case 8:
rgbidx = RGB_8;
rgb = &def_rgb_8;
break;
default:
rgbidx = RGB_16;
}
/*
* Copy the RGB parameters for this display
* from the machine specific parameters.
*/
var->red = fbi->rgb[rgbidx]->red;
var->green = fbi->rgb[rgbidx]->green;
var->blue = fbi->rgb[rgbidx]->blue;
var->transp = fbi->rgb[rgbidx]->transp;
var->red = rgb->red;
var->green = rgb->green;
var->blue = rgb->blue;
var->transp = rgb->transp;
pr_debug("RGBT length = %d:%d:%d:%d\n",
var->red.length, var->green.length, var->blue.length,
......@@ -545,9 +548,6 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
info->flags = FBINFO_FLAG_DEFAULT |
FBINFO_READS_FAST;
fbi->rgb[RGB_16] = &def_rgb_16;
fbi->rgb[RGB_8] = &def_rgb_8;
fbi->max_xres = pdata->xres;
info->var.xres = pdata->xres;
info->var.xres_virtual = pdata->xres;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册