Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+79 -64
+60 -30
arch/arm/mach-sa1100/assabet.c
··· 71 71 72 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 76 * Assabet flash support code. ··· 179 206 .sclk_rate = 11981000, 180 207 }; 181 208 209 + static void assabet_lcd_set_visual(u32 visual) 210 + { 211 + u_int is_true_color = visual == FB_VISUAL_TRUECOLOR; 212 + 213 + if (machine_is_assabet()) { 214 + #if 1 // phase 4 or newer Assabet's 215 + if (is_true_color) 216 + ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 217 + else 218 + ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 219 + #else 220 + // older Assabet's 221 + if (is_true_color) 222 + ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 223 + else 224 + ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 225 + #endif 226 + } 227 + } 228 + 182 229 #ifndef ASSABET_PAL_VIDEO 230 + static void assabet_lcd_backlight_power(int on) 231 + { 232 + if (on) 233 + ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON); 234 + else 235 + ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); 236 + } 237 + 238 + /* 239 + * Turn on/off the backlight. When turning the backlight on, we wait 240 + * 500us after turning it on so we don't cause the supplies to droop 241 + * when we enable the LCD controller (and cause a hard reset.) 242 + */ 243 + static void assabet_lcd_power(int on) 244 + { 245 + if (on) { 246 + ASSABET_BCR_set(ASSABET_BCR_LCD_ON); 247 + udelay(500); 248 + } else 249 + ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); 250 + } 251 + 183 252 /* 184 253 * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually 185 254 * takes an RGB666 signal, but we provide it with an RGB565 signal ··· 239 224 240 225 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 241 226 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 227 + 228 + .backlight_power = assabet_lcd_backlight_power, 229 + .lcd_power = assabet_lcd_power, 230 + .set_visual = assabet_lcd_set_visual, 242 231 }; 243 232 #else 233 + static void assabet_pal_backlight_power(int on) 234 + { 235 + ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); 236 + } 237 + 238 + static void assabet_pal_power(int on) 239 + { 240 + ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); 241 + } 242 + 244 243 static struct sa1100fb_mach_info pal_info = { 245 244 .pixclock = 67797, .bpp = 16, 246 245 .xres = 640, .yres = 512, ··· 265 236 266 237 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 267 238 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), 239 + 240 + .backlight_power = assabet_pal_backlight_power, 241 + .lcd_power = assabet_pal_power, 242 + .set_visual = assabet_lcd_set_visual, 268 243 }; 269 244 #endif 270 245 ··· 298 265 PSDR = 0; 299 266 PPDR |= PPC_TXD3 | PPC_TXD1; 300 267 PPSR |= PPC_TXD3 | PPC_TXD1; 301 - 302 - sa1100fb_lcd_power = assabet_lcd_power; 303 - sa1100fb_backlight_power = assabet_backlight_power; 304 268 305 269 if (machine_has_neponset()) { 306 270 /*
-6
arch/arm/mach-sa1100/generic.c
··· 374 374 375 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 379 * Common I/O mapping:
-3
arch/arm/mach-sa1100/generic.h
··· 16 16 mi->bank[__nr].start = (__start), \ 17 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 19 extern void sa1110_mb_enable(void); 23 20 extern void sa1110_mb_disable(void); 24 21
+2 -1
arch/arm/mach-sa1100/h3100.c
··· 52 52 53 53 .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, 54 54 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 55 + 56 + .lcd_power = h3100_lcd_power, 55 57 }; 56 58 57 59 static void __init h3100_map_io(void) ··· 98 96 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); 99 97 h3xxx_mach_init(); 100 98 101 - sa1100fb_lcd_power = h3100_lcd_power; 102 99 sa11x0_register_lcd(&h3100_lcd_info); 103 100 sa11x0_register_irda(&h3100_irda_data); 104 101 }
+2 -1
arch/arm/mach-sa1100/h3600.c
··· 79 79 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 80 80 81 81 .rgb[RGB_16] = &h3600_rgb_16, 82 + 83 + .lcd_power = h3600_lcd_power, 82 84 }; 83 85 84 86 ··· 148 146 h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); 149 147 h3xxx_mach_init(); 150 148 151 - sa1100fb_lcd_power = h3600_lcd_power; 152 149 sa11x0_register_lcd(&h3600_lcd_info); 153 150 sa11x0_register_irda(&h3600_irda_data); 154 151 }
+9 -23
drivers/video/sa1100fb.c
··· 194 194 195 195 #include "sa1100fb.h" 196 196 197 - extern void (*sa1100fb_backlight_power)(int on); 198 - extern void (*sa1100fb_lcd_power)(int on); 199 - 200 197 static const struct sa1100fb_rgb rgb_4 = { 201 198 .red = { .offset = 0, .length = 4, }, 202 199 .green = { .offset = 0, .length = 4, }, ··· 423 426 return 0; 424 427 } 425 428 426 - static inline void sa1100fb_set_truecolor(u_int is_true_color) 429 + static void sa1100fb_set_visual(struct sa1100fb_info *fbi, u32 visual) 427 430 { 428 - if (machine_is_assabet()) { 429 - #if 1 // phase 4 or newer Assabet's 430 - if (is_true_color) 431 - ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 432 - else 433 - ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 434 - #else 435 - // older Assabet's 436 - if (is_true_color) 437 - ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 438 - else 439 - ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 440 - #endif 441 - } 431 + if (fbi->inf->set_visual) 432 + fbi->inf->set_visual(visual); 442 433 } 443 434 444 435 /* ··· 468 483 /* 469 484 * Set (any) board control register to handle new color depth 470 485 */ 471 - sa1100fb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); 486 + sa1100fb_set_visual(fbi, fbi->fb.fix.visual); 472 487 sa1100fb_activate_var(var, fbi); 473 488 474 489 return 0; ··· 725 740 { 726 741 dev_dbg(fbi->dev, "backlight o%s\n", on ? "n" : "ff"); 727 742 728 - if (sa1100fb_backlight_power) 729 - sa1100fb_backlight_power(on); 743 + if (fbi->inf->backlight_power) 744 + fbi->inf->backlight_power(on); 730 745 } 731 746 732 747 static inline void __sa1100fb_lcd_power(struct sa1100fb_info *fbi, int on) 733 748 { 734 749 dev_dbg(fbi->dev, "LCD power o%s\n", on ? "n" : "ff"); 735 750 736 - if (sa1100fb_lcd_power) 737 - sa1100fb_lcd_power(on); 751 + if (fbi->inf->lcd_power) 752 + fbi->inf->lcd_power(on); 738 753 } 739 754 740 755 static void sa1100fb_setup_gpio(struct sa1100fb_info *fbi) ··· 1182 1197 fbi->task_state = (u_char)-1; 1183 1198 fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * 1184 1199 fbi->max_bpp / 8; 1200 + fbi->inf = inf; 1185 1201 1186 1202 /* Copy the RGB bitfield overrides */ 1187 1203 for (i = 0; i < NR_RGB; i++)
+2
drivers/video/sa1100fb.h
··· 65 65 struct notifier_block freq_transition; 66 66 struct notifier_block freq_policy; 67 67 #endif 68 + 69 + const struct sa1100fb_mach_info *inf; 68 70 }; 69 71 70 72 #define TO_INF(ptr,member) container_of(ptr,struct sa1100fb_info,member)
+4
include/video/sa1100fb.h
··· 54 54 55 55 /* Overrides for the default RGB maps */ 56 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 63 #endif