leds.c 1.5 KB

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