2 * linux/arch/arm/mach-omap1/leds-osk.c
4 * LED driver for OSK with optional Mistral QVGA board
6 #include <linux/gpio.h>
7 #include <linux/init.h>
9 #include <mach/hardware.h>
15 #define LED_STATE_ENABLED (1 << 0)
16 #define LED_STATE_CLAIMED (1 << 1)
19 #define TIMER_LED (1 << 3) /* Mistral board */
20 #define IDLE_LED (1 << 4) /* Mistral board */
21 static u8 hw_led_state
;
24 #ifdef CONFIG_OMAP_OSK_MISTRAL
26 /* For now, all system indicators require the Mistral board, since that
27 * LED can be manipulated without a task context. This LED is either red,
28 * or green, but not both; it can't give the full "disco led" effect.
31 #define GPIO_LED_RED 3
32 #define GPIO_LED_GREEN OMAP_MPUIO(4)
34 static void mistral_setled(void)
39 if (hw_led_state
& TIMER_LED
)
41 else if (hw_led_state
& IDLE_LED
)
43 /* else both sides are disabled */
45 gpio_set_value(GPIO_LED_GREEN
, green
);
46 gpio_set_value(GPIO_LED_RED
, red
);
51 void osk_leds_event(led_event_t evt
)
56 local_irq_save(flags
);
58 if (!(led_state
& LED_STATE_ENABLED
) && evt
!= led_start
)
64 led_state
|= LED_STATE_ENABLED
;
71 led_state
&= ~LED_STATE_ENABLED
;
76 led_state
|= LED_STATE_CLAIMED
;
82 led_state
&= ~LED_STATE_CLAIMED
;
86 #ifdef CONFIG_OMAP_OSK_MISTRAL
89 hw_led_state
^= TIMER_LED
;
93 case led_idle_start
: /* idle == off */
94 hw_led_state
&= ~IDLE_LED
;
99 hw_led_state
|= IDLE_LED
;
103 #endif /* CONFIG_OMAP_OSK_MISTRAL */
109 leds
^= hw_led_state
;
112 local_irq_restore(flags
);