[PATCH] ARM: Remove argument for disable_irq/enable_irq
[linux-2.6] / arch / arm / mach-sa1100 / leds-hackkit.c
1 /*
2  * linux/arch/arm/mach-sa1100/leds-hackkit.c
3  *
4  * based on leds-lart.c
5  *
6  * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000
7  * (C) Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>, 2002
8  *
9  * The HackKit has two leds (GPIO 22/23). The red led (gpio 22) is used
10  * as cpu led, the green one is used as timer led.
11  */
12 #include <linux/config.h>
13 #include <linux/init.h>
14
15 #include <asm/hardware.h>
16 #include <asm/leds.h>
17 #include <asm/system.h>
18
19 #include "leds.h"
20
21
22 #define LED_STATE_ENABLED       1
23 #define LED_STATE_CLAIMED       2
24
25 static unsigned int led_state;
26 static unsigned int hw_led_state;
27
28 #define LED_GREEN    GPIO_GPIO23
29 #define LED_RED    GPIO_GPIO22
30 #define LED_MASK  (LED_RED | LED_GREEN)
31
32 void hackkit_leds_event(led_event_t evt)
33 {
34         unsigned long flags;
35
36         local_irq_save(flags);
37
38         switch(evt) {
39                 case led_start:
40                         /* pin 22/23 are outputs */
41                         GPDR |= LED_MASK;
42                         hw_led_state = LED_MASK;
43                         led_state = LED_STATE_ENABLED;
44                         break;
45
46                 case led_stop:
47                         led_state &= ~LED_STATE_ENABLED;
48                         break;
49
50                 case led_claim:
51                         led_state |= LED_STATE_CLAIMED;
52                         hw_led_state = LED_MASK;
53                         break;
54
55                 case led_release:
56                         led_state &= ~LED_STATE_CLAIMED;
57                         hw_led_state = LED_MASK;
58                         break;
59
60 #ifdef CONFIG_LEDS_TIMER
61                 case led_timer:
62                         if (!(led_state & LED_STATE_CLAIMED))
63                                 hw_led_state ^= LED_GREEN;
64                         break;
65 #endif
66
67 #ifdef CONFIG_LEDS_CPU
68                 case led_idle_start:
69                         /* The LART people like the LED to be off when the
70                            system is idle... */
71                         if (!(led_state & LED_STATE_CLAIMED))
72                                 hw_led_state &= ~LED_RED;
73                         break;
74
75                 case led_idle_end:
76                         /* ... and on if the system is not idle */
77                         if (!(led_state & LED_STATE_CLAIMED))
78                                 hw_led_state |= LED_RED;
79                         break;
80 #endif
81
82                 case led_red_on:
83                         if (led_state & LED_STATE_CLAIMED)
84                                 hw_led_state &= ~LED_RED;
85                         break;
86
87                 case led_red_off:
88                         if (led_state & LED_STATE_CLAIMED)
89                                 hw_led_state |= LED_RED;
90                         break;
91
92                 case led_green_on:
93                         if (led_state & LED_STATE_CLAIMED)
94                                 hw_led_state &= ~LED_GREEN;
95                         break;
96
97                 case led_green_off:
98                         if (led_state & LED_STATE_CLAIMED)
99                                 hw_led_state |= LED_GREEN;
100                         break;
101
102                 default:
103                         break;
104         }
105
106         /* Now set the GPIO state, or nothing will happen at all */
107         if (led_state & LED_STATE_ENABLED) {
108                 GPSR = hw_led_state;
109                 GPCR = hw_led_state ^ LED_MASK;
110         }
111
112         local_irq_restore(flags);
113 }