2 * linux/arch/arm/mach-sa1100/leds-assabet.c
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
6 * Original (leds-footbridge.c) by Russell King
8 * Assabet uses the LEDs as follows:
9 * - Green - toggles state every 50 timer interrupts
10 * - Red - on if system is not idle
12 #include <linux/init.h>
14 #include <mach/hardware.h>
16 #include <asm/system.h>
17 #include <mach/assabet.h>
22 #define LED_STATE_ENABLED 1
23 #define LED_STATE_CLAIMED 2
25 static unsigned int led_state
;
26 static unsigned int hw_led_state
;
28 #define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED)
30 void assabet_leds_event(led_event_t evt
)
34 local_irq_save(flags
);
38 hw_led_state
= ASSABET_BCR_LED_RED
| ASSABET_BCR_LED_GREEN
;
39 led_state
= LED_STATE_ENABLED
;
43 led_state
&= ~LED_STATE_ENABLED
;
44 hw_led_state
= ASSABET_BCR_LED_RED
| ASSABET_BCR_LED_GREEN
;
45 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK
, hw_led_state
);
49 led_state
|= LED_STATE_CLAIMED
;
50 hw_led_state
= ASSABET_BCR_LED_RED
| ASSABET_BCR_LED_GREEN
;
54 led_state
&= ~LED_STATE_CLAIMED
;
55 hw_led_state
= ASSABET_BCR_LED_RED
| ASSABET_BCR_LED_GREEN
;
58 #ifdef CONFIG_LEDS_TIMER
60 if (!(led_state
& LED_STATE_CLAIMED
))
61 hw_led_state
^= ASSABET_BCR_LED_GREEN
;
65 #ifdef CONFIG_LEDS_CPU
67 if (!(led_state
& LED_STATE_CLAIMED
))
68 hw_led_state
|= ASSABET_BCR_LED_RED
;
72 if (!(led_state
& LED_STATE_CLAIMED
))
73 hw_led_state
&= ~ASSABET_BCR_LED_RED
;
81 if (led_state
& LED_STATE_CLAIMED
)
82 hw_led_state
&= ~ASSABET_BCR_LED_GREEN
;
86 if (led_state
& LED_STATE_CLAIMED
)
87 hw_led_state
|= ASSABET_BCR_LED_GREEN
;
97 if (led_state
& LED_STATE_CLAIMED
)
98 hw_led_state
&= ~ASSABET_BCR_LED_RED
;
102 if (led_state
& LED_STATE_CLAIMED
)
103 hw_led_state
|= ASSABET_BCR_LED_RED
;
110 if (led_state
& LED_STATE_ENABLED
)
111 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK
, hw_led_state
);
113 local_irq_restore(flags
);
This page took 0.032262 seconds and 5 git commands to generate.