MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-sa1100 / leds-simpad.c
blobda426bcd19f1890e916bfe5d0c18e4804d584a45
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 unsigned long flags;
33 //local_irq_save(flags);
35 switch (evt)
37 case led_start:
38 hw_led_state = LED_GREEN;
39 led_state = LED_STATE_ENABLED;
40 break;
42 case led_stop:
43 led_state &= ~LED_STATE_ENABLED;
44 break;
46 case led_claim:
47 led_state |= LED_STATE_CLAIMED;
48 hw_led_state = LED_GREEN;
49 break;
51 case led_release:
52 led_state &= ~LED_STATE_CLAIMED;
53 hw_led_state = LED_GREEN;
54 break;
56 #ifdef CONFIG_LEDS_TIMER
57 case led_timer:
58 if (!(led_state & LED_STATE_CLAIMED))
59 hw_led_state ^= LED_GREEN;
60 break;
61 #endif
63 #ifdef CONFIG_LEDS_CPU
64 case led_idle_start:
65 break;
67 case led_idle_end:
68 break;
69 #endif
71 case led_halted:
72 break;
74 case led_green_on:
75 if (led_state & LED_STATE_CLAIMED)
76 hw_led_state |= LED_GREEN;
77 break;
79 case led_green_off:
80 if (led_state & LED_STATE_CLAIMED)
81 hw_led_state &= ~LED_GREEN;
82 break;
84 case led_amber_on:
85 break;
87 case led_amber_off:
88 break;
90 case led_red_on:
91 break;
93 case led_red_off:
94 break;
96 default:
97 break;
100 if (led_state & LED_STATE_ENABLED)
101 set_cs3_bit(LED2_ON);
102 else
103 clear_cs3_bit(LED2_ON);
104 //local_irq_restore(flags);