acpiphp: Execute ACPI _REG method for hotadded devices
[linux/fpc-iii.git] / arch / arm / mach-sa1100 / leds-lart.c
blob0505a1fdcdb2b98f203d0db244fcf57aac12e1da
1 /*
2 * linux/arch/arm/mach-sa1100/leds-lart.c
4 * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000
6 * LART uses the LED as follows:
7 * - GPIO23 is the LED, on if system is not idle
8 * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same
9 * time, but in that case the timer events will still dictate the
10 * pace of the LED.
12 #include <linux/init.h>
14 #include <mach/hardware.h>
15 #include <asm/leds.h>
16 #include <asm/system.h>
18 #include "leds.h"
21 #define LED_STATE_ENABLED 1
22 #define LED_STATE_CLAIMED 2
24 static unsigned int led_state;
25 static unsigned int hw_led_state;
27 #define LED_23 GPIO_GPIO23
28 #define LED_MASK (LED_23)
30 void lart_leds_event(led_event_t evt)
32 unsigned long flags;
34 local_irq_save(flags);
36 switch(evt) {
37 case led_start:
38 /* pin 23 is output pin */
39 GPDR |= LED_23;
40 hw_led_state = LED_MASK;
41 led_state = LED_STATE_ENABLED;
42 break;
44 case led_stop:
45 led_state &= ~LED_STATE_ENABLED;
46 break;
48 case led_claim:
49 led_state |= LED_STATE_CLAIMED;
50 hw_led_state = LED_MASK;
51 break;
53 case led_release:
54 led_state &= ~LED_STATE_CLAIMED;
55 hw_led_state = LED_MASK;
56 break;
58 #ifdef CONFIG_LEDS_TIMER
59 case led_timer:
60 if (!(led_state & LED_STATE_CLAIMED))
61 hw_led_state ^= LED_23;
62 break;
63 #endif
65 #ifdef CONFIG_LEDS_CPU
66 case led_idle_start:
67 /* The LART people like the LED to be off when the
68 system is idle... */
69 if (!(led_state & LED_STATE_CLAIMED))
70 hw_led_state &= ~LED_23;
71 break;
73 case led_idle_end:
74 /* ... and on if the system is not idle */
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= LED_23;
77 break;
78 #endif
80 case led_red_on:
81 if (led_state & LED_STATE_CLAIMED)
82 hw_led_state &= ~LED_23;
83 break;
85 case led_red_off:
86 if (led_state & LED_STATE_CLAIMED)
87 hw_led_state |= LED_23;
88 break;
90 default:
91 break;
94 /* Now set the GPIO state, or nothing will happen at all */
95 if (led_state & LED_STATE_ENABLED) {
96 GPSR = hw_led_state;
97 GPCR = hw_led_state ^ LED_MASK;
100 local_irq_restore(flags);