leds.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * linux/arch/arm/mach-omap1/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()
  19. || machine_is_omap_h3()
  20. || machine_is_omap_perseus2())
  21. leds_event = h2p2_dbg_leds_event;
  22. else if (machine_is_omap_osk())
  23. leds_event = osk_leds_event;
  24. else
  25. return -1;
  26. if (machine_is_omap_h2()
  27. || machine_is_omap_h3()
  28. || machine_is_omap_perseus2()
  29. #ifdef CONFIG_OMAP_OSK_MISTRAL
  30. || machine_is_omap_osk()
  31. #endif
  32. ) {
  33. /* LED1/LED2 pins can be used as GPIO (as done here), or by
  34. * the LPG (works even in deep sleep!), to drive a bicolor
  35. * LED on the H2 sample board, and another on the H2/P2
  36. * "surfer" expansion board.
  37. *
  38. * The same pins drive a LED on the OSK Mistral board, but
  39. * that's a different kind of LED (just one color at a time).
  40. */
  41. omap_cfg_reg(P18_1610_GPIO3);
  42. if (omap_request_gpio(3) == 0)
  43. omap_set_gpio_direction(3, 0);
  44. else
  45. printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
  46. omap_cfg_reg(MPUIO4);
  47. if (omap_request_gpio(OMAP_MPUIO(4)) == 0)
  48. omap_set_gpio_direction(OMAP_MPUIO(4), 0);
  49. else
  50. printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
  51. }
  52. leds_event(led_start);
  53. return 0;
  54. }
  55. __initcall(omap_leds_init);