Commit 80eee6bc authored by Sascha Hauer's avatar 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: default avatarKrzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 27889273
...@@ -116,16 +116,10 @@ struct imxfb_rgb { ...@@ -116,16 +116,10 @@ struct imxfb_rgb {
struct fb_bitfield transp; struct fb_bitfield transp;
}; };
#define RGB_16 (0)
#define RGB_8 (1)
#define NR_RGB 2
struct imxfb_info { struct imxfb_info {
struct platform_device *pdev; struct platform_device *pdev;
void __iomem *regs; void __iomem *regs;
struct imxfb_rgb *rgb[NR_RGB];
u_int max_bpp; u_int max_bpp;
u_int max_xres; u_int max_xres;
u_int max_yres; u_int max_yres;
...@@ -165,7 +159,14 @@ struct imxfb_info { ...@@ -165,7 +159,14 @@ struct imxfb_info {
#define MIN_XRES 64 #define MIN_XRES 64
#define MIN_YRES 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,}, .red = {.offset = 8, .length = 4,},
.green = {.offset = 4, .length = 4,}, .green = {.offset = 4, .length = 4,},
.blue = {.offset = 0, .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, ...@@ -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) static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{ {
struct imxfb_info *fbi = info->par; struct imxfb_info *fbi = info->par;
int rgbidx; struct imxfb_rgb *rgb;
if (var->xres < MIN_XRES) if (var->xres < MIN_XRES)
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) ...@@ -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); pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel);
switch (var->bits_per_pixel) { switch (var->bits_per_pixel) {
case 16: 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; break;
case 8: case 8:
rgbidx = RGB_8; rgb = &def_rgb_8;
break; break;
default:
rgbidx = RGB_16;
} }
/* /*
* Copy the RGB parameters for this display * Copy the RGB parameters for this display
* from the machine specific parameters. * from the machine specific parameters.
*/ */
var->red = fbi->rgb[rgbidx]->red; var->red = rgb->red;
var->green = fbi->rgb[rgbidx]->green; var->green = rgb->green;
var->blue = fbi->rgb[rgbidx]->blue; var->blue = rgb->blue;
var->transp = fbi->rgb[rgbidx]->transp; var->transp = rgb->transp;
pr_debug("RGBT length = %d:%d:%d:%d\n", pr_debug("RGBT length = %d:%d:%d:%d\n",
var->red.length, var->green.length, var->blue.length, var->red.length, var->green.length, var->blue.length,
...@@ -545,9 +548,6 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev) ...@@ -545,9 +548,6 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
info->flags = FBINFO_FLAG_DEFAULT | info->flags = FBINFO_FLAG_DEFAULT |
FBINFO_READS_FAST; FBINFO_READS_FAST;
fbi->rgb[RGB_16] = &def_rgb_16;
fbi->rgb[RGB_8] = &def_rgb_8;
fbi->max_xres = pdata->xres; fbi->max_xres = pdata->xres;
info->var.xres = pdata->xres; info->var.xres = pdata->xres;
info->var.xres_virtual = pdata->xres; info->var.xres_virtual = pdata->xres;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment