2 * linux/arch/arm/mach-omap1/leds-osk.c
4 * LED driver for OSK with optional Mistral QVGA board
6 #include <linux/init.h>
8 #include <asm/hardware.h>
10 #include <asm/system.h>
12 #include <asm/arch/gpio.h>
17 #define LED_STATE_ENABLED (1 << 0)
18 #define LED_STATE_CLAIMED (1 << 1)
21 #define TIMER_LED (1 << 3) /* Mistral board */
22 #define IDLE_LED (1 << 4) /* Mistral board */
23 static u8 hw_led_state;
26 #ifdef CONFIG_OMAP_OSK_MISTRAL
28 /* For now, all system indicators require the Mistral board, since that
29 * LED can be manipulated without a task context. This LED is either red,
30 * or green, but not both; it can't give the full "disco led" effect.
33 #define GPIO_LED_RED 3
34 #define GPIO_LED_GREEN OMAP_MPUIO(4)
36 static void mistral_setled(void)
41 if (hw_led_state & TIMER_LED)
43 else if (hw_led_state & IDLE_LED)
45 /* else both sides are disabled */
47 omap_set_gpio_dataout(GPIO_LED_GREEN, green);
48 omap_set_gpio_dataout(GPIO_LED_RED, red);
53 void osk_leds_event(led_event_t evt)
58 local_irq_save(flags);
60 if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
66 led_state |= LED_STATE_ENABLED;
73 led_state &= ~LED_STATE_ENABLED;
78 led_state |= LED_STATE_CLAIMED;
84 led_state &= ~LED_STATE_CLAIMED;
88 #ifdef CONFIG_OMAP_OSK_MISTRAL
91 hw_led_state ^= TIMER_LED;
95 case led_idle_start: /* idle == off */
96 hw_led_state &= ~IDLE_LED;
101 hw_led_state |= IDLE_LED;
105 #endif /* CONFIG_OMAP_OSK_MISTRAL */
111 leds ^= hw_led_state;
114 local_irq_restore(flags);