2 * linux/arch/arm/mach-sa1100/leds-graphicsmaster.c
4 * GraphicsClient Plus LEDs support
5 * Woojung Huh, Feb 13, 2001
7 #include <linux/config.h>
8 #include <linux/init.h>
10 #include <asm/hardware.h>
12 #include <asm/system.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_TIMER ADS_LED0 /* green heartbeat */
24 #define LED_USER ADS_LED1 /* amber, boots to on */
25 #define LED_IDLE ADS_LED2 /* red has the idle led, if any */
27 #define LED_MASK (ADS_LED0|ADS_LED1|ADS_LED2)
29 void graphicsmaster_leds_event(led_event_t evt)
33 local_irq_save(flags);
37 hw_led_state = 0; /* gc leds are positive logic */
38 led_state = LED_STATE_ENABLED;
42 led_state &= ~LED_STATE_ENABLED;
46 led_state |= LED_STATE_CLAIMED;
47 hw_led_state = LED_MASK;
51 led_state &= ~LED_STATE_CLAIMED;
52 hw_led_state = LED_MASK;
55 #ifdef CONFIG_LEDS_TIMER
57 if (!(led_state & LED_STATE_CLAIMED))
58 hw_led_state ^= LED_TIMER;
62 #ifdef CONFIG_LEDS_CPU
64 if (!(led_state & LED_STATE_CLAIMED))
65 hw_led_state &= ~LED_IDLE;
69 if (!(led_state & LED_STATE_CLAIMED))
70 hw_led_state |= LED_IDLE;
81 hw_led_state |= LED_USER;
85 hw_led_state &= ~LED_USER;
98 if (led_state & LED_STATE_ENABLED) {
100 GPCR = hw_led_state ^ LED_MASK;
103 local_irq_restore(flags);