aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorJochen Friedrich <jochen@scram.de>2011-08-18 16:51:39 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-10-17 04:12:42 -0400
commitd056f5a8fec028cc58c75706f35f2c3daed13e6e (patch)
treea9338fe9a708cb92616a788372c4b355e4a43feb /arch/arm/mach-sa1100
parentdbd406f9d0a1d33a1303eb75cbe3f9435513d339 (diff)
ARM: 7026/1: simpad: replace ARM specific LED code
Remove the legacy ARM LED code for simpad devices and register a stadard LED platform device using GPIO line instead. Signed-off-by: Jochen Friedrich <jochen@scram.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/Makefile1
-rw-r--r--arch/arm/mach-sa1100/leds-simpad.c97
-rw-r--r--arch/arm/mach-sa1100/leds.c2
-rw-r--r--arch/arm/mach-sa1100/leds.h1
-rw-r--r--arch/arm/mach-sa1100/simpad.c28
5 files changed, 28 insertions, 101 deletions
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 41252d22e659..00631787e80a 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_SA1100_PLEB) += pleb.o
45obj-$(CONFIG_SA1100_SHANNON) += shannon.o 45obj-$(CONFIG_SA1100_SHANNON) += shannon.o
46 46
47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o 47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o
48led-$(CONFIG_SA1100_SIMPAD) += leds-simpad.o
49 48
50# LEDs support 49# LEDs support
51obj-$(CONFIG_LEDS) += $(led-y) 50obj-$(CONFIG_LEDS) += $(led-y)
diff --git a/arch/arm/mach-sa1100/leds-simpad.c b/arch/arm/mach-sa1100/leds-simpad.c
deleted file mode 100644
index d25784cc96e6..000000000000
--- a/arch/arm/mach-sa1100/leds-simpad.c
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-simpad.c
3 *
4 * Author: Juergen Messerer <juergen.messerer@siemens.ch>
5 */
6#include <linux/init.h>
7
8#include <mach/hardware.h>
9#include <asm/leds.h>
10#include <asm/system.h>
11#include <mach/simpad.h>
12
13#include "leds.h"
14
15
16#define LED_STATE_ENABLED 1
17#define LED_STATE_CLAIMED 2
18
19static unsigned int led_state;
20static unsigned int hw_led_state;
21
22#define LED_GREEN (1)
23#define LED_MASK (1)
24
25void simpad_leds_event(led_event_t evt)
26{
27 switch (evt)
28 {
29 case led_start:
30 hw_led_state = LED_GREEN;
31 led_state = LED_STATE_ENABLED;
32 break;
33
34 case led_stop:
35 led_state &= ~LED_STATE_ENABLED;
36 break;
37
38 case led_claim:
39 led_state |= LED_STATE_CLAIMED;
40 hw_led_state = LED_GREEN;
41 break;
42
43 case led_release:
44 led_state &= ~LED_STATE_CLAIMED;
45 hw_led_state = LED_GREEN;
46 break;
47
48#ifdef CONFIG_LEDS_TIMER
49 case led_timer:
50 if (!(led_state & LED_STATE_CLAIMED))
51 hw_led_state ^= LED_GREEN;
52 break;
53#endif
54
55#ifdef CONFIG_LEDS_CPU
56 case led_idle_start:
57 break;
58
59 case led_idle_end:
60 break;
61#endif
62
63 case led_halted:
64 break;
65
66 case led_green_on:
67 if (led_state & LED_STATE_CLAIMED)
68 hw_led_state |= LED_GREEN;
69 break;
70
71 case led_green_off:
72 if (led_state & LED_STATE_CLAIMED)
73 hw_led_state &= ~LED_GREEN;
74 break;
75
76 case led_amber_on:
77 break;
78
79 case led_amber_off:
80 break;
81
82 case led_red_on:
83 break;
84
85 case led_red_off:
86 break;
87
88 default:
89 break;
90 }
91
92 if (led_state & LED_STATE_ENABLED)
93 simpad_set_cs3_bit(LED2_ON);
94 else
95 simpad_clear_cs3_bit(LED2_ON);
96}
97
diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c
index bbfe197fb4d6..5fe71a0f1053 100644
--- a/arch/arm/mach-sa1100/leds.c
+++ b/arch/arm/mach-sa1100/leds.c
@@ -42,8 +42,6 @@ sa1100_leds_init(void)
42 leds_event = adsbitsy_leds_event; 42 leds_event = adsbitsy_leds_event;
43 if (machine_is_pt_system3()) 43 if (machine_is_pt_system3())
44 leds_event = system3_leds_event; 44 leds_event = system3_leds_event;
45 if (machine_is_simpad())
46 leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */
47 45
48 leds_event(led_start); 46 leds_event(led_start);
49 return 0; 47 return 0;
diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h
index 68cc9f773d6d..776b6020f550 100644
--- a/arch/arm/mach-sa1100/leds.h
+++ b/arch/arm/mach-sa1100/leds.h
@@ -11,4 +11,3 @@ extern void pfs168_leds_event(led_event_t evt);
11extern void graphicsmaster_leds_event(led_event_t evt); 11extern void graphicsmaster_leds_event(led_event_t evt);
12extern void adsbitsy_leds_event(led_event_t evt); 12extern void adsbitsy_leds_event(led_event_t evt);
13extern void system3_leds_event(led_event_t evt); 13extern void system3_leds_event(led_event_t evt);
14extern void simpad_leds_event(led_event_t evt);
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index 9f0eefdaa2a1..34659f354bef 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -31,6 +31,7 @@
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/gpio_keys.h> 33#include <linux/gpio_keys.h>
34#include <linux/leds.h>
34#include <linux/i2c-gpio.h> 35#include <linux/i2c-gpio.h>
35 36
36#include "generic.h" 37#include "generic.h"
@@ -295,6 +296,32 @@ static struct platform_device simpad_polled_keys = {
295}; 296};
296 297
297/* 298/*
299 * GPIO LEDs
300 */
301
302static struct gpio_led simpad_leds[] = {
303 {
304 .name = "simpad:power",
305 .gpio = SIMPAD_CS3_LED2_ON,
306 .active_low = 0,
307 .default_trigger = "default-on",
308 },
309};
310
311static struct gpio_led_platform_data simpad_led_data = {
312 .num_leds = ARRAY_SIZE(simpad_leds),
313 .leds = simpad_leds,
314};
315
316static struct platform_device simpad_gpio_leds = {
317 .name = "leds-gpio",
318 .id = 0,
319 .dev = {
320 .platform_data = &simpad_led_data,
321 },
322};
323
324/*
298 * i2c 325 * i2c
299 */ 326 */
300static struct i2c_gpio_platform_data simpad_i2c_data = { 327static struct i2c_gpio_platform_data simpad_i2c_data = {
@@ -324,6 +351,7 @@ static struct platform_device *devices[] __initdata = {
324 &simpad_keys, 351 &simpad_keys,
325 &simpad_polled_keys, 352 &simpad_polled_keys,
326 &simpad_mq200fb, 353 &simpad_mq200fb,
354 &simpad_gpio_leds,
327 &simpad_i2c, 355 &simpad_i2c,
328}; 356};
329 357