mwl8k: increase firmware loading timeouts
[linux/fpc-iii.git] / arch / arm / mach-omap1 / leds-osk.c
blob499d7ad8697d175847a21fbf133a6cb772526429
1 /*
2 * linux/arch/arm/mach-omap1/leds-osk.c
4 * LED driver for OSK with optional Mistral QVGA board
5 */
6 #include <linux/init.h>
8 #include <mach/hardware.h>
9 #include <asm/leds.h>
10 #include <asm/system.h>
12 #include <mach/gpio.h>
14 #include "leds.h"
17 #define LED_STATE_ENABLED (1 << 0)
18 #define LED_STATE_CLAIMED (1 << 1)
19 static u8 led_state;
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)
38 int red = 0;
39 int green = 0;
41 if (hw_led_state & TIMER_LED)
42 red = 1;
43 else if (hw_led_state & IDLE_LED)
44 green = 1;
45 /* else both sides are disabled */
47 gpio_set_value(GPIO_LED_GREEN, green);
48 gpio_set_value(GPIO_LED_RED, red);
51 #endif
53 void osk_leds_event(led_event_t evt)
55 unsigned long flags;
56 u16 leds;
58 local_irq_save(flags);
60 if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
61 goto done;
63 leds = hw_led_state;
64 switch (evt) {
65 case led_start:
66 led_state |= LED_STATE_ENABLED;
67 hw_led_state = 0;
68 leds = ~0;
69 break;
71 case led_halted:
72 case led_stop:
73 led_state &= ~LED_STATE_ENABLED;
74 hw_led_state = 0;
75 break;
77 case led_claim:
78 led_state |= LED_STATE_CLAIMED;
79 hw_led_state = 0;
80 leds = ~0;
81 break;
83 case led_release:
84 led_state &= ~LED_STATE_CLAIMED;
85 hw_led_state = 0;
86 break;
88 #ifdef CONFIG_OMAP_OSK_MISTRAL
90 case led_timer:
91 hw_led_state ^= TIMER_LED;
92 mistral_setled();
93 break;
95 case led_idle_start: /* idle == off */
96 hw_led_state &= ~IDLE_LED;
97 mistral_setled();
98 break;
100 case led_idle_end:
101 hw_led_state |= IDLE_LED;
102 mistral_setled();
103 break;
105 #endif /* CONFIG_OMAP_OSK_MISTRAL */
107 default:
108 break;
111 leds ^= hw_led_state;
113 done:
114 local_irq_restore(flags);