diff options
author | Pavel Machek <pavel@ucw.cz> | 2005-09-06 18:16:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:20 -0400 |
commit | 987132bb0b136c93cef5f195e7371bb98df64709 (patch) | |
tree | 9a26d57b3a02cda5783785e7c8c80b872b7c0353 /drivers | |
parent | f2cf8e25ba4cf4e0881e612125858b4eed563ee4 (diff) |
[PATCH] Support powering sharp zaurus sl-5500 LCD up and down
This adds support for powering Zaurus's video up and down. PDA without
screen is kind of useless, so it is quite important... I'll have to figure
out how to really control the frontlight, because LCD without that is quite
hard to read.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/backlight/Makefile | 1 | ||||
-rw-r--r-- | drivers/video/backlight/locomolcd.c | 157 |
2 files changed, 158 insertions, 0 deletions
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 9aae884475be..4af321fae390 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -3,3 +3,4 @@ | |||
3 | obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o | 3 | obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o |
4 | obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o | 4 | obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o |
5 | obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o | 5 | obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o |
6 | obj-$(CONFIG_SHARP_LOCOMO) += locomolcd.o | ||
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c new file mode 100644 index 000000000000..ada6e75eb048 --- /dev/null +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * Backlight control code for Sharp Zaurus SL-5500 | ||
3 | * | ||
4 | * Copyright 2005 John Lenz <lenz@cs.wisc.edu> | ||
5 | * Maintainer: Pavel Machek <pavel@suse.cz> (unless John wants to :-) | ||
6 | * GPL v2 | ||
7 | * | ||
8 | * This driver assumes single CPU. That's okay, because collie is | ||
9 | * slightly old hardware, and noone is going to retrofit second CPU to | ||
10 | * old PDA. | ||
11 | */ | ||
12 | |||
13 | /* LCD power functions */ | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | |||
21 | #include <asm/hardware/locomo.h> | ||
22 | #include <asm/irq.h> | ||
23 | |||
24 | #ifdef CONFIG_SA1100_COLLIE | ||
25 | #include <asm/arch/collie.h> | ||
26 | #else | ||
27 | #include <asm/arch/poodle.h> | ||
28 | #endif | ||
29 | |||
30 | extern void (*sa1100fb_lcd_power)(int on); | ||
31 | |||
32 | static struct locomo_dev *locomolcd_dev; | ||
33 | |||
34 | static void locomolcd_on(int comadj) | ||
35 | { | ||
36 | locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_VSHA_ON, 0); | ||
37 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHA_ON, 1); | ||
38 | mdelay(2); | ||
39 | |||
40 | locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_VSHD_ON, 0); | ||
41 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHD_ON, 1); | ||
42 | mdelay(2); | ||
43 | |||
44 | locomo_m62332_senddata(locomolcd_dev, comadj, 0); | ||
45 | mdelay(5); | ||
46 | |||
47 | locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_VEE_ON, 0); | ||
48 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VEE_ON, 1); | ||
49 | mdelay(10); | ||
50 | |||
51 | /* TFTCRST | CPSOUT=0 | CPSEN */ | ||
52 | locomo_writel(0x01, locomolcd_dev->mapbase + LOCOMO_TC); | ||
53 | |||
54 | /* Set CPSD */ | ||
55 | locomo_writel(6, locomolcd_dev->mapbase + LOCOMO_CPSD); | ||
56 | |||
57 | /* TFTCRST | CPSOUT=0 | CPSEN */ | ||
58 | locomo_writel((0x04 | 0x01), locomolcd_dev->mapbase + LOCOMO_TC); | ||
59 | mdelay(10); | ||
60 | |||
61 | locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_MOD, 0); | ||
62 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_MOD, 1); | ||
63 | } | ||
64 | |||
65 | static void locomolcd_off(int comadj) | ||
66 | { | ||
67 | /* TFTCRST=1 | CPSOUT=1 | CPSEN = 0 */ | ||
68 | locomo_writel(0x06, locomolcd_dev->mapbase + LOCOMO_TC); | ||
69 | mdelay(1); | ||
70 | |||
71 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHA_ON, 0); | ||
72 | mdelay(110); | ||
73 | |||
74 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VEE_ON, 0); | ||
75 | mdelay(700); | ||
76 | |||
77 | /* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */ | ||
78 | locomo_writel(0, locomolcd_dev->mapbase + LOCOMO_TC); | ||
79 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_MOD, 0); | ||
80 | locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHD_ON, 0); | ||
81 | } | ||
82 | |||
83 | void locomolcd_power(int on) | ||
84 | { | ||
85 | int comadj = 118; | ||
86 | unsigned long flags; | ||
87 | |||
88 | local_irq_save(flags); | ||
89 | |||
90 | if (!locomolcd_dev) { | ||
91 | local_irq_restore(flags); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | /* read comadj */ | ||
96 | #ifdef CONFIG_MACH_POODLE | ||
97 | comadj = 118; | ||
98 | #else | ||
99 | comadj = 128; | ||
100 | #endif | ||
101 | |||
102 | if (on) | ||
103 | locomolcd_on(comadj); | ||
104 | else | ||
105 | locomolcd_off(comadj); | ||
106 | |||
107 | local_irq_restore(flags); | ||
108 | } | ||
109 | EXPORT_SYMBOL(locomolcd_power); | ||
110 | |||
111 | static int poodle_lcd_probe(struct locomo_dev *dev) | ||
112 | { | ||
113 | unsigned long flags; | ||
114 | |||
115 | local_irq_save(flags); | ||
116 | locomolcd_dev = dev; | ||
117 | |||
118 | /* the poodle_lcd_power function is called for the first time | ||
119 | * from fs_initcall, which is before locomo is activated. | ||
120 | * We need to recall poodle_lcd_power here*/ | ||
121 | #ifdef CONFIG_MACH_POODLE | ||
122 | locomolcd_power(1); | ||
123 | #endif | ||
124 | local_irq_restore(flags); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static int poodle_lcd_remove(struct locomo_dev *dev) | ||
129 | { | ||
130 | unsigned long flags; | ||
131 | local_irq_save(flags); | ||
132 | locomolcd_dev = NULL; | ||
133 | local_irq_restore(flags); | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | static struct locomo_driver poodle_lcd_driver = { | ||
138 | .drv = { | ||
139 | .name = "locomo-backlight", | ||
140 | }, | ||
141 | .devid = LOCOMO_DEVID_BACKLIGHT, | ||
142 | .probe = poodle_lcd_probe, | ||
143 | .remove = poodle_lcd_remove, | ||
144 | }; | ||
145 | |||
146 | static int __init poodle_lcd_init(void) | ||
147 | { | ||
148 | int ret = locomo_driver_register(&poodle_lcd_driver); | ||
149 | if (ret) return ret; | ||
150 | |||
151 | #ifdef CONFIG_SA1100_COLLIE | ||
152 | sa1100fb_lcd_power = locomolcd_power; | ||
153 | #endif | ||
154 | return 0; | ||
155 | } | ||
156 | device_initcall(poodle_lcd_init); | ||
157 | |||