aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/leds-assabet.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-sa1100/leds-assabet.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/arm/mach-sa1100/leds-assabet.c')
-rw-r--r--arch/arm/mach-sa1100/leds-assabet.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/leds-assabet.c b/arch/arm/mach-sa1100/leds-assabet.c
new file mode 100644
index 000000000000..e9aa9dff211a
--- /dev/null
+++ b/arch/arm/mach-sa1100/leds-assabet.c
@@ -0,0 +1,115 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-assabet.c
3 *
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
5 *
6 * Original (leds-footbridge.c) by Russell King
7 *
8 * Assabet uses the LEDs as follows:
9 * - Green - toggles state every 50 timer interrupts
10 * - Red - on if system is not idle
11 */
12#include <linux/config.h>
13#include <linux/init.h>
14
15#include <asm/hardware.h>
16#include <asm/leds.h>
17#include <asm/system.h>
18#include <asm/arch/assabet.h>
19
20#include "leds.h"
21
22
23#define LED_STATE_ENABLED 1
24#define LED_STATE_CLAIMED 2
25
26static unsigned int led_state;
27static unsigned int hw_led_state;
28
29#define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED)
30
31void assabet_leds_event(led_event_t evt)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36
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;
42
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;
48
49 case led_claim:
50 led_state |= LED_STATE_CLAIMED;
51 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
52 break;
53
54 case led_release:
55 led_state &= ~LED_STATE_CLAIMED;
56 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
57 break;
58
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
65
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;
71
72 case led_idle_end:
73 if (!(led_state & LED_STATE_CLAIMED))
74 hw_led_state &= ~ASSABET_BCR_LED_RED;
75 break;
76#endif
77
78 case led_halted:
79 break;
80
81 case led_green_on:
82 if (led_state & LED_STATE_CLAIMED)
83 hw_led_state &= ~ASSABET_BCR_LED_GREEN;
84 break;
85
86 case led_green_off:
87 if (led_state & LED_STATE_CLAIMED)
88 hw_led_state |= ASSABET_BCR_LED_GREEN;
89 break;
90
91 case led_amber_on:
92 break;
93
94 case led_amber_off:
95 break;
96
97 case led_red_on:
98 if (led_state & LED_STATE_CLAIMED)
99 hw_led_state &= ~ASSABET_BCR_LED_RED;
100 break;
101
102 case led_red_off:
103 if (led_state & LED_STATE_CLAIMED)
104 hw_led_state |= ASSABET_BCR_LED_RED;
105 break;
106
107 default:
108 break;
109 }
110
111 if (led_state & LED_STATE_ENABLED)
112 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
113
114 local_irq_restore(flags);
115}