Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireles...
[linux-2.6] / 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/init.h>
7
8 #include <asm/hardware.h>
9 #include <asm/leds.h>
10 #include <asm/system.h>
11 #include <asm/arch/simpad.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 extern void set_cs3_bit(int value);
26 extern void clear_cs3_bit(int value);     
27
28 void simpad_leds_event(led_event_t evt)
29 {
30         switch (evt)
31         {
32         case led_start:
33                 hw_led_state = LED_GREEN;
34                 led_state = LED_STATE_ENABLED;
35                 break;
36
37         case led_stop:
38                 led_state &= ~LED_STATE_ENABLED;
39                 break;
40
41         case led_claim:
42                 led_state |= LED_STATE_CLAIMED;
43                 hw_led_state = LED_GREEN;
44                 break;
45
46         case led_release:
47                 led_state &= ~LED_STATE_CLAIMED;
48                 hw_led_state = LED_GREEN;
49                 break;
50
51 #ifdef CONFIG_LEDS_TIMER
52         case led_timer:
53                 if (!(led_state & LED_STATE_CLAIMED))
54                         hw_led_state ^= LED_GREEN;
55                 break;
56 #endif
57
58 #ifdef CONFIG_LEDS_CPU
59         case led_idle_start:
60                 break;
61
62         case led_idle_end:
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 |= LED_GREEN;
72                 break;
73
74         case led_green_off:
75                 if (led_state & LED_STATE_CLAIMED)
76                         hw_led_state &= ~LED_GREEN;
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                 break;
87
88         case led_red_off:
89                 break;
90
91         default:
92                 break;
93         }
94
95         if  (led_state & LED_STATE_ENABLED)
96                 set_cs3_bit(LED2_ON);
97         else 
98                 clear_cs3_bit(LED2_ON);
99 }
100