diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-sa1100/leds-lart.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-lart.c')
-rw-r--r-- | arch/arm/mach-sa1100/leds-lart.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/leds-lart.c b/arch/arm/mach-sa1100/leds-lart.c new file mode 100644 index 000000000000..187501490713 --- /dev/null +++ b/arch/arm/mach-sa1100/leds-lart.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds-lart.c | ||
3 | * | ||
4 | * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000 | ||
5 | * | ||
6 | * LART uses the LED as follows: | ||
7 | * - GPIO23 is the LED, on if system is not idle | ||
8 | * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same | ||
9 | * time, but in that case the timer events will still dictate the | ||
10 | * pace of the LED. | ||
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 | |||
19 | #include "leds.h" | ||
20 | |||
21 | |||
22 | #define LED_STATE_ENABLED 1 | ||
23 | #define LED_STATE_CLAIMED 2 | ||
24 | |||
25 | static unsigned int led_state; | ||
26 | static unsigned int hw_led_state; | ||
27 | |||
28 | #define LED_23 GPIO_GPIO23 | ||
29 | #define LED_MASK (LED_23) | ||
30 | |||
31 | void lart_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 | /* pin 23 is output pin */ | ||
40 | GPDR |= LED_23; | ||
41 | hw_led_state = LED_MASK; | ||
42 | led_state = LED_STATE_ENABLED; | ||
43 | break; | ||
44 | |||
45 | case led_stop: | ||
46 | led_state &= ~LED_STATE_ENABLED; | ||
47 | break; | ||
48 | |||
49 | case led_claim: | ||
50 | led_state |= LED_STATE_CLAIMED; | ||
51 | hw_led_state = LED_MASK; | ||
52 | break; | ||
53 | |||
54 | case led_release: | ||
55 | led_state &= ~LED_STATE_CLAIMED; | ||
56 | hw_led_state = LED_MASK; | ||
57 | break; | ||
58 | |||
59 | #ifdef CONFIG_LEDS_TIMER | ||
60 | case led_timer: | ||
61 | if (!(led_state & LED_STATE_CLAIMED)) | ||
62 | hw_led_state ^= LED_23; | ||
63 | break; | ||
64 | #endif | ||
65 | |||
66 | #ifdef CONFIG_LEDS_CPU | ||
67 | case led_idle_start: | ||
68 | /* The LART people like the LED to be off when the | ||
69 | system is idle... */ | ||
70 | if (!(led_state & LED_STATE_CLAIMED)) | ||
71 | hw_led_state &= ~LED_23; | ||
72 | break; | ||
73 | |||
74 | case led_idle_end: | ||
75 | /* ... and on if the system is not idle */ | ||
76 | if (!(led_state & LED_STATE_CLAIMED)) | ||
77 | hw_led_state |= LED_23; | ||
78 | break; | ||
79 | #endif | ||
80 | |||
81 | case led_red_on: | ||
82 | if (led_state & LED_STATE_CLAIMED) | ||
83 | hw_led_state &= ~LED_23; | ||
84 | break; | ||
85 | |||
86 | case led_red_off: | ||
87 | if (led_state & LED_STATE_CLAIMED) | ||
88 | hw_led_state |= LED_23; | ||
89 | break; | ||
90 | |||
91 | default: | ||
92 | break; | ||
93 | } | ||
94 | |||
95 | /* Now set the GPIO state, or nothing will happen at all */ | ||
96 | if (led_state & LED_STATE_ENABLED) { | ||
97 | GPSR = hw_led_state; | ||
98 | GPCR = hw_led_state ^ LED_MASK; | ||
99 | } | ||
100 | |||
101 | local_irq_restore(flags); | ||
102 | } | ||