MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / arm / mach-sa1100 / leds-graphicsmaster.c
blob297dc613a1000e3d76cc8f3718ee7d3603d3db81
1 /*
2 * linux/arch/arm/mach-sa1100/leds-graphicsmaster.c
4 * GraphicsClient Plus LEDs support
5 * Woojung Huh, Feb 13, 2001
6 */
7 #include <linux/config.h>
8 #include <linux/init.h>
10 #include <asm/hardware.h>
11 #include <asm/leds.h>
12 #include <asm/system.h>
14 #include "leds.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)
31 unsigned long flags;
33 local_irq_save(flags);
35 switch (evt) {
36 case led_start:
37 hw_led_state = 0; /* gc leds are positive logic */
38 led_state = LED_STATE_ENABLED;
39 break;
41 case led_stop:
42 led_state &= ~LED_STATE_ENABLED;
43 break;
45 case led_claim:
46 led_state |= LED_STATE_CLAIMED;
47 hw_led_state = LED_MASK;
48 break;
50 case led_release:
51 led_state &= ~LED_STATE_CLAIMED;
52 hw_led_state = LED_MASK;
53 break;
55 #ifdef CONFIG_LEDS_TIMER
56 case led_timer:
57 if (!(led_state & LED_STATE_CLAIMED))
58 hw_led_state ^= LED_TIMER;
59 break;
60 #endif
62 #ifdef CONFIG_LEDS_CPU
63 case led_idle_start:
64 if (!(led_state & LED_STATE_CLAIMED))
65 hw_led_state &= ~LED_IDLE;
66 break;
68 case led_idle_end:
69 if (!(led_state & LED_STATE_CLAIMED))
70 hw_led_state |= LED_IDLE;
71 break;
72 #endif
74 case led_green_on:
75 break;
77 case led_green_off:
78 break;
80 case led_amber_on:
81 hw_led_state |= LED_USER;
82 break;
84 case led_amber_off:
85 hw_led_state &= ~LED_USER;
86 break;
88 case led_red_on:
89 break;
91 case led_red_off:
92 break;
94 default:
95 break;
98 if (led_state & LED_STATE_ENABLED) {
99 GPSR = hw_led_state;
100 GPCR = hw_led_state ^ LED_MASK;
103 local_irq_restore(flags);