PCI / PM: Block races between runtime PM and system sleep
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-sa1100 / leds-simpad.c
blobd50f4eeaa12ee5045282eca6d2b96cc18b59fa42
1 /*
2 * linux/arch/arm/mach-sa1100/leds-simpad.c
4 * Author: Juergen Messerer <juergen.messerer@siemens.ch>
5 */
6 #include <linux/init.h>
8 #include <mach/hardware.h>
9 #include <asm/leds.h>
10 #include <asm/system.h>
11 #include <mach/simpad.h>
13 #include "leds.h"
16 #define LED_STATE_ENABLED 1
17 #define LED_STATE_CLAIMED 2
19 static unsigned int led_state;
20 static unsigned int hw_led_state;
22 #define LED_GREEN (1)
23 #define LED_MASK (1)
25 extern void set_cs3_bit(int value);
26 extern void clear_cs3_bit(int value);
28 void simpad_leds_event(led_event_t evt)
30 switch (evt)
32 case led_start:
33 hw_led_state = LED_GREEN;
34 led_state = LED_STATE_ENABLED;
35 break;
37 case led_stop:
38 led_state &= ~LED_STATE_ENABLED;
39 break;
41 case led_claim:
42 led_state |= LED_STATE_CLAIMED;
43 hw_led_state = LED_GREEN;
44 break;
46 case led_release:
47 led_state &= ~LED_STATE_CLAIMED;
48 hw_led_state = LED_GREEN;
49 break;
51 #ifdef CONFIG_LEDS_TIMER
52 case led_timer:
53 if (!(led_state & LED_STATE_CLAIMED))
54 hw_led_state ^= LED_GREEN;
55 break;
56 #endif
58 #ifdef CONFIG_LEDS_CPU
59 case led_idle_start:
60 break;
62 case led_idle_end:
63 break;
64 #endif
66 case led_halted:
67 break;
69 case led_green_on:
70 if (led_state & LED_STATE_CLAIMED)
71 hw_led_state |= LED_GREEN;
72 break;
74 case led_green_off:
75 if (led_state & LED_STATE_CLAIMED)
76 hw_led_state &= ~LED_GREEN;
77 break;
79 case led_amber_on:
80 break;
82 case led_amber_off:
83 break;
85 case led_red_on:
86 break;
88 case led_red_off:
89 break;
91 default:
92 break;
95 if (led_state & LED_STATE_ENABLED)
96 set_cs3_bit(LED2_ON);
97 else
98 clear_cs3_bit(LED2_ON);