Commit 66c8719b authored by Sascha Hauer's avatar Sascha Hauer

i.MX Framebuffer: Cleanup Coding style

Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 24b9baf7
/* /*
* linux/drivers/video/imxfb.c
*
* Freescale i.MX Frame Buffer device driver * Freescale i.MX Frame Buffer device driver
* *
* Copyright (C) 2004 Sascha Hauer, Pengutronix * Copyright (C) 2004 Sascha Hauer, Pengutronix
...@@ -168,20 +166,21 @@ struct imxfb_info { ...@@ -168,20 +166,21 @@ struct imxfb_info {
#define MIN_YRES 64 #define MIN_YRES 64
static struct imxfb_rgb def_rgb_16 = { static struct imxfb_rgb def_rgb_16 = {
.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,},
.transp = { .offset = 0, .length = 0, }, .transp = {.offset = 0, .length = 0,},
}; };
static struct imxfb_rgb def_rgb_8 = { static struct imxfb_rgb def_rgb_8 = {
.red = { .offset = 0, .length = 8, }, .red = {.offset = 0, .length = 8,},
.green = { .offset = 0, .length = 8, }, .green = {.offset = 0, .length = 8,},
.blue = { .offset = 0, .length = 8, }, .blue = {.offset = 0, .length = 8,},
.transp = { .offset = 0, .length = 0, }, .transp = {.offset = 0, .length = 0,},
}; };
static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *info); static int imxfb_activate_var(struct fb_var_screeninfo *var,
struct fb_info *info);
static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf) static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
{ {
...@@ -190,8 +189,7 @@ static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf) ...@@ -190,8 +189,7 @@ static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
return chan << bf->offset; return chan << bf->offset;
} }
static int static int imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
u_int trans, struct fb_info *info) u_int trans, struct fb_info *info)
{ {
struct imxfb_info *fbi = info->par; struct imxfb_info *fbi = info->par;
...@@ -209,8 +207,7 @@ imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -209,8 +207,7 @@ imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
return ret; return ret;
} }
static int static int imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int trans, struct fb_info *info) u_int trans, struct fb_info *info)
{ {
struct imxfb_info *fbi = info->par; struct imxfb_info *fbi = info->par;
...@@ -270,8 +267,7 @@ imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -270,8 +267,7 @@ imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
* yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale, * yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
* bitfields, horizontal timing, vertical timing. * bitfields, horizontal timing, vertical timing.
*/ */
static int static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
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; int rgbidx;
...@@ -343,8 +339,7 @@ static int imxfb_set_par(struct fb_info *info) ...@@ -343,8 +339,7 @@ static int imxfb_set_par(struct fb_info *info)
info->fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR; info->fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
} }
info->fix.line_length = var->xres_virtual * info->fix.line_length = var->xres_virtual * var->bits_per_pixel / 8;
var->bits_per_pixel / 8;
fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16; fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16;
imxfb_activate_var(var, info); imxfb_activate_var(var, info);
...@@ -375,9 +370,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) ...@@ -375,9 +370,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
writel(RMCR_LCDC_EN, fbi->regs + LCDC_RMCR); writel(RMCR_LCDC_EN, fbi->regs + LCDC_RMCR);
if(fbi->backlight_power) if (fbi->backlight_power)
fbi->backlight_power(1); fbi->backlight_power(1);
if(fbi->lcd_power) if (fbi->lcd_power)
fbi->lcd_power(1); fbi->lcd_power(1);
} }
...@@ -385,9 +380,9 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) ...@@ -385,9 +380,9 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
{ {
pr_debug("Disabling LCD controller\n"); pr_debug("Disabling LCD controller\n");
if(fbi->backlight_power) if (fbi->backlight_power)
fbi->backlight_power(0); fbi->backlight_power(0);
if(fbi->lcd_power) if (fbi->lcd_power)
fbi->lcd_power(0); fbi->lcd_power(0);
writel(0, fbi->regs + LCDC_RMCR); writel(0, fbi->regs + LCDC_RMCR);
...@@ -495,7 +490,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf ...@@ -495,7 +490,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
static int imxfb_suspend(struct platform_device *dev, pm_message_t state) static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct imxfb_info *fbi = platform_get_drvdata(dev); struct imxfb_info *fbi = platform_get_drvdata(dev);
pr_debug("%s\n",__func__);
pr_debug("%s\n", __func__);
imxfb_disable_controller(fbi); imxfb_disable_controller(fbi);
return 0; return 0;
...@@ -504,7 +500,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state) ...@@ -504,7 +500,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
static int imxfb_resume(struct platform_device *dev) static int imxfb_resume(struct platform_device *dev)
{ {
struct imxfb_info *fbi = platform_get_drvdata(dev); struct imxfb_info *fbi = platform_get_drvdata(dev);
pr_debug("%s\n",__func__);
pr_debug("%s\n", __func__);
imxfb_enable_controller(fbi); imxfb_enable_controller(fbi);
return 0; return 0;
...@@ -522,7 +519,7 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev) ...@@ -522,7 +519,7 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
pr_debug("%s\n",__func__); pr_debug("%s\n",__func__);
info->pseudo_palette = kmalloc( sizeof(u32) * 16, GFP_KERNEL); info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
if (!info->pseudo_palette) if (!info->pseudo_palette)
return -ENOMEM; return -ENOMEM;
...@@ -545,7 +542,8 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev) ...@@ -545,7 +542,8 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
info->var.vmode = FB_VMODE_NONINTERLACED; info->var.vmode = FB_VMODE_NONINTERLACED;
info->fbops = &imxfb_ops; info->fbops = &imxfb_ops;
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_READS_FAST; info->flags = FBINFO_FLAG_DEFAULT |
FBINFO_READS_FAST;
fbi->rgb[RGB_16] = &def_rgb_16; fbi->rgb[RGB_16] = &def_rgb_16;
fbi->rgb[RGB_8] = &def_rgb_8; fbi->rgb[RGB_8] = &def_rgb_8;
...@@ -593,17 +591,17 @@ static int __init imxfb_probe(struct platform_device *pdev) ...@@ -593,17 +591,17 @@ static int __init imxfb_probe(struct platform_device *pdev)
printk("i.MX Framebuffer driver\n"); printk("i.MX Framebuffer driver\n");
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if(!res) if (!res)
return -ENODEV; return -ENODEV;
inf = pdev->dev.platform_data; inf = pdev->dev.platform_data;
if(!inf) { if (!inf) {
dev_err(&pdev->dev,"No platform_data available\n"); dev_err(&pdev->dev,"No platform_data available\n");
return -ENOMEM; return -ENOMEM;
} }
info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev); info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
if(!info) if (!info)
return -ENOMEM; return -ENOMEM;
fbi = info->par; fbi = info->par;
...@@ -611,7 +609,7 @@ static int __init imxfb_probe(struct platform_device *pdev) ...@@ -611,7 +609,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
ret = imxfb_init_fbinfo(pdev); ret = imxfb_init_fbinfo(pdev);
if( ret < 0 ) if (ret < 0)
goto failed_init; goto failed_init;
res = request_mem_region(res->start, resource_size(res), res = request_mem_region(res->start, resource_size(res),
...@@ -658,7 +656,7 @@ static int __init imxfb_probe(struct platform_device *pdev) ...@@ -658,7 +656,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
*/ */
imxfb_check_var(&info->var, info); imxfb_check_var(&info->var, info);
ret = fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0); ret = fb_alloc_cmap(&info->cmap, 1 << info->var.bits_per_pixel, 0);
if (ret < 0) if (ret < 0)
goto failed_cmap; goto failed_cmap;
......
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