Linux 2.6.13-rc4
[linux-2.6/next.git] / arch / arm / mach-sa1100 / leds-simpad.c
blob6a27a2d32206101dd549684ccbc744de258c4fae
1 /*
2 * linux/arch/arm/mach-sa1100/leds-simpad.c
4 * Author: Juergen Messerer <juergen.messerer@siemens.ch>
5 */
6 #include <linux/config.h>
7 #include <linux/init.h>
9 #include <asm/hardware.h>
10 #include <asm/leds.h>
11 #include <asm/system.h>
12 #include <asm/arch/simpad.h>
14 #include "leds.h"
17 #define LED_STATE_ENABLED 1
18 #define LED_STATE_CLAIMED 2
20 static unsigned int led_state;
21 static unsigned int hw_led_state;
23 #define LED_GREEN (1)
24 #define LED_MASK (1)
26 extern void set_cs3_bit(int value);
27 extern void clear_cs3_bit(int value);
29 void simpad_leds_event(led_event_t evt)
31 switch (evt)
33 case led_start:
34 hw_led_state = LED_GREEN;
35 led_state = LED_STATE_ENABLED;
36 break;
38 case led_stop:
39 led_state &= ~LED_STATE_ENABLED;
40 break;
42 case led_claim:
43 led_state |= LED_STATE_CLAIMED;
44 hw_led_state = LED_GREEN;
45 break;
47 case led_release:
48 led_state &= ~LED_STATE_CLAIMED;
49 hw_led_state = LED_GREEN;
50 break;
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
59 #ifdef CONFIG_LEDS_CPU
60 case led_idle_start:
61 break;
63 case led_idle_end:
64 break;
65 #endif
67 case led_halted:
68 break;
70 case led_green_on:
71 if (led_state & LED_STATE_CLAIMED)
72 hw_led_state |= LED_GREEN;
73 break;
75 case led_green_off:
76 if (led_state & LED_STATE_CLAIMED)
77 hw_led_state &= ~LED_GREEN;
78 break;
80 case led_amber_on:
81 break;
83 case led_amber_off:
84 break;
86 case led_red_on:
87 break;
89 case led_red_off:
90 break;
92 default:
93 break;
96 if (led_state & LED_STATE_ENABLED)
97 set_cs3_bit(LED2_ON);
98 else
99 clear_cs3_bit(LED2_ON);