Sysace: Move IRQ handler registration to occur after FSM is initialized
[linux-2.6/mini2440.git] / arch / arm / mach-pxa / leds-lubbock.c
blobafbc6698e27cfce4107bee4f097f2db98cf79065
1 /*
2 * linux/arch/arm/mach-pxa/leds-lubbock.c
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
6 * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com>
8 * Original (leds-footbridge.c) by Russell King
10 * Major surgery on April 2004 by Nicolas Pitre for less global
11 * namespace collision. Mostly adapted the Mainstone version.
14 #include <linux/init.h>
16 #include <asm/hardware.h>
17 #include <asm/leds.h>
18 #include <asm/system.h>
19 #include <asm/arch/pxa-regs.h>
20 #include <asm/arch/lubbock.h>
22 #include "leds.h"
25 * 8 discrete leds available for general use:
27 * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays
28 * so be sure to not monkey with them here.
31 #define D28 (1 << 0)
32 #define D27 (1 << 1)
33 #define D26 (1 << 2)
34 #define D25 (1 << 3)
35 #define D24 (1 << 4)
36 #define D23 (1 << 5)
37 #define D22 (1 << 6)
38 #define D21 (1 << 7)
40 #define LED_STATE_ENABLED 1
41 #define LED_STATE_CLAIMED 2
43 static unsigned int led_state;
44 static unsigned int hw_led_state;
46 void lubbock_leds_event(led_event_t evt)
48 unsigned long flags;
50 local_irq_save(flags);
52 switch (evt) {
53 case led_start:
54 hw_led_state = 0;
55 led_state = LED_STATE_ENABLED;
56 break;
58 case led_stop:
59 led_state &= ~LED_STATE_ENABLED;
60 break;
62 case led_claim:
63 led_state |= LED_STATE_CLAIMED;
64 hw_led_state = 0;
65 break;
67 case led_release:
68 led_state &= ~LED_STATE_CLAIMED;
69 hw_led_state = 0;
70 break;
72 #ifdef CONFIG_LEDS_TIMER
73 case led_timer:
74 hw_led_state ^= D26;
75 break;
76 #endif
78 #ifdef CONFIG_LEDS_CPU
79 case led_idle_start:
80 hw_led_state &= ~D27;
81 break;
83 case led_idle_end:
84 hw_led_state |= D27;
85 break;
86 #endif
88 case led_halted:
89 break;
91 case led_green_on:
92 hw_led_state |= D21;
93 break;
95 case led_green_off:
96 hw_led_state &= ~D21;
97 break;
99 case led_amber_on:
100 hw_led_state |= D22;
101 break;
103 case led_amber_off:
104 hw_led_state &= ~D22;
105 break;
107 case led_red_on:
108 hw_led_state |= D23;
109 break;
111 case led_red_off:
112 hw_led_state &= ~D23;
113 break;
115 default:
116 break;
119 if (led_state & LED_STATE_ENABLED)
120 LUB_DISC_BLNK_LED = (LUB_DISC_BLNK_LED | 0xff) & ~hw_led_state;
121 else
122 LUB_DISC_BLNK_LED |= 0xff;
124 local_irq_restore(flags);