acpiphp: Execute ACPI _REG method for hotadded devices
[linux/fpc-iii.git] / arch / arm / mach-sa1100 / leds-assabet.c
blob64e9b4b11b5454b83f192b93ac0b8ff0b5782d66
1 /*
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>
15 #include <asm/leds.h>
16 #include <asm/system.h>
17 #include <mach/assabet.h>
19 #include "leds.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)
32 unsigned long flags;
34 local_irq_save(flags);
36 switch (evt) {
37 case led_start:
38 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
39 led_state = LED_STATE_ENABLED;
40 break;
42 case led_stop:
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);
46 break;
48 case led_claim:
49 led_state |= LED_STATE_CLAIMED;
50 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
51 break;
53 case led_release:
54 led_state &= ~LED_STATE_CLAIMED;
55 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
56 break;
58 #ifdef CONFIG_LEDS_TIMER
59 case led_timer:
60 if (!(led_state & LED_STATE_CLAIMED))
61 hw_led_state ^= ASSABET_BCR_LED_GREEN;
62 break;
63 #endif
65 #ifdef CONFIG_LEDS_CPU
66 case led_idle_start:
67 if (!(led_state & LED_STATE_CLAIMED))
68 hw_led_state |= ASSABET_BCR_LED_RED;
69 break;
71 case led_idle_end:
72 if (!(led_state & LED_STATE_CLAIMED))
73 hw_led_state &= ~ASSABET_BCR_LED_RED;
74 break;
75 #endif
77 case led_halted:
78 break;
80 case led_green_on:
81 if (led_state & LED_STATE_CLAIMED)
82 hw_led_state &= ~ASSABET_BCR_LED_GREEN;
83 break;
85 case led_green_off:
86 if (led_state & LED_STATE_CLAIMED)
87 hw_led_state |= ASSABET_BCR_LED_GREEN;
88 break;
90 case led_amber_on:
91 break;
93 case led_amber_off:
94 break;
96 case led_red_on:
97 if (led_state & LED_STATE_CLAIMED)
98 hw_led_state &= ~ASSABET_BCR_LED_RED;
99 break;
101 case led_red_off:
102 if (led_state & LED_STATE_CLAIMED)
103 hw_led_state |= ASSABET_BCR_LED_RED;
104 break;
106 default:
107 break;
110 if (led_state & LED_STATE_ENABLED)
111 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
113 local_irq_restore(flags);