leds.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * linux/arch/arm/mach-omap1/leds.c
  3. *
  4. * OMAP LEDs dispatcher
  5. */
  6. #include <linux/gpio.h>
  7. #include <linux/kernel.h>
  8. #include <linux/init.h>
  9. #include <linux/platform_data/gpio-omap.h>
  10. #include <asm/leds.h>
  11. #include <asm/mach-types.h>
  12. #include <plat/mux.h>
  13. #include "leds.h"
  14. static int __init
  15. omap_leds_init(void)
  16. {
  17. if (!cpu_class_is_omap1())
  18. return -ENODEV;
  19. if (machine_is_omap_innovator())
  20. leds_event = innovator_leds_event;
  21. else if (machine_is_omap_h2()
  22. || machine_is_omap_h3()
  23. || machine_is_omap_perseus2())
  24. leds_event = h2p2_dbg_leds_event;
  25. else if (machine_is_omap_osk())
  26. leds_event = osk_leds_event;
  27. else
  28. return -1;
  29. if (machine_is_omap_h2()
  30. || machine_is_omap_h3()
  31. #ifdef CONFIG_OMAP_OSK_MISTRAL
  32. || machine_is_omap_osk()
  33. #endif
  34. ) {
  35. /* LED1/LED2 pins can be used as GPIO (as done here), or by
  36. * the LPG (works even in deep sleep!), to drive a bicolor
  37. * LED on the H2 sample board, and another on the H2/P2
  38. * "surfer" expansion board.
  39. *
  40. * The same pins drive a LED on the OSK Mistral board, but
  41. * that's a different kind of LED (just one color at a time).
  42. */
  43. omap_cfg_reg(P18_1610_GPIO3);
  44. if (gpio_request(3, "LED red") == 0)
  45. gpio_direction_output(3, 1);
  46. else
  47. printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
  48. omap_cfg_reg(MPUIO4);
  49. if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
  50. gpio_direction_output(OMAP_MPUIO(4), 1);
  51. else
  52. printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
  53. }
  54. leds_event(led_start);
  55. return 0;
  56. }
  57. __initcall(omap_leds_init);