Skip to contentSkip to conversation

ARM: shmobile: ape6evm: support GPIO switches and LEDs

PATCH New Simon Horman 3 participants 9 messages Jul 30, 2013 – Aug 6, 2013

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

cover ARM: shmobile: ape6evm: support GPIO switches and LEDs

This short series adds support for GPIO swtiches and LEDS to the ape6evm board.

Applies on top of renesas-devel-20130726.

Simon Horman (4):
ARM: shmobile: ape6evm: support GPIO switches
ARM: shmobile: ape6evm: Enable gpio-keys in defconfig
ARM: shmobile: ape6evm: Add GPIO LEDs
ARM: shmobile: ape6evm: Enable gpio-leds in defconfig

 arch/arm/configs/ape6evm_defconfig     |  6 +++-
 arch/arm/mach-shmobile/board-ape6evm.c | 60 ++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/4 ARM: shmobile: ape6evm: support GPIO switches

The ape6evm board has switches S16 - S23 wired up to GPIO pins. This patch allows access to those pins as gpio-keys.

---
 arch/arm/mach-shmobile/board-ape6evm.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/mach-shmobile/board-ape6evm.c +23 -0
index ccf8b04..677752c 100644
@@ -19,6 +19,8 @@
  */
 
 #include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/mfd/tmio.h>
@@ -37,6 +39,24 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* GPIO KEY */
+#define GPIO_KEY(c, g, d, ...) \
+	{ .code = c, .gpio = g, .desc = d, .active_low = 1 }
+
+static struct gpio_keys_button gpio_buttons[] = {
+	GPIO_KEY(KEY_0,			324,	"S16"),
+	GPIO_KEY(KEY_MENU,		325,	"S17"),
+	GPIO_KEY(KEY_HOME,		326,	"S18"),
+	GPIO_KEY(KEY_BACK,		327,	"S19"),
+	GPIO_KEY(KEY_VOLUMEUP,		328,	"S20"),
+	GPIO_KEY(KEY_VOLUMEDOWN,	329,	"S21"),
+};
+
+static struct __initdata gpio_keys_platform_data ape6evm_keys_pdata = {
+	.buttons	= gpio_buttons,
+	.nbuttons	= ARRAY_SIZE(gpio_buttons),
+};
+
 /* Dummy supplies, where voltage doesn't matter */
 static struct regulator_consumer_supply dummy_supplies[] = {
 	REGULATOR_SUPPLY("vddvario", "smsc911x"),
@@ -172,6 +192,9 @@ static void __init ape6evm_add_standard_devices(void)
 	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1,
 					  sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
 					  &sdhi1_pdata, sizeof(sdhi1_pdata));
+	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+				      &ape6evm_keys_pdata,
+				      sizeof(ape6evm_keys_pdata));
 }
 
 static const char *ape6evm_boards_compat_dt[] __initdata = {
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 2/4 ARM: shmobile: ape6evm: Enable gpio-keys in defconfig

In reply to Simon Horman
---
 arch/arm/configs/ape6evm_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/configs/ape6evm_defconfig +2 -1
index dab5a7d..e4359c7 100644
@@ -54,7 +54,8 @@ CONFIG_NETDEVICES=y
 CONFIG_SMC91X=y
 CONFIG_SMSC911X=y
 # CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_KEYBOARD is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_KEYBOARD_GPIO=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 CONFIG_SERIAL_NONSTANDARD=y
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 3/4 ARM: shmobile: ape6evm: Add GPIO LEDs

In reply to Simon Horman

The board has 6 LEDs connected to GPIOs. Add a led-gpio device to support them.

---
 arch/arm/mach-shmobile/board-ape6evm.c | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm/mach-shmobile/board-ape6evm.c +37 -0
index 677752c..db97460 100644
@@ -39,6 +39,40 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* LEDS */
+static struct gpio_led ape6evm_leds[] = {
+	{
+		.name		= "gnss-en",
+		.gpio		= 28,
+		.default_state	= LEDS_GPIO_DEFSTATE_OFF,
+	}, {
+		.name		= "nfc-nrst",
+		.gpio		= 126,
+		.default_state	= LEDS_GPIO_DEFSTATE_OFF,
+	}, {
+		.name		= "gnss-nrst",
+		.gpio		= 132,
+		.default_state	= LEDS_GPIO_DEFSTATE_OFF,
+	}, {
+		.name		= "bt-wakeup",
+		.gpio		= 232,
+		.default_state	= LEDS_GPIO_DEFSTATE_OFF,
+	}, {
+		.name		= "strobe",
+		.gpio		= 250,
+		.default_state	= LEDS_GPIO_DEFSTATE_OFF,
+	}, {
+		.name		= "bbresetout",
+		.gpio		= 288,
+		.default_state	= LEDS_GPIO_DEFSTATE_OFF,
+	},
+};
+
+static __initdata struct gpio_led_platform_data ape6evm_leds_pdata = {
+	.leds		= ape6evm_leds,
+	.num_leds	= ARRAY_SIZE(ape6evm_leds),
+};
+
 /* GPIO KEY */
 #define GPIO_KEY(c, g, d, ...) \
 	{ .code = c, .gpio = g, .desc = d, .active_low = 1 }
@@ -195,6 +229,9 @@ static void __init ape6evm_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &ape6evm_keys_pdata,
 				      sizeof(ape6evm_keys_pdata));
+	platform_device_register_data(&platform_bus, "leds-gpio", -1,
+				      &ape6evm_leds_pdata,
+				      sizeof(ape6evm_leds_pdata));
 }
 
 static const char *ape6evm_boards_compat_dt[] __initdata = {
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH 4/4 ARM: shmobile: ape6evm: Enable gpio-leds in defconfig

In reply to Simon Horman
---
 arch/arm/configs/ape6evm_defconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/configs/ape6evm_defconfig +3 -0
index e4359c7..1ce3994 100644
@@ -72,6 +72,9 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_GPIO=y
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
 # CONFIG_IOMMU_SUPPORT is not set
 # CONFIG_DNOTIFY is not set
 CONFIG_TMPFS=y
Signature · 1 line
1.8.3.2
#5 lore raw

cover ARM: shmobile: ape6evm: support GPIO switches and LEDs

In reply to Simon Horman
Quoted 5 lines · Simon Horman

This short series adds support for GPIO swtiches and LEDS to the ape6evm board.

Applies on top of renesas-devel-20130726.

Quoted 8 lines

Simon Horman (4):
ARM: shmobile: ape6evm: support GPIO switches
ARM: shmobile: ape6evm: Enable gpio-keys in defconfig
ARM: shmobile: ape6evm: Add GPIO LEDs
ARM: shmobile: ape6evm: Enable gpio-leds in defconfig

 arch/arm/configs/ape6evm_defconfig     |  6 +++-
 arch/arm/mach-shmobile/board-ape6evm.c | 60 ++++++++++++++++++++++++++++++++++

Hi Magnus, Hi All,

could I get a review of this, and if appropriate an Ack.

#6 lore raw

cover ARM: shmobile: ape6evm: support GPIO switches and LEDs

Quoted 12 lines · Simon Horman
Quoted 11 lines · Simon Horman

This short series adds support for GPIO swtiches and LEDS to the ape6evm board.

Applies on top of renesas-devel-20130726.

Simon Horman (4):
ARM: shmobile: ape6evm: support GPIO switches
ARM: shmobile: ape6evm: Enable gpio-keys in defconfig
ARM: shmobile: ape6evm: Add GPIO LEDs
ARM: shmobile: ape6evm: Enable gpio-leds in defconfig

Quoted 6 lines
Quoted 2 lines
 arch/arm/configs/ape6evm_defconfig     |  6 +++-
 arch/arm/mach-shmobile/board-ape6evm.c | 60 ++++++++++++++++++++++++++++++++++

Hi Magnus, Hi All,

could I get a review of this, and if appropriate an Ack.

Ping.

#7 lore raw

cover ARM: shmobile: ape6evm: support GPIO switches and LEDs

In reply to Simon Horman

Hi Simon

Quoted 11 lines

This short series adds support for GPIO swtiches and LEDS to the ape6evm board.

Applies on top of renesas-devel-20130726.

Simon Horman (4):
ARM: shmobile: ape6evm: support GPIO switches
ARM: shmobile: ape6evm: Enable gpio-keys in defconfig
ARM: shmobile: ape6evm: Add GPIO LEDs
ARM: shmobile: ape6evm: Enable gpio-leds in defconfig

Quoted 3 lines
 arch/arm/configs/ape6evm_defconfig     |  6 +++-
 arch/arm/mach-shmobile/board-ape6evm.c | 60 ++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)

For all patches

Best regards
---
Kuninori Morimoto

#8 lore raw

cover ARM: shmobile: ape6evm: support GPIO switches and LEDs

Quoted 14 lines · Kuninori Morimoto

Hi Simon

Quoted 11 lines

This short series adds support for GPIO swtiches and LEDS to the ape6evm board.

Applies on top of renesas-devel-20130726.

Simon Horman (4):
ARM: shmobile: ape6evm: support GPIO switches
ARM: shmobile: ape6evm: Enable gpio-keys in defconfig
ARM: shmobile: ape6evm: Add GPIO LEDs
ARM: shmobile: ape6evm: Enable gpio-leds in defconfig

Quoted 7 lines
Quoted 3 lines
 arch/arm/configs/ape6evm_defconfig     |  6 +++-
 arch/arm/mach-shmobile/board-ape6evm.c | 60 ++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)

For all patches

Thanks.

I have queued up these patches for v3.12.
The two defconfig patches are in the defconfig branch. And the other two patches are in the boards2 branch.