diff options
Diffstat (limited to 'arch/arm/mach-omap1/leds-innovator.c')
-rw-r--r-- | arch/arm/mach-omap1/leds-innovator.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c new file mode 100644 index 000000000000..8043b7d0f66e --- /dev/null +++ b/arch/arm/mach-omap1/leds-innovator.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap/leds-innovator.c | ||
3 | */ | ||
4 | #include <linux/config.h> | ||
5 | #include <linux/init.h> | ||
6 | |||
7 | #include <asm/hardware.h> | ||
8 | #include <asm/leds.h> | ||
9 | #include <asm/system.h> | ||
10 | |||
11 | #include "leds.h" | ||
12 | |||
13 | |||
14 | #define LED_STATE_ENABLED 1 | ||
15 | #define LED_STATE_CLAIMED 2 | ||
16 | |||
17 | static unsigned int led_state; | ||
18 | static unsigned int hw_led_state; | ||
19 | |||
20 | void innovator_leds_event(led_event_t evt) | ||
21 | { | ||
22 | unsigned long flags; | ||
23 | |||
24 | local_irq_save(flags); | ||
25 | |||
26 | switch (evt) { | ||
27 | case led_start: | ||
28 | hw_led_state = 0; | ||
29 | led_state = LED_STATE_ENABLED; | ||
30 | break; | ||
31 | |||
32 | case led_stop: | ||
33 | led_state &= ~LED_STATE_ENABLED; | ||
34 | hw_led_state = 0; | ||
35 | break; | ||
36 | |||
37 | case led_claim: | ||
38 | led_state |= LED_STATE_CLAIMED; | ||
39 | hw_led_state = 0; | ||
40 | break; | ||
41 | |||
42 | case led_release: | ||
43 | led_state &= ~LED_STATE_CLAIMED; | ||
44 | hw_led_state = 0; | ||
45 | break; | ||
46 | |||
47 | #ifdef CONFIG_LEDS_TIMER | ||
48 | case led_timer: | ||
49 | if (!(led_state & LED_STATE_CLAIMED)) | ||
50 | hw_led_state ^= 0; | ||
51 | break; | ||
52 | #endif | ||
53 | |||
54 | #ifdef CONFIG_LEDS_CPU | ||
55 | case led_idle_start: | ||
56 | if (!(led_state & LED_STATE_CLAIMED)) | ||
57 | hw_led_state |= 0; | ||
58 | break; | ||
59 | |||
60 | case led_idle_end: | ||
61 | if (!(led_state & LED_STATE_CLAIMED)) | ||
62 | hw_led_state &= ~0; | ||
63 | break; | ||
64 | #endif | ||
65 | |||
66 | case led_halted: | ||
67 | break; | ||
68 | |||
69 | case led_green_on: | ||
70 | if (led_state & LED_STATE_CLAIMED) | ||
71 | hw_led_state &= ~0; | ||
72 | break; | ||
73 | |||
74 | case led_green_off: | ||
75 | if (led_state & LED_STATE_CLAIMED) | ||
76 | hw_led_state |= 0; | ||
77 | break; | ||
78 | |||
79 | case led_amber_on: | ||
80 | break; | ||
81 | |||
82 | case led_amber_off: | ||
83 | break; | ||
84 | |||
85 | case led_red_on: | ||
86 | if (led_state & LED_STATE_CLAIMED) | ||
87 | hw_led_state &= ~0; | ||
88 | break; | ||
89 | |||
90 | case led_red_off: | ||
91 | if (led_state & LED_STATE_CLAIMED) | ||
92 | hw_led_state |= 0; | ||
93 | break; | ||
94 | |||
95 | default: | ||
96 | break; | ||
97 | } | ||
98 | |||
99 | if (led_state & LED_STATE_ENABLED) | ||
100 | ; | ||
101 | |||
102 | local_irq_restore(flags); | ||
103 | } | ||