ARM: 7026/1: simpad: replace ARM specific LED code
authorJochen Friedrich <jochen@scram.de>
Thu, 18 Aug 2011 20:51:39 +0000 (21:51 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 17 Oct 2011 08:12:42 +0000 (09:12 +0100)
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>
arch/arm/mach-sa1100/Makefile
arch/arm/mach-sa1100/leds-simpad.c [deleted file]
arch/arm/mach-sa1100/leds.c
arch/arm/mach-sa1100/leds.h
arch/arm/mach-sa1100/simpad.c

index 41252d22e6591d437e274d967126ed86dee0112a..00631787e80accba4cd5f1c71661579bffc6a813 100644 (file)
@@ -45,7 +45,6 @@ obj-$(CONFIG_SA1100_PLEB)             += pleb.o
 obj-$(CONFIG_SA1100_SHANNON)           += shannon.o
 
 obj-$(CONFIG_SA1100_SIMPAD)            += simpad.o
-led-$(CONFIG_SA1100_SIMPAD)            += leds-simpad.o
 
 # LEDs support
 obj-$(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 (file)
index d25784c..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * linux/arch/arm/mach-sa1100/leds-simpad.c
- *
- * Author: Juergen Messerer <juergen.messerer@siemens.ch>
- */
-#include <linux/init.h>
-
-#include <mach/hardware.h>
-#include <asm/leds.h>
-#include <asm/system.h>
-#include <mach/simpad.h>
-
-#include "leds.h"
-
-
-#define LED_STATE_ENABLED      1
-#define LED_STATE_CLAIMED      2
-
-static unsigned int led_state;
-static unsigned int hw_led_state;
-
-#define        LED_GREEN       (1)
-#define        LED_MASK        (1)
-
-void simpad_leds_event(led_event_t evt)
-{
-       switch (evt)
-       {
-       case led_start:
-               hw_led_state = LED_GREEN;
-               led_state = LED_STATE_ENABLED;
-               break;
-
-       case led_stop:
-               led_state &= ~LED_STATE_ENABLED;
-               break;
-
-       case led_claim:
-               led_state |= LED_STATE_CLAIMED;
-               hw_led_state = LED_GREEN;
-               break;
-
-       case led_release:
-               led_state &= ~LED_STATE_CLAIMED;
-               hw_led_state = LED_GREEN;
-               break;
-
-#ifdef CONFIG_LEDS_TIMER
-       case led_timer:
-               if (!(led_state & LED_STATE_CLAIMED))
-                       hw_led_state ^= LED_GREEN;
-               break;
-#endif
-
-#ifdef CONFIG_LEDS_CPU
-       case led_idle_start:
-               break;
-
-       case led_idle_end:
-               break;
-#endif
-
-       case led_halted:
-               break;
-
-       case led_green_on:
-               if (led_state & LED_STATE_CLAIMED)
-                       hw_led_state |= LED_GREEN;
-               break;
-
-       case led_green_off:
-               if (led_state & LED_STATE_CLAIMED)
-                       hw_led_state &= ~LED_GREEN;
-               break;
-
-       case led_amber_on:
-               break;
-
-       case led_amber_off:
-               break;
-
-       case led_red_on:
-               break;
-
-       case led_red_off:
-               break;
-
-       default:
-               break;
-       }
-
-       if  (led_state & LED_STATE_ENABLED)
-               simpad_set_cs3_bit(LED2_ON);
-       else 
-               simpad_clear_cs3_bit(LED2_ON);
-}
-
index bbfe197fb4d6274c19734a94ba2d9e7b8ddd0978..5fe71a0f10537073cb4506ce3cb7a0c8772cc712 100644 (file)
@@ -42,8 +42,6 @@ sa1100_leds_init(void)
                leds_event = adsbitsy_leds_event;
        if (machine_is_pt_system3())
                leds_event = system3_leds_event;
-       if (machine_is_simpad())
-               leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */
 
        leds_event(led_start);
        return 0;
index 68cc9f773d6d6b81ae38283edf459b5e287dca6c..776b6020f550020d26dd7e6b97a632c8f64d4b31 100644 (file)
@@ -11,4 +11,3 @@ extern void pfs168_leds_event(led_event_t evt);
 extern void graphicsmaster_leds_event(led_event_t evt);
 extern void adsbitsy_leds_event(led_event_t evt);
 extern void system3_leds_event(led_event_t evt);
-extern void simpad_leds_event(led_event_t evt);
index 9f0eefdaa2a1ac4ea5aff94e8a060cf6a7c7e3c9..34659f354bef8ba60c1d7b0d732f2904133ae6df 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/ioport.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/leds.h>
 #include <linux/i2c-gpio.h>
 
 #include "generic.h"
@@ -294,6 +295,32 @@ static struct platform_device simpad_polled_keys = {
        },
 };
 
+/*
+ * GPIO LEDs
+ */
+
+static struct gpio_led simpad_leds[] = {
+       {
+               .name = "simpad:power",
+               .gpio = SIMPAD_CS3_LED2_ON,
+               .active_low = 0,
+               .default_trigger = "default-on",
+       },
+};
+
+static struct gpio_led_platform_data simpad_led_data = {
+       .num_leds = ARRAY_SIZE(simpad_leds),
+       .leds = simpad_leds,
+};
+
+static struct platform_device simpad_gpio_leds = {
+       .name = "leds-gpio",
+       .id = 0,
+       .dev = {
+               .platform_data = &simpad_led_data,
+       },
+};
+
 /*
  * i2c
  */
@@ -324,6 +351,7 @@ static struct platform_device *devices[] __initdata = {
        &simpad_keys,
        &simpad_polled_keys,
        &simpad_mq200fb,
+       &simpad_gpio_leds,
        &simpad_i2c,
 };