v2.4.8 -> v2.4.8.1
[opensuse:kernel.git] / arch / arm / mach-sa1100 / leds-simpad.c
1 /*
2  * linux/arch/arm/mach-sa1100/leds-simpad.c
3  *
4  * Author: Juergen Messerer <juergen.messerer@siemens.ch>
5  */
6 #include <linux/config.h>
7 #include <linux/init.h>
8
9 #include <asm/hardware.h>
10 #include <asm/leds.h>
11 #include <asm/system.h>
12
13 #include "leds.h"
14
15
16 #define LED_STATE_ENABLED       1
17 #define LED_STATE_CLAIMED       2
18
19 static unsigned int led_state;
20 static unsigned int hw_led_state;
21
22 #define LED_GREEN       (1)
23 #define LED_MASK        (1)
24
25 void simpad_leds_event(led_event_t evt)
26 {
27         unsigned long flags;
28
29         //local_irq_save(flags);
30
31         switch (evt)
32         {
33         case led_start:
34                 hw_led_state = LED_GREEN;
35                 led_state = LED_STATE_ENABLED;
36                 break;
37
38         case led_stop:
39                 led_state &= ~LED_STATE_ENABLED;
40                 break;
41
42         case led_claim:
43                 led_state |= LED_STATE_CLAIMED;
44                 hw_led_state = LED_GREEN;
45                 break;
46
47         case led_release:
48                 led_state &= ~LED_STATE_CLAIMED;
49                 hw_led_state = LED_GREEN;
50                 break;
51
52 #ifdef CONFIG_LEDS_TIMER
53         case led_timer:
54                 if (!(led_state & LED_STATE_CLAIMED))
55                         hw_led_state ^= LED_GREEN;
56                 break;
57 #endif
58
59 #ifdef CONFIG_LEDS_CPU
60         case led_idle_start:
61                 break;
62
63         case led_idle_end:
64                 break;
65 #endif
66
67         case led_halted:
68                 break;
69
70         case led_green_on:
71                 if (led_state & LED_STATE_CLAIMED)
72                         hw_led_state |= LED_GREEN;
73                 break;
74
75         case led_green_off:
76                 if (led_state & LED_STATE_CLAIMED)
77                         hw_led_state &= ~LED_GREEN;
78                 break;
79
80         case led_amber_on:
81                 break;
82
83         case led_amber_off:
84                 break;
85
86         case led_red_on:
87                 break;
88
89         case led_red_off:
90                 break;
91
92         default:
93                 break;
94         }
95
96         if  (led_state & LED_STATE_ENABLED)
97                 cs3_shadow |= LED2_ON;
98
99         //local_irq_restore(flags);
100 }
101