2 * linux/arch/arm/mach-sa1100/leds-adsbitsy.c
5 * 2/7/2003 Robert Whaley
6 * This file comes from leds-adsbitsy.c of Woojung Huh <whuh@applieddata.net>
8 #include <linux/config.h>
9 #include <linux/init.h>
11 #include <asm/hardware.h>
13 #include <asm/system.h>
18 #define LED_STATE_ENABLED 1
19 #define LED_STATE_CLAIMED 2
21 static unsigned int led_state;
22 static unsigned int hw_led_state;
24 #define LED_TIMER GPIO_GPIO20 /* green heartbeat */
26 #define LED_MASK (LED_TIMER)
28 void adsbitsyplus_leds_event(led_event_t evt)
32 local_irq_save(flags);
36 hw_led_state = 0; /* gc leds are positive logic */
37 led_state = LED_STATE_ENABLED;
41 led_state &= ~LED_STATE_ENABLED;
45 led_state |= LED_STATE_CLAIMED;
46 hw_led_state = LED_MASK;
50 led_state &= ~LED_STATE_CLAIMED;
51 hw_led_state = LED_MASK;
54 #ifdef CONFIG_LEDS_TIMER
56 if (!(led_state & LED_STATE_CLAIMED))
57 hw_led_state ^= LED_TIMER;
61 #ifdef CONFIG_LEDS_CPU
91 if (led_state & LED_STATE_ENABLED) {
93 GPCR = hw_led_state ^ LED_MASK;
96 local_irq_restore(flags);