diff options
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 8 | ||||
-rw-r--r-- | arch/arm/mach-pxa/idp.c | 81 | ||||
-rw-r--r-- | arch/arm/mach-pxa/leds-idp.c | 115 | ||||
-rw-r--r-- | arch/arm/mach-pxa/leds-lubbock.c | 124 | ||||
-rw-r--r-- | arch/arm/mach-pxa/leds-mainstone.c | 119 | ||||
-rw-r--r-- | arch/arm/mach-pxa/leds.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-pxa/leds.h | 13 | ||||
-rw-r--r-- | arch/arm/mach-pxa/lubbock.c | 95 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 94 |
9 files changed, 270 insertions, 411 deletions
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index be0f7df8685c..d4337e300ada 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -95,12 +95,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR) += raumfeld.o | |||
95 | obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o | 95 | obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o |
96 | obj-$(CONFIG_MACH_ZIPIT2) += z2.o | 96 | obj-$(CONFIG_MACH_ZIPIT2) += z2.o |
97 | 97 | ||
98 | # Support for blinky lights | ||
99 | led-y := leds.o | ||
100 | led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o | ||
101 | led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o | ||
102 | led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o | ||
103 | |||
104 | obj-$(CONFIG_LEDS) += $(led-y) | ||
105 | |||
106 | obj-$(CONFIG_TOSA_BT) += tosa-bt.o | 98 | obj-$(CONFIG_TOSA_BT) += tosa-bt.o |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 6ff466bd43e8..ae1e9977603e 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -191,6 +191,87 @@ static void __init idp_map_io(void) | |||
191 | iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc)); | 191 | iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc)); |
192 | } | 192 | } |
193 | 193 | ||
194 | /* LEDs */ | ||
195 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
196 | struct idp_led { | ||
197 | struct led_classdev cdev; | ||
198 | u8 mask; | ||
199 | }; | ||
200 | |||
201 | /* | ||
202 | * The triggers lines up below will only be used if the | ||
203 | * LED triggers are compiled in. | ||
204 | */ | ||
205 | static const struct { | ||
206 | const char *name; | ||
207 | const char *trigger; | ||
208 | } idp_leds[] = { | ||
209 | { "idp:green", "heartbeat", }, | ||
210 | { "idp:red", "cpu0", }, | ||
211 | }; | ||
212 | |||
213 | static void idp_led_set(struct led_classdev *cdev, | ||
214 | enum led_brightness b) | ||
215 | { | ||
216 | struct idp_led *led = container_of(cdev, | ||
217 | struct idp_led, cdev); | ||
218 | u32 reg = IDP_CPLD_LED_CONTROL; | ||
219 | |||
220 | if (b != LED_OFF) | ||
221 | reg &= ~led->mask; | ||
222 | else | ||
223 | reg |= led->mask; | ||
224 | |||
225 | IDP_CPLD_LED_CONTROL = reg; | ||
226 | } | ||
227 | |||
228 | static enum led_brightness idp_led_get(struct led_classdev *cdev) | ||
229 | { | ||
230 | struct idp_led *led = container_of(cdev, | ||
231 | struct idp_led, cdev); | ||
232 | |||
233 | return (IDP_CPLD_LED_CONTROL & led->mask) ? LED_OFF : LED_FULL; | ||
234 | } | ||
235 | |||
236 | static int __init idp_leds_init(void) | ||
237 | { | ||
238 | int i; | ||
239 | |||
240 | if (!machine_is_pxa_idp()) | ||
241 | return -ENODEV; | ||
242 | |||
243 | for (i = 0; i < ARRAY_SIZE(idp_leds); i++) { | ||
244 | struct idp_led *led; | ||
245 | |||
246 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
247 | if (!led) | ||
248 | break; | ||
249 | |||
250 | led->cdev.name = idp_leds[i].name; | ||
251 | led->cdev.brightness_set = idp_led_set; | ||
252 | led->cdev.brightness_get = idp_led_get; | ||
253 | led->cdev.default_trigger = idp_leds[i].trigger; | ||
254 | |||
255 | if (i == 0) | ||
256 | led->mask = IDP_HB_LED; | ||
257 | else | ||
258 | led->mask = IDP_BUSY_LED; | ||
259 | |||
260 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
261 | kfree(led); | ||
262 | break; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * Since we may have triggers on any subsystem, defer registration | ||
271 | * until after subsystem_init. | ||
272 | */ | ||
273 | fs_initcall(idp_leds_init); | ||
274 | #endif | ||
194 | 275 | ||
195 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") | 276 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") |
196 | /* Maintainer: Vibren Technologies */ | 277 | /* Maintainer: Vibren Technologies */ |
diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c deleted file mode 100644 index 06b060025d11..000000000000 --- a/arch/arm/mach-pxa/leds-idp.c +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds-idp.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 | * Macros for actual LED manipulation should be in machine specific | ||
11 | * files in this 'mach' directory. | ||
12 | */ | ||
13 | |||
14 | |||
15 | #include <linux/init.h> | ||
16 | |||
17 | #include <mach/hardware.h> | ||
18 | #include <asm/leds.h> | ||
19 | |||
20 | #include <mach/pxa25x.h> | ||
21 | #include <mach/idp.h> | ||
22 | |||
23 | #include "leds.h" | ||
24 | |||
25 | #define LED_STATE_ENABLED 1 | ||
26 | #define LED_STATE_CLAIMED 2 | ||
27 | |||
28 | static unsigned int led_state; | ||
29 | static unsigned int hw_led_state; | ||
30 | |||
31 | void idp_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 | hw_led_state = IDP_HB_LED | IDP_BUSY_LED; | ||
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 = IDP_HB_LED | IDP_BUSY_LED; | ||
50 | break; | ||
51 | |||
52 | case led_release: | ||
53 | led_state &= ~LED_STATE_CLAIMED; | ||
54 | hw_led_state = IDP_HB_LED | IDP_BUSY_LED; | ||
55 | break; | ||
56 | |||
57 | #ifdef CONFIG_LEDS_TIMER | ||
58 | case led_timer: | ||
59 | if (!(led_state & LED_STATE_CLAIMED)) | ||
60 | hw_led_state ^= IDP_HB_LED; | ||
61 | break; | ||
62 | #endif | ||
63 | |||
64 | #ifdef CONFIG_LEDS_CPU | ||
65 | case led_idle_start: | ||
66 | if (!(led_state & LED_STATE_CLAIMED)) | ||
67 | hw_led_state &= ~IDP_BUSY_LED; | ||
68 | break; | ||
69 | |||
70 | case led_idle_end: | ||
71 | if (!(led_state & LED_STATE_CLAIMED)) | ||
72 | hw_led_state |= IDP_BUSY_LED; | ||
73 | break; | ||
74 | #endif | ||
75 | |||
76 | case led_halted: | ||
77 | break; | ||
78 | |||
79 | case led_green_on: | ||
80 | if (led_state & LED_STATE_CLAIMED) | ||
81 | hw_led_state |= IDP_HB_LED; | ||
82 | break; | ||
83 | |||
84 | case led_green_off: | ||
85 | if (led_state & LED_STATE_CLAIMED) | ||
86 | hw_led_state &= ~IDP_HB_LED; | ||
87 | break; | ||
88 | |||
89 | case led_amber_on: | ||
90 | break; | ||
91 | |||
92 | case led_amber_off: | ||
93 | break; | ||
94 | |||
95 | case led_red_on: | ||
96 | if (led_state & LED_STATE_CLAIMED) | ||
97 | hw_led_state |= IDP_BUSY_LED; | ||
98 | break; | ||
99 | |||
100 | case led_red_off: | ||
101 | if (led_state & LED_STATE_CLAIMED) | ||
102 | hw_led_state &= ~IDP_BUSY_LED; | ||
103 | break; | ||
104 | |||
105 | default: | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | if (led_state & LED_STATE_ENABLED) | ||
110 | IDP_CPLD_LED_CONTROL = ( (IDP_CPLD_LED_CONTROL | IDP_LEDS_MASK) & ~hw_led_state); | ||
111 | else | ||
112 | IDP_CPLD_LED_CONTROL |= IDP_LEDS_MASK; | ||
113 | |||
114 | local_irq_restore(flags); | ||
115 | } | ||
diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c deleted file mode 100644 index 0bd85c884a7c..000000000000 --- a/arch/arm/mach-pxa/leds-lubbock.c +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
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/init.h> | ||
15 | |||
16 | #include <mach/hardware.h> | ||
17 | #include <asm/leds.h> | ||
18 | #include <mach/pxa25x.h> | ||
19 | #include <mach/lubbock.h> | ||
20 | |||
21 | #include "leds.h" | ||
22 | |||
23 | /* | ||
24 | * 8 discrete leds available for general use: | ||
25 | * | ||
26 | * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays | ||
27 | * so be sure to not monkey with them here. | ||
28 | */ | ||
29 | |||
30 | #define D28 (1 << 0) | ||
31 | #define D27 (1 << 1) | ||
32 | #define D26 (1 << 2) | ||
33 | #define D25 (1 << 3) | ||
34 | #define D24 (1 << 4) | ||
35 | #define D23 (1 << 5) | ||
36 | #define D22 (1 << 6) | ||
37 | #define D21 (1 << 7) | ||
38 | |||
39 | #define LED_STATE_ENABLED 1 | ||
40 | #define LED_STATE_CLAIMED 2 | ||
41 | |||
42 | static unsigned int led_state; | ||
43 | static unsigned int hw_led_state; | ||
44 | |||
45 | void lubbock_leds_event(led_event_t evt) | ||
46 | { | ||
47 | unsigned long flags; | ||
48 | |||
49 | local_irq_save(flags); | ||
50 | |||
51 | switch (evt) { | ||
52 | case led_start: | ||
53 | hw_led_state = 0; | ||
54 | led_state = LED_STATE_ENABLED; | ||
55 | break; | ||
56 | |||
57 | case led_stop: | ||
58 | led_state &= ~LED_STATE_ENABLED; | ||
59 | break; | ||
60 | |||
61 | case led_claim: | ||
62 | led_state |= LED_STATE_CLAIMED; | ||
63 | hw_led_state = 0; | ||
64 | break; | ||
65 | |||
66 | case led_release: | ||
67 | led_state &= ~LED_STATE_CLAIMED; | ||
68 | hw_led_state = 0; | ||
69 | break; | ||
70 | |||
71 | #ifdef CONFIG_LEDS_TIMER | ||
72 | case led_timer: | ||
73 | hw_led_state ^= D26; | ||
74 | break; | ||
75 | #endif | ||
76 | |||
77 | #ifdef CONFIG_LEDS_CPU | ||
78 | case led_idle_start: | ||
79 | hw_led_state &= ~D27; | ||
80 | break; | ||
81 | |||
82 | case led_idle_end: | ||
83 | hw_led_state |= D27; | ||
84 | break; | ||
85 | #endif | ||
86 | |||
87 | case led_halted: | ||
88 | break; | ||
89 | |||
90 | case led_green_on: | ||
91 | hw_led_state |= D21; | ||
92 | break; | ||
93 | |||
94 | case led_green_off: | ||
95 | hw_led_state &= ~D21; | ||
96 | break; | ||
97 | |||
98 | case led_amber_on: | ||
99 | hw_led_state |= D22; | ||
100 | break; | ||
101 | |||
102 | case led_amber_off: | ||
103 | hw_led_state &= ~D22; | ||
104 | break; | ||
105 | |||
106 | case led_red_on: | ||
107 | hw_led_state |= D23; | ||
108 | break; | ||
109 | |||
110 | case led_red_off: | ||
111 | hw_led_state &= ~D23; | ||
112 | break; | ||
113 | |||
114 | default: | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | if (led_state & LED_STATE_ENABLED) | ||
119 | LUB_DISC_BLNK_LED = (LUB_DISC_BLNK_LED | 0xff) & ~hw_led_state; | ||
120 | else | ||
121 | LUB_DISC_BLNK_LED |= 0xff; | ||
122 | |||
123 | local_irq_restore(flags); | ||
124 | } | ||
diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c deleted file mode 100644 index 4058ab340fe6..000000000000 --- a/arch/arm/mach-pxa/leds-mainstone.c +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds-mainstone.c | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Nov 05, 2002 | ||
6 | * Copyright: MontaVista Software Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <asm/leds.h> | ||
17 | |||
18 | #include <mach/pxa27x.h> | ||
19 | #include <mach/mainstone.h> | ||
20 | |||
21 | #include "leds.h" | ||
22 | |||
23 | |||
24 | /* 8 discrete leds available for general use: */ | ||
25 | #define D28 (1 << 0) | ||
26 | #define D27 (1 << 1) | ||
27 | #define D26 (1 << 2) | ||
28 | #define D25 (1 << 3) | ||
29 | #define D24 (1 << 4) | ||
30 | #define D23 (1 << 5) | ||
31 | #define D22 (1 << 6) | ||
32 | #define D21 (1 << 7) | ||
33 | |||
34 | #define LED_STATE_ENABLED 1 | ||
35 | #define LED_STATE_CLAIMED 2 | ||
36 | |||
37 | static unsigned int led_state; | ||
38 | static unsigned int hw_led_state; | ||
39 | |||
40 | void mainstone_leds_event(led_event_t evt) | ||
41 | { | ||
42 | unsigned long flags; | ||
43 | |||
44 | local_irq_save(flags); | ||
45 | |||
46 | switch (evt) { | ||
47 | case led_start: | ||
48 | hw_led_state = 0; | ||
49 | led_state = LED_STATE_ENABLED; | ||
50 | break; | ||
51 | |||
52 | case led_stop: | ||
53 | led_state &= ~LED_STATE_ENABLED; | ||
54 | break; | ||
55 | |||
56 | case led_claim: | ||
57 | led_state |= LED_STATE_CLAIMED; | ||
58 | hw_led_state = 0; | ||
59 | break; | ||
60 | |||
61 | case led_release: | ||
62 | led_state &= ~LED_STATE_CLAIMED; | ||
63 | hw_led_state = 0; | ||
64 | break; | ||
65 | |||
66 | #ifdef CONFIG_LEDS_TIMER | ||
67 | case led_timer: | ||
68 | hw_led_state ^= D26; | ||
69 | break; | ||
70 | #endif | ||
71 | |||
72 | #ifdef CONFIG_LEDS_CPU | ||
73 | case led_idle_start: | ||
74 | hw_led_state &= ~D27; | ||
75 | break; | ||
76 | |||
77 | case led_idle_end: | ||
78 | hw_led_state |= D27; | ||
79 | break; | ||
80 | #endif | ||
81 | |||
82 | case led_halted: | ||
83 | break; | ||
84 | |||
85 | case led_green_on: | ||
86 | hw_led_state |= D21; | ||
87 | break; | ||
88 | |||
89 | case led_green_off: | ||
90 | hw_led_state &= ~D21; | ||
91 | break; | ||
92 | |||
93 | case led_amber_on: | ||
94 | hw_led_state |= D22; | ||
95 | break; | ||
96 | |||
97 | case led_amber_off: | ||
98 | hw_led_state &= ~D22; | ||
99 | break; | ||
100 | |||
101 | case led_red_on: | ||
102 | hw_led_state |= D23; | ||
103 | break; | ||
104 | |||
105 | case led_red_off: | ||
106 | hw_led_state &= ~D23; | ||
107 | break; | ||
108 | |||
109 | default: | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | if (led_state & LED_STATE_ENABLED) | ||
114 | MST_LEDCTRL = (MST_LEDCTRL | 0xff) & ~hw_led_state; | ||
115 | else | ||
116 | MST_LEDCTRL |= 0xff; | ||
117 | |||
118 | local_irq_restore(flags); | ||
119 | } | ||
diff --git a/arch/arm/mach-pxa/leds.c b/arch/arm/mach-pxa/leds.c deleted file mode 100644 index bbe4d5f6afaa..000000000000 --- a/arch/arm/mach-pxa/leds.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds.c | ||
3 | * | ||
4 | * xscale LEDs dispatcher | ||
5 | * | ||
6 | * Copyright (C) 2001 Nicolas Pitre | ||
7 | * | ||
8 | * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc. | ||
9 | */ | ||
10 | #include <linux/compiler.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | #include <asm/leds.h> | ||
14 | #include <asm/mach-types.h> | ||
15 | |||
16 | #include "leds.h" | ||
17 | |||
18 | static int __init | ||
19 | pxa_leds_init(void) | ||
20 | { | ||
21 | if (machine_is_lubbock()) | ||
22 | leds_event = lubbock_leds_event; | ||
23 | if (machine_is_mainstone()) | ||
24 | leds_event = mainstone_leds_event; | ||
25 | if (machine_is_pxa_idp()) | ||
26 | leds_event = idp_leds_event; | ||
27 | |||
28 | leds_event(led_start); | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | core_initcall(pxa_leds_init); | ||
diff --git a/arch/arm/mach-pxa/leds.h b/arch/arm/mach-pxa/leds.h deleted file mode 100644 index 7f0dfe01345a..000000000000 --- a/arch/arm/mach-pxa/leds.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/leds.h | ||
3 | * | ||
4 | * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc. | ||
5 | * | ||
6 | * blinky lights for various PXA-based systems: | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | extern void idp_leds_event(led_event_t evt); | ||
11 | extern void lubbock_leds_event(led_event_t evt); | ||
12 | extern void mainstone_leds_event(led_event_t evt); | ||
13 | extern void trizeps4_leds_event(led_event_t evt); | ||
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 6bb3f47b1f14..435028350981 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/io.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/syscore_ops.h> | 20 | #include <linux/syscore_ops.h> |
20 | #include <linux/major.h> | 21 | #include <linux/major.h> |
@@ -23,6 +24,8 @@ | |||
23 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
25 | #include <linux/smc91x.h> | 26 | #include <linux/smc91x.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/leds.h> | ||
26 | 29 | ||
27 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/ads7846.h> | 31 | #include <linux/spi/ads7846.h> |
@@ -549,6 +552,98 @@ static void __init lubbock_map_io(void) | |||
549 | PCFR |= PCFR_OPDE; | 552 | PCFR |= PCFR_OPDE; |
550 | } | 553 | } |
551 | 554 | ||
555 | /* | ||
556 | * Driver for the 8 discrete LEDs available for general use: | ||
557 | * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays | ||
558 | * so be sure to not monkey with them here. | ||
559 | */ | ||
560 | |||
561 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
562 | struct lubbock_led { | ||
563 | struct led_classdev cdev; | ||
564 | u8 mask; | ||
565 | }; | ||
566 | |||
567 | /* | ||
568 | * The triggers lines up below will only be used if the | ||
569 | * LED triggers are compiled in. | ||
570 | */ | ||
571 | static const struct { | ||
572 | const char *name; | ||
573 | const char *trigger; | ||
574 | } lubbock_leds[] = { | ||
575 | { "lubbock:D28", "default-on", }, | ||
576 | { "lubbock:D27", "cpu0", }, | ||
577 | { "lubbock:D26", "heartbeat" }, | ||
578 | { "lubbock:D25", }, | ||
579 | { "lubbock:D24", }, | ||
580 | { "lubbock:D23", }, | ||
581 | { "lubbock:D22", }, | ||
582 | { "lubbock:D21", }, | ||
583 | }; | ||
584 | |||
585 | static void lubbock_led_set(struct led_classdev *cdev, | ||
586 | enum led_brightness b) | ||
587 | { | ||
588 | struct lubbock_led *led = container_of(cdev, | ||
589 | struct lubbock_led, cdev); | ||
590 | u32 reg = LUB_DISC_BLNK_LED; | ||
591 | |||
592 | if (b != LED_OFF) | ||
593 | reg |= led->mask; | ||
594 | else | ||
595 | reg &= ~led->mask; | ||
596 | |||
597 | LUB_DISC_BLNK_LED = reg; | ||
598 | } | ||
599 | |||
600 | static enum led_brightness lubbock_led_get(struct led_classdev *cdev) | ||
601 | { | ||
602 | struct lubbock_led *led = container_of(cdev, | ||
603 | struct lubbock_led, cdev); | ||
604 | u32 reg = LUB_DISC_BLNK_LED; | ||
605 | |||
606 | return (reg & led->mask) ? LED_FULL : LED_OFF; | ||
607 | } | ||
608 | |||
609 | static int __init lubbock_leds_init(void) | ||
610 | { | ||
611 | int i; | ||
612 | |||
613 | if (!machine_is_lubbock()) | ||
614 | return -ENODEV; | ||
615 | |||
616 | /* All ON */ | ||
617 | LUB_DISC_BLNK_LED |= 0xff; | ||
618 | for (i = 0; i < ARRAY_SIZE(lubbock_leds); i++) { | ||
619 | struct lubbock_led *led; | ||
620 | |||
621 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
622 | if (!led) | ||
623 | break; | ||
624 | |||
625 | led->cdev.name = lubbock_leds[i].name; | ||
626 | led->cdev.brightness_set = lubbock_led_set; | ||
627 | led->cdev.brightness_get = lubbock_led_get; | ||
628 | led->cdev.default_trigger = lubbock_leds[i].trigger; | ||
629 | led->mask = BIT(i); | ||
630 | |||
631 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
632 | kfree(led); | ||
633 | break; | ||
634 | } | ||
635 | } | ||
636 | |||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | /* | ||
641 | * Since we may have triggers on any subsystem, defer registration | ||
642 | * until after subsystem_init. | ||
643 | */ | ||
644 | fs_initcall(lubbock_leds_init); | ||
645 | #endif | ||
646 | |||
552 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") | 647 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") |
553 | /* Maintainer: MontaVista Software Inc. */ | 648 | /* Maintainer: MontaVista Software Inc. */ |
554 | .map_io = lubbock_map_io, | 649 | .map_io = lubbock_map_io, |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 1aebaf719462..bdc6c335830a 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/pwm_backlight.h> | 28 | #include <linux/pwm_backlight.h> |
29 | #include <linux/smc91x.h> | 29 | #include <linux/smc91x.h> |
30 | #include <linux/i2c/pxa-i2c.h> | 30 | #include <linux/i2c/pxa-i2c.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/leds.h> | ||
31 | 33 | ||
32 | #include <asm/types.h> | 34 | #include <asm/types.h> |
33 | #include <asm/setup.h> | 35 | #include <asm/setup.h> |
@@ -613,6 +615,98 @@ static void __init mainstone_map_io(void) | |||
613 | PCFR = 0x66; | 615 | PCFR = 0x66; |
614 | } | 616 | } |
615 | 617 | ||
618 | /* | ||
619 | * Driver for the 8 discrete LEDs available for general use: | ||
620 | * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays | ||
621 | * so be sure to not monkey with them here. | ||
622 | */ | ||
623 | |||
624 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
625 | struct mainstone_led { | ||
626 | struct led_classdev cdev; | ||
627 | u8 mask; | ||
628 | }; | ||
629 | |||
630 | /* | ||
631 | * The triggers lines up below will only be used if the | ||
632 | * LED triggers are compiled in. | ||
633 | */ | ||
634 | static const struct { | ||
635 | const char *name; | ||
636 | const char *trigger; | ||
637 | } mainstone_leds[] = { | ||
638 | { "mainstone:D28", "default-on", }, | ||
639 | { "mainstone:D27", "cpu0", }, | ||
640 | { "mainstone:D26", "heartbeat" }, | ||
641 | { "mainstone:D25", }, | ||
642 | { "mainstone:D24", }, | ||
643 | { "mainstone:D23", }, | ||
644 | { "mainstone:D22", }, | ||
645 | { "mainstone:D21", }, | ||
646 | }; | ||
647 | |||
648 | static void mainstone_led_set(struct led_classdev *cdev, | ||
649 | enum led_brightness b) | ||
650 | { | ||
651 | struct mainstone_led *led = container_of(cdev, | ||
652 | struct mainstone_led, cdev); | ||
653 | u32 reg = MST_LEDCTRL; | ||
654 | |||
655 | if (b != LED_OFF) | ||
656 | reg |= led->mask; | ||
657 | else | ||
658 | reg &= ~led->mask; | ||
659 | |||
660 | MST_LEDCTRL = reg; | ||
661 | } | ||
662 | |||
663 | static enum led_brightness mainstone_led_get(struct led_classdev *cdev) | ||
664 | { | ||
665 | struct mainstone_led *led = container_of(cdev, | ||
666 | struct mainstone_led, cdev); | ||
667 | u32 reg = MST_LEDCTRL; | ||
668 | |||
669 | return (reg & led->mask) ? LED_FULL : LED_OFF; | ||
670 | } | ||
671 | |||
672 | static int __init mainstone_leds_init(void) | ||
673 | { | ||
674 | int i; | ||
675 | |||
676 | if (!machine_is_mainstone()) | ||
677 | return -ENODEV; | ||
678 | |||
679 | /* All ON */ | ||
680 | MST_LEDCTRL |= 0xff; | ||
681 | for (i = 0; i < ARRAY_SIZE(mainstone_leds); i++) { | ||
682 | struct mainstone_led *led; | ||
683 | |||
684 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
685 | if (!led) | ||
686 | break; | ||
687 | |||
688 | led->cdev.name = mainstone_leds[i].name; | ||
689 | led->cdev.brightness_set = mainstone_led_set; | ||
690 | led->cdev.brightness_get = mainstone_led_get; | ||
691 | led->cdev.default_trigger = mainstone_leds[i].trigger; | ||
692 | led->mask = BIT(i); | ||
693 | |||
694 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
695 | kfree(led); | ||
696 | break; | ||
697 | } | ||
698 | } | ||
699 | |||
700 | return 0; | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | * Since we may have triggers on any subsystem, defer registration | ||
705 | * until after subsystem_init. | ||
706 | */ | ||
707 | fs_initcall(mainstone_leds_init); | ||
708 | #endif | ||
709 | |||
616 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 710 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |
617 | /* Maintainer: MontaVista Software Inc. */ | 711 | /* Maintainer: MontaVista Software Inc. */ |
618 | .atag_offset = 0x100, /* BLOB boot parameter setting */ | 712 | .atag_offset = 0x100, /* BLOB boot parameter setting */ |