diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-14 07:03:22 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-21 06:56:19 -0500 |
commit | 086ada54abaa4316e8603f02410fe8ebc9ba2de1 (patch) | |
tree | 0cbcbc821d15d037cb5ad6ab74d9546ceec624b1 | |
parent | e1b7a72aeb8292502c97b43eceb01aea47ded40f (diff) |
FB: sa1100: remove global sa1100fb_.*_power function pointers
Now that we have platform data contained within the individual board
code, we can get rid of the global function pointers, placing them
inside the platform data instead.
Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-sa1100/assabet.c | 90 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/generic.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/generic.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/h3100.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/h3600.c | 3 | ||||
-rw-r--r-- | drivers/video/sa1100fb.c | 32 | ||||
-rw-r--r-- | drivers/video/sa1100fb.h | 2 | ||||
-rw-r--r-- | include/video/sa1100fb.h | 4 |
8 files changed, 79 insertions, 64 deletions
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index 37fb0cd1a296..65b0a9a3fb9c 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -71,33 +71,6 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val) | |||
71 | 71 | ||
72 | EXPORT_SYMBOL(ASSABET_BCR_frob); | 72 | EXPORT_SYMBOL(ASSABET_BCR_frob); |
73 | 73 | ||
74 | static void assabet_backlight_power(int on) | ||
75 | { | ||
76 | #ifndef ASSABET_PAL_VIDEO | ||
77 | if (on) | ||
78 | ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON); | ||
79 | else | ||
80 | #endif | ||
81 | ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * Turn on/off the backlight. When turning the backlight on, | ||
86 | * we wait 500us after turning it on so we don't cause the | ||
87 | * supplies to droop when we enable the LCD controller (and | ||
88 | * cause a hard reset.) | ||
89 | */ | ||
90 | static void assabet_lcd_power(int on) | ||
91 | { | ||
92 | #ifndef ASSABET_PAL_VIDEO | ||
93 | if (on) { | ||
94 | ASSABET_BCR_set(ASSABET_BCR_LCD_ON); | ||
95 | udelay(500); | ||
96 | } else | ||
97 | #endif | ||
98 | ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); | ||
99 | } | ||
100 | |||
101 | 74 | ||
102 | /* | 75 | /* |
103 | * Assabet flash support code. | 76 | * Assabet flash support code. |
@@ -206,7 +179,49 @@ static struct mcp_plat_data assabet_mcp_data = { | |||
206 | .sclk_rate = 11981000, | 179 | .sclk_rate = 11981000, |
207 | }; | 180 | }; |
208 | 181 | ||
182 | static void assabet_lcd_set_visual(u32 visual) | ||
183 | { | ||
184 | u_int is_true_color = visual == FB_VISUAL_TRUECOLOR; | ||
185 | |||
186 | if (machine_is_assabet()) { | ||
187 | #if 1 // phase 4 or newer Assabet's | ||
188 | if (is_true_color) | ||
189 | ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); | ||
190 | else | ||
191 | ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); | ||
192 | #else | ||
193 | // older Assabet's | ||
194 | if (is_true_color) | ||
195 | ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); | ||
196 | else | ||
197 | ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); | ||
198 | #endif | ||
199 | } | ||
200 | } | ||
201 | |||
209 | #ifndef ASSABET_PAL_VIDEO | 202 | #ifndef ASSABET_PAL_VIDEO |
203 | static void assabet_lcd_backlight_power(int on) | ||
204 | { | ||
205 | if (on) | ||
206 | ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON); | ||
207 | else | ||
208 | ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); | ||
209 | } | ||
210 | |||
211 | /* | ||
212 | * Turn on/off the backlight. When turning the backlight on, we wait | ||
213 | * 500us after turning it on so we don't cause the supplies to droop | ||
214 | * when we enable the LCD controller (and cause a hard reset.) | ||
215 | */ | ||
216 | static void assabet_lcd_power(int on) | ||
217 | { | ||
218 | if (on) { | ||
219 | ASSABET_BCR_set(ASSABET_BCR_LCD_ON); | ||
220 | udelay(500); | ||
221 | } else | ||
222 | ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); | ||
223 | } | ||
224 | |||
210 | /* | 225 | /* |
211 | * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually | 226 | * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually |
212 | * takes an RGB666 signal, but we provide it with an RGB565 signal | 227 | * takes an RGB666 signal, but we provide it with an RGB565 signal |
@@ -224,8 +239,22 @@ static struct sa1100fb_mach_info lq039q2ds54_info = { | |||
224 | 239 | ||
225 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | 240 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
226 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), | 241 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), |
242 | |||
243 | .backlight_power = assabet_lcd_backlight_power, | ||
244 | .lcd_power = assabet_lcd_power, | ||
245 | .set_visual = assabet_lcd_set_visual, | ||
227 | }; | 246 | }; |
228 | #else | 247 | #else |
248 | static void assabet_pal_backlight_power(int on) | ||
249 | { | ||
250 | ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); | ||
251 | } | ||
252 | |||
253 | static void assabet_pal_power(int on) | ||
254 | { | ||
255 | ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); | ||
256 | } | ||
257 | |||
229 | static struct sa1100fb_mach_info pal_info = { | 258 | static struct sa1100fb_mach_info pal_info = { |
230 | .pixclock = 67797, .bpp = 16, | 259 | .pixclock = 67797, .bpp = 16, |
231 | .xres = 640, .yres = 512, | 260 | .xres = 640, .yres = 512, |
@@ -236,6 +265,10 @@ static struct sa1100fb_mach_info pal_info = { | |||
236 | 265 | ||
237 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | 266 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
238 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), | 267 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), |
268 | |||
269 | .backlight_power = assabet_pal_backlight_power, | ||
270 | .lcd_power = assabet_pal_power, | ||
271 | .set_visual = assabet_lcd_set_visual, | ||
239 | }; | 272 | }; |
240 | #endif | 273 | #endif |
241 | 274 | ||
@@ -266,9 +299,6 @@ static void __init assabet_init(void) | |||
266 | PPDR |= PPC_TXD3 | PPC_TXD1; | 299 | PPDR |= PPC_TXD3 | PPC_TXD1; |
267 | PPSR |= PPC_TXD3 | PPC_TXD1; | 300 | PPSR |= PPC_TXD3 | PPC_TXD1; |
268 | 301 | ||
269 | sa1100fb_lcd_power = assabet_lcd_power; | ||
270 | sa1100fb_backlight_power = assabet_backlight_power; | ||
271 | |||
272 | if (machine_has_neponset()) { | 302 | if (machine_has_neponset()) { |
273 | /* | 303 | /* |
274 | * Angel sets this, but other bootloaders may not. | 304 | * Angel sets this, but other bootloaders may not. |
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index f57808fb1827..9cb4062b1e9b 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -374,12 +374,6 @@ static int __init sa1100_init(void) | |||
374 | 374 | ||
375 | arch_initcall(sa1100_init); | 375 | arch_initcall(sa1100_init); |
376 | 376 | ||
377 | void (*sa1100fb_backlight_power)(int on); | ||
378 | void (*sa1100fb_lcd_power)(int on); | ||
379 | |||
380 | EXPORT_SYMBOL(sa1100fb_backlight_power); | ||
381 | EXPORT_SYMBOL(sa1100fb_lcd_power); | ||
382 | |||
383 | 377 | ||
384 | /* | 378 | /* |
385 | * Common I/O mapping: | 379 | * Common I/O mapping: |
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h index 3b903f42464d..5c68be858e0c 100644 --- a/arch/arm/mach-sa1100/generic.h +++ b/arch/arm/mach-sa1100/generic.h | |||
@@ -16,9 +16,6 @@ extern void sa11x0_restart(char, const char *); | |||
16 | mi->bank[__nr].start = (__start), \ | 16 | mi->bank[__nr].start = (__start), \ |
17 | mi->bank[__nr].size = (__size) | 17 | mi->bank[__nr].size = (__size) |
18 | 18 | ||
19 | extern void (*sa1100fb_backlight_power)(int on); | ||
20 | extern void (*sa1100fb_lcd_power)(int on); | ||
21 | |||
22 | extern void sa1110_mb_enable(void); | 19 | extern void sa1110_mb_enable(void); |
23 | extern void sa1110_mb_disable(void); | 20 | extern void sa1110_mb_disable(void); |
24 | 21 | ||
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c index 1f8a271dc668..f23e7d0b2fba 100644 --- a/arch/arm/mach-sa1100/h3100.c +++ b/arch/arm/mach-sa1100/h3100.c | |||
@@ -52,6 +52,8 @@ static struct sa1100fb_mach_info h3100_lcd_info = { | |||
52 | 52 | ||
53 | .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, | 53 | .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, |
54 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), | 54 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), |
55 | |||
56 | .lcd_power = h3100_lcd_power, | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | static void __init h3100_map_io(void) | 59 | static void __init h3100_map_io(void) |
@@ -96,7 +98,6 @@ static void __init h3100_mach_init(void) | |||
96 | h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); | 98 | h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); |
97 | h3xxx_mach_init(); | 99 | h3xxx_mach_init(); |
98 | 100 | ||
99 | sa1100fb_lcd_power = h3100_lcd_power; | ||
100 | sa11x0_register_lcd(&h3100_lcd_info); | 101 | sa11x0_register_lcd(&h3100_lcd_info); |
101 | sa11x0_register_irda(&h3100_irda_data); | 102 | sa11x0_register_irda(&h3100_irda_data); |
102 | } | 103 | } |
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index 3dd39bfe348d..2feac56ec90d 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c | |||
@@ -79,6 +79,8 @@ static struct sa1100fb_mach_info h3600_lcd_info = { | |||
79 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), | 79 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), |
80 | 80 | ||
81 | .rgb[RGB_16] = &h3600_rgb_16, | 81 | .rgb[RGB_16] = &h3600_rgb_16, |
82 | |||
83 | .lcd_power = h3600_lcd_power, | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | 86 | ||
@@ -146,7 +148,6 @@ static void __init h3600_mach_init(void) | |||
146 | h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); | 148 | h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); |
147 | h3xxx_mach_init(); | 149 | h3xxx_mach_init(); |
148 | 150 | ||
149 | sa1100fb_lcd_power = h3600_lcd_power; | ||
150 | sa11x0_register_lcd(&h3600_lcd_info); | 151 | sa11x0_register_lcd(&h3600_lcd_info); |
151 | sa11x0_register_irda(&h3600_irda_data); | 152 | sa11x0_register_irda(&h3600_irda_data); |
152 | } | 153 | } |
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index d645c6d5fd9f..c9f1e7cd95f8 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -194,9 +194,6 @@ | |||
194 | 194 | ||
195 | #include "sa1100fb.h" | 195 | #include "sa1100fb.h" |
196 | 196 | ||
197 | extern void (*sa1100fb_backlight_power)(int on); | ||
198 | extern void (*sa1100fb_lcd_power)(int on); | ||
199 | |||
200 | static const struct sa1100fb_rgb rgb_4 = { | 197 | static const struct sa1100fb_rgb rgb_4 = { |
201 | .red = { .offset = 0, .length = 4, }, | 198 | .red = { .offset = 0, .length = 4, }, |
202 | .green = { .offset = 0, .length = 4, }, | 199 | .green = { .offset = 0, .length = 4, }, |
@@ -426,22 +423,10 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
426 | return 0; | 423 | return 0; |
427 | } | 424 | } |
428 | 425 | ||
429 | static inline void sa1100fb_set_truecolor(u_int is_true_color) | 426 | static void sa1100fb_set_visual(struct sa1100fb_info *fbi, u32 visual) |
430 | { | 427 | { |
431 | if (machine_is_assabet()) { | 428 | if (fbi->inf->set_visual) |
432 | #if 1 // phase 4 or newer Assabet's | 429 | fbi->inf->set_visual(visual); |
433 | if (is_true_color) | ||
434 | ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); | ||
435 | else | ||
436 | ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); | ||
437 | #else | ||
438 | // older Assabet's | ||
439 | if (is_true_color) | ||
440 | ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); | ||
441 | else | ||
442 | ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); | ||
443 | #endif | ||
444 | } | ||
445 | } | 430 | } |
446 | 431 | ||
447 | /* | 432 | /* |
@@ -483,7 +468,7 @@ static int sa1100fb_set_par(struct fb_info *info) | |||
483 | /* | 468 | /* |
484 | * Set (any) board control register to handle new color depth | 469 | * Set (any) board control register to handle new color depth |
485 | */ | 470 | */ |
486 | sa1100fb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); | 471 | sa1100fb_set_visual(fbi, fbi->fb.fix.visual); |
487 | sa1100fb_activate_var(var, fbi); | 472 | sa1100fb_activate_var(var, fbi); |
488 | 473 | ||
489 | return 0; | 474 | return 0; |
@@ -740,16 +725,16 @@ static inline void __sa1100fb_backlight_power(struct sa1100fb_info *fbi, int on) | |||
740 | { | 725 | { |
741 | dev_dbg(fbi->dev, "backlight o%s\n", on ? "n" : "ff"); | 726 | dev_dbg(fbi->dev, "backlight o%s\n", on ? "n" : "ff"); |
742 | 727 | ||
743 | if (sa1100fb_backlight_power) | 728 | if (fbi->inf->backlight_power) |
744 | sa1100fb_backlight_power(on); | 729 | fbi->inf->backlight_power(on); |
745 | } | 730 | } |
746 | 731 | ||
747 | static inline void __sa1100fb_lcd_power(struct sa1100fb_info *fbi, int on) | 732 | static inline void __sa1100fb_lcd_power(struct sa1100fb_info *fbi, int on) |
748 | { | 733 | { |
749 | dev_dbg(fbi->dev, "LCD power o%s\n", on ? "n" : "ff"); | 734 | dev_dbg(fbi->dev, "LCD power o%s\n", on ? "n" : "ff"); |
750 | 735 | ||
751 | if (sa1100fb_lcd_power) | 736 | if (fbi->inf->lcd_power) |
752 | sa1100fb_lcd_power(on); | 737 | fbi->inf->lcd_power(on); |
753 | } | 738 | } |
754 | 739 | ||
755 | static void sa1100fb_setup_gpio(struct sa1100fb_info *fbi) | 740 | static void sa1100fb_setup_gpio(struct sa1100fb_info *fbi) |
@@ -1197,6 +1182,7 @@ static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev) | |||
1197 | fbi->task_state = (u_char)-1; | 1182 | fbi->task_state = (u_char)-1; |
1198 | fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * | 1183 | fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * |
1199 | fbi->max_bpp / 8; | 1184 | fbi->max_bpp / 8; |
1185 | fbi->inf = inf; | ||
1200 | 1186 | ||
1201 | /* Copy the RGB bitfield overrides */ | 1187 | /* Copy the RGB bitfield overrides */ |
1202 | for (i = 0; i < NR_RGB; i++) | 1188 | for (i = 0; i < NR_RGB; i++) |
diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h index 9ff9ba9a281a..3a634abbec14 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/sa1100fb.h | |||
@@ -65,6 +65,8 @@ struct sa1100fb_info { | |||
65 | struct notifier_block freq_transition; | 65 | struct notifier_block freq_transition; |
66 | struct notifier_block freq_policy; | 66 | struct notifier_block freq_policy; |
67 | #endif | 67 | #endif |
68 | |||
69 | const struct sa1100fb_mach_info *inf; | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | #define TO_INF(ptr,member) container_of(ptr,struct sa1100fb_info,member) | 72 | #define TO_INF(ptr,member) container_of(ptr,struct sa1100fb_info,member) |
diff --git a/include/video/sa1100fb.h b/include/video/sa1100fb.h index e73c813c87f0..4ab409653785 100644 --- a/include/video/sa1100fb.h +++ b/include/video/sa1100fb.h | |||
@@ -54,6 +54,10 @@ struct sa1100fb_mach_info { | |||
54 | 54 | ||
55 | /* Overrides for the default RGB maps */ | 55 | /* Overrides for the default RGB maps */ |
56 | const struct sa1100fb_rgb *rgb[NR_RGB]; | 56 | const struct sa1100fb_rgb *rgb[NR_RGB]; |
57 | |||
58 | void (*backlight_power)(int); | ||
59 | void (*lcd_power)(int); | ||
60 | void (*set_visual)(u32); | ||
57 | }; | 61 | }; |
58 | 62 | ||
59 | #endif | 63 | #endif |