leds.c 1.4 KB

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