aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-igep0020.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-igep0020.c')
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c156
1 files changed, 87 insertions, 69 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 2f40d77a2f1e..d7a0db7058e1 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -262,6 +262,77 @@ static struct omap2_hsmmc_info mmc[] = {
262 {} /* Terminator */ 262 {} /* Terminator */
263}; 263};
264 264
265#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
266#include <linux/leds.h>
267
268static struct gpio_led igep2_gpio_leds[] = {
269 [0] = {
270 .name = "gpio-led:red:d0",
271 .gpio = IGEP2_GPIO_LED0_RED,
272 .default_trigger = "default-off"
273 },
274 [1] = {
275 .name = "gpio-led:green:d0",
276 .gpio = IGEP2_GPIO_LED0_GREEN,
277 .default_trigger = "default-off",
278 },
279 [2] = {
280 .name = "gpio-led:red:d1",
281 .gpio = IGEP2_GPIO_LED1_RED,
282 .default_trigger = "default-off",
283 },
284 [3] = {
285 .name = "gpio-led:green:d1",
286 .default_trigger = "heartbeat",
287 .gpio = -EINVAL, /* gets replaced */
288 },
289};
290
291static struct gpio_led_platform_data igep2_led_pdata = {
292 .leds = igep2_gpio_leds,
293 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
294};
295
296static struct platform_device igep2_led_device = {
297 .name = "leds-gpio",
298 .id = -1,
299 .dev = {
300 .platform_data = &igep2_led_pdata,
301 },
302};
303
304static void __init igep2_leds_init(void)
305{
306 platform_device_register(&igep2_led_device);
307}
308
309#else
310static inline void igep2_leds_init(void)
311{
312 if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
313 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
314 gpio_export(IGEP2_GPIO_LED0_RED, 0);
315 gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
316 } else
317 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
318
319 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
320 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
321 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
322 gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
323 } else
324 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
325
326 if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
327 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
328 gpio_export(IGEP2_GPIO_LED1_RED, 0);
329 gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
330 } else
331 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
332
333}
334#endif
335
265static int igep2_twl_gpio_setup(struct device *dev, 336static int igep2_twl_gpio_setup(struct device *dev,
266 unsigned gpio, unsigned ngpio) 337 unsigned gpio, unsigned ngpio)
267{ 338{
@@ -291,14 +362,26 @@ static int igep2_twl_gpio_setup(struct device *dev,
291 (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0)) 362 (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0))
292 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); 363 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
293 364
365 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
366#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
367 if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0)
368 && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) {
369 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
370 gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0);
371 } else
372 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
373#else
374 igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
375#endif
376
294 return 0; 377 return 0;
295}; 378};
296 379
297static struct twl4030_gpio_platform_data igep2_gpio_data = { 380static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
298 .gpio_base = OMAP_MAX_GPIO_LINES, 381 .gpio_base = OMAP_MAX_GPIO_LINES,
299 .irq_base = TWL4030_GPIO_IRQ_BASE, 382 .irq_base = TWL4030_GPIO_IRQ_BASE,
300 .irq_end = TWL4030_GPIO_IRQ_END, 383 .irq_end = TWL4030_GPIO_IRQ_END,
301 .use_leds = false, 384 .use_leds = true,
302 .setup = igep2_twl_gpio_setup, 385 .setup = igep2_twl_gpio_setup,
303}; 386};
304 387
@@ -372,47 +455,6 @@ static void __init igep2_display_init(void)
372 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); 455 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
373} 456}
374 457
375#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
376#include <linux/leds.h>
377
378static struct gpio_led igep2_gpio_leds[] = {
379 {
380 .name = "led0:red",
381 .gpio = IGEP2_GPIO_LED0_RED,
382 },
383 {
384 .name = "led0:green",
385 .default_trigger = "heartbeat",
386 .gpio = IGEP2_GPIO_LED0_GREEN,
387 },
388 {
389 .name = "led1:red",
390 .gpio = IGEP2_GPIO_LED1_RED,
391 },
392};
393
394static struct gpio_led_platform_data igep2_led_pdata = {
395 .leds = igep2_gpio_leds,
396 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
397};
398
399static struct platform_device igep2_led_device = {
400 .name = "leds-gpio",
401 .id = -1,
402 .dev = {
403 .platform_data = &igep2_led_pdata,
404 },
405};
406
407static void __init igep2_init_led(void)
408{
409 platform_device_register(&igep2_led_device);
410}
411
412#else
413static inline void igep2_init_led(void) {}
414#endif
415
416static struct platform_device *igep2_devices[] __initdata = { 458static struct platform_device *igep2_devices[] __initdata = {
417 &igep2_dss_device, 459 &igep2_dss_device,
418}; 460};
@@ -442,7 +484,7 @@ static struct twl4030_platform_data igep2_twldata = {
442 /* platform_data for children goes here */ 484 /* platform_data for children goes here */
443 .usb = &igep2_usb_data, 485 .usb = &igep2_usb_data,
444 .codec = &igep2_codec_data, 486 .codec = &igep2_codec_data,
445 .gpio = &igep2_gpio_data, 487 .gpio = &igep2_twl4030_gpio_pdata,
446 .vmmc1 = &igep2_vmmc1, 488 .vmmc1 = &igep2_vmmc1,
447 .vmmc2 = &igep2_vmmc2, 489 .vmmc2 = &igep2_vmmc2,
448 .vpll2 = &igep2_vpll2, 490 .vpll2 = &igep2_vpll2,
@@ -503,34 +545,10 @@ static void __init igep2_init(void)
503 usb_ehci_init(&ehci_pdata); 545 usb_ehci_init(&ehci_pdata);
504 546
505 igep2_flash_init(); 547 igep2_flash_init();
506 igep2_init_led(); 548 igep2_leds_init();
507 igep2_display_init(); 549 igep2_display_init();
508 igep2_init_smsc911x(); 550 igep2_init_smsc911x();
509 551
510 /* GPIO userspace leds */
511#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
512 if ((gpio_request(IGEP2_GPIO_LED0_RED, "led0:red") == 0) &&
513 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
514 gpio_export(IGEP2_GPIO_LED0_RED, 0);
515 gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
516 } else
517 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
518
519 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "led0:green") == 0) &&
520 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
521 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
522 gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
523 } else
524 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
525
526 if ((gpio_request(IGEP2_GPIO_LED1_RED, "led1:red") == 0) &&
527 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
528 gpio_export(IGEP2_GPIO_LED1_RED, 0);
529 gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
530 } else
531 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
532#endif
533
534 /* GPIO W-LAN + Bluetooth combo module */ 552 /* GPIO W-LAN + Bluetooth combo module */
535 if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && 553 if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) &&
536 (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) { 554 (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) {