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