aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-14 05:49:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-21 06:56:19 -0500
commit531060fc1989a438fbc2c3198f5057c40121ff50 (patch)
tree9de13ddf44c42ef3137dacfc1b24d0dd746e6f66 /drivers/video
parent798892966871077b8c867abf3d491227037dc2eb (diff)
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 <FlorianSchandinat@gmx.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/sa1100fb.c21
-rw-r--r--drivers/video/sa1100fb.h22
2 files changed, 24 insertions, 19 deletions
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index ecd7cd4ce41..a905e20404f 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -252,6 +252,13 @@ static struct sa1100fb_mach_info pal_info __devinitdata = {
252#endif 252#endif
253 253
254#ifdef CONFIG_SA1100_H3600 254#ifdef CONFIG_SA1100_H3600
255static const struct sa1100fb_rgb h3600_rgb_16 = {
256 .red = { .offset = 12, .length = 4, },
257 .green = { .offset = 7, .length = 4, },
258 .blue = { .offset = 1, .length = 4, },
259 .transp = { .offset = 0, .length = 0, },
260};
261
255static struct sa1100fb_mach_info h3600_info __devinitdata = { 262static struct sa1100fb_mach_info h3600_info __devinitdata = {
256 .pixclock = 174757, .bpp = 16, 263 .pixclock = 174757, .bpp = 16,
257 .xres = 320, .yres = 240, 264 .xres = 320, .yres = 240,
@@ -264,13 +271,8 @@ static struct sa1100fb_mach_info h3600_info __devinitdata = {
264 271
265 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 272 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
266 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 273 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
267};
268 274
269static const struct sa1100fb_rgb h3600_rgb_16 = { 275 .rgb[RGB_16] = &h3600_rgb_16,
270 .red = { .offset = 12, .length = 4, },
271 .green = { .offset = 7, .length = 4, },
272 .blue = { .offset = 1, .length = 4, },
273 .transp = { .offset = 0, .length = 0, },
274}; 276};
275#endif 277#endif
276 278
@@ -413,7 +415,6 @@ sa1100fb_get_machine_info(struct sa1100fb_info *fbi)
413#ifdef CONFIG_SA1100_H3600 415#ifdef CONFIG_SA1100_H3600
414 if (machine_is_h3600()) { 416 if (machine_is_h3600()) {
415 inf = &h3600_info; 417 inf = &h3600_info;
416 fbi->rgb[RGB_16] = &h3600_rgb_16;
417 } 418 }
418#endif 419#endif
419#ifdef CONFIG_SA1100_COLLIE 420#ifdef CONFIG_SA1100_COLLIE
@@ -1352,6 +1353,7 @@ static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev)
1352{ 1353{
1353 struct sa1100fb_mach_info *inf; 1354 struct sa1100fb_mach_info *inf;
1354 struct sa1100fb_info *fbi; 1355 struct sa1100fb_info *fbi;
1356 unsigned i;
1355 1357
1356 fbi = kmalloc(sizeof(struct sa1100fb_info) + sizeof(u32) * 16, 1358 fbi = kmalloc(sizeof(struct sa1100fb_info) + sizeof(u32) * 16,
1357 GFP_KERNEL); 1359 GFP_KERNEL);
@@ -1424,6 +1426,11 @@ static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev)
1424 fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * 1426 fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres *
1425 fbi->max_bpp / 8; 1427 fbi->max_bpp / 8;
1426 1428
1429 /* Copy the RGB bitfield overrides */
1430 for (i = 0; i < NR_RGB; i++)
1431 if (inf->rgb[i])
1432 fbi->rgb[i] = inf->rgb[i];
1433
1427 init_waitqueue_head(&fbi->ctrlr_wait); 1434 init_waitqueue_head(&fbi->ctrlr_wait);
1428 INIT_WORK(&fbi->task, sa1100fb_task); 1435 INIT_WORK(&fbi->task, sa1100fb_task);
1429 mutex_init(&fbi->ctrlr_lock); 1436 mutex_init(&fbi->ctrlr_lock);
diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h
index b1d5b089ee4..77239b766e5 100644
--- a/drivers/video/sa1100fb.h
+++ b/drivers/video/sa1100fb.h
@@ -10,10 +10,12 @@
10 * for more details. 10 * for more details.
11 */ 11 */
12 12
13/* 13#define RGB_4 0
14 * These are the bitfields for each 14#define RGB_8 1
15 * display depth that we support. 15#define RGB_16 2
16 */ 16#define NR_RGB 3
17
18/* These are the bitfields for each display depth that we support. */
17struct sa1100fb_rgb { 19struct sa1100fb_rgb {
18 struct fb_bitfield red; 20 struct fb_bitfield red;
19 struct fb_bitfield green; 21 struct fb_bitfield green;
@@ -21,9 +23,7 @@ struct sa1100fb_rgb {
21 struct fb_bitfield transp; 23 struct fb_bitfield transp;
22}; 24};
23 25
24/* 26/* This structure describes the machine which we are running on. */
25 * This structure describes the machine which we are running on.
26 */
27struct sa1100fb_mach_info { 27struct sa1100fb_mach_info {
28 u_long pixclock; 28 u_long pixclock;
29 29
@@ -47,6 +47,9 @@ struct sa1100fb_mach_info {
47 47
48 u_int lccr0; 48 u_int lccr0;
49 u_int lccr3; 49 u_int lccr3;
50
51 /* Overrides for the default RGB maps */
52 const struct sa1100fb_rgb *rgb[NR_RGB];
50}; 53};
51 54
52/* Shadows for LCD controller registers */ 55/* Shadows for LCD controller registers */
@@ -57,11 +60,6 @@ struct sa1100fb_lcd_reg {
57 unsigned long lccr3; 60 unsigned long lccr3;
58}; 61};
59 62
60#define RGB_4 (0)
61#define RGB_8 (1)
62#define RGB_16 (2)
63#define NR_RGB 3
64
65struct sa1100fb_info { 63struct sa1100fb_info {
66 struct fb_info fb; 64 struct fb_info fb;
67 struct device *dev; 65 struct device *dev;