aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 21:46:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 21:46:13 -0400
commit8f446a7a069e0af0639385f67c78ee2279bca04c (patch)
tree580cf495616b36ca0af0826afa87c430cdc1e7cb /arch/arm/mach-pxa
parent84be4ae2c038e2b03d650cbf2a7cfd9e8d6e9e51 (diff)
parent04ef037c926ddb31088c976538e29eada4fd1490 (diff)
Merge tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM soc driver specific changes from Olof Johansson: - A long-coming conversion of various platforms to a common LED infrastructure - AT91 is moved over to use the newer MCI driver for MMC - Pincontrol conversions for samsung platforms - DT bindings for gscaler on samsung - i2c driver fixes for tegra, acked by i2c maintainer Fix up conflicts as per Olof. * tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (48 commits) drivers: bus: omap_l3: use resources instead of hardcoded irqs pinctrl: exynos: Fix wakeup IRQ domain registration check pinctrl: samsung: Uninline samsung_pinctrl_get_soc_data pinctrl: exynos: Correct the detection of wakeup-eint node pinctrl: exynos: Mark exynos_irq_demux_eint as inline pinctrl: exynos: Handle only unmasked wakeup interrupts pinctrl: exynos: Fix typos in gpio/wkup _irq_mask pinctrl: exynos: Set pin function to EINT in irq_set_type of GPIO EINTa drivers: bus: Move the OMAP interconnect driver to drivers/bus/ i2c: tegra: dynamically control fast clk i2c: tegra: I2_M_NOSTART functionality not supported in Tegra20 ARM: tegra: clock: remove unused clock entry for i2c ARM: tegra: clock: add connection name in i2c clock entry i2c: tegra: pass proper name for getting clock ARM: tegra: clock: add i2c fast clock entry in clock table ARM: EXYNOS: Adds G-Scaler device from Device Tree ARM: EXYNOS: Add clock support for G-Scaler ARM: EXYNOS: Enable pinctrl driver support for EXYNOS4 device tree enabled platform ARM: dts: Add pinctrl node entries for SAMSUNG EXYNOS4210 SoC ARM: EXYNOS: skip wakeup interrupt setup if pinctrl driver is used ...
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/Makefile8
-rw-r--r--arch/arm/mach-pxa/idp.c81
-rw-r--r--arch/arm/mach-pxa/leds-idp.c115
-rw-r--r--arch/arm/mach-pxa/leds-lubbock.c124
-rw-r--r--arch/arm/mach-pxa/leds-mainstone.c119
-rw-r--r--arch/arm/mach-pxa/leds.c32
-rw-r--r--arch/arm/mach-pxa/leds.h13
-rw-r--r--arch/arm/mach-pxa/lubbock.c95
-rw-r--r--arch/arm/mach-pxa/mainstone.c94
9 files changed, 270 insertions, 411 deletions
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 2bedc9ed076c..ee88d6eae648 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -98,12 +98,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR) += raumfeld.o
98obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o 98obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o
99obj-$(CONFIG_MACH_ZIPIT2) += z2.o 99obj-$(CONFIG_MACH_ZIPIT2) += z2.o
100 100
101# Support for blinky lights
102led-y := leds.o
103led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o
104led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o
105led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o
106
107obj-$(CONFIG_LEDS) += $(led-y)
108
109obj-$(CONFIG_TOSA_BT) += tosa-bt.o 101obj-$(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)
196struct 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 */
205static const struct {
206 const char *name;
207 const char *trigger;
208} idp_leds[] = {
209 { "idp:green", "heartbeat", },
210 { "idp:red", "cpu0", },
211};
212
213static 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
228static 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
236static 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 */
273fs_initcall(idp_leds_init);
274#endif
194 275
195MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") 276MACHINE_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
28static unsigned int led_state;
29static unsigned int hw_led_state;
30
31void 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
42static unsigned int led_state;
43static unsigned int hw_led_state;
44
45void 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
37static unsigned int led_state;
38static unsigned int hw_led_state;
39
40void 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
18static int __init
19pxa_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
32core_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
10extern void idp_leds_event(led_event_t evt);
11extern void lubbock_leds_event(led_event_t evt);
12extern void mainstone_leds_event(led_event_t evt);
13extern 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 0ca0db787903..3c48035afd6b 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)
562struct 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 */
571static 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
585static 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
600static 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
609static 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 */
644fs_initcall(lubbock_leds_init);
645#endif
646
552MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") 647MACHINE_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)
625struct 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 */
634static 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
648static 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
663static 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
672static 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 */
707fs_initcall(mainstone_leds_init);
708#endif
709
616MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") 710MACHINE_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 */