Skip to contentSkip to conversation

Convert SA1100 to use LEDs subsystem

PATCH New Russell King - ARM Linux 2 participants 4 messages Nov 28, 2018

Subsystems (2)
lore
Share & tools
lore

Russell King - ARM Linux

author maintainer
#0 lore raw

cover Convert SA1100 to use LEDs subsystem

This series, following on from the "SA11xx PCMCIA updates and GPIOD conversion" series, converts SA11x0 to use the LEDs subsystem and GPIO interfaces.

 arch/arm/mach-sa1100/Kconfig   |   2 +
 arch/arm/mach-sa1100/assabet.c | 143 ++++++++++++++++-------------------------
 arch/arm/mach-sa1100/cerf.c    |  11 +---
 3 files changed, 60 insertions(+), 96 deletions(-)
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
#1 lore raw

PATCH 1/3 ARM: sa1100/assabet: add gpio keys support for right-hand two buttons

Add gpio keys support for the right-hand two buttons on the Assabet, which can be used to wake up the CPU after PM.

---
 arch/arm/mach-sa1100/assabet.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/mach-sa1100/assabet.c +30 -0
index 3e8c0948abcc..53afea52a961 100644
@@ -15,6 +15,7 @@
 #include <linux/errno.h>
 #include <linux/gpio/gpio-reg.h>
 #include <linux/gpio/machine.h>
+#include <linux/gpio_keys.h>
 #include <linux/ioport.h>
 #include <linux/platform_data/sa11x0-serial.h>
 #include <linux/regulator/fixed.h>
@@ -479,6 +480,30 @@ static struct gpiod_lookup_table assabet_cf_vcc_gpio_table = {
 	},
 };
 
+static struct gpio_keys_button assabet_keys_buttons[] = {
+	{
+		.gpio = 0,
+		.irq = IRQ_GPIO0,
+		.desc = "gpio0",
+		.wakeup = 1,
+		.can_disable = 1,
+		.debounce_interval = 5,
+	}, {
+		.gpio = 1,
+		.irq = IRQ_GPIO1,
+		.desc = "gpio1",
+		.wakeup = 1,
+		.can_disable = 1,
+		.debounce_interval = 5,
+	},
+};
+
+static const struct gpio_keys_platform_data assabet_keys_pdata = {
+	.buttons = assabet_keys_buttons,
+	.nbuttons = ARRAY_SIZE(assabet_keys_buttons),
+	.rep = 0,
+};
+
 static void __init assabet_init(void)
 {
 	/*
@@ -533,6 +558,11 @@ static void __init assabet_init(void)
 
 	}
 
+	platform_device_register_resndata(NULL, "gpio-keys", 0,
+					  NULL, 0,
+					  &assabet_keys_pdata,
+					  sizeof(assabet_keys_pdata));
+
 #ifndef ASSABET_PAL_VIDEO
 	sa11x0_register_lcd(&lq039q2ds54_info);
 #else
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 ARM: sa1100/assabet: switch to using gpio leds

In reply to Russell King - ARM Linux

Switch over to using gpio leds now that we have the gpio driver for the assabet board register in place.

---
 arch/arm/mach-sa1100/Kconfig   |   1 +
 arch/arm/mach-sa1100/assabet.c | 113 ++++++++++-------------------------------
 2 files changed, 28 insertions(+), 86 deletions(-)
arch/arm/mach-sa1100/Kconfig +1 -0
index fde7ef1ab192..ab0a71c8b10e 100644
@@ -6,6 +6,7 @@ config SA1100_ASSABET
 	bool "Assabet"
 	select ARM_SA1110_CPUFREQ
 	select GPIO_REG
+	select LEDS_GPIO_REGISTER
 	select REGULATOR
 	select REGULATOR_FIXED_VOLTAGE
 	help
arch/arm/mach-sa1100/assabet.c +27 -86

145 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/3 ARM: sa1100/cerf: switch to using gpio_led_register_device()

In reply to Russell King - ARM Linux

Rather than statically declaring the leds-gpio device, use the helper function provided.

---
 arch/arm/mach-sa1100/Kconfig |  1 +
 arch/arm/mach-sa1100/cerf.c  | 11 +----------
 2 files changed, 2 insertions(+), 10 deletions(-)
arch/arm/mach-sa1100/Kconfig +1 -0
index ab0a71c8b10e..af15ae50b5a2 100644
@@ -25,6 +25,7 @@ config ASSABET_NEPONSET
 config SA1100_CERF
 	bool "CerfBoard"
 	select ARM_SA1110_CPUFREQ
+	select LEDS_GPIO_REGISTER
 	help
 	  The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued).
 	  More information is available at:
arch/arm/mach-sa1100/cerf.c +1 -10
index b2a4b41626ef..88e526561a24 100644
@@ -89,18 +89,8 @@ static struct gpio_led_platform_data cerf_gpio_led_info = {
 	.num_leds	= ARRAY_SIZE(cerf_gpio_leds),
 };
 
-static struct platform_device cerf_leds = {
-	.name	= "leds-gpio",
-	.id	= -1,
-	.dev	= {
-		.platform_data	= &cerf_gpio_led_info,
-	}
-};
-
-
 static struct platform_device *cerf_devices[] __initdata = {
 	&cerfuart2_device,
-	&cerf_leds,
 };
 
 #ifdef CONFIG_SA1100_CERF_FLASH_32MB
@@ -176,6 +166,7 @@ static void __init cerf_init(void)
 {
 	sa11x0_ppc_configure_mcp();
 	platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
+	gpio_led_register_device(-1, &cerf_gpio_led_info);
 	sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
 	sa11x0_register_mcp(&cerf_mcp_data);
 	sa11x0_register_pcmcia(1, &cerf_cf_gpio_table);
Signature · 1 line
2.7.4