Merge branches 'irq-urgent-for-linus' and 'smp-hotplug-for-linus' of git://git.kernel...
[deliverable/linux.git] / arch / arm / mach-sa1100 / leds-lart.c
CommitLineData
1da177e4
LT
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 */
1da177e4
LT
12#include <linux/init.h>
13
a09e64fb 14#include <mach/hardware.h>
1da177e4 15#include <asm/leds.h>
1da177e4
LT
16
17#include "leds.h"
18
19
20#define LED_STATE_ENABLED 1
21#define LED_STATE_CLAIMED 2
22
23static unsigned int led_state;
24static unsigned int hw_led_state;
25
26#define LED_23 GPIO_GPIO23
27#define LED_MASK (LED_23)
28
29void lart_leds_event(led_event_t evt)
30{
31 unsigned long flags;
32
33 local_irq_save(flags);
34
35 switch(evt) {
36 case led_start:
37 /* pin 23 is output pin */
38 GPDR |= LED_23;
39 hw_led_state = LED_MASK;
40 led_state = LED_STATE_ENABLED;
41 break;
42
43 case led_stop:
44 led_state &= ~LED_STATE_ENABLED;
45 break;
46
47 case led_claim:
48 led_state |= LED_STATE_CLAIMED;
49 hw_led_state = LED_MASK;
50 break;
51
52 case led_release:
53 led_state &= ~LED_STATE_CLAIMED;
54 hw_led_state = LED_MASK;
55 break;
56
57#ifdef CONFIG_LEDS_TIMER
58 case led_timer:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state ^= LED_23;
61 break;
62#endif
63
64#ifdef CONFIG_LEDS_CPU
65 case led_idle_start:
66 /* The LART people like the LED to be off when the
67 system is idle... */
68 if (!(led_state & LED_STATE_CLAIMED))
69 hw_led_state &= ~LED_23;
70 break;
71
72 case led_idle_end:
73 /* ... and on if the system is not idle */
74 if (!(led_state & LED_STATE_CLAIMED))
75 hw_led_state |= LED_23;
76 break;
77#endif
78
79 case led_red_on:
80 if (led_state & LED_STATE_CLAIMED)
81 hw_led_state &= ~LED_23;
82 break;
83
84 case led_red_off:
85 if (led_state & LED_STATE_CLAIMED)
86 hw_led_state |= LED_23;
87 break;
88
89 default:
90 break;
91 }
92
93 /* Now set the GPIO state, or nothing will happen at all */
94 if (led_state & LED_STATE_ENABLED) {
95 GPSR = hw_led_state;
96 GPCR = hw_led_state ^ LED_MASK;
97 }
98
99 local_irq_restore(flags);
100}
This page took 0.630727 seconds and 5 git commands to generate.