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

Merge branch 'sa11x0-lcd' into sa11x0

Conflicts:
arch/arm/mach-sa1100/assabet.c

+490 -468
+100 -30
arch/arm/mach-sa1100/assabet.c
··· 20 20 #include <linux/delay.h> 21 21 #include <linux/mm.h> 22 22 23 + #include <video/sa1100fb.h> 24 + 23 25 #include <mach/hardware.h> 24 26 #include <asm/mach-types.h> 25 27 #include <asm/irq.h> ··· 70 68 } 71 69 72 70 EXPORT_SYMBOL(ASSABET_BCR_frob); 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 71 101 72 102 73 /* ··· 172 197 .sclk_rate = 11981000, 173 198 }; 174 199 200 + static void assabet_lcd_set_visual(u32 visual) 201 + { 202 + u_int is_true_color = visual == FB_VISUAL_TRUECOLOR; 203 + 204 + if (machine_is_assabet()) { 205 + #if 1 // phase 4 or newer Assabet's 206 + if (is_true_color) 207 + ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 208 + else 209 + ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 210 + #else 211 + // older Assabet's 212 + if (is_true_color) 213 + ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 214 + else 215 + ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 216 + #endif 217 + } 218 + } 219 + 220 + #ifndef ASSABET_PAL_VIDEO 221 + static void assabet_lcd_backlight_power(int on) 222 + { 223 + if (on) 224 + ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON); 225 + else 226 + ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); 227 + } 228 + 229 + /* 230 + * Turn on/off the backlight. When turning the backlight on, we wait 231 + * 500us after turning it on so we don't cause the supplies to droop 232 + * when we enable the LCD controller (and cause a hard reset.) 233 + */ 234 + static void assabet_lcd_power(int on) 235 + { 236 + if (on) { 237 + ASSABET_BCR_set(ASSABET_BCR_LCD_ON); 238 + udelay(500); 239 + } else 240 + ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); 241 + } 242 + 243 + /* 244 + * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually 245 + * takes an RGB666 signal, but we provide it with an RGB565 signal 246 + * instead (def_rgb_16). 247 + */ 248 + static struct sa1100fb_mach_info lq039q2ds54_info = { 249 + .pixclock = 171521, .bpp = 16, 250 + .xres = 320, .yres = 240, 251 + 252 + .hsync_len = 5, .vsync_len = 1, 253 + .left_margin = 61, .upper_margin = 3, 254 + .right_margin = 9, .lower_margin = 0, 255 + 256 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 257 + 258 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 259 + .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 260 + 261 + .backlight_power = assabet_lcd_backlight_power, 262 + .lcd_power = assabet_lcd_power, 263 + .set_visual = assabet_lcd_set_visual, 264 + }; 265 + #else 266 + static void assabet_pal_backlight_power(int on) 267 + { 268 + ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); 269 + } 270 + 271 + static void assabet_pal_power(int on) 272 + { 273 + ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); 274 + } 275 + 276 + static struct sa1100fb_mach_info pal_info = { 277 + .pixclock = 67797, .bpp = 16, 278 + .xres = 640, .yres = 512, 279 + 280 + .hsync_len = 64, .vsync_len = 6, 281 + .left_margin = 125, .upper_margin = 70, 282 + .right_margin = 115, .lower_margin = 36, 283 + 284 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 285 + .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), 286 + 287 + .backlight_power = assabet_pal_backlight_power, 288 + .lcd_power = assabet_pal_power, 289 + .set_visual = assabet_lcd_set_visual, 290 + }; 291 + #endif 292 + 175 293 #ifdef CONFIG_ASSABET_NEPONSET 176 294 static struct resource neponset_resources[] = { 177 295 DEFINE_RES_MEM(0x10000000, 0x08000000), ··· 309 241 PPDR |= PPC_TXD3 | PPC_TXD1; 310 242 PPSR |= PPC_TXD3 | PPC_TXD1; 311 243 312 - sa1100fb_lcd_power = assabet_lcd_power; 313 - sa1100fb_backlight_power = assabet_backlight_power; 314 - 315 244 if (machine_has_neponset()) { 316 245 /* 317 246 * Angel sets this, but other bootloaders may not. ··· 327 262 #endif 328 263 } 329 264 265 + #ifndef ASSABET_PAL_VIDEO 266 + sa11x0_register_lcd(&lq039q2ds54_info); 267 + #else 268 + sa11x0_register_lcd(&pal_video); 269 + #endif 330 270 sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources, 331 271 ARRAY_SIZE(assabet_flash_resources)); 332 272 sa11x0_register_irda(&assabet_irda_data);
+17
arch/arm/mach-sa1100/collie.c
··· 28 28 #include <linux/gpio.h> 29 29 #include <linux/pda_power.h> 30 30 31 + #include <video/sa1100fb.h> 32 + 31 33 #include <mach/hardware.h> 32 34 #include <asm/mach-types.h> 33 35 #include <asm/irq.h> ··· 296 294 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M), 297 295 }; 298 296 297 + static struct sa1100fb_mach_info collie_lcd_info = { 298 + .pixclock = 171521, .bpp = 16, 299 + .xres = 320, .yres = 240, 300 + 301 + .hsync_len = 5, .vsync_len = 1, 302 + .left_margin = 11, .upper_margin = 2, 303 + .right_margin = 30, .lower_margin = 0, 304 + 305 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 306 + 307 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 308 + .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 309 + }; 310 + 299 311 static void __init collie_init(void) 300 312 { 301 313 int ret = 0; ··· 348 332 printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); 349 333 } 350 334 335 + sa11x0_register_lcd(&collie_lcd_info); 351 336 sa11x0_register_mtd(&collie_flash_data, collie_flash_resources, 352 337 ARRAY_SIZE(collie_flash_resources)); 353 338 sa11x0_register_mcp(&collie_mcp_data);
+7 -7
arch/arm/mach-sa1100/generic.c
··· 20 20 #include <linux/ioport.h> 21 21 #include <linux/platform_device.h> 22 22 23 + #include <video/sa1100fb.h> 24 + 23 25 #include <asm/div64.h> 24 26 #include <mach/hardware.h> 25 27 #include <asm/system.h> ··· 249 247 .resource = sa11x0fb_resources, 250 248 }; 251 249 250 + void sa11x0_register_lcd(struct sa1100fb_mach_info *inf) 251 + { 252 + sa11x0_register_device(&sa11x0fb_device, inf); 253 + } 254 + 252 255 static struct platform_device sa11x0pcmcia_device = { 253 256 .name = "sa11x0-pcmcia", 254 257 .id = -1, ··· 326 319 &sa11x0uart3_device, 327 320 &sa11x0ssp_device, 328 321 &sa11x0pcmcia_device, 329 - &sa11x0fb_device, 330 322 &sa11x0rtc_device, 331 323 &sa11x0dma_device, 332 324 }; ··· 337 331 } 338 332 339 333 arch_initcall(sa1100_init); 340 - 341 - void (*sa1100fb_backlight_power)(int on); 342 - void (*sa1100fb_lcd_power)(int on); 343 - 344 - EXPORT_SYMBOL(sa1100fb_backlight_power); 345 - EXPORT_SYMBOL(sa1100fb_lcd_power); 346 334 347 335 348 336 /*
+3 -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 ··· 37 40 38 41 struct mcp_plat_data; 39 42 void sa11x0_register_mcp(struct mcp_plat_data *data); 43 + 44 + struct sa1100fb_mach_info; 45 + void sa11x0_register_lcd(struct sa1100fb_mach_info *inf);
+21 -2
arch/arm/mach-sa1100/h3100.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/gpio.h> 16 16 17 + #include <video/sa1100fb.h> 18 + 17 19 #include <asm/mach-types.h> 18 20 #include <asm/mach/arch.h> 19 21 #include <asm/mach/irda.h> ··· 38 36 } 39 37 } 40 38 39 + static struct sa1100fb_mach_info h3100_lcd_info = { 40 + .pixclock = 406977, .bpp = 4, 41 + .xres = 320, .yres = 240, 42 + 43 + .hsync_len = 26, .vsync_len = 41, 44 + .left_margin = 4, .upper_margin = 0, 45 + .right_margin = 4, .lower_margin = 0, 46 + 47 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 48 + .cmap_greyscale = 1, 49 + .cmap_inverse = 1, 50 + 51 + .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, 52 + .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 53 + 54 + .lcd_power = h3100_lcd_power, 55 + }; 41 56 42 57 static void __init h3100_map_io(void) 43 58 { 44 59 h3xxx_map_io(); 45 - 46 - sa1100fb_lcd_power = h3100_lcd_power; 47 60 48 61 /* Older bootldrs put GPIO2-9 in alternate mode on the 49 62 assumption that they are used for video */ ··· 97 80 { 98 81 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); 99 82 h3xxx_mach_init(); 83 + 84 + sa11x0_register_lcd(&h3100_lcd_info); 100 85 sa11x0_register_irda(&h3100_irda_data); 101 86 } 102 87
+30 -2
arch/arm/mach-sa1100/h3600.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/gpio.h> 16 16 17 + #include <video/sa1100fb.h> 18 + 17 19 #include <asm/mach-types.h> 18 20 #include <asm/mach/arch.h> 19 21 #include <asm/mach/irda.h> ··· 58 56 err1: return; 59 57 } 60 58 59 + static const struct sa1100fb_rgb h3600_rgb_16 = { 60 + .red = { .offset = 12, .length = 4, }, 61 + .green = { .offset = 7, .length = 4, }, 62 + .blue = { .offset = 1, .length = 4, }, 63 + .transp = { .offset = 0, .length = 0, }, 64 + }; 65 + 66 + static struct sa1100fb_mach_info h3600_lcd_info = { 67 + .pixclock = 174757, .bpp = 16, 68 + .xres = 320, .yres = 240, 69 + 70 + .hsync_len = 3, .vsync_len = 3, 71 + .left_margin = 12, .upper_margin = 10, 72 + .right_margin = 17, .lower_margin = 1, 73 + 74 + .cmap_static = 1, 75 + 76 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 77 + .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 78 + 79 + .rgb[RGB_16] = &h3600_rgb_16, 80 + 81 + .lcd_power = h3600_lcd_power, 82 + }; 83 + 84 + 61 85 static void __init h3600_map_io(void) 62 86 { 63 87 h3xxx_map_io(); 64 - 65 - sa1100fb_lcd_power = h3600_lcd_power; 66 88 } 67 89 68 90 /* ··· 147 121 { 148 122 h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); 149 123 h3xxx_mach_init(); 124 + 125 + sa11x0_register_lcd(&h3600_lcd_info); 150 126 sa11x0_register_irda(&h3600_irda_data); 151 127 } 152 128
-10
arch/arm/mach-sa1100/include/mach/SA-1100.h
··· 1688 1688 #define LCD_Int100_0A 0xF /* LCD Intensity = 100.0% = 1 */ 1689 1689 /* (Alternative) */ 1690 1690 1691 - #define LCCR0 __REG(0xB0100000) /* LCD Control Reg. 0 */ 1692 - #define LCSR __REG(0xB0100004) /* LCD Status Reg. */ 1693 - #define DBAR1 __REG(0xB0100010) /* LCD DMA Base Address Reg. channel 1 */ 1694 - #define DCAR1 __REG(0xB0100014) /* LCD DMA Current Address Reg. channel 1 */ 1695 - #define DBAR2 __REG(0xB0100018) /* LCD DMA Base Address Reg. channel 2 */ 1696 - #define DCAR2 __REG(0xB010001C) /* LCD DMA Current Address Reg. channel 2 */ 1697 - #define LCCR1 __REG(0xB0100020) /* LCD Control Reg. 1 */ 1698 - #define LCCR2 __REG(0xB0100024) /* LCD Control Reg. 2 */ 1699 - #define LCCR3 __REG(0xB0100028) /* LCD Control Reg. 3 */ 1700 - 1701 1691 #define LCCR0_LEN 0x00000001 /* LCD ENable */ 1702 1692 #define LCCR0_CMS 0x00000002 /* Color/Monochrome display Select */ 1703 1693 #define LCCR0_Color (LCCR0_CMS*0) /* Color display */
+1 -1
arch/arm/mach-sa1100/include/mach/shannon.h
··· 21 21 #define SHANNON_GPIO_U3_RTS GPIO_GPIO (19) /* ?? */ 22 22 #define SHANNON_GPIO_U3_CTS GPIO_GPIO (20) /* ?? */ 23 23 #define SHANNON_GPIO_SENSE_12V GPIO_GPIO (21) /* Input, 12v flash unprotect detected */ 24 - #define SHANNON_GPIO_DISP_EN GPIO_GPIO (22) /* out */ 24 + #define SHANNON_GPIO_DISP_EN 22 /* out */ 25 25 /* XXX GPIO 23 unaccounted for */ 26 26 #define SHANNON_GPIO_EJECT_0 GPIO_GPIO (24) /* in */ 27 27 #define SHANNON_IRQ_GPIO_EJECT_0 IRQ_GPIO24
+79
arch/arm/mach-sa1100/lart.c
··· 6 6 #include <linux/kernel.h> 7 7 #include <linux/tty.h> 8 8 9 + #include <video/sa1100fb.h> 10 + 9 11 #include <mach/hardware.h> 10 12 #include <asm/setup.h> 11 13 #include <asm/mach-types.h> ··· 28 26 .sclk_rate = 11981000, 29 27 }; 30 28 29 + #ifdef LART_GREY_LCD 30 + static struct sa1100fb_mach_info lart_grey_info = { 31 + .pixclock = 150000, .bpp = 4, 32 + .xres = 320, .yres = 240, 33 + 34 + .hsync_len = 1, .vsync_len = 1, 35 + .left_margin = 4, .upper_margin = 0, 36 + .right_margin = 2, .lower_margin = 0, 37 + 38 + .cmap_greyscale = 1, 39 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 40 + 41 + .lccr0 = LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono, 42 + .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), 43 + }; 44 + #endif 45 + #ifdef LART_COLOR_LCD 46 + static struct sa1100fb_mach_info lart_color_info = { 47 + .pixclock = 150000, .bpp = 16, 48 + .xres = 320, .yres = 240, 49 + 50 + .hsync_len = 2, .vsync_len = 3, 51 + .left_margin = 69, .upper_margin = 14, 52 + .right_margin = 8, .lower_margin = 4, 53 + 54 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 55 + .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512), 56 + }; 57 + #endif 58 + #ifdef LART_VIDEO_OUT 59 + static struct sa1100fb_mach_info lart_video_info = { 60 + .pixclock = 39721, .bpp = 16, 61 + .xres = 640, .yres = 480, 62 + 63 + .hsync_len = 95, .vsync_len = 2, 64 + .left_margin = 40, .upper_margin = 32, 65 + .right_margin = 24, .lower_margin = 11, 66 + 67 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 68 + 69 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 70 + .lccr3 = LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512), 71 + }; 72 + #endif 73 + 74 + #ifdef LART_KIT01_LCD 75 + static struct sa1100fb_mach_info lart_kit01_info = { 76 + .pixclock = 63291, .bpp = 16, 77 + .xres = 640, .yres = 480, 78 + 79 + .hsync_len = 64, .vsync_len = 3, 80 + .left_margin = 122, .upper_margin = 45, 81 + .right_margin = 10, .lower_margin = 10, 82 + 83 + .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 84 + .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg 85 + }; 86 + #endif 87 + 31 88 static void __init lart_init(void) 32 89 { 90 + struct sa1100fb_mach_info *inf = NULL; 91 + 92 + #ifdef LART_GREY_LCD 93 + inf = &lart_grey_info; 94 + #endif 95 + #ifdef LART_COLOR_LCD 96 + inf = &lart_color_info; 97 + #endif 98 + #ifdef LART_VIDEO_OUT 99 + inf = &lart_video_info; 100 + #endif 101 + #ifdef LART_KIT01_LCD 102 + inf = &lart_kit01_info; 103 + #endif 104 + 105 + if (inf) 106 + sa11x0_register_lcd(inf); 107 + 33 108 sa11x0_register_mcp(&lart_mcp_data); 34 109 } 35 110
+17
arch/arm/mach-sa1100/shannon.c
··· 9 9 #include <linux/mtd/mtd.h> 10 10 #include <linux/mtd/partitions.h> 11 11 12 + #include <video/sa1100fb.h> 13 + 12 14 #include <mach/hardware.h> 13 15 #include <asm/mach-types.h> 14 16 #include <asm/setup.h> ··· 56 54 .sclk_rate = 11981000, 57 55 }; 58 56 57 + static struct sa1100fb_mach_info shannon_lcd_info = { 58 + .pixclock = 152500, .bpp = 8, 59 + .xres = 640, .yres = 480, 60 + 61 + .hsync_len = 4, .vsync_len = 3, 62 + .left_margin = 2, .upper_margin = 0, 63 + .right_margin = 1, .lower_margin = 0, 64 + 65 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 66 + 67 + .lccr0 = LCCR0_Color | LCCR0_Dual | LCCR0_Pas, 68 + .lccr3 = LCCR3_ACBsDiv(512), 69 + }; 70 + 59 71 static void __init shannon_init(void) 60 72 { 73 + sa11x0_register_lcd(&shannon_lcd_info); 61 74 sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1); 62 75 sa11x0_register_mcp(&shannon_mcp_data); 63 76 }
+139 -350
drivers/video/sa1100fb.c
··· 173 173 #include <linux/init.h> 174 174 #include <linux/ioport.h> 175 175 #include <linux/cpufreq.h> 176 + #include <linux/gpio.h> 176 177 #include <linux/platform_device.h> 177 178 #include <linux/dma-mapping.h> 178 179 #include <linux/mutex.h> 179 180 #include <linux/io.h> 180 181 182 + #include <video/sa1100fb.h> 183 + 181 184 #include <mach/hardware.h> 182 185 #include <asm/mach-types.h> 183 - #include <mach/assabet.h> 184 186 #include <mach/shannon.h> 185 187 186 - /* 187 - * debugging? 188 - */ 189 - #define DEBUG 0 190 188 /* 191 189 * Complain if VAR is out of range. 192 190 */ 193 191 #define DEBUG_VAR 1 194 192 195 - #undef ASSABET_PAL_VIDEO 196 - 197 193 #include "sa1100fb.h" 198 194 199 - extern void (*sa1100fb_backlight_power)(int on); 200 - extern void (*sa1100fb_lcd_power)(int on); 201 - 202 - static struct sa1100fb_rgb rgb_4 = { 195 + static const struct sa1100fb_rgb rgb_4 = { 203 196 .red = { .offset = 0, .length = 4, }, 204 197 .green = { .offset = 0, .length = 4, }, 205 198 .blue = { .offset = 0, .length = 4, }, 206 199 .transp = { .offset = 0, .length = 0, }, 207 200 }; 208 201 209 - static struct sa1100fb_rgb rgb_8 = { 202 + static const struct sa1100fb_rgb rgb_8 = { 210 203 .red = { .offset = 0, .length = 8, }, 211 204 .green = { .offset = 0, .length = 8, }, 212 205 .blue = { .offset = 0, .length = 8, }, 213 206 .transp = { .offset = 0, .length = 0, }, 214 207 }; 215 208 216 - static struct sa1100fb_rgb def_rgb_16 = { 209 + static const struct sa1100fb_rgb def_rgb_16 = { 217 210 .red = { .offset = 11, .length = 5, }, 218 211 .green = { .offset = 5, .length = 6, }, 219 212 .blue = { .offset = 0, .length = 5, }, 220 213 .transp = { .offset = 0, .length = 0, }, 221 214 }; 222 215 223 - #ifdef CONFIG_SA1100_ASSABET 224 - #ifndef ASSABET_PAL_VIDEO 225 - /* 226 - * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually 227 - * takes an RGB666 signal, but we provide it with an RGB565 signal 228 - * instead (def_rgb_16). 229 - */ 230 - static struct sa1100fb_mach_info lq039q2ds54_info __initdata = { 231 - .pixclock = 171521, .bpp = 16, 232 - .xres = 320, .yres = 240, 233 216 234 - .hsync_len = 5, .vsync_len = 1, 235 - .left_margin = 61, .upper_margin = 3, 236 - .right_margin = 9, .lower_margin = 0, 237 - 238 - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 239 - 240 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 241 - .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 242 - }; 243 - #else 244 - static struct sa1100fb_mach_info pal_info __initdata = { 245 - .pixclock = 67797, .bpp = 16, 246 - .xres = 640, .yres = 512, 247 - 248 - .hsync_len = 64, .vsync_len = 6, 249 - .left_margin = 125, .upper_margin = 70, 250 - .right_margin = 115, .lower_margin = 36, 251 - 252 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 253 - .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), 254 - }; 255 - #endif 256 - #endif 257 - 258 - #ifdef CONFIG_SA1100_H3600 259 - static struct sa1100fb_mach_info h3600_info __initdata = { 260 - .pixclock = 174757, .bpp = 16, 261 - .xres = 320, .yres = 240, 262 - 263 - .hsync_len = 3, .vsync_len = 3, 264 - .left_margin = 12, .upper_margin = 10, 265 - .right_margin = 17, .lower_margin = 1, 266 - 267 - .cmap_static = 1, 268 - 269 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 270 - .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 271 - }; 272 - 273 - static struct sa1100fb_rgb h3600_rgb_16 = { 274 - .red = { .offset = 12, .length = 4, }, 275 - .green = { .offset = 7, .length = 4, }, 276 - .blue = { .offset = 1, .length = 4, }, 277 - .transp = { .offset = 0, .length = 0, }, 278 - }; 279 - #endif 280 - 281 - #ifdef CONFIG_SA1100_H3100 282 - static struct sa1100fb_mach_info h3100_info __initdata = { 283 - .pixclock = 406977, .bpp = 4, 284 - .xres = 320, .yres = 240, 285 - 286 - .hsync_len = 26, .vsync_len = 41, 287 - .left_margin = 4, .upper_margin = 0, 288 - .right_margin = 4, .lower_margin = 0, 289 - 290 - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 291 - .cmap_greyscale = 1, 292 - .cmap_inverse = 1, 293 - 294 - .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, 295 - .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 296 - }; 297 - #endif 298 - 299 - #ifdef CONFIG_SA1100_COLLIE 300 - static struct sa1100fb_mach_info collie_info __initdata = { 301 - .pixclock = 171521, .bpp = 16, 302 - .xres = 320, .yres = 240, 303 - 304 - .hsync_len = 5, .vsync_len = 1, 305 - .left_margin = 11, .upper_margin = 2, 306 - .right_margin = 30, .lower_margin = 0, 307 - 308 - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 309 - 310 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 311 - .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), 312 - }; 313 - #endif 314 - 315 - #ifdef LART_GREY_LCD 316 - static struct sa1100fb_mach_info lart_grey_info __initdata = { 317 - .pixclock = 150000, .bpp = 4, 318 - .xres = 320, .yres = 240, 319 - 320 - .hsync_len = 1, .vsync_len = 1, 321 - .left_margin = 4, .upper_margin = 0, 322 - .right_margin = 2, .lower_margin = 0, 323 - 324 - .cmap_greyscale = 1, 325 - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 326 - 327 - .lccr0 = LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono, 328 - .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), 329 - }; 330 - #endif 331 - #ifdef LART_COLOR_LCD 332 - static struct sa1100fb_mach_info lart_color_info __initdata = { 333 - .pixclock = 150000, .bpp = 16, 334 - .xres = 320, .yres = 240, 335 - 336 - .hsync_len = 2, .vsync_len = 3, 337 - .left_margin = 69, .upper_margin = 14, 338 - .right_margin = 8, .lower_margin = 4, 339 - 340 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 341 - .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512), 342 - }; 343 - #endif 344 - #ifdef LART_VIDEO_OUT 345 - static struct sa1100fb_mach_info lart_video_info __initdata = { 346 - .pixclock = 39721, .bpp = 16, 347 - .xres = 640, .yres = 480, 348 - 349 - .hsync_len = 95, .vsync_len = 2, 350 - .left_margin = 40, .upper_margin = 32, 351 - .right_margin = 24, .lower_margin = 11, 352 - 353 - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 354 - 355 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 356 - .lccr3 = LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512), 357 - }; 358 - #endif 359 - 360 - #ifdef LART_KIT01_LCD 361 - static struct sa1100fb_mach_info lart_kit01_info __initdata = { 362 - .pixclock = 63291, .bpp = 16, 363 - .xres = 640, .yres = 480, 364 - 365 - .hsync_len = 64, .vsync_len = 3, 366 - .left_margin = 122, .upper_margin = 45, 367 - .right_margin = 10, .lower_margin = 10, 368 - 369 - .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, 370 - .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg 371 - }; 372 - #endif 373 - 374 - #ifdef CONFIG_SA1100_SHANNON 375 - static struct sa1100fb_mach_info shannon_info __initdata = { 376 - .pixclock = 152500, .bpp = 8, 377 - .xres = 640, .yres = 480, 378 - 379 - .hsync_len = 4, .vsync_len = 3, 380 - .left_margin = 2, .upper_margin = 0, 381 - .right_margin = 1, .lower_margin = 0, 382 - 383 - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 384 - 385 - .lccr0 = LCCR0_Color | LCCR0_Dual | LCCR0_Pas, 386 - .lccr3 = LCCR3_ACBsDiv(512), 387 - }; 388 - #endif 389 - 390 - 391 - 392 - static struct sa1100fb_mach_info * __init 393 - sa1100fb_get_machine_info(struct sa1100fb_info *fbi) 394 - { 395 - struct sa1100fb_mach_info *inf = NULL; 396 - 397 - /* 398 - * R G B T 399 - * default {11,5}, { 5,6}, { 0,5}, { 0,0} 400 - * h3600 {12,4}, { 7,4}, { 1,4}, { 0,0} 401 - * freebird { 8,4}, { 4,4}, { 0,4}, {12,4} 402 - */ 403 - #ifdef CONFIG_SA1100_ASSABET 404 - if (machine_is_assabet()) { 405 - #ifndef ASSABET_PAL_VIDEO 406 - inf = &lq039q2ds54_info; 407 - #else 408 - inf = &pal_info; 409 - #endif 410 - } 411 - #endif 412 - #ifdef CONFIG_SA1100_H3100 413 - if (machine_is_h3100()) { 414 - inf = &h3100_info; 415 - } 416 - #endif 417 - #ifdef CONFIG_SA1100_H3600 418 - if (machine_is_h3600()) { 419 - inf = &h3600_info; 420 - fbi->rgb[RGB_16] = &h3600_rgb_16; 421 - } 422 - #endif 423 - #ifdef CONFIG_SA1100_COLLIE 424 - if (machine_is_collie()) { 425 - inf = &collie_info; 426 - } 427 - #endif 428 - #ifdef CONFIG_SA1100_LART 429 - if (machine_is_lart()) { 430 - #ifdef LART_GREY_LCD 431 - inf = &lart_grey_info; 432 - #endif 433 - #ifdef LART_COLOR_LCD 434 - inf = &lart_color_info; 435 - #endif 436 - #ifdef LART_VIDEO_OUT 437 - inf = &lart_video_info; 438 - #endif 439 - #ifdef LART_KIT01_LCD 440 - inf = &lart_kit01_info; 441 - #endif 442 - } 443 - #endif 444 - #ifdef CONFIG_SA1100_SHANNON 445 - if (machine_is_shannon()) { 446 - inf = &shannon_info; 447 - } 448 - #endif 449 - return inf; 450 - } 451 217 452 218 static int sa1100fb_activate_var(struct fb_var_screeninfo *var, struct sa1100fb_info *); 453 219 static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state); ··· 299 533 * is what you poke into the framebuffer to produce the 300 534 * colour you requested. 301 535 */ 302 - if (fbi->cmap_inverse) { 536 + if (fbi->inf->cmap_inverse) { 303 537 red = 0xffff - red; 304 538 green = 0xffff - green; 305 539 blue = 0xffff - blue; ··· 373 607 var->xres = MIN_XRES; 374 608 if (var->yres < MIN_YRES) 375 609 var->yres = MIN_YRES; 376 - if (var->xres > fbi->max_xres) 377 - var->xres = fbi->max_xres; 378 - if (var->yres > fbi->max_yres) 379 - var->yres = fbi->max_yres; 610 + if (var->xres > fbi->inf->xres) 611 + var->xres = fbi->inf->xres; 612 + if (var->yres > fbi->inf->yres) 613 + var->yres = fbi->inf->yres; 380 614 var->xres_virtual = max(var->xres_virtual, var->xres); 381 615 var->yres_virtual = max(var->yres_virtual, var->yres); 382 616 383 - DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel); 617 + dev_dbg(fbi->dev, "var->bits_per_pixel=%d\n", var->bits_per_pixel); 384 618 switch (var->bits_per_pixel) { 385 619 case 4: 386 620 rgbidx = RGB_4; ··· 404 638 var->blue = fbi->rgb[rgbidx]->blue; 405 639 var->transp = fbi->rgb[rgbidx]->transp; 406 640 407 - DPRINTK("RGBT length = %d:%d:%d:%d\n", 641 + dev_dbg(fbi->dev, "RGBT length = %d:%d:%d:%d\n", 408 642 var->red.length, var->green.length, var->blue.length, 409 643 var->transp.length); 410 644 411 - DPRINTK("RGBT offset = %d:%d:%d:%d\n", 645 + dev_dbg(fbi->dev, "RGBT offset = %d:%d:%d:%d\n", 412 646 var->red.offset, var->green.offset, var->blue.offset, 413 647 var->transp.offset); 414 648 415 649 #ifdef CONFIG_CPU_FREQ 416 - printk(KERN_DEBUG "dma period = %d ps, clock = %d kHz\n", 650 + dev_dbg(fbi->dev, "dma period = %d ps, clock = %d kHz\n", 417 651 sa1100fb_display_dma_period(var), 418 652 cpufreq_get(smp_processor_id())); 419 653 #endif ··· 421 655 return 0; 422 656 } 423 657 424 - static inline void sa1100fb_set_truecolor(u_int is_true_color) 658 + static void sa1100fb_set_visual(struct sa1100fb_info *fbi, u32 visual) 425 659 { 426 - if (machine_is_assabet()) { 427 - #if 1 // phase 4 or newer Assabet's 428 - if (is_true_color) 429 - ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 430 - else 431 - ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 432 - #else 433 - // older Assabet's 434 - if (is_true_color) 435 - ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); 436 - else 437 - ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); 438 - #endif 439 - } 660 + if (fbi->inf->set_visual) 661 + fbi->inf->set_visual(visual); 440 662 } 441 663 442 664 /* ··· 437 683 struct fb_var_screeninfo *var = &info->var; 438 684 unsigned long palette_mem_size; 439 685 440 - DPRINTK("set_par\n"); 686 + dev_dbg(fbi->dev, "set_par\n"); 441 687 442 688 if (var->bits_per_pixel == 16) 443 689 fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; 444 - else if (!fbi->cmap_static) 690 + else if (!fbi->inf->cmap_static) 445 691 fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; 446 692 else { 447 693 /* ··· 458 704 459 705 palette_mem_size = fbi->palette_size * sizeof(u16); 460 706 461 - DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); 707 + dev_dbg(fbi->dev, "palette_mem_size = 0x%08lx\n", palette_mem_size); 462 708 463 709 fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size); 464 710 fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size; ··· 466 712 /* 467 713 * Set (any) board control register to handle new color depth 468 714 */ 469 - sa1100fb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); 715 + sa1100fb_set_visual(fbi, fbi->fb.fix.visual); 470 716 sa1100fb_activate_var(var, fbi); 471 717 472 718 return 0; ··· 482 728 /* 483 729 * Make sure the user isn't doing something stupid. 484 730 */ 485 - if (!kspc && (fbi->fb.var.bits_per_pixel == 16 || fbi->cmap_static)) 731 + if (!kspc && (fbi->fb.var.bits_per_pixel == 16 || fbi->inf->cmap_static)) 486 732 return -EINVAL; 487 733 488 734 return gen_set_cmap(cmap, kspc, con, info); ··· 529 775 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 530 776 int i; 531 777 532 - DPRINTK("sa1100fb_blank: blank=%d\n", blank); 778 + dev_dbg(fbi->dev, "sa1100fb_blank: blank=%d\n", blank); 533 779 534 780 switch (blank) { 535 781 case FB_BLANK_POWERDOWN: ··· 617 863 u_int half_screen_size, yres, pcd; 618 864 u_long flags; 619 865 620 - DPRINTK("Configuring SA1100 LCD\n"); 866 + dev_dbg(fbi->dev, "Configuring SA1100 LCD\n"); 621 867 622 - DPRINTK("var: xres=%d hslen=%d lm=%d rm=%d\n", 868 + dev_dbg(fbi->dev, "var: xres=%d hslen=%d lm=%d rm=%d\n", 623 869 var->xres, var->hsync_len, 624 870 var->left_margin, var->right_margin); 625 - DPRINTK("var: yres=%d vslen=%d um=%d bm=%d\n", 871 + dev_dbg(fbi->dev, "var: yres=%d vslen=%d um=%d bm=%d\n", 626 872 var->yres, var->vsync_len, 627 873 var->upper_margin, var->lower_margin); 628 874 629 875 #if DEBUG_VAR 630 876 if (var->xres < 16 || var->xres > 1024) 631 - printk(KERN_ERR "%s: invalid xres %d\n", 877 + dev_err(fbi->dev, "%s: invalid xres %d\n", 632 878 fbi->fb.fix.id, var->xres); 633 879 if (var->hsync_len < 1 || var->hsync_len > 64) 634 - printk(KERN_ERR "%s: invalid hsync_len %d\n", 880 + dev_err(fbi->dev, "%s: invalid hsync_len %d\n", 635 881 fbi->fb.fix.id, var->hsync_len); 636 882 if (var->left_margin < 1 || var->left_margin > 255) 637 - printk(KERN_ERR "%s: invalid left_margin %d\n", 883 + dev_err(fbi->dev, "%s: invalid left_margin %d\n", 638 884 fbi->fb.fix.id, var->left_margin); 639 885 if (var->right_margin < 1 || var->right_margin > 255) 640 - printk(KERN_ERR "%s: invalid right_margin %d\n", 886 + dev_err(fbi->dev, "%s: invalid right_margin %d\n", 641 887 fbi->fb.fix.id, var->right_margin); 642 888 if (var->yres < 1 || var->yres > 1024) 643 - printk(KERN_ERR "%s: invalid yres %d\n", 889 + dev_err(fbi->dev, "%s: invalid yres %d\n", 644 890 fbi->fb.fix.id, var->yres); 645 891 if (var->vsync_len < 1 || var->vsync_len > 64) 646 - printk(KERN_ERR "%s: invalid vsync_len %d\n", 892 + dev_err(fbi->dev, "%s: invalid vsync_len %d\n", 647 893 fbi->fb.fix.id, var->vsync_len); 648 894 if (var->upper_margin < 0 || var->upper_margin > 255) 649 - printk(KERN_ERR "%s: invalid upper_margin %d\n", 895 + dev_err(fbi->dev, "%s: invalid upper_margin %d\n", 650 896 fbi->fb.fix.id, var->upper_margin); 651 897 if (var->lower_margin < 0 || var->lower_margin > 255) 652 - printk(KERN_ERR "%s: invalid lower_margin %d\n", 898 + dev_err(fbi->dev, "%s: invalid lower_margin %d\n", 653 899 fbi->fb.fix.id, var->lower_margin); 654 900 #endif 655 901 656 - new_regs.lccr0 = fbi->lccr0 | 902 + new_regs.lccr0 = fbi->inf->lccr0 | 657 903 LCCR0_LEN | LCCR0_LDM | LCCR0_BAM | 658 904 LCCR0_ERM | LCCR0_LtlEnd | LCCR0_DMADel(0); 659 905 ··· 668 914 * the YRES parameter. 669 915 */ 670 916 yres = var->yres; 671 - if (fbi->lccr0 & LCCR0_Dual) 917 + if (fbi->inf->lccr0 & LCCR0_Dual) 672 918 yres /= 2; 673 919 674 920 new_regs.lccr2 = ··· 678 924 LCCR2_EndFrmDel(var->lower_margin); 679 925 680 926 pcd = get_pcd(var->pixclock, cpufreq_get(0)); 681 - new_regs.lccr3 = LCCR3_PixClkDiv(pcd) | fbi->lccr3 | 927 + new_regs.lccr3 = LCCR3_PixClkDiv(pcd) | fbi->inf->lccr3 | 682 928 (var->sync & FB_SYNC_HOR_HIGH_ACT ? LCCR3_HorSnchH : LCCR3_HorSnchL) | 683 929 (var->sync & FB_SYNC_VERT_HIGH_ACT ? LCCR3_VrtSnchH : LCCR3_VrtSnchL); 684 930 685 - DPRINTK("nlccr0 = 0x%08lx\n", new_regs.lccr0); 686 - DPRINTK("nlccr1 = 0x%08lx\n", new_regs.lccr1); 687 - DPRINTK("nlccr2 = 0x%08lx\n", new_regs.lccr2); 688 - DPRINTK("nlccr3 = 0x%08lx\n", new_regs.lccr3); 931 + dev_dbg(fbi->dev, "nlccr0 = 0x%08lx\n", new_regs.lccr0); 932 + dev_dbg(fbi->dev, "nlccr1 = 0x%08lx\n", new_regs.lccr1); 933 + dev_dbg(fbi->dev, "nlccr2 = 0x%08lx\n", new_regs.lccr2); 934 + dev_dbg(fbi->dev, "nlccr3 = 0x%08lx\n", new_regs.lccr3); 689 935 690 936 half_screen_size = var->bits_per_pixel; 691 937 half_screen_size = half_screen_size * var->xres * var->yres / 16; ··· 705 951 * Only update the registers if the controller is enabled 706 952 * and something has changed. 707 953 */ 708 - if ((LCCR0 != fbi->reg_lccr0) || (LCCR1 != fbi->reg_lccr1) || 709 - (LCCR2 != fbi->reg_lccr2) || (LCCR3 != fbi->reg_lccr3) || 710 - (DBAR1 != fbi->dbar1) || (DBAR2 != fbi->dbar2)) 954 + if (readl_relaxed(fbi->base + LCCR0) != fbi->reg_lccr0 || 955 + readl_relaxed(fbi->base + LCCR1) != fbi->reg_lccr1 || 956 + readl_relaxed(fbi->base + LCCR2) != fbi->reg_lccr2 || 957 + readl_relaxed(fbi->base + LCCR3) != fbi->reg_lccr3 || 958 + readl_relaxed(fbi->base + DBAR1) != fbi->dbar1 || 959 + readl_relaxed(fbi->base + DBAR2) != fbi->dbar2) 711 960 sa1100fb_schedule_work(fbi, C_REENABLE); 712 961 713 962 return 0; ··· 724 967 */ 725 968 static inline void __sa1100fb_backlight_power(struct sa1100fb_info *fbi, int on) 726 969 { 727 - DPRINTK("backlight o%s\n", on ? "n" : "ff"); 970 + dev_dbg(fbi->dev, "backlight o%s\n", on ? "n" : "ff"); 728 971 729 - if (sa1100fb_backlight_power) 730 - sa1100fb_backlight_power(on); 972 + if (fbi->inf->backlight_power) 973 + fbi->inf->backlight_power(on); 731 974 } 732 975 733 976 static inline void __sa1100fb_lcd_power(struct sa1100fb_info *fbi, int on) 734 977 { 735 - DPRINTK("LCD power o%s\n", on ? "n" : "ff"); 978 + dev_dbg(fbi->dev, "LCD power o%s\n", on ? "n" : "ff"); 736 979 737 - if (sa1100fb_lcd_power) 738 - sa1100fb_lcd_power(on); 980 + if (fbi->inf->lcd_power) 981 + fbi->inf->lcd_power(on); 739 982 } 740 983 741 984 static void sa1100fb_setup_gpio(struct sa1100fb_info *fbi) ··· 765 1008 } 766 1009 767 1010 if (mask) { 1011 + unsigned long flags; 1012 + 1013 + /* 1014 + * SA-1100 requires the GPIO direction register set 1015 + * appropriately for the alternate function. Hence 1016 + * we set it here via bitmask rather than excessive 1017 + * fiddling via the GPIO subsystem - and even then 1018 + * we'll still have to deal with GAFR. 1019 + */ 1020 + local_irq_save(flags); 768 1021 GPDR |= mask; 769 1022 GAFR |= mask; 1023 + local_irq_restore(flags); 770 1024 } 771 1025 } 772 1026 773 1027 static void sa1100fb_enable_controller(struct sa1100fb_info *fbi) 774 1028 { 775 - DPRINTK("Enabling LCD controller\n"); 1029 + dev_dbg(fbi->dev, "Enabling LCD controller\n"); 776 1030 777 1031 /* 778 1032 * Make sure the mode bits are present in the first palette entry ··· 792 1024 fbi->palette_cpu[0] |= palette_pbs(&fbi->fb.var); 793 1025 794 1026 /* Sequence from 11.7.10 */ 795 - LCCR3 = fbi->reg_lccr3; 796 - LCCR2 = fbi->reg_lccr2; 797 - LCCR1 = fbi->reg_lccr1; 798 - LCCR0 = fbi->reg_lccr0 & ~LCCR0_LEN; 799 - DBAR1 = fbi->dbar1; 800 - DBAR2 = fbi->dbar2; 801 - LCCR0 |= LCCR0_LEN; 1027 + writel_relaxed(fbi->reg_lccr3, fbi->base + LCCR3); 1028 + writel_relaxed(fbi->reg_lccr2, fbi->base + LCCR2); 1029 + writel_relaxed(fbi->reg_lccr1, fbi->base + LCCR1); 1030 + writel_relaxed(fbi->reg_lccr0 & ~LCCR0_LEN, fbi->base + LCCR0); 1031 + writel_relaxed(fbi->dbar1, fbi->base + DBAR1); 1032 + writel_relaxed(fbi->dbar2, fbi->base + DBAR2); 1033 + writel_relaxed(fbi->reg_lccr0 | LCCR0_LEN, fbi->base + LCCR0); 802 1034 803 - if (machine_is_shannon()) { 804 - GPDR |= SHANNON_GPIO_DISP_EN; 805 - GPSR |= SHANNON_GPIO_DISP_EN; 806 - } 1035 + if (machine_is_shannon()) 1036 + gpio_set_value(SHANNON_GPIO_DISP_EN, 1); 807 1037 808 - DPRINTK("DBAR1 = 0x%08x\n", DBAR1); 809 - DPRINTK("DBAR2 = 0x%08x\n", DBAR2); 810 - DPRINTK("LCCR0 = 0x%08x\n", LCCR0); 811 - DPRINTK("LCCR1 = 0x%08x\n", LCCR1); 812 - DPRINTK("LCCR2 = 0x%08x\n", LCCR2); 813 - DPRINTK("LCCR3 = 0x%08x\n", LCCR3); 1038 + dev_dbg(fbi->dev, "DBAR1: 0x%08x\n", readl_relaxed(fbi->base + DBAR1)); 1039 + dev_dbg(fbi->dev, "DBAR2: 0x%08x\n", readl_relaxed(fbi->base + DBAR2)); 1040 + dev_dbg(fbi->dev, "LCCR0: 0x%08x\n", readl_relaxed(fbi->base + LCCR0)); 1041 + dev_dbg(fbi->dev, "LCCR1: 0x%08x\n", readl_relaxed(fbi->base + LCCR1)); 1042 + dev_dbg(fbi->dev, "LCCR2: 0x%08x\n", readl_relaxed(fbi->base + LCCR2)); 1043 + dev_dbg(fbi->dev, "LCCR3: 0x%08x\n", readl_relaxed(fbi->base + LCCR3)); 814 1044 } 815 1045 816 1046 static void sa1100fb_disable_controller(struct sa1100fb_info *fbi) 817 1047 { 818 1048 DECLARE_WAITQUEUE(wait, current); 1049 + u32 lccr0; 819 1050 820 - DPRINTK("Disabling LCD controller\n"); 1051 + dev_dbg(fbi->dev, "Disabling LCD controller\n"); 821 1052 822 - if (machine_is_shannon()) { 823 - GPCR |= SHANNON_GPIO_DISP_EN; 824 - } 1053 + if (machine_is_shannon()) 1054 + gpio_set_value(SHANNON_GPIO_DISP_EN, 0); 825 1055 826 1056 set_current_state(TASK_UNINTERRUPTIBLE); 827 1057 add_wait_queue(&fbi->ctrlr_wait, &wait); 828 1058 829 - LCSR = 0xffffffff; /* Clear LCD Status Register */ 830 - LCCR0 &= ~LCCR0_LDM; /* Enable LCD Disable Done Interrupt */ 831 - LCCR0 &= ~LCCR0_LEN; /* Disable LCD Controller */ 1059 + /* Clear LCD Status Register */ 1060 + writel_relaxed(~0, fbi->base + LCSR); 1061 + 1062 + lccr0 = readl_relaxed(fbi->base + LCCR0); 1063 + lccr0 &= ~LCCR0_LDM; /* Enable LCD Disable Done Interrupt */ 1064 + writel_relaxed(lccr0, fbi->base + LCCR0); 1065 + lccr0 &= ~LCCR0_LEN; /* Disable LCD Controller */ 1066 + writel_relaxed(lccr0, fbi->base + LCCR0); 832 1067 833 1068 schedule_timeout(20 * HZ / 1000); 834 1069 remove_wait_queue(&fbi->ctrlr_wait, &wait); ··· 843 1072 static irqreturn_t sa1100fb_handle_irq(int irq, void *dev_id) 844 1073 { 845 1074 struct sa1100fb_info *fbi = dev_id; 846 - unsigned int lcsr = LCSR; 1075 + unsigned int lcsr = readl_relaxed(fbi->base + LCSR); 847 1076 848 1077 if (lcsr & LCSR_LDD) { 849 - LCCR0 |= LCCR0_LDM; 1078 + u32 lccr0 = readl_relaxed(fbi->base + LCCR0) | LCCR0_LDM; 1079 + writel_relaxed(lccr0, fbi->base + LCCR0); 850 1080 wake_up(&fbi->ctrlr_wait); 851 1081 } 852 1082 853 - LCSR = lcsr; 1083 + writel_relaxed(lcsr, fbi->base + LCSR); 854 1084 return IRQ_HANDLED; 855 1085 } 856 1086 ··· 1040 1268 switch (val) { 1041 1269 case CPUFREQ_ADJUST: 1042 1270 case CPUFREQ_INCOMPATIBLE: 1043 - printk(KERN_DEBUG "min dma period: %d ps, " 1271 + dev_dbg(fbi->dev, "min dma period: %d ps, " 1044 1272 "new clock %d kHz\n", sa1100fb_min_dma_period(fbi), 1045 1273 policy->max); 1046 1274 /* todo: fill in min/max values */ ··· 1090 1318 * cache. Once this area is remapped, all virtual memory 1091 1319 * access to the video memory should occur at the new region. 1092 1320 */ 1093 - static int __init sa1100fb_map_video_memory(struct sa1100fb_info *fbi) 1321 + static int __devinit sa1100fb_map_video_memory(struct sa1100fb_info *fbi) 1094 1322 { 1095 1323 /* 1096 1324 * We reserve one page for the palette, plus the size ··· 1116 1344 } 1117 1345 1118 1346 /* Fake monspecs to fill in fbinfo structure */ 1119 - static struct fb_monspecs monspecs __initdata = { 1347 + static struct fb_monspecs monspecs __devinitdata = { 1120 1348 .hfmin = 30000, 1121 1349 .hfmax = 70000, 1122 1350 .vfmin = 50, ··· 1124 1352 }; 1125 1353 1126 1354 1127 - static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) 1355 + static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev) 1128 1356 { 1129 - struct sa1100fb_mach_info *inf; 1357 + struct sa1100fb_mach_info *inf = dev->platform_data; 1130 1358 struct sa1100fb_info *fbi; 1359 + unsigned i; 1131 1360 1132 1361 fbi = kmalloc(sizeof(struct sa1100fb_info) + sizeof(u32) * 16, 1133 1362 GFP_KERNEL); ··· 1163 1390 fbi->rgb[RGB_8] = &rgb_8; 1164 1391 fbi->rgb[RGB_16] = &def_rgb_16; 1165 1392 1166 - inf = sa1100fb_get_machine_info(fbi); 1167 - 1168 1393 /* 1169 1394 * People just don't seem to get this. We don't support 1170 1395 * anything but correct entries now, so panic if someone ··· 1173 1402 panic("sa1100fb error: invalid LCCR3 fields set or zero " 1174 1403 "pixclock."); 1175 1404 1176 - fbi->max_xres = inf->xres; 1177 1405 fbi->fb.var.xres = inf->xres; 1178 1406 fbi->fb.var.xres_virtual = inf->xres; 1179 - fbi->max_yres = inf->yres; 1180 1407 fbi->fb.var.yres = inf->yres; 1181 1408 fbi->fb.var.yres_virtual = inf->yres; 1182 - fbi->max_bpp = inf->bpp; 1183 1409 fbi->fb.var.bits_per_pixel = inf->bpp; 1184 1410 fbi->fb.var.pixclock = inf->pixclock; 1185 1411 fbi->fb.var.hsync_len = inf->hsync_len; ··· 1187 1419 fbi->fb.var.lower_margin = inf->lower_margin; 1188 1420 fbi->fb.var.sync = inf->sync; 1189 1421 fbi->fb.var.grayscale = inf->cmap_greyscale; 1190 - fbi->cmap_inverse = inf->cmap_inverse; 1191 - fbi->cmap_static = inf->cmap_static; 1192 - fbi->lccr0 = inf->lccr0; 1193 - fbi->lccr3 = inf->lccr3; 1194 1422 fbi->state = C_STARTUP; 1195 1423 fbi->task_state = (u_char)-1; 1196 - fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * 1197 - fbi->max_bpp / 8; 1424 + fbi->fb.fix.smem_len = inf->xres * inf->yres * 1425 + inf->bpp / 8; 1426 + fbi->inf = inf; 1427 + 1428 + /* Copy the RGB bitfield overrides */ 1429 + for (i = 0; i < NR_RGB; i++) 1430 + if (inf->rgb[i]) 1431 + fbi->rgb[i] = inf->rgb[i]; 1198 1432 1199 1433 init_waitqueue_head(&fbi->ctrlr_wait); 1200 1434 INIT_WORK(&fbi->task, sa1100fb_task); ··· 1208 1438 static int __devinit sa1100fb_probe(struct platform_device *pdev) 1209 1439 { 1210 1440 struct sa1100fb_info *fbi; 1441 + struct resource *res; 1211 1442 int ret, irq; 1212 1443 1444 + if (!pdev->dev.platform_data) { 1445 + dev_err(&pdev->dev, "no platform LCD data\n"); 1446 + return -EINVAL; 1447 + } 1448 + 1449 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1213 1450 irq = platform_get_irq(pdev, 0); 1214 - if (irq < 0) 1451 + if (irq < 0 || !res) 1215 1452 return -EINVAL; 1216 1453 1217 - if (!request_mem_region(0xb0100000, 0x10000, "LCD")) 1454 + if (!request_mem_region(res->start, resource_size(res), "LCD")) 1218 1455 return -EBUSY; 1219 1456 1220 1457 fbi = sa1100fb_init_fbinfo(&pdev->dev); 1221 1458 ret = -ENOMEM; 1222 1459 if (!fbi) 1460 + goto failed; 1461 + 1462 + fbi->base = ioremap(res->start, resource_size(res)); 1463 + if (!fbi->base) 1223 1464 goto failed; 1224 1465 1225 1466 /* Initialize video memory */ ··· 1240 1459 1241 1460 ret = request_irq(irq, sa1100fb_handle_irq, 0, "LCD", fbi); 1242 1461 if (ret) { 1243 - printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret); 1462 + dev_err(&pdev->dev, "request_irq failed: %d\n", ret); 1244 1463 goto failed; 1245 1464 } 1246 1465 1247 - #ifdef ASSABET_PAL_VIDEO 1248 - if (machine_is_assabet()) 1249 - ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); 1250 - #endif 1466 + if (machine_is_shannon()) { 1467 + ret = gpio_request_one(SHANNON_GPIO_DISP_EN, 1468 + GPIOF_OUT_INIT_LOW, "display enable"); 1469 + if (ret) 1470 + goto err_free_irq; 1471 + } 1251 1472 1252 1473 /* 1253 1474 * This makes sure that our colour bitfield ··· 1261 1478 1262 1479 ret = register_framebuffer(&fbi->fb); 1263 1480 if (ret < 0) 1264 - goto err_free_irq; 1481 + goto err_reg_fb; 1265 1482 1266 1483 #ifdef CONFIG_CPU_FREQ 1267 1484 fbi->freq_transition.notifier_call = sa1100fb_freq_transition; ··· 1273 1490 /* This driver cannot be unloaded at the moment */ 1274 1491 return 0; 1275 1492 1493 + err_reg_fb: 1494 + if (machine_is_shannon()) 1495 + gpio_free(SHANNON_GPIO_DISP_EN); 1276 1496 err_free_irq: 1277 1497 free_irq(irq, fbi); 1278 1498 failed: 1499 + if (fbi) 1500 + iounmap(fbi->base); 1279 1501 platform_set_drvdata(pdev, NULL); 1280 1502 kfree(fbi); 1281 - release_mem_region(0xb0100000, 0x10000); 1503 + release_mem_region(res->start, resource_size(res)); 1282 1504 return ret; 1283 1505 } 1284 1506 ··· 1293 1505 .resume = sa1100fb_resume, 1294 1506 .driver = { 1295 1507 .name = "sa11x0-fb", 1508 + .owner = THIS_MODULE, 1296 1509 }, 1297 1510 }; 1298 1511
+13 -63
drivers/video/sa1100fb.h
··· 10 10 * for more details. 11 11 */ 12 12 13 - /* 14 - * These are the bitfields for each 15 - * display depth that we support. 16 - */ 17 - struct sa1100fb_rgb { 18 - struct fb_bitfield red; 19 - struct fb_bitfield green; 20 - struct fb_bitfield blue; 21 - struct fb_bitfield transp; 22 - }; 23 - 24 - /* 25 - * This structure describes the machine which we are running on. 26 - */ 27 - struct sa1100fb_mach_info { 28 - u_long pixclock; 29 - 30 - u_short xres; 31 - u_short yres; 32 - 33 - u_char bpp; 34 - u_char hsync_len; 35 - u_char left_margin; 36 - u_char right_margin; 37 - 38 - u_char vsync_len; 39 - u_char upper_margin; 40 - u_char lower_margin; 41 - u_char sync; 42 - 43 - u_int cmap_greyscale:1, 44 - cmap_inverse:1, 45 - cmap_static:1, 46 - unused:29; 47 - 48 - u_int lccr0; 49 - u_int lccr3; 50 - }; 13 + #define LCCR0 0x0000 /* LCD Control Reg. 0 */ 14 + #define LCSR 0x0004 /* LCD Status Reg. */ 15 + #define DBAR1 0x0010 /* LCD DMA Base Address Reg. channel 1 */ 16 + #define DCAR1 0x0014 /* LCD DMA Current Address Reg. channel 1 */ 17 + #define DBAR2 0x0018 /* LCD DMA Base Address Reg. channel 2 */ 18 + #define DCAR2 0x001C /* LCD DMA Current Address Reg. channel 2 */ 19 + #define LCCR1 0x0020 /* LCD Control Reg. 1 */ 20 + #define LCCR2 0x0024 /* LCD Control Reg. 2 */ 21 + #define LCCR3 0x0028 /* LCD Control Reg. 3 */ 51 22 52 23 /* Shadows for LCD controller registers */ 53 24 struct sa1100fb_lcd_reg { ··· 28 57 unsigned long lccr3; 29 58 }; 30 59 31 - #define RGB_4 (0) 32 - #define RGB_8 (1) 33 - #define RGB_16 (2) 34 - #define NR_RGB 3 35 - 36 60 struct sa1100fb_info { 37 61 struct fb_info fb; 38 62 struct device *dev; 39 - struct sa1100fb_rgb *rgb[NR_RGB]; 40 - 41 - u_int max_bpp; 42 - u_int max_xres; 43 - u_int max_yres; 63 + const struct sa1100fb_rgb *rgb[NR_RGB]; 64 + void __iomem *base; 44 65 45 66 /* 46 67 * These are the addresses we mapped ··· 51 88 dma_addr_t dbar1; 52 89 dma_addr_t dbar2; 53 90 54 - u_int lccr0; 55 - u_int lccr3; 56 - u_int cmap_inverse:1, 57 - cmap_static:1, 58 - unused:30; 59 - 60 91 u_int reg_lccr0; 61 92 u_int reg_lccr1; 62 93 u_int reg_lccr2; ··· 66 109 struct notifier_block freq_transition; 67 110 struct notifier_block freq_policy; 68 111 #endif 112 + 113 + const struct sa1100fb_mach_info *inf; 69 114 }; 70 115 71 116 #define TO_INF(ptr,member) container_of(ptr,struct sa1100fb_info,member) ··· 87 128 #define C_STARTUP (7) 88 129 89 130 #define SA1100_NAME "SA1100" 90 - 91 - /* 92 - * Debug macros 93 - */ 94 - #if DEBUG 95 - # define DPRINTK(fmt, args...) printk("%s: " fmt, __func__ , ## args) 96 - #else 97 - # define DPRINTK(fmt, args...) 98 - #endif 99 131 100 132 /* 101 133 * Minimum X and Y resolutions
+63
include/video/sa1100fb.h
··· 1 + /* 2 + * StrongARM 1100 LCD Controller Frame Buffer Device 3 + * 4 + * Copyright (C) 1999 Eric A. Thomas 5 + * Based on acornfb.c Copyright (C) Russell King. 6 + * 7 + * This file is subject to the terms and conditions of the GNU General Public 8 + * License. See the file COPYING in the main directory of this archive 9 + * for more details. 10 + */ 11 + #ifndef _VIDEO_SA1100FB_H 12 + #define _VIDEO_SA1100FB_H 13 + 14 + #include <linux/fb.h> 15 + #include <linux/types.h> 16 + 17 + #define RGB_4 0 18 + #define RGB_8 1 19 + #define RGB_16 2 20 + #define NR_RGB 3 21 + 22 + /* These are the bitfields for each display depth that we support. */ 23 + struct sa1100fb_rgb { 24 + struct fb_bitfield red; 25 + struct fb_bitfield green; 26 + struct fb_bitfield blue; 27 + struct fb_bitfield transp; 28 + }; 29 + 30 + /* This structure describes the machine which we are running on. */ 31 + struct sa1100fb_mach_info { 32 + u_long pixclock; 33 + 34 + u_short xres; 35 + u_short yres; 36 + 37 + u_char bpp; 38 + u_char hsync_len; 39 + u_char left_margin; 40 + u_char right_margin; 41 + 42 + u_char vsync_len; 43 + u_char upper_margin; 44 + u_char lower_margin; 45 + u_char sync; 46 + 47 + u_int cmap_greyscale:1, 48 + cmap_inverse:1, 49 + cmap_static:1, 50 + unused:29; 51 + 52 + u_int lccr0; 53 + u_int lccr3; 54 + 55 + /* Overrides for the default RGB maps */ 56 + const struct sa1100fb_rgb *rgb[NR_RGB]; 57 + 58 + void (*backlight_power)(int); 59 + void (*lcd_power)(int); 60 + void (*set_visual)(u32); 61 + }; 62 + 63 + #endif