From 66564d832f531c6336d6d06b6976e16b249aa532 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:00:38 +0000 Subject: [PATCH 01/14] FB: sa1100: avoid section mismatch warnings WARNING: drivers/video/built-in.o(.devinit.text+0x58): Section mismatch in reference from the function sa1100fb_probe() to the function .init.text:sa1100fb_init_fbinfo() The function __devinit sa1100fb_probe() references a function __init sa1100fb_init_fbinfo(). If sa1100fb_init_fbinfo is only used by sa1100fb_probe then annotate sa1100fb_init_fbinfo with a matching annotation. WARNING: drivers/video/built-in.o(.devinit.text+0x258): Section mismatch in reference from the function sa1100fb_init_fbinfo() to the (unknown reference) .init.data:(unknown) The function __devinit sa1100fb_init_fbinfo() references a (unknown reference) __initdata (unknown). If (unknown) is only used by sa1100fb_init_fbinfo then annotate (unknown) with a matching annotation. WARNING: drivers/video/built-in.o(.devinit.text+0x26c): Section mismatch in reference from the function sa1100fb_init_fbinfo() to the (unknown reference) .init.data:(unknown) The function __devinit sa1100fb_init_fbinfo() references a (unknown reference) __initdata (unknown). If (unknown) is only used by sa1100fb_init_fbinfo then annotate (unknown) with a matching annotation. WARNING: drivers/video/built-in.o(.devinit.text+0x270): Section mismatch in reference from the function sa1100fb_init_fbinfo() to the (unknown reference) .init.data:(unknown) The function __devinit sa1100fb_init_fbinfo() references a (unknown reference) __initdata (unknown). If (unknown) is only used by sa1100fb_init_fbinfo then annotate (unknown) with a matching annotation. WARNING: drivers/video/built-in.o(.devinit.text+0x278): Section mismatch in reference from the function sa1100fb_init_fbinfo() to the (unknown reference) .init.data:(unknown) The function __devinit sa1100fb_init_fbinfo() references a (unknown reference) __initdata (unknown). If (unknown) is only used by sa1100fb_init_fbinfo then annotate (unknown) with a matching annotation. Acked-by: Florian Tobias Schandinat Signed-off-by: Russell King --- drivers/video/sa1100fb.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index 98d55d0e2da5..2cc268c0e89a 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -227,7 +227,7 @@ static struct sa1100fb_rgb def_rgb_16 = { * takes an RGB666 signal, but we provide it with an RGB565 signal * instead (def_rgb_16). */ -static struct sa1100fb_mach_info lq039q2ds54_info __initdata = { +static struct sa1100fb_mach_info lq039q2ds54_info __devinitdata = { .pixclock = 171521, .bpp = 16, .xres = 320, .yres = 240, @@ -241,7 +241,7 @@ static struct sa1100fb_mach_info lq039q2ds54_info __initdata = { .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), }; #else -static struct sa1100fb_mach_info pal_info __initdata = { +static struct sa1100fb_mach_info pal_info __devinitdata = { .pixclock = 67797, .bpp = 16, .xres = 640, .yres = 512, @@ -256,7 +256,7 @@ static struct sa1100fb_mach_info pal_info __initdata = { #endif #ifdef CONFIG_SA1100_H3600 -static struct sa1100fb_mach_info h3600_info __initdata = { +static struct sa1100fb_mach_info h3600_info __devinitdata = { .pixclock = 174757, .bpp = 16, .xres = 320, .yres = 240, @@ -279,7 +279,7 @@ static struct sa1100fb_rgb h3600_rgb_16 = { #endif #ifdef CONFIG_SA1100_H3100 -static struct sa1100fb_mach_info h3100_info __initdata = { +static struct sa1100fb_mach_info h3100_info __devinitdata = { .pixclock = 406977, .bpp = 4, .xres = 320, .yres = 240, @@ -297,7 +297,7 @@ static struct sa1100fb_mach_info h3100_info __initdata = { #endif #ifdef CONFIG_SA1100_COLLIE -static struct sa1100fb_mach_info collie_info __initdata = { +static struct sa1100fb_mach_info collie_info __devinitdata = { .pixclock = 171521, .bpp = 16, .xres = 320, .yres = 240, @@ -313,7 +313,7 @@ static struct sa1100fb_mach_info collie_info __initdata = { #endif #ifdef LART_GREY_LCD -static struct sa1100fb_mach_info lart_grey_info __initdata = { +static struct sa1100fb_mach_info lart_grey_info __devinitdata = { .pixclock = 150000, .bpp = 4, .xres = 320, .yres = 240, @@ -329,7 +329,7 @@ static struct sa1100fb_mach_info lart_grey_info __initdata = { }; #endif #ifdef LART_COLOR_LCD -static struct sa1100fb_mach_info lart_color_info __initdata = { +static struct sa1100fb_mach_info lart_color_info __devinitdata = { .pixclock = 150000, .bpp = 16, .xres = 320, .yres = 240, @@ -342,7 +342,7 @@ static struct sa1100fb_mach_info lart_color_info __initdata = { }; #endif #ifdef LART_VIDEO_OUT -static struct sa1100fb_mach_info lart_video_info __initdata = { +static struct sa1100fb_mach_info lart_video_info __devinitdata = { .pixclock = 39721, .bpp = 16, .xres = 640, .yres = 480, @@ -358,7 +358,7 @@ static struct sa1100fb_mach_info lart_video_info __initdata = { #endif #ifdef LART_KIT01_LCD -static struct sa1100fb_mach_info lart_kit01_info __initdata = { +static struct sa1100fb_mach_info lart_kit01_info __devinitdata = { .pixclock = 63291, .bpp = 16, .xres = 640, .yres = 480, @@ -372,7 +372,7 @@ static struct sa1100fb_mach_info lart_kit01_info __initdata = { #endif #ifdef CONFIG_SA1100_SHANNON -static struct sa1100fb_mach_info shannon_info __initdata = { +static struct sa1100fb_mach_info shannon_info __devinitdata = { .pixclock = 152500, .bpp = 8, .xres = 640, .yres = 480, @@ -389,7 +389,7 @@ static struct sa1100fb_mach_info shannon_info __initdata = { -static struct sa1100fb_mach_info * __init +static struct sa1100fb_mach_info * __devinit sa1100fb_get_machine_info(struct sa1100fb_info *fbi) { struct sa1100fb_mach_info *inf = NULL; @@ -1318,7 +1318,7 @@ static int sa1100fb_resume(struct platform_device *dev) * cache. Once this area is remapped, all virtual memory * access to the video memory should occur at the new region. */ -static int __init sa1100fb_map_video_memory(struct sa1100fb_info *fbi) +static int __devinit sa1100fb_map_video_memory(struct sa1100fb_info *fbi) { /* * We reserve one page for the palette, plus the size @@ -1344,7 +1344,7 @@ static int __init sa1100fb_map_video_memory(struct sa1100fb_info *fbi) } /* Fake monspecs to fill in fbinfo structure */ -static struct fb_monspecs monspecs __initdata = { +static struct fb_monspecs monspecs __devinitdata = { .hfmin = 30000, .hfmax = 70000, .vfmin = 50, @@ -1352,7 +1352,7 @@ static struct fb_monspecs monspecs __initdata = { }; -static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) +static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev) { struct sa1100fb_mach_info *inf; struct sa1100fb_info *fbi; From 4f7e34f8eff0b3dbbd75cc778b0a363bdb29ac18 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:11:03 +0000 Subject: [PATCH 02/14] FB: sa1100: add .owner initializer to driver structure Annotate the driver structure with the .owner field, to allow the module to be associated with the driver. Acked-by: Florian Tobias Schandinat Signed-off-by: Russell King --- drivers/video/sa1100fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index 2cc268c0e89a..bac9d4f39da5 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -1505,6 +1505,7 @@ static struct platform_driver sa1100fb_driver = { .resume = sa1100fb_resume, .driver = { .name = "sa11x0-fb", + .owner = THIS_MODULE, }, }; From 58f5cbf275f8fb9529cba20df2564d370a6107da Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:13:30 +0000 Subject: [PATCH 03/14] FB: sa1100: constify rgb structures The rgb structures should only be read and never written. Constify them. Acked-by: Florian Tobias Schandinat Signed-off-by: Russell King --- drivers/video/sa1100fb.c | 8 ++++---- drivers/video/sa1100fb.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index bac9d4f39da5..a797220fdf5c 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -199,21 +199,21 @@ extern void (*sa1100fb_backlight_power)(int on); extern void (*sa1100fb_lcd_power)(int on); -static struct sa1100fb_rgb rgb_4 = { +static const struct sa1100fb_rgb rgb_4 = { .red = { .offset = 0, .length = 4, }, .green = { .offset = 0, .length = 4, }, .blue = { .offset = 0, .length = 4, }, .transp = { .offset = 0, .length = 0, }, }; -static struct sa1100fb_rgb rgb_8 = { +static const struct sa1100fb_rgb rgb_8 = { .red = { .offset = 0, .length = 8, }, .green = { .offset = 0, .length = 8, }, .blue = { .offset = 0, .length = 8, }, .transp = { .offset = 0, .length = 0, }, }; -static struct sa1100fb_rgb def_rgb_16 = { +static const struct sa1100fb_rgb def_rgb_16 = { .red = { .offset = 11, .length = 5, }, .green = { .offset = 5, .length = 6, }, .blue = { .offset = 0, .length = 5, }, @@ -270,7 +270,7 @@ static struct sa1100fb_mach_info h3600_info __devinitdata = { .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), }; -static struct sa1100fb_rgb h3600_rgb_16 = { +static const struct sa1100fb_rgb h3600_rgb_16 = { .red = { .offset = 12, .length = 4, }, .green = { .offset = 7, .length = 4, }, .blue = { .offset = 1, .length = 4, }, diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h index 1c3b459865d8..7a3d66a5516f 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/sa1100fb.h @@ -65,7 +65,7 @@ struct sa1100fb_lcd_reg { struct sa1100fb_info { struct fb_info fb; struct device *dev; - struct sa1100fb_rgb *rgb[NR_RGB]; + const struct sa1100fb_rgb *rgb[NR_RGB]; u_int max_bpp; u_int max_xres; From 798892966871077b8c867abf3d491227037dc2eb Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:22:56 +0000 Subject: [PATCH 04/14] FB: sa1100: convert printks to dev_xxx() Use the dev_xxx() macros for driver kernel message output, rather than open coded printk() with KERN_ levels etc. Remove DPRINTK(). Acked-by: Florian Tobias Schandinat Signed-off-by: Russell King --- drivers/video/sa1100fb.c | 72 +++++++++++++++++++--------------------- drivers/video/sa1100fb.h | 9 ----- 2 files changed, 34 insertions(+), 47 deletions(-) diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index a797220fdf5c..ecd7cd4ce412 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -183,10 +183,6 @@ #include #include -/* - * debugging? - */ -#define DEBUG 0 /* * Complain if VAR is out of range. */ @@ -614,7 +610,7 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) var->xres_virtual = max(var->xres_virtual, var->xres); var->yres_virtual = max(var->yres_virtual, var->yres); - DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel); + dev_dbg(fbi->dev, "var->bits_per_pixel=%d\n", var->bits_per_pixel); switch (var->bits_per_pixel) { case 4: rgbidx = RGB_4; @@ -638,16 +634,16 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) var->blue = fbi->rgb[rgbidx]->blue; var->transp = fbi->rgb[rgbidx]->transp; - DPRINTK("RGBT length = %d:%d:%d:%d\n", + dev_dbg(fbi->dev, "RGBT length = %d:%d:%d:%d\n", var->red.length, var->green.length, var->blue.length, var->transp.length); - DPRINTK("RGBT offset = %d:%d:%d:%d\n", + dev_dbg(fbi->dev, "RGBT offset = %d:%d:%d:%d\n", var->red.offset, var->green.offset, var->blue.offset, var->transp.offset); #ifdef CONFIG_CPU_FREQ - printk(KERN_DEBUG "dma period = %d ps, clock = %d kHz\n", + dev_dbg(fbi->dev, "dma period = %d ps, clock = %d kHz\n", sa1100fb_display_dma_period(var), cpufreq_get(smp_processor_id())); #endif @@ -683,7 +679,7 @@ static int sa1100fb_set_par(struct fb_info *info) struct fb_var_screeninfo *var = &info->var; unsigned long palette_mem_size; - DPRINTK("set_par\n"); + dev_dbg(fbi->dev, "set_par\n"); if (var->bits_per_pixel == 16) fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; @@ -704,7 +700,7 @@ static int sa1100fb_set_par(struct fb_info *info) palette_mem_size = fbi->palette_size * sizeof(u16); - DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); + dev_dbg(fbi->dev, "palette_mem_size = 0x%08lx\n", palette_mem_size); fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size); fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size; @@ -775,7 +771,7 @@ static int sa1100fb_blank(int blank, struct fb_info *info) struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; int i; - DPRINTK("sa1100fb_blank: blank=%d\n", blank); + dev_dbg(fbi->dev, "sa1100fb_blank: blank=%d\n", blank); switch (blank) { case FB_BLANK_POWERDOWN: @@ -863,39 +859,39 @@ static int sa1100fb_activate_var(struct fb_var_screeninfo *var, struct sa1100fb_ u_int half_screen_size, yres, pcd; u_long flags; - DPRINTK("Configuring SA1100 LCD\n"); + dev_dbg(fbi->dev, "Configuring SA1100 LCD\n"); - DPRINTK("var: xres=%d hslen=%d lm=%d rm=%d\n", + dev_dbg(fbi->dev, "var: xres=%d hslen=%d lm=%d rm=%d\n", var->xres, var->hsync_len, var->left_margin, var->right_margin); - DPRINTK("var: yres=%d vslen=%d um=%d bm=%d\n", + dev_dbg(fbi->dev, "var: yres=%d vslen=%d um=%d bm=%d\n", var->yres, var->vsync_len, var->upper_margin, var->lower_margin); #if DEBUG_VAR if (var->xres < 16 || var->xres > 1024) - printk(KERN_ERR "%s: invalid xres %d\n", + dev_err(fbi->dev, "%s: invalid xres %d\n", fbi->fb.fix.id, var->xres); if (var->hsync_len < 1 || var->hsync_len > 64) - printk(KERN_ERR "%s: invalid hsync_len %d\n", + dev_err(fbi->dev, "%s: invalid hsync_len %d\n", fbi->fb.fix.id, var->hsync_len); if (var->left_margin < 1 || var->left_margin > 255) - printk(KERN_ERR "%s: invalid left_margin %d\n", + dev_err(fbi->dev, "%s: invalid left_margin %d\n", fbi->fb.fix.id, var->left_margin); if (var->right_margin < 1 || var->right_margin > 255) - printk(KERN_ERR "%s: invalid right_margin %d\n", + dev_err(fbi->dev, "%s: invalid right_margin %d\n", fbi->fb.fix.id, var->right_margin); if (var->yres < 1 || var->yres > 1024) - printk(KERN_ERR "%s: invalid yres %d\n", + dev_err(fbi->dev, "%s: invalid yres %d\n", fbi->fb.fix.id, var->yres); if (var->vsync_len < 1 || var->vsync_len > 64) - printk(KERN_ERR "%s: invalid vsync_len %d\n", + dev_err(fbi->dev, "%s: invalid vsync_len %d\n", fbi->fb.fix.id, var->vsync_len); if (var->upper_margin < 0 || var->upper_margin > 255) - printk(KERN_ERR "%s: invalid upper_margin %d\n", + dev_err(fbi->dev, "%s: invalid upper_margin %d\n", fbi->fb.fix.id, var->upper_margin); if (var->lower_margin < 0 || var->lower_margin > 255) - printk(KERN_ERR "%s: invalid lower_margin %d\n", + dev_err(fbi->dev, "%s: invalid lower_margin %d\n", fbi->fb.fix.id, var->lower_margin); #endif @@ -928,10 +924,10 @@ static int sa1100fb_activate_var(struct fb_var_screeninfo *var, struct sa1100fb_ (var->sync & FB_SYNC_HOR_HIGH_ACT ? LCCR3_HorSnchH : LCCR3_HorSnchL) | (var->sync & FB_SYNC_VERT_HIGH_ACT ? LCCR3_VrtSnchH : LCCR3_VrtSnchL); - DPRINTK("nlccr0 = 0x%08lx\n", new_regs.lccr0); - DPRINTK("nlccr1 = 0x%08lx\n", new_regs.lccr1); - DPRINTK("nlccr2 = 0x%08lx\n", new_regs.lccr2); - DPRINTK("nlccr3 = 0x%08lx\n", new_regs.lccr3); + dev_dbg(fbi->dev, "nlccr0 = 0x%08lx\n", new_regs.lccr0); + dev_dbg(fbi->dev, "nlccr1 = 0x%08lx\n", new_regs.lccr1); + dev_dbg(fbi->dev, "nlccr2 = 0x%08lx\n", new_regs.lccr2); + dev_dbg(fbi->dev, "nlccr3 = 0x%08lx\n", new_regs.lccr3); half_screen_size = var->bits_per_pixel; half_screen_size = half_screen_size * var->xres * var->yres / 16; @@ -967,7 +963,7 @@ static int sa1100fb_activate_var(struct fb_var_screeninfo *var, struct sa1100fb_ */ static inline void __sa1100fb_backlight_power(struct sa1100fb_info *fbi, int on) { - DPRINTK("backlight o%s\n", on ? "n" : "ff"); + dev_dbg(fbi->dev, "backlight o%s\n", on ? "n" : "ff"); if (sa1100fb_backlight_power) sa1100fb_backlight_power(on); @@ -975,7 +971,7 @@ static inline void __sa1100fb_backlight_power(struct sa1100fb_info *fbi, int on) static inline void __sa1100fb_lcd_power(struct sa1100fb_info *fbi, int on) { - DPRINTK("LCD power o%s\n", on ? "n" : "ff"); + dev_dbg(fbi->dev, "LCD power o%s\n", on ? "n" : "ff"); if (sa1100fb_lcd_power) sa1100fb_lcd_power(on); @@ -1015,7 +1011,7 @@ static void sa1100fb_setup_gpio(struct sa1100fb_info *fbi) static void sa1100fb_enable_controller(struct sa1100fb_info *fbi) { - DPRINTK("Enabling LCD controller\n"); + dev_dbg(fbi->dev, "Enabling LCD controller\n"); /* * Make sure the mode bits are present in the first palette entry @@ -1037,19 +1033,19 @@ static void sa1100fb_enable_controller(struct sa1100fb_info *fbi) GPSR |= SHANNON_GPIO_DISP_EN; } - DPRINTK("DBAR1 = 0x%08x\n", DBAR1); - DPRINTK("DBAR2 = 0x%08x\n", DBAR2); - DPRINTK("LCCR0 = 0x%08x\n", LCCR0); - DPRINTK("LCCR1 = 0x%08x\n", LCCR1); - DPRINTK("LCCR2 = 0x%08x\n", LCCR2); - DPRINTK("LCCR3 = 0x%08x\n", LCCR3); + dev_dbg(fbi->dev, "DBAR1 = 0x%08lx\n", DBAR1); + dev_dbg(fbi->dev, "DBAR2 = 0x%08lx\n", DBAR2); + dev_dbg(fbi->dev, "LCCR0 = 0x%08lx\n", LCCR0); + dev_dbg(fbi->dev, "LCCR1 = 0x%08lx\n", LCCR1); + dev_dbg(fbi->dev, "LCCR2 = 0x%08lx\n", LCCR2); + dev_dbg(fbi->dev, "LCCR3 = 0x%08lx\n", LCCR3); } static void sa1100fb_disable_controller(struct sa1100fb_info *fbi) { DECLARE_WAITQUEUE(wait, current); - DPRINTK("Disabling LCD controller\n"); + dev_dbg(fbi->dev, "Disabling LCD controller\n"); if (machine_is_shannon()) { GPCR |= SHANNON_GPIO_DISP_EN; @@ -1268,7 +1264,7 @@ sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val, switch (val) { case CPUFREQ_ADJUST: case CPUFREQ_INCOMPATIBLE: - printk(KERN_DEBUG "min dma period: %d ps, " + dev_dbg(fbi->dev, "min dma period: %d ps, " "new clock %d kHz\n", sa1100fb_min_dma_period(fbi), policy->max); /* todo: fill in min/max values */ @@ -1459,7 +1455,7 @@ static int __devinit sa1100fb_probe(struct platform_device *pdev) ret = request_irq(irq, sa1100fb_handle_irq, 0, "LCD", fbi); if (ret) { - printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret); + dev_err(&pdev->dev, "request_irq failed: %d\n", ret); goto failed; } diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h index 7a3d66a5516f..b1d5b089ee4a 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/sa1100fb.h @@ -129,15 +129,6 @@ struct sa1100fb_info { #define SA1100_NAME "SA1100" -/* - * Debug macros - */ -#if DEBUG -# define DPRINTK(fmt, args...) printk("%s: " fmt, __func__ , ## args) -#else -# define DPRINTK(fmt, args...) -#endif - /* * Minimum X and Y resolutions */ From 531060fc1989a438fbc2c3198f5057c40121ff50 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:49:44 +0000 Subject: [PATCH 05/14] FB: sa1100: combine RGB bitfield overrides into sa1100fb_mach_info Allow the sa1100fb_mach_info structure to carry the RGB bitfield overrides, rather than requiring them to be separately initialized in sa1100fb_get_machine_info(). Acked-by: Florian Tobias Schandinat Signed-off-by: Russell King --- drivers/video/sa1100fb.c | 21 ++++++++++++++------- drivers/video/sa1100fb.h | 22 ++++++++++------------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index ecd7cd4ce412..a905e20404fd 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -252,6 +252,13 @@ static struct sa1100fb_mach_info pal_info __devinitdata = { #endif #ifdef CONFIG_SA1100_H3600 +static const struct sa1100fb_rgb h3600_rgb_16 = { + .red = { .offset = 12, .length = 4, }, + .green = { .offset = 7, .length = 4, }, + .blue = { .offset = 1, .length = 4, }, + .transp = { .offset = 0, .length = 0, }, +}; + static struct sa1100fb_mach_info h3600_info __devinitdata = { .pixclock = 174757, .bpp = 16, .xres = 320, .yres = 240, @@ -264,13 +271,8 @@ static struct sa1100fb_mach_info h3600_info __devinitdata = { .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), -}; -static const struct sa1100fb_rgb h3600_rgb_16 = { - .red = { .offset = 12, .length = 4, }, - .green = { .offset = 7, .length = 4, }, - .blue = { .offset = 1, .length = 4, }, - .transp = { .offset = 0, .length = 0, }, + .rgb[RGB_16] = &h3600_rgb_16, }; #endif @@ -413,7 +415,6 @@ sa1100fb_get_machine_info(struct sa1100fb_info *fbi) #ifdef CONFIG_SA1100_H3600 if (machine_is_h3600()) { inf = &h3600_info; - fbi->rgb[RGB_16] = &h3600_rgb_16; } #endif #ifdef CONFIG_SA1100_COLLIE @@ -1352,6 +1353,7 @@ static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev) { struct sa1100fb_mach_info *inf; struct sa1100fb_info *fbi; + unsigned i; fbi = kmalloc(sizeof(struct sa1100fb_info) + sizeof(u32) * 16, GFP_KERNEL); @@ -1424,6 +1426,11 @@ static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev) fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * fbi->max_bpp / 8; + /* Copy the RGB bitfield overrides */ + for (i = 0; i < NR_RGB; i++) + if (inf->rgb[i]) + fbi->rgb[i] = inf->rgb[i]; + init_waitqueue_head(&fbi->ctrlr_wait); INIT_WORK(&fbi->task, sa1100fb_task); mutex_init(&fbi->ctrlr_lock); diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h index b1d5b089ee4a..77239b766e56 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/sa1100fb.h @@ -10,10 +10,12 @@ * for more details. */ -/* - * These are the bitfields for each - * display depth that we support. - */ +#define RGB_4 0 +#define RGB_8 1 +#define RGB_16 2 +#define NR_RGB 3 + +/* These are the bitfields for each display depth that we support. */ struct sa1100fb_rgb { struct fb_bitfield red; struct fb_bitfield green; @@ -21,9 +23,7 @@ struct sa1100fb_rgb { struct fb_bitfield transp; }; -/* - * This structure describes the machine which we are running on. - */ +/* This structure describes the machine which we are running on. */ struct sa1100fb_mach_info { u_long pixclock; @@ -47,6 +47,9 @@ struct sa1100fb_mach_info { u_int lccr0; u_int lccr3; + + /* Overrides for the default RGB maps */ + const struct sa1100fb_rgb *rgb[NR_RGB]; }; /* Shadows for LCD controller registers */ @@ -57,11 +60,6 @@ struct sa1100fb_lcd_reg { unsigned long lccr3; }; -#define RGB_4 (0) -#define RGB_8 (1) -#define RGB_16 (2) -#define NR_RGB 3 - struct sa1100fb_info { struct fb_info fb; struct device *dev; From 9e6720fb0cfd6edda12b408a66f4ac88e8a82e32 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:56:06 +0000 Subject: [PATCH 06/14] FB: sa1100: move machine inf structures to