aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>2011-12-19 18:08:53 -0500
committerTony Lindgren <tony@atomide.com>2011-12-22 11:59:49 -0500
commit5ca6180fa6d7333fb5fabf30420b0e3cc32dd731 (patch)
treed2bcd9a2e73ceece085b8a0c3680c395c125040e
parent937eb4bb00588571f223eade260f9b509bf223ab (diff)
ARM: OMAP1: ams-delta: supersede custom led device by leds-gpio
Now that the Amstrad Delta on-board latches have been converted to GPIO devices, use the generic driver to control on-board LEDs which hang off those latches. Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/Kconfig1
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c87
-rw-r--r--arch/arm/plat-omap/include/plat/board-ams-delta.h19
3 files changed, 49 insertions, 58 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index e14532f236a0..5b1edbae6893 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -156,6 +156,7 @@ config MACH_AMS_DELTA
156 depends on ARCH_OMAP1 && ARCH_OMAP15XX 156 depends on ARCH_OMAP1 && ARCH_OMAP15XX
157 select FIQ 157 select FIQ
158 select GPIO_GENERIC_PLATFORM 158 select GPIO_GENERIC_PLATFORM
159 select LEDS_GPIO_REGISTER
159 help 160 help
160 Support for the Amstrad E3 (codename Delta) videophone. Say Y here 161 Support for the Amstrad E3 (codename Delta) videophone. Say Y here
161 if you have such a device. 162 if you have such a device.
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index cff2711dc259..034d0094e93a 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -164,18 +164,21 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = {
164 { OMAP_TAG_LCD, &ams_delta_lcd_config }, 164 { OMAP_TAG_LCD, &ams_delta_lcd_config },
165}; 165};
166 166
167#define LATCH1_GPIO_BASE 232
168#define LATCH1_NGPIO 8
169
167static struct resource latch1_resources[] __initconst = { 170static struct resource latch1_resources[] __initconst = {
168 [0] = { 171 [0] = {
169 .name = "dat", 172 .name = "dat",
170 .start = LATCH1_PHYS, 173 .start = LATCH1_PHYS,
171 .end = LATCH1_PHYS + (AMS_DELTA_LATCH1_NGPIO - 1) / 8, 174 .end = LATCH1_PHYS + (LATCH1_NGPIO - 1) / 8,
172 .flags = IORESOURCE_MEM, 175 .flags = IORESOURCE_MEM,
173 }, 176 },
174}; 177};
175 178
176static struct bgpio_pdata latch1_pdata __initconst = { 179static struct bgpio_pdata latch1_pdata __initconst = {
177 .base = AMS_DELTA_LATCH1_GPIO_BASE, 180 .base = LATCH1_GPIO_BASE,
178 .ngpio = AMS_DELTA_LATCH1_NGPIO, 181 .ngpio = LATCH1_NGPIO,
179}; 182};
180 183
181static struct platform_device latch1_gpio_device = { 184static struct platform_device latch1_gpio_device = {
@@ -214,42 +217,12 @@ static struct platform_device latch2_gpio_device = {
214 217
215static struct gpio latch_gpios[] __initconst = { 218static struct gpio latch_gpios[] __initconst = {
216 { 219 {
217 .gpio = AMS_DELTA_GPIO_PIN_LED_CAMERA, 220 .gpio = LATCH1_GPIO_BASE + 6,
218 .flags = GPIOF_OUT_INIT_LOW,
219 .label = "led_camera",
220 },
221 {
222 .gpio = AMS_DELTA_GPIO_PIN_LED_ADVERT,
223 .flags = GPIOF_OUT_INIT_LOW,
224 .label = "led_advert",
225 },
226 {
227 .gpio = AMS_DELTA_GPIO_PIN_LED_EMAIL,
228 .flags = GPIOF_OUT_INIT_LOW,
229 .label = "led_email",
230 },
231 {
232 .gpio = AMS_DELTA_GPIO_PIN_LED_HANDSFREE,
233 .flags = GPIOF_OUT_INIT_LOW,
234 .label = "led_handsfree",
235 },
236 {
237 .gpio = AMS_DELTA_GPIO_PIN_LED_VOICEMAIL,
238 .flags = GPIOF_OUT_INIT_LOW,
239 .label = "led_voicemail",
240 },
241 {
242 .gpio = AMS_DELTA_GPIO_PIN_LED_VOICE,
243 .flags = GPIOF_OUT_INIT_LOW,
244 .label = "led_voice",
245 },
246 {
247 .gpio = AMS_DELTA_LATCH1_GPIO_BASE + 6,
248 .flags = GPIOF_OUT_INIT_LOW, 221 .flags = GPIOF_OUT_INIT_LOW,
249 .label = "dockit1", 222 .label = "dockit1",
250 }, 223 },
251 { 224 {
252 .gpio = AMS_DELTA_LATCH1_GPIO_BASE + 7, 225 .gpio = LATCH1_GPIO_BASE + 7,
253 .flags = GPIOF_OUT_INIT_LOW, 226 .flags = GPIOF_OUT_INIT_LOW,
254 .label = "dockit2", 227 .label = "dockit2",
255 }, 228 },
@@ -399,9 +372,45 @@ static struct platform_device ams_delta_lcd_device = {
399 .id = -1, 372 .id = -1,
400}; 373};
401 374
402static struct platform_device ams_delta_led_device = { 375static struct gpio_led gpio_leds[] __initconst = {
403 .name = "ams-delta-led", 376 {
404 .id = -1 377 .name = "camera",
378 .gpio = LATCH1_GPIO_BASE + 0,
379 .default_state = LEDS_GPIO_DEFSTATE_OFF,
380#ifdef CONFIG_LEDS_TRIGGERS
381 .default_trigger = "ams_delta_camera",
382#endif
383 },
384 {
385 .name = "advert",
386 .gpio = LATCH1_GPIO_BASE + 1,
387 .default_state = LEDS_GPIO_DEFSTATE_OFF,
388 },
389 {
390 .name = "email",
391 .gpio = LATCH1_GPIO_BASE + 2,
392 .default_state = LEDS_GPIO_DEFSTATE_OFF,
393 },
394 {
395 .name = "handsfree",
396 .gpio = LATCH1_GPIO_BASE + 3,
397 .default_state = LEDS_GPIO_DEFSTATE_OFF,
398 },
399 {
400 .name = "voicemail",
401 .gpio = LATCH1_GPIO_BASE + 4,
402 .default_state = LEDS_GPIO_DEFSTATE_OFF,
403 },
404 {
405 .name = "voice",
406 .gpio = LATCH1_GPIO_BASE + 5,
407 .default_state = LEDS_GPIO_DEFSTATE_OFF,
408 },
409};
410
411static struct gpio_led_platform_data leds_pdata __initconst = {
412 .leds = gpio_leds,
413 .num_leds = ARRAY_SIZE(gpio_leds),
405}; 414};
406 415
407static struct i2c_board_info ams_delta_camera_board_info[] = { 416static struct i2c_board_info ams_delta_camera_board_info[] = {
@@ -459,7 +468,6 @@ static struct platform_device *ams_delta_devices[] __initdata = {
459static struct platform_device *late_devices[] __initconst = { 468static struct platform_device *late_devices[] __initconst = {
460 &ams_delta_nand_device, 469 &ams_delta_nand_device,
461 &ams_delta_lcd_device, 470 &ams_delta_lcd_device,
462 &ams_delta_led_device,
463}; 471};
464 472
465static void __init ams_delta_init(void) 473static void __init ams_delta_init(void)
@@ -493,6 +501,7 @@ static void __init ams_delta_init(void)
493 led_trigger_register_simple("ams_delta_camera", 501 led_trigger_register_simple("ams_delta_camera",
494 &ams_delta_camera_led_trigger); 502 &ams_delta_camera_led_trigger);
495#endif 503#endif
504 gpio_led_register_device(-1, &leds_pdata);
496 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); 505 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
497 506
498 ams_delta_init_fiq(); 507 ams_delta_init_fiq();
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index 68ffe328a777..a0f86ca75ddc 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,13 +28,6 @@
28 28
29#if defined (CONFIG_MACH_AMS_DELTA) 29#if defined (CONFIG_MACH_AMS_DELTA)
30 30
31#define AMS_DELTA_LATCH1_LED_CAMERA 0x01
32#define AMS_DELTA_LATCH1_LED_ADVERT 0x02
33#define AMS_DELTA_LATCH1_LED_EMAIL 0x04
34#define AMS_DELTA_LATCH1_LED_HANDSFREE 0x08
35#define AMS_DELTA_LATCH1_LED_VOICEMAIL 0x10
36#define AMS_DELTA_LATCH1_LED_VOICE 0x20
37
38#define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001 31#define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001
39#define AMS_DELTA_LATCH2_LCD_NDISP 0x0002 32#define AMS_DELTA_LATCH2_LCD_NDISP 0x0002
40#define AMS_DELTA_LATCH2_NAND_NCE 0x0004 33#define AMS_DELTA_LATCH2_NAND_NCE 0x0004
@@ -59,13 +52,6 @@
59#define AMS_DELTA_GPIO_PIN_CONFIG 11 52#define AMS_DELTA_GPIO_PIN_CONFIG 11
60#define AMS_DELTA_GPIO_PIN_NAND_RB 12 53#define AMS_DELTA_GPIO_PIN_NAND_RB 12
61 54
62#define AMS_DELTA_GPIO_PIN_LED_CAMERA 232
63#define AMS_DELTA_GPIO_PIN_LED_ADVERT 233
64#define AMS_DELTA_GPIO_PIN_LED_EMAIL 234
65#define AMS_DELTA_GPIO_PIN_LED_HANDSFREE 235
66#define AMS_DELTA_GPIO_PIN_LED_VOICEMAIL 236
67#define AMS_DELTA_GPIO_PIN_LED_VOICE 237
68
69#define AMS_DELTA_GPIO_PIN_LCD_VBLEN 240 55#define AMS_DELTA_GPIO_PIN_LCD_VBLEN 240
70#define AMS_DELTA_GPIO_PIN_LCD_NDISP 241 56#define AMS_DELTA_GPIO_PIN_LCD_NDISP 241
71#define AMS_DELTA_GPIO_PIN_NAND_NCE 242 57#define AMS_DELTA_GPIO_PIN_NAND_NCE 242
@@ -81,16 +67,11 @@
81#define AMS_DELTA_GPIO_PIN_MODEM_NRESET 252 67#define AMS_DELTA_GPIO_PIN_MODEM_NRESET 252
82#define AMS_DELTA_GPIO_PIN_MODEM_CODEC 253 68#define AMS_DELTA_GPIO_PIN_MODEM_CODEC 253
83 69
84#define AMS_DELTA_LATCH1_GPIO_BASE AMS_DELTA_GPIO_PIN_LED_CAMERA
85#define AMS_DELTA_LATCH1_NGPIO 8
86#define AMS_DELTA_LATCH2_GPIO_BASE AMS_DELTA_GPIO_PIN_LCD_VBLEN 70#define AMS_DELTA_LATCH2_GPIO_BASE AMS_DELTA_GPIO_PIN_LCD_VBLEN
87#define AMS_DELTA_LATCH2_NGPIO 16 71#define AMS_DELTA_LATCH2_NGPIO 16
88 72
89#ifndef __ASSEMBLY__ 73#ifndef __ASSEMBLY__
90void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value); 74void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value);
91#define ams_delta_latch1_write(mask, value) \
92 ams_delta_latch_write(AMS_DELTA_LATCH1_GPIO_BASE, \
93 AMS_DELTA_LATCH1_NGPIO, (mask), (value))
94#define ams_delta_latch2_write(mask, value) \ 75#define ams_delta_latch2_write(mask, value) \
95 ams_delta_latch_write(AMS_DELTA_LATCH2_GPIO_BASE, \ 76 ams_delta_latch_write(AMS_DELTA_LATCH2_GPIO_BASE, \
96 AMS_DELTA_LATCH2_NGPIO, (mask), (value)) 77 AMS_DELTA_LATCH2_NGPIO, (mask), (value))