leds.c 1.4 KB

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