aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/spitz.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r--arch/arm/mach-pxa/spitz.c106
1 files changed, 102 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 2d78199d24af..bb4b65d352c9 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
275static unsigned long (*get_hsync_invperiod)(struct device *dev);
276
277static 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
283static struct device *spitz_pxafb_dev;
284
285static 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
292static 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
309static 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
318static void spitz_wait_hsync(void)
319{
320 sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
321}
322
274static struct resource spitzts_resources[] = { 323static 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
282static struct corgits_machinfo spitz_ts_machinfo = { 331static 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
288static struct platform_device spitzts_device = { 337static struct platform_device spitzts_device = {
@@ -423,6 +472,14 @@ static struct pxaficp_platform_data spitz_ficp_platform_data = {
423 * Spitz PXA Framebuffer 472 * Spitz PXA Framebuffer
424 */ 473 */
425 474
475static void spitz_lcd_power(int on, struct fb_var_screeninfo *var)
476{
477 if (on)
478 corgi_lcdtg_hw_init(var->xres);
479 else
480 corgi_lcdtg_suspend();
481}
482
426static struct pxafb_mode_info spitz_pxafb_modes[] = { 483static struct pxafb_mode_info spitz_pxafb_modes[] = {
427{ 484{
428 .pixclock = 19231, 485 .pixclock = 19231,
@@ -520,6 +577,27 @@ static void __init common_init(void)
520 set_pxa_fb_info(&spitz_pxafb_info); 577 set_pxa_fb_info(&spitz_pxafb_info);
521} 578}
522 579
580#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
581static void spitz_bl_set_intensity(int intensity)
582{
583 if (intensity > 0x10)
584 intensity += 0x10;
585
586 /* Bits 0-4 are accessed via the SSP interface */
587 corgi_ssp_blduty_set(intensity & 0x1f);
588
589 /* Bit 5 is via SCOOP */
590 if (intensity & 0x0020)
591 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
592 else
593 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
594
595 if (intensity)
596 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
597 else
598 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
599}
600
523static void __init spitz_init(void) 601static void __init spitz_init(void)
524{ 602{
525 platform_scoop_config = &spitz_pcmcia_config; 603 platform_scoop_config = &spitz_pcmcia_config;
@@ -530,6 +608,7 @@ static void __init spitz_init(void)
530 608
531 platform_device_register(&spitzscoop2_device); 609 platform_device_register(&spitzscoop2_device);
532} 610}
611#endif
533 612
534#ifdef CONFIG_MACH_AKITA 613#ifdef CONFIG_MACH_AKITA
535/* 614/*
@@ -542,6 +621,26 @@ struct platform_device akitaioexp_device = {
542 621
543EXPORT_SYMBOL_GPL(akitaioexp_device); 622EXPORT_SYMBOL_GPL(akitaioexp_device);
544 623
624static void akita_bl_set_intensity(int intensity)
625{
626 if (intensity > 0x10)
627 intensity += 0x10;
628
629 /* Bits 0-4 are accessed via the SSP interface */
630 corgi_ssp_blduty_set(intensity & 0x1f);
631
632 /* Bit 5 is via IO-Expander */
633 if (intensity & 0x0020)
634 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
635 else
636 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
637
638 if (intensity)
639 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
640 else
641 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
642}
643
545static void __init akita_init(void) 644static void __init akita_init(void)
546{ 645{
547 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; 646 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
@@ -558,7 +657,6 @@ static void __init akita_init(void)
558} 657}
559#endif 658#endif
560 659
561
562static void __init fixup_spitz(struct machine_desc *desc, 660static void __init fixup_spitz(struct machine_desc *desc,
563 struct tag *tags, char **cmdline, struct meminfo *mi) 661 struct tag *tags, char **cmdline, struct meminfo *mi)
564{ 662{