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
12 #include <linux/init.h>
14 #include <mach/hardware.h>
16 #include <asm/system.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
)
34 local_irq_save(flags
);
38 /* pin 23 is output pin */
40 hw_led_state
= LED_MASK
;
41 led_state
= LED_STATE_ENABLED
;
45 led_state
&= ~LED_STATE_ENABLED
;
49 led_state
|= LED_STATE_CLAIMED
;
50 hw_led_state
= LED_MASK
;
54 led_state
&= ~LED_STATE_CLAIMED
;
55 hw_led_state
= LED_MASK
;
58 #ifdef CONFIG_LEDS_TIMER
60 if (!(led_state
& LED_STATE_CLAIMED
))
61 hw_led_state
^= LED_23
;
65 #ifdef CONFIG_LEDS_CPU
67 /* The LART people like the LED to be off when the
69 if (!(led_state
& LED_STATE_CLAIMED
))
70 hw_led_state
&= ~LED_23
;
74 /* ... and on if the system is not idle */
75 if (!(led_state
& LED_STATE_CLAIMED
))
76 hw_led_state
|= LED_23
;
81 if (led_state
& LED_STATE_CLAIMED
)
82 hw_led_state
&= ~LED_23
;
86 if (led_state
& LED_STATE_CLAIMED
)
87 hw_led_state
|= LED_23
;
94 /* Now set the GPIO state, or nothing will happen at all */
95 if (led_state
& LED_STATE_ENABLED
) {
97 GPCR
= hw_led_state
^ LED_MASK
;
100 local_irq_restore(flags
);