[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / arm / mach-sa1100 / leds-assabet.c
blobe9aa9dff211a5f273a4b1d067d837cd63e68c39f
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/config.h>
13 #include <linux/init.h>
15 #include <asm/hardware.h>
16 #include <asm/leds.h>
17 #include <asm/system.h>
18 #include <asm/arch/assabet.h>
20 #include "leds.h"
23 #define LED_STATE_ENABLED 1
24 #define LED_STATE_CLAIMED 2
26 static unsigned int led_state;
27 static unsigned int hw_led_state;
29 #define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED)
31 void assabet_leds_event(led_event_t evt)
33 unsigned long flags;
35 local_irq_save(flags);
37 switch (evt) {
38 case led_start:
39 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
40 led_state = LED_STATE_ENABLED;
41 break;
43 case led_stop:
44 led_state &= ~LED_STATE_ENABLED;
45 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
46 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
47 break;
49 case led_claim:
50 led_state |= LED_STATE_CLAIMED;
51 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
52 break;
54 case led_release:
55 led_state &= ~LED_STATE_CLAIMED;
56 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
57 break;
59 #ifdef CONFIG_LEDS_TIMER
60 case led_timer:
61 if (!(led_state & LED_STATE_CLAIMED))
62 hw_led_state ^= ASSABET_BCR_LED_GREEN;
63 break;
64 #endif
66 #ifdef CONFIG_LEDS_CPU
67 case led_idle_start:
68 if (!(led_state & LED_STATE_CLAIMED))
69 hw_led_state |= ASSABET_BCR_LED_RED;
70 break;
72 case led_idle_end:
73 if (!(led_state & LED_STATE_CLAIMED))
74 hw_led_state &= ~ASSABET_BCR_LED_RED;
75 break;
76 #endif
78 case led_halted:
79 break;
81 case led_green_on:
82 if (led_state & LED_STATE_CLAIMED)
83 hw_led_state &= ~ASSABET_BCR_LED_GREEN;
84 break;
86 case led_green_off:
87 if (led_state & LED_STATE_CLAIMED)
88 hw_led_state |= ASSABET_BCR_LED_GREEN;
89 break;
91 case led_amber_on:
92 break;
94 case led_amber_off:
95 break;
97 case led_red_on:
98 if (led_state & LED_STATE_CLAIMED)
99 hw_led_state &= ~ASSABET_BCR_LED_RED;
100 break;
102 case led_red_off:
103 if (led_state & LED_STATE_CLAIMED)
104 hw_led_state |= ASSABET_BCR_LED_RED;
105 break;
107 default:
108 break;
111 if (led_state & LED_STATE_ENABLED)
112 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
114 local_irq_restore(flags);