Thread (65 messages) flat view 65 messages, 10 authors, 2011-07-19
STALE5541d

[PATCH 16/17] mach-sa1100: retire custom LED code

From: jochen@scram.de (Jochen Friedrich)
Date: 2011-07-06 14:04:44

On 06.07.2011 14:34, Bryan Wu wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index cfb7607..6f87258 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -13,6 +13,8 @@
  #include<linux/mtd/mtd.h>
  #include<linux/mtd/partitions.h>
  #include<linux/io.h>
+#include<linux/leds.h>
+#include<linux/slab.h>

  #include<asm/irq.h>
  #include<mach/hardware.h>
@@ -205,7 +207,53 @@ static struct platform_device *devices[] __initdata = {
  	&simpad_mq200fb
  };

+/* LEDs */
+#define LED_GREEN	1

+static void simpad_led_set(struct led_classdev *cdev,
+			      enum led_brightness b)
+{
+	if (b != LED_OFF)
+		set_cs3_bit(LED_GREEN);
+	else
+		clear_cs3_bit(LED_GREEN);
+}
+
+static enum led_brightness simpad_led_get(struct led_classdev *cdev)
+{
+	u32 reg = *(CS3BUSTYPE *)(CS3_BASE);
+
+	return (reg&  LED_GREEN) ? LED_FULL : LED_OFF;
+}
NACK, bit 1 on the CS3 register is PCMCIA power control (write) and 
PCMCIA BVD1 (read), but not LED_GREEN. LED2_ON would be correct for 
write, but you would need to read cs3_shadow instead of the register 
itself for the LED status.

BTW: Some time ago I wrote a similar patch for ARM that converts CS3 
functions to GPIOs, wich simplifies the LED stuff even further ;-)

http://www.spinics.net/lists/arm-kernel/msg122479.html

Thanks,
Jochen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help