public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support
@ 2011-03-10  0:08 Steve Sakoman
  2011-03-10  0:08 ` [PATCH v2 1/2] OMAP: Add gpio-leds support for Overo Steve Sakoman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Steve Sakoman @ 2011-03-10  0:08 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel; +Cc: tomi.valkeinen, Steve Sakoman

Overo COMs and expansion boards have three LEDS and 2 push button switches
connected to GPIO pins.  This patch series adds support for utilizing
them with gpio-keys and gpio-leds.

Changes from version 1: Guard gpio_leds assignment with CONFIG_LEDS_GPIO check

Steve Sakoman (2):
  OMAP: Add gpio-leds support for Overo
  OMAP: Add gpio-keys support for Overo

 arch/arm/mach-omap2/board-overo.c |   95 +++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 0 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] OMAP: Add gpio-leds support for Overo
  2011-03-10  0:08 [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Steve Sakoman
@ 2011-03-10  0:08 ` Steve Sakoman
  2011-03-10  0:08 ` [PATCH v2 2/2] OMAP: Add gpio-keys " Steve Sakoman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Sakoman @ 2011-03-10  0:08 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel; +Cc: tomi.valkeinen, Steve Sakoman

This patch adds support for the standard LEDs on the Overo COM and expansion boards

Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 arch/arm/mach-omap2/board-overo.c |   53 +++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 4278ecb..e694ebd 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -473,6 +473,52 @@ static struct regulator_consumer_supply overo_vmmc1_supply = {
 	.supply			= "vmmc",
 };
 
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+#include <linux/leds.h>
+
+static struct gpio_led gpio_leds[] = {
+	{
+		.name			= "overo:red:gpio21",
+		.default_trigger	= "heartbeat",
+		.gpio			= 21,
+		.active_low		= true,
+	},
+	{
+		.name			= "overo:blue:gpio22",
+		.default_trigger	= "none",
+		.gpio			= 22,
+		.active_low		= true,
+	},
+	{
+		.name			= "overo:blue:COM",
+		.default_trigger	= "mmc0",
+		.gpio			= -EINVAL,	/* gets replaced */
+		.active_low		= true,
+	},
+};
+
+static struct gpio_led_platform_data gpio_leds_pdata = {
+	.leds		= gpio_leds,
+	.num_leds	= ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device gpio_leds_device = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &gpio_leds_pdata,
+	},
+};
+
+static void __init overo_init_led(void)
+{
+	platform_device_register(&gpio_leds_device);
+}
+
+#else
+static inline void __init overo_init_led(void) { return; }
+#endif
+
 static int overo_twl_gpio_setup(struct device *dev,
 		unsigned gpio, unsigned ngpio)
 {
@@ -480,6 +526,11 @@ static int overo_twl_gpio_setup(struct device *dev,
 
 	overo_vmmc1_supply.dev = mmc[0].dev;
 
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+	/* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
+	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
+#endif
+
 	return 0;
 }
 
@@ -487,6 +538,7 @@ static struct twl4030_gpio_platform_data overo_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
 	.irq_end	= TWL4030_GPIO_IRQ_END,
+	.use_leds	= true,
 	.setup		= overo_twl_gpio_setup,
 };
 
@@ -648,6 +700,7 @@ static void __init overo_init(void)
 	overo_spi_init();
 	overo_init_smsc911x();
 	overo_display_init();
+	overo_init_led();
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
 	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] OMAP: Add gpio-keys support for Overo
  2011-03-10  0:08 [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Steve Sakoman
  2011-03-10  0:08 ` [PATCH v2 1/2] OMAP: Add gpio-leds support for Overo Steve Sakoman
@ 2011-03-10  0:08 ` Steve Sakoman
  2011-03-10 17:58 ` [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Tony Lindgren
  2011-03-11 13:49 ` Tomi Valkeinen
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Sakoman @ 2011-03-10  0:08 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel; +Cc: tomi.valkeinen, Steve Sakoman

This patch adds support for the standard push buttons available on
Overo expansion boards.

Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 arch/arm/mach-omap2/board-overo.c |   42 +++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index e694ebd..1e17061 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -519,6 +519,47 @@ static void __init overo_init_led(void)
 static inline void __init overo_init_led(void) { return; }
 #endif
 
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+
+static struct gpio_keys_button gpio_buttons[] = {
+	{
+		.code			= BTN_0,
+		.gpio			= 23,
+		.desc			= "button0",
+		.wakeup			= 1,
+	},
+	{
+		.code			= BTN_1,
+		.gpio			= 14,
+		.desc			= "button1",
+		.wakeup			= 1,
+	},
+};
+
+static struct gpio_keys_platform_data gpio_keys_pdata = {
+	.buttons	= gpio_buttons,
+	.nbuttons	= ARRAY_SIZE(gpio_buttons),
+};
+
+static struct platform_device gpio_keys_device = {
+	.name	= "gpio-keys",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &gpio_keys_pdata,
+	},
+};
+
+static void __init overo_init_keys(void)
+{
+	platform_device_register(&gpio_keys_device);
+}
+
+#else
+static inline void __init overo_init_keys(void) { return; }
+#endif
+
 static int overo_twl_gpio_setup(struct device *dev,
 		unsigned gpio, unsigned ngpio)
 {
@@ -701,6 +742,7 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_display_init();
 	overo_init_led();
+	overo_init_keys();
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
 	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support
  2011-03-10  0:08 [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Steve Sakoman
  2011-03-10  0:08 ` [PATCH v2 1/2] OMAP: Add gpio-leds support for Overo Steve Sakoman
  2011-03-10  0:08 ` [PATCH v2 2/2] OMAP: Add gpio-keys " Steve Sakoman
@ 2011-03-10 17:58 ` Tony Lindgren
  2011-03-11 13:49 ` Tomi Valkeinen
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2011-03-10 17:58 UTC (permalink / raw)
  To: Steve Sakoman; +Cc: linux-omap, linux-arm-kernel, tomi.valkeinen

* Steve Sakoman <steve@sakoman.com> [110309 16:06]:
> Overo COMs and expansion boards have three LEDS and 2 push button switches
> connected to GPIO pins.  This patch series adds support for utilizing
> them with gpio-keys and gpio-leds.

Assuming Tomi will take these to avoid merge conflicts so:

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support
  2011-03-10  0:08 [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Steve Sakoman
                   ` (2 preceding siblings ...)
  2011-03-10 17:58 ` [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Tony Lindgren
@ 2011-03-11 13:49 ` Tomi Valkeinen
  3 siblings, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2011-03-11 13:49 UTC (permalink / raw)
  To: Steve Sakoman
  Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org

On Wed, 2011-03-09 at 18:08 -0600, Steve Sakoman wrote:
> Overo COMs and expansion boards have three LEDS and 2 push button switches
> connected to GPIO pins.  This patch series adds support for utilizing
> them with gpio-keys and gpio-leds.
> 
> Changes from version 1: Guard gpio_leds assignment with CONFIG_LEDS_GPIO check
> 
> Steve Sakoman (2):
>   OMAP: Add gpio-leds support for Overo
>   OMAP: Add gpio-keys support for Overo
> 
>  arch/arm/mach-omap2/board-overo.c |   95 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 95 insertions(+), 0 deletions(-)
> 

Thanks, I'll take these to my tree.

 Tomi



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-11 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-10  0:08 [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Steve Sakoman
2011-03-10  0:08 ` [PATCH v2 1/2] OMAP: Add gpio-leds support for Overo Steve Sakoman
2011-03-10  0:08 ` [PATCH v2 2/2] OMAP: Add gpio-keys " Steve Sakoman
2011-03-10 17:58 ` [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Tony Lindgren
2011-03-11 13:49 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox