diff options
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 112 |
1 files changed, 104 insertions, 8 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 2d78199d24af..5078edeadf96 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -271,6 +271,55 @@ static struct platform_device spitzled_device = { | |||
271 | /* | 271 | /* |
272 | * Spitz Touch Screen Device | 272 | * Spitz Touch Screen Device |
273 | */ | 273 | */ |
274 | |||
275 | static unsigned long (*get_hsync_invperiod)(struct device *dev); | ||
276 | |||
277 | static void inline sharpsl_wait_sync(int gpio) | ||
278 | { | ||
279 | while((GPLR(gpio) & GPIO_bit(gpio)) == 0); | ||
280 | while((GPLR(gpio) & GPIO_bit(gpio)) != 0); | ||
281 | } | ||
282 | |||
283 | static struct device *spitz_pxafb_dev; | ||
284 | |||
285 | static int is_pxafb_device(struct device * dev, void * data) | ||
286 | { | ||
287 | struct platform_device *pdev = container_of(dev, struct platform_device, dev); | ||
288 | |||
289 | return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0); | ||
290 | } | ||
291 | |||
292 | static unsigned long spitz_get_hsync_invperiod(void) | ||
293 | { | ||
294 | #ifdef CONFIG_FB_PXA | ||
295 | if (!spitz_pxafb_dev) { | ||
296 | spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device); | ||
297 | if (!spitz_pxafb_dev) | ||
298 | return 0; | ||
299 | } | ||
300 | if (!get_hsync_invperiod) | ||
301 | get_hsync_invperiod = symbol_get(pxafb_get_hsync_time); | ||
302 | if (!get_hsync_invperiod) | ||
303 | #endif | ||
304 | return 0; | ||
305 | |||
306 | return get_hsync_invperiod(spitz_pxafb_dev); | ||
307 | } | ||
308 | |||
309 | static void spitz_put_hsync(void) | ||
310 | { | ||
311 | put_device(spitz_pxafb_dev); | ||
312 | if (get_hsync_invperiod) | ||
313 | symbol_put(pxafb_get_hsync_time); | ||
314 | spitz_pxafb_dev = NULL; | ||
315 | get_hsync_invperiod = NULL; | ||
316 | } | ||
317 | |||
318 | static void spitz_wait_hsync(void) | ||
319 | { | ||
320 | sharpsl_wait_sync(SPITZ_GPIO_HSYNC); | ||
321 | } | ||
322 | |||
274 | static struct resource spitzts_resources[] = { | 323 | static struct resource spitzts_resources[] = { |
275 | [0] = { | 324 | [0] = { |
276 | .start = SPITZ_IRQ_GPIO_TP_INT, | 325 | .start = SPITZ_IRQ_GPIO_TP_INT, |
@@ -280,9 +329,9 @@ static struct resource spitzts_resources[] = { | |||
280 | }; | 329 | }; |
281 | 330 | ||
282 | static struct corgits_machinfo spitz_ts_machinfo = { | 331 | static struct corgits_machinfo spitz_ts_machinfo = { |
283 | .get_hsync_len = spitz_get_hsync_len, | 332 | .get_hsync_invperiod = spitz_get_hsync_invperiod, |
284 | .put_hsync = spitz_put_hsync, | 333 | .put_hsync = spitz_put_hsync, |
285 | .wait_hsync = spitz_wait_hsync, | 334 | .wait_hsync = spitz_wait_hsync, |
286 | }; | 335 | }; |
287 | 336 | ||
288 | static struct platform_device spitzts_device = { | 337 | static struct platform_device spitzts_device = { |
@@ -325,12 +374,10 @@ static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, vo | |||
325 | err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, | 374 | err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, |
326 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 375 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
327 | "MMC card detect", data); | 376 | "MMC card detect", data); |
328 | if (err) { | 377 | if (err) |
329 | printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | 378 | printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
330 | return -1; | ||
331 | } | ||
332 | 379 | ||
333 | return 0; | 380 | return err; |
334 | } | 381 | } |
335 | 382 | ||
336 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) | 383 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
@@ -423,6 +470,14 @@ static struct pxaficp_platform_data spitz_ficp_platform_data = { | |||
423 | * Spitz PXA Framebuffer | 470 | * Spitz PXA Framebuffer |
424 | */ | 471 | */ |
425 | 472 | ||
473 | static void spitz_lcd_power(int on, struct fb_var_screeninfo *var) | ||
474 | { | ||
475 | if (on) | ||
476 | corgi_lcdtg_hw_init(var->xres); | ||
477 | else | ||
478 | corgi_lcdtg_suspend(); | ||
479 | } | ||
480 | |||
426 | static struct pxafb_mode_info spitz_pxafb_modes[] = { | 481 | static struct pxafb_mode_info spitz_pxafb_modes[] = { |
427 | { | 482 | { |
428 | .pixclock = 19231, | 483 | .pixclock = 19231, |
@@ -520,6 +575,27 @@ static void __init common_init(void) | |||
520 | set_pxa_fb_info(&spitz_pxafb_info); | 575 | set_pxa_fb_info(&spitz_pxafb_info); |
521 | } | 576 | } |
522 | 577 | ||
578 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) | ||
579 | static void spitz_bl_set_intensity(int intensity) | ||
580 | { | ||
581 | if (intensity > 0x10) | ||
582 | intensity += 0x10; | ||
583 | |||
584 | /* Bits 0-4 are accessed via the SSP interface */ | ||
585 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
586 | |||
587 | /* Bit 5 is via SCOOP */ | ||
588 | if (intensity & 0x0020) | ||
589 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
590 | else | ||
591 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
592 | |||
593 | if (intensity) | ||
594 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
595 | else | ||
596 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
597 | } | ||
598 | |||
523 | static void __init spitz_init(void) | 599 | static void __init spitz_init(void) |
524 | { | 600 | { |
525 | platform_scoop_config = &spitz_pcmcia_config; | 601 | platform_scoop_config = &spitz_pcmcia_config; |
@@ -530,6 +606,7 @@ static void __init spitz_init(void) | |||
530 | 606 | ||
531 | platform_device_register(&spitzscoop2_device); | 607 | platform_device_register(&spitzscoop2_device); |
532 | } | 608 | } |
609 | #endif | ||
533 | 610 | ||
534 | #ifdef CONFIG_MACH_AKITA | 611 | #ifdef CONFIG_MACH_AKITA |
535 | /* | 612 | /* |
@@ -542,6 +619,26 @@ struct platform_device akitaioexp_device = { | |||
542 | 619 | ||
543 | EXPORT_SYMBOL_GPL(akitaioexp_device); | 620 | EXPORT_SYMBOL_GPL(akitaioexp_device); |
544 | 621 | ||
622 | static void akita_bl_set_intensity(int intensity) | ||
623 | { | ||
624 | if (intensity > 0x10) | ||
625 | intensity += 0x10; | ||
626 | |||
627 | /* Bits 0-4 are accessed via the SSP interface */ | ||
628 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
629 | |||
630 | /* Bit 5 is via IO-Expander */ | ||
631 | if (intensity & 0x0020) | ||
632 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | ||
633 | else | ||
634 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | ||
635 | |||
636 | if (intensity) | ||
637 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | ||
638 | else | ||
639 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | ||
640 | } | ||
641 | |||
545 | static void __init akita_init(void) | 642 | static void __init akita_init(void) |
546 | { | 643 | { |
547 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; | 644 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; |
@@ -558,7 +655,6 @@ static void __init akita_init(void) | |||
558 | } | 655 | } |
559 | #endif | 656 | #endif |
560 | 657 | ||
561 | |||
562 | static void __init fixup_spitz(struct machine_desc *desc, | 658 | static void __init fixup_spitz(struct machine_desc *desc, |
563 | struct tag *tags, char **cmdline, struct meminfo *mi) | 659 | struct tag *tags, char **cmdline, struct meminfo *mi) |
564 | { | 660 | { |