Skip to contentSkip to conversation

ARM: simpad: Add support for GPIO attached hardware

PATCH New Jochen Friedrich 4 participants 12 messages Jul 12, 2011 – Aug 7, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: simpad: Add support for GPIO attached hardware

Resend as this might got lost in the develtech.com disaster. Bryan Wu <[email protected]> intends to base his patch set to get rid of the custom LED code on this series.

This series enables GPIO API on UCB1x00 and implements the GPIO API on the CS3 latch. The third patch finally registers platform devices for the GPIO attached LED, buttons and I2C bus.

ARM: simpad: Add ucb1x00 GPIO definitions and register GPIO
ARM: simpad: Cleanup CS3 accessors and add GPIO API
ARM: simpad: add GPIO based device definitions
ARM: simpad: replace ARM specific LED code

Overall diffstat:

 arch/arm/mach-sa1100/Makefile              |    1 -
 arch/arm/mach-sa1100/include/mach/simpad.h |   94 ++++++++++---
 arch/arm/mach-sa1100/leds-simpad.c         |  100 -------------
 arch/arm/mach-sa1100/leds.c                |    2 -
 arch/arm/mach-sa1100/leds.h                |    1 -
 arch/arm/mach-sa1100/simpad.c              |  211 ++++++++++++++++++++++++---
 drivers/pcmcia/sa1100_simpad.c             |   35 ++---
 7 files changed, 274 insertions(+), 170 deletions(-)
#1 lore raw

PATCH 1/4 ARM:simpad: Add ucb1x00 GPIO definitions and register GPIO

Add ucb1x00 GPIO definitions to simpad.h and add gpio_base to ucb1x00 platform device so the pins are available using the GPIO API.

---
 arch/arm/mach-sa1100/include/mach/simpad.h |   13 +++++++++++++
 arch/arm/mach-sa1100/simpad.c              |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-sa1100/include/mach/simpad.h +13 -0
index 9296c45..231550d 100644
@@ -48,6 +48,19 @@
 #define GPIO_SMART_CARD		GPIO_GPIO10
 #define IRQ_GPIO_SMARD_CARD	IRQ_GPIO10
 
+/*--- ucb1x00 GPIO ---*/
+#define SIMPAD_UCB1X00_GPIO_BASE	(GPIO_MAX + 1)
+#define SIMPAD_UCB1X00_GPIO_PROG1	(SIMPAD_UCB1X00_GPIO_BASE)
+#define SIMPAD_UCB1X00_GPIO_PROG2	(SIMPAD_UCB1X00_GPIO_BASE + 1)
+#define SIMPAD_UCB1X00_GPIO_UP		(SIMPAD_UCB1X00_GPIO_BASE + 2)
+#define SIMPAD_UCB1X00_GPIO_DOWN	(SIMPAD_UCB1X00_GPIO_BASE + 3)
+#define SIMPAD_UCB1X00_GPIO_LEFT	(SIMPAD_UCB1X00_GPIO_BASE + 4)
+#define SIMPAD_UCB1X00_GPIO_RIGHT	(SIMPAD_UCB1X00_GPIO_BASE + 5)
+#define SIMPAD_UCB1X00_GPIO_6		(SIMPAD_UCB1X00_GPIO_BASE + 6)
+#define SIMPAD_UCB1X00_GPIO_7		(SIMPAD_UCB1X00_GPIO_BASE + 7)
+#define SIMPAD_UCB1X00_GPIO_HEADSET	(SIMPAD_UCB1X00_GPIO_BASE + 8)
+#define SIMPAD_UCB1X00_GPIO_SPEAKER	(SIMPAD_UCB1X00_GPIO_BASE + 9)
+
 // CS3 Latch is write only, a shadow is necessary
 
 #define CS3BUSTYPE unsigned volatile long
arch/arm/mach-sa1100/simpad.c +1 -0
index cfb7607..718b802 100644
@@ -132,6 +132,7 @@ static struct resource simpad_flash_resources [] = {
 static struct mcp_plat_data simpad_mcp_data = {
 	.mccr0		= MCCR0_ADM,
 	.sclk_rate	= 11981000,
+	.gpio_base	= SIMPAD_UCB1X00_GPIO_BASE,
 };
 
 
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/4 ARM:simpad: Cleanup CS3 accessors.

In reply to Jochen Friedrich

- prepend CS3 accessors by simpad_ to indicate they are specific to simpad devices.
- use spinlock to protect shadow register.
- implement 8 read-only pins.
- use readl/writel macros so barriers are used where necessary.
- register CS3 as GPIO controller with 24 pins (16 output only and 8 input only).
- fix PCMCIA driver to access the read-only pins rather than the shadow register for status bits.

---
 arch/arm/mach-sa1100/include/mach/simpad.h |   81 ++++++++++++++------
 arch/arm/mach-sa1100/leds-simpad.c         |    7 +-
 arch/arm/mach-sa1100/simpad.c              |  115 ++++++++++++++++++++++------
 drivers/pcmcia/sa1100_simpad.c             |   35 ++++-----
 4 files changed, 168 insertions(+), 70 deletions(-)
arch/arm/mach-sa1100/include/mach/simpad.h +58 -23
index 231550d..db28118 100644
@@ -61,32 +61,67 @@
 #define SIMPAD_UCB1X00_GPIO_HEADSET	(SIMPAD_UCB1X00_GPIO_BASE + 8)
 #define SIMPAD_UCB1X00_GPIO_SPEAKER	(SIMPAD_UCB1X00_GPIO_BASE + 9)
 
-// CS3 Latch is write only, a shadow is necessary
+/*--- CS3 Latch ---*/
+#define SIMPAD_CS3_GPIO_BASE		(GPIO_MAX + 11)
+#define SIMPAD_CS3_VCC_5V_EN		(SIMPAD_CS3_GPIO_BASE)
+#define SIMPAD_CS3_VCC_3V_EN		(SIMPAD_CS3_GPIO_BASE + 1)
+#define SIMPAD_CS3_EN1			(SIMPAD_CS3_GPIO_BASE + 2)
+#define SIMPAD_CS3_EN0			(SIMPAD_CS3_GPIO_BASE + 3)
+#define SIMPAD_CS3_DISPLAY_ON		(SIMPAD_CS3_GPIO_BASE + 4)
+#define SIMPAD_CS3_PCMCIA_BUFF_DIS	(SIMPAD_CS3_GPIO_BASE + 5)
+#define SIMPAD_CS3_MQ_RESET		(SIMPAD_CS3_GPIO_BASE + 6)
+#define SIMPAD_CS3_PCMCIA_RESET		(SIMPAD_CS3_GPIO_BASE + 7)
+#define SIMPAD_CS3_DECT_POWER_ON	(SIMPAD_CS3_GPIO_BASE + 8)
+#define SIMPAD_CS3_IRDA_SD		(SIMPAD_CS3_GPIO_BASE + 9)
+#define SIMPAD_CS3_RS232_ON		(SIMPAD_CS3_GPIO_BASE + 10)
+#define SIMPAD_CS3_SD_MEDIAQ		(SIMPAD_CS3_GPIO_BASE + 11)
+#define SIMPAD_CS3_LED2_ON		(SIMPAD_CS3_GPIO_BASE + 12)
+#define SIMPAD_CS3_IRDA_MODE		(SIMPAD_CS3_GPIO_BASE + 13)
+#define SIMPAD_CS3_ENABLE_5V		(SIMPAD_CS3_GPIO_BASE + 14)
+#define SIMPAD_CS3_RESET_SIMCARD	(SIMPAD_CS3_GPIO_BASE + 15)
+
+#define SIMPAD_CS3_PCMCIA_BVD1		(SIMPAD_CS3_GPIO_BASE + 16)
+#define SIMPAD_CS3_PCMCIA_BVD2		(SIMPAD_CS3_GPIO_BASE + 17)
+#define SIMPAD_CS3_PCMCIA_VS1		(SIMPAD_CS3_GPIO_BASE + 18)
+#define SIMPAD_CS3_PCMCIA_VS2		(SIMPAD_CS3_GPIO_BASE + 19)
+#define SIMPAD_CS3_LOCK_IND		(SIMPAD_CS3_GPIO_BASE + 20)
+#define SIMPAD_CS3_CHARGING_STATE	(SIMPAD_CS3_GPIO_BASE + 21)
+#define SIMPAD_CS3_PCMCIA_SHORT		(SIMPAD_CS3_GPIO_BASE + 22)
+#define SIMPAD_CS3_GPIO_23		(SIMPAD_CS3_GPIO_BASE + 23)
 
-#define CS3BUSTYPE unsigned volatile long
 #define CS3_BASE        0xf1000000
 
-#define VCC_5V_EN       0x0001 // For 5V PCMCIA
-#define VCC_3V_EN       0x0002 // FOR 3.3V PCMCIA
-#define EN1             0x0004 // This is only for EPROM's
-#define EN0             0x0008 // Both should be enable for 3.3V or 5V
-#define DISPLAY_ON      0x0010
-#define PCMCIA_BUFF_DIS 0x0020
-#define MQ_RESET        0x0040
-#define PCMCIA_RESET    0x0080
-#define DECT_POWER_ON   0x0100
-#define IRDA_SD         0x0200 // Shutdown for powersave
-#define RS232_ON        0x0400
-#define SD_MEDIAQ       0x0800 // Shutdown for powersave
-#define LED2_ON         0x1000
-#define IRDA_MODE       0x2000 // Fast/Slow IrDA mode
-#define ENABLE_5V       0x4000 // Enable 5V circuit
-#define RESET_SIMCARD   0x8000
-
-#define RS232_ENABLE    0x0440
-#define PCMCIAMASK      0x402f
-
-
+long simpad_get_cs3_ro(void);
+long simpad_get_cs3_shadow(void);
+void simpad_set_cs3_bit(int value);
+void simpad_clear_cs3_bit(int value);
+
+#define VCC_5V_EN	0x0001 /* For 5V PCMCIA */
+#define VCC_3V_EN	0x0002 /* FOR 3.3V PCMCIA */
+#define EN1		0x0004 /* This is only for EPROM's */
+#define EN0		0x0008 /* Both should be enable for 3.3V or 5V */
+#define DISPLAY_ON	0x0010
+#define PCMCIA_BUFF_DIS	0x0020
+#define MQ_RESET	0x0040
+#define PCMCIA_RESET	0x0080
+#define DECT_POWER_ON	0x0100
+#define IRDA_SD		0x0200 /* Shutdown for powersave */
+#define RS232_ON	0x0400
+#define SD_MEDIAQ	0x0800 /* Shutdown for powersave */
+#define LED2_ON		0x1000
+#define IRDA_MODE	0x2000 /* Fast/Slow IrDA mode */
+#define ENABLE_5V	0x4000 /* Enable 5V circuit */
+#define RESET_SIMCARD	0x8000
+
+#define PCMCIA_BVD1	0x01
+#define PCMCIA_BVD2	0x02
+#define PCMCIA_VS1	0x04
+#define PCMCIA_VS2	0x08
+#define LOCK_IND	0x10
+#define CHARGING_STATE	0x20
+#define PCMCIA_SHORT	0x40
+
+/*--- Battery ---*/
 struct simpad_battery {
 	unsigned char ac_status;	/* line connected yes/no */
 	unsigned char status;		/* battery loading yes/no */
arch/arm/mach-sa1100/leds-simpad.c +2 -5
index d50f4ee..d25784c 100644
@@ -22,9 +22,6 @@ static unsigned int hw_led_state;
 #define	LED_GREEN	(1)
 #define	LED_MASK	(1)
 
-extern void set_cs3_bit(int value);
-extern void clear_cs3_bit(int value);     
-
 void simpad_leds_event(led_event_t evt)
 {
 	switch (evt)
@@ -93,8 +90,8 @@ void simpad_leds_event(led_event_t evt)
 	}
 
 	if  (led_state & LED_STATE_ENABLED)
-		set_cs3_bit(LED2_ON);
+		simpad_set_cs3_bit(LED2_ON);
 	else 
-	        clear_cs3_bit(LED2_ON);
+		simpad_clear_cs3_bit(LED2_ON);
 }
 
arch/arm/mach-sa1100/simpad.c +92 -23

178 lines not on this page · raw message

drivers/pcmcia/sa1100_simpad.c +16 -19
index c998f7a..0fac965 100644
@@ -15,10 +15,6 @@
 #include <mach/simpad.h>
 #include "sa1100_generic.h"
  
-extern long get_cs3_shadow(void);
-extern void set_cs3_bit(int value); 
-extern void clear_cs3_bit(int value);
-
 static struct pcmcia_irqs irqs[] = {
 	{ 1, IRQ_GPIO_CF_CD, "CF_CD" },
 };
@@ -26,7 +22,7 @@ static struct pcmcia_irqs irqs[] = {
 static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 
-	clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
+	simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
 
 	skt->socket.pci_irq = IRQ_GPIO_CF_IRQ;
 
@@ -38,8 +34,8 @@ static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/* Disable CF bus: */
-	//set_cs3_bit(PCMCIA_BUFF_DIS);
-	clear_cs3_bit(PCMCIA_RESET);       
+	/*simpad_set_cs3_bit(PCMCIA_BUFF_DIS);*/
+	simpad_clear_cs3_bit(PCMCIA_RESET);
 }
 
 static void
@@ -47,15 +43,16 @@ simpad_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			   struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
-	long cs3reg = get_cs3_shadow();
+	long cs3reg = simpad_get_cs3_ro();
 
 	state->detect=((levels & GPIO_CF_CD)==0)?1:0;
 	state->ready=(levels & GPIO_CF_IRQ)?1:0;
-	state->bvd1=1; /* Not available on Simpad. */
-	state->bvd2=1; /* Not available on Simpad. */
+	state->bvd1 = 1; /* Might be cs3reg & PCMCIA_BVD1 */
+	state->bvd2 = 1; /* Might be cs3reg & PCMCIA_BVD2 */
 	state->wrprot=0; /* Not available on Simpad. */
-  
-	if((cs3reg & 0x0c) == 0x0c) {
+
+	if ((cs3reg & (PCMCIA_VS1|PCMCIA_VS2)) ==
+			(PCMCIA_VS1|PCMCIA_VS2)) {
 		state->vs_3v=0;
 		state->vs_Xv=0;
 	} else {
@@ -75,23 +72,23 @@ simpad_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 	/* Murphy: see table of MIC2562a-1 */
 	switch (state->Vcc) {
 	case 0:
-		clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
+		simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
 		break;
 
 	case 33:  
-		clear_cs3_bit(VCC_3V_EN|EN1);
-		set_cs3_bit(VCC_5V_EN|EN0);
+		simpad_clear_cs3_bit(VCC_3V_EN|EN1);
+		simpad_set_cs3_bit(VCC_5V_EN|EN0);
 		break;
 
 	case 50:
-		clear_cs3_bit(VCC_5V_EN|EN1);
-		set_cs3_bit(VCC_3V_EN|EN0);
+		simpad_clear_cs3_bit(VCC_5V_EN|EN1);
+		simpad_set_cs3_bit(VCC_3V_EN|EN0);
 		break;
 
 	default:
 		printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
 			__func__, state->Vcc);
-		clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
+		simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
 		local_irq_restore(flags);
 		return -1;
 	}
@@ -110,7 +107,7 @@ static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
 	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
-	set_cs3_bit(PCMCIA_RESET);
+	simpad_set_cs3_bit(PCMCIA_RESET);
 }
 
 static struct pcmcia_low_level simpad_pcmcia_ops = { 
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/4 ARM:simpad: add GPIO based device definitions.

In reply to Jochen Friedrich

Register keyboard, polled keyboard and I2C platform devices based on GPIOs.

V3: Split LED changes into seperate patch.

---
 arch/arm/mach-sa1100/simpad.c |   67 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 1 deletions(-)
arch/arm/mach-sa1100/simpad.c +66 -1
index 4d60c28..d1a13bb 100644
@@ -29,6 +29,9 @@
 
 #include <linux/serial_core.h>
 #include <linux/ioport.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+#include <linux/i2c-gpio.h>
 
 #include "generic.h"
 
@@ -249,6 +252,65 @@ static void simpad_power_off(void)
 
 }
 
+/*
+ * gpio_keys
+*/
+
+static struct gpio_keys_button simpad_button_table[] = {
+	{ KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" },
+};
+
+static struct gpio_keys_platform_data simpad_keys_data = {
+	.buttons = simpad_button_table,
+	.nbuttons = ARRAY_SIZE(simpad_button_table),
+};
+
+static struct platform_device simpad_keys = {
+	.name = "gpio-keys",
+	.dev = {
+		.platform_data = &simpad_keys_data,
+	},
+};
+
+static struct gpio_keys_button simpad_polled_button_table[] = {
+	{ KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" },
+	{ KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" },
+	{ KEY_UP,    SIMPAD_UCB1X00_GPIO_UP,    1, "up button" },
+	{ KEY_DOWN,  SIMPAD_UCB1X00_GPIO_DOWN,  1, "down button" },
+	{ KEY_LEFT,  SIMPAD_UCB1X00_GPIO_LEFT,  1, "left button" },
+	{ KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" },
+};
+
+static struct gpio_keys_platform_data simpad_polled_keys_data = {
+	.buttons = simpad_polled_button_table,
+	.nbuttons = ARRAY_SIZE(simpad_polled_button_table),
+	.poll_interval = 50,
+};
+
+static struct platform_device simpad_polled_keys = {
+	.name = "gpio-keys-polled",
+	.dev = {
+		.platform_data = &simpad_polled_keys_data,
+	},
+};
+
+/*
+ * i2c
+ */
+static struct i2c_gpio_platform_data simpad_i2c_data = {
+	.sda_pin = GPIO_GPIO21,
+	.scl_pin = GPIO_GPIO25,
+	.udelay = 10,
+	.timeout = HZ,
+};
+
+static struct platform_device simpad_i2c = {
+	.name = "i2c-gpio",
+	.id = 0,
+	.dev = {
+		.platform_data = &simpad_i2c_data,
+	},
+};
 
 /*
  * MediaQ Video Device
@@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = {
 };
 
 static struct platform_device *devices[] __initdata = {
-	&simpad_mq200fb
+	&simpad_keys,
+	&simpad_polled_keys,
+	&simpad_mq200fb,
+	&simpad_i2c,
 };
 
 
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 3/4 ARM:simpad: add GPIO based device definitions.

Quoted 9 lines · Jochen Friedrich

Register keyboard, polled keyboard and I2C platform devices based on GPIOs.

V3: Split LED changes into seperate patch.

---
 arch/arm/mach-sa1100/simpad.c |   67 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 1 deletions(-)

[skip]

arch/arm/mach-sa1100/simpad.c static struct platform_device simpad_mq200fb = { · line 262

Quoted 5 lines
arch/arm/mach-sa1100/simpad.c +0 -1
@@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = {
 };
 
 static struct platform_device *devices[] __initdata = {
-	&simpad_mq200fb

Are you sure this is correct?

Quoted 7 lines
arch/arm/mach-sa1100/simpad.c +4 -0
+	&simpad_keys,
+	&simpad_polled_keys,
+	&simpad_mq200fb,
+	&simpad_i2c,
 };
 
 
Signature · 2 lines
With best wishes
Dmitry
#5 lore raw

PATCH 3/4 ARM:simpad: add GPIO based device definitions.

Hi Dmitry,

Quoted 8 lines

arch/arm/mach-sa1100/simpad.c static struct platform_device simpad_mq200fb = { · line 262

Quoted 5 lines
arch/arm/mach-sa1100/simpad.c +0 -1
@@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = {
  };
 
  static struct platform_device *devices[] __initdata = {
-	&simpad_mq200fb

Are you sure this is correct?

Quoted 5 lines

arch/arm/mach-sa1100/simpad.c static struct platform_device simpad_mq200fb = { · line 328

Quoted 5 lines
arch/arm/mach-sa1100/simpad.c +4 -0
+	&simpad_keys,
+	&simpad_polled_keys,
+	&simpad_mq200fb,
+	&simpad_i2c,
  };

Sorry, I don't see your point here. Could you clarify? Did I miss something obvious?

Thanks,
Jochen

#6 lore raw

PATCH 3/4 ARM:simpad: add GPIO based device definitions.

Hello,

Quoted 10 lines · Jochen Friedrich

Hi Dmitry,

Quoted 8 lines

arch/arm/mach-sa1100/simpad.c static struct platform_device simpad_mq200fb = { · line 262

Quoted 5 lines
arch/arm/mach-sa1100/simpad.c +0 -1
@@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = {
 };
 
 static struct platform_device *devices[] __initdata = {
- &simpad_mq200fb

Are you sure this is correct?

Quoted 8 lines
Quoted 5 lines

arch/arm/mach-sa1100/simpad.c static struct platform_device simpad_mq200fb = { · line 328

Quoted 5 lines
arch/arm/mach-sa1100/simpad.c +4 -0
+ &simpad_keys,
+ &simpad_polled_keys,
+ &simpad_mq200fb,
+ &simpad_i2c,
 };

Sorry, I don't see your point here. Could you clarify? Did I miss something obvious?

Oh, I'm sorry now. I saw the removal of mq200fb device, but missed the re-addition of it. So please ignore my comment.

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

PATCH 4/4 ARM: simpad: replace ARM specific LED code

In reply to Jochen Friedrich

Remove the legacy ARM LED code for simpad devices and register a stadard LED platform device using GPIO line instead.

---
 arch/arm/mach-sa1100/Makefile      |    1 -
 arch/arm/mach-sa1100/leds-simpad.c |   97 ------------------------------------
 arch/arm/mach-sa1100/leds.c        |    2 -
 arch/arm/mach-sa1100/leds.h        |    1 -
 arch/arm/mach-sa1100/simpad.c      |   28 ++++++++++
 5 files changed, 28 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/leds-simpad.c
arch/arm/mach-sa1100/Makefile +0 -1
index 41252d2..0063178 100644
@@ -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)
arch/arm/mach-sa1100/leds-simpad.c deleted +0 -97

97 lines not on this page · raw message

arch/arm/mach-sa1100/leds.c +0 -2
index bbfe197..5fe71a0 100644
@@ -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;
arch/arm/mach-sa1100/leds.h +0 -1
index 68cc9f7..776b602 100644
@@ -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);
arch/arm/mach-sa1100/simpad.c +28 -0
index d1a13bb..b9c8e39 100644
@@ -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"
@@ -295,6 +296,32 @@ static struct platform_device simpad_polled_keys = {
 };
 
 /*
+ * GPIO LEDs
+ */
+
+static struct gpio_led simpad_leds[] = {
+	{
+		.name = "power",
+		.gpio = SIMPAD_CS3_LED2_ON,
+		.active_low = 0,
+		.default_trigger = "default-on",
+	},
+};
+
+static struct gpio_led_platform_data simpad_led_data = {
+	.num_leds = 1,
+	.leds = simpad_leds,
+};
+
+static struct platform_device simpad_gpio_leds = {
+	.name = "leds-gpio",
+	.id = 0,
+	.dev = {
+		.platform_data = &simpad_led_data,
+	},
+};
+
+/*
  * i2c
  */
 static struct i2c_gpio_platform_data simpad_i2c_data = {
@@ -324,6 +351,7 @@ static struct platform_device *devices[] __initdata = {
 	&simpad_keys,
 	&simpad_polled_keys,
 	&simpad_mq200fb,
+	&simpad_gpio_leds,
 	&simpad_i2c,
 };
 
Signature · 1 line
1.7.5.4
#8 lore raw

cover ARM: simpad: Add support for GPIO attached hardware

In reply to Jochen Friedrich

Jochen,

Is there any news about this patchset? Merged already? I'm going to post an updated Led patchset based on this.

Thanks,
-Bryan

Quoted 24 lines · Jochen Friedrich

Resend as this might got lost in the develtech.com disaster. Bryan Wu <[email protected]> intends to base his patch set to get rid of the custom LED code on this series.

This series enables GPIO API on UCB1x00 and implements the GPIO API on the CS3 latch. The third patch finally registers platform devices for the GPIO attached LED, buttons and I2C bus.

ARM: simpad: Add ucb1x00 GPIO definitions and register GPIO
ARM: simpad: Cleanup CS3 accessors and add GPIO API
ARM: simpad: add GPIO based device definitions
ARM: simpad: replace ARM specific LED code

Overall diffstat:

?arch/arm/mach-sa1100/Makefile ? ? ? ? ? ? ?| ? ?1 -
?arch/arm/mach-sa1100/include/mach/simpad.h | ? 94 ++++++++++---
?arch/arm/mach-sa1100/leds-simpad.c ? ? ? ? | ?100 -------------
?arch/arm/mach-sa1100/leds.c ? ? ? ? ? ? ? ?| ? ?2 -
?arch/arm/mach-sa1100/leds.h ? ? ? ? ? ? ? ?| ? ?1 -
?arch/arm/mach-sa1100/simpad.c ? ? ? ? ? ? ?| ?211 ++++++++++++++++++++++++---
?drivers/pcmcia/sa1100_simpad.c ? ? ? ? ? ? | ? 35 ++---

?7 files changed, 274 insertions(+), 170 deletions(-)

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#9 lore raw

cover ARM: simpad: Add support for GPIO attached hardware

Hi Bryan,

Quoted 2 lines

Is there any news about this patchset? Merged already? I'm going to post an updated Led patchset based on this.

Not yet. I'm currently waiting for the end of the merge window prior to submitting this patch against 3.1-rc1 again.

Thanks,
Jochen

#10 lore raw

cover ARM: simpad: Add support for GPIO attached hardware

Quoted 7 lines · Jochen Friedrich

Hi Bryan,

Quoted 2 lines

Is there any news about this patchset? Merged already? I'm going to post an updated Led patchset based on this.

Not yet. I'm currently waiting for the end of the merge window prior to submitting this patch against 3.1-rc1 again.

You still havent gotten any reply about those patches? I know Ive been occupied lately but I could give them a look/apply if that helps.

Best wishes
Kristoffer

Quoted 3 lines

Thanks,
Jochen

#11 lore raw

cover ARM: simpad: Add support for GPIO attached hardware

Am 07.08.2011 22:05, schrieb Kristoffer Ericson:

Quoted 11 lines
Quoted 7 lines · Jochen Friedrich

Hi Bryan,

Quoted 2 lines

Is there any news about this patchset? Merged already? I'm going to post an updated Led patchset based on this.

Not yet. I'm currently waiting for the end of the merge window prior to submitting this patch against 3.1-rc1 again.

You still havent gotten any reply about those patches? I know Ive been occupied lately but I could give them a look/apply if that helps.

I got a few comments which I hope to have addressed, but not yet the OK from Alan to add them to his patch tracking system.

Thanks,
Jochen