All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] ARM: mach-shmobile: lager: support GPIO switches
Date: Mon, 13 May 2013 13:25:50 +0000	[thread overview]
Message-ID: <5190E9DE.6000502@cogentembedded.com> (raw)
In-Reply-To: <1368435233-8587-4-git-send-email-horms+renesas@verge.net.au>

On 13-05-2013 12:53, Simon Horman wrote:

> The lager board has pins 1 - 4 of SW2 wired up to GPIO pins.
> This patch allows access to those pins as KEYS 1 - 4 using
> gpio-keys.

> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

[...]

> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index 6a1ba38..4d1b42b 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
[...]
> @@ -52,6 +55,22 @@ static struct gpio_led_platform_data lager_leds_pdata = {
>   	.num_leds	= ARRAY_SIZE(lager_leds),
>   };
>
> +/* 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_4,		RCAR_GP_PIN(1, 28),	"SW2-pin4"),
> +	GPIO_KEY(KEY_3,		RCAR_GP_PIN(1, 26),	"SW2-pin3"),
> +	GPIO_KEY(KEY_2,		RCAR_GP_PIN(1, 24),	"SW2-pin2"),
> +	GPIO_KEY(KEY_1,		RCAR_GP_PIN(1, 14),	"SW2-pin1"),
> +};
> +
> +static struct gpio_keys_platform_data lager_keys_pdata = {

    You forgot to annotate this with __initdata.

> +	.buttons	= gpio_buttons,
> +	.nbuttons	= ARRAY_SIZE(gpio_buttons),
> +};
> +
>   static const struct pinctrl_map lager_pinctrl_map[] = {
>   	/* SCIF0 (CN19: DEBUG SERIAL0) */
>   	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
> @@ -73,6 +92,9 @@ static void __init lager_add_standard_devices(void)
>   	platform_device_register_data(&platform_bus, "leds-gpio", -1,
>   				      &lager_leds_pdata,
>   				      sizeof(lager_leds_pdata));
> +	platform_device_register_data(&platform_bus, "gpio-keys", -1,
> +				      &lager_keys_pdata,
> +				      sizeof(lager_keys_pdata));
>   }

WBR, Sergei



WARNING: multiple messages have this Message-ID (diff)
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: mach-shmobile: lager: support GPIO switches
Date: Mon, 13 May 2013 17:25:50 +0400	[thread overview]
Message-ID: <5190E9DE.6000502@cogentembedded.com> (raw)
In-Reply-To: <1368435233-8587-4-git-send-email-horms+renesas@verge.net.au>

On 13-05-2013 12:53, Simon Horman wrote:

> The lager board has pins 1 - 4 of SW2 wired up to GPIO pins.
> This patch allows access to those pins as KEYS 1 - 4 using
> gpio-keys.

> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

[...]

> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index 6a1ba38..4d1b42b 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
[...]
> @@ -52,6 +55,22 @@ static struct gpio_led_platform_data lager_leds_pdata = {
>   	.num_leds	= ARRAY_SIZE(lager_leds),
>   };
>
> +/* 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_4,		RCAR_GP_PIN(1, 28),	"SW2-pin4"),
> +	GPIO_KEY(KEY_3,		RCAR_GP_PIN(1, 26),	"SW2-pin3"),
> +	GPIO_KEY(KEY_2,		RCAR_GP_PIN(1, 24),	"SW2-pin2"),
> +	GPIO_KEY(KEY_1,		RCAR_GP_PIN(1, 14),	"SW2-pin1"),
> +};
> +
> +static struct gpio_keys_platform_data lager_keys_pdata = {

    You forgot to annotate this with __initdata.

> +	.buttons	= gpio_buttons,
> +	.nbuttons	= ARRAY_SIZE(gpio_buttons),
> +};
> +
>   static const struct pinctrl_map lager_pinctrl_map[] = {
>   	/* SCIF0 (CN19: DEBUG SERIAL0) */
>   	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
> @@ -73,6 +92,9 @@ static void __init lager_add_standard_devices(void)
>   	platform_device_register_data(&platform_bus, "leds-gpio", -1,
>   				      &lager_leds_pdata,
>   				      sizeof(lager_leds_pdata));
> +	platform_device_register_data(&platform_bus, "gpio-keys", -1,
> +				      &lager_keys_pdata,
> +				      sizeof(lager_keys_pdata));
>   }

WBR, Sergei

  reply	other threads:[~2013-05-13 13:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13  8:53 [PATCH 0/3] ARM: mach-shmobile: lager: support GPIO switche Simon Horman
2013-05-13  8:53 ` Simon Horman
2013-05-13  8:53 ` [PATCH 1/3] gpio-rcar: Add support for IRQ_TYPE_EDGE_BOTH Simon Horman
2013-05-13  8:53   ` Simon Horman
2013-05-13 10:14   ` Magnus Damm
2013-05-13 10:14     ` Magnus Damm
2013-05-14  2:44     ` Simon Horman
2013-05-14  2:44       ` Simon Horman
2013-05-13  8:53 ` [PATCH 2/3] ARM: shmobile: r8a7790: Configure R-Car GPIO " Simon Horman
2013-05-13  8:53   ` Simon Horman
2013-05-13 22:33   ` Laurent Pinchart
2013-05-13 22:33     ` Laurent Pinchart
2013-05-14  2:40     ` Simon Horman
2013-05-14  2:40       ` Simon Horman
2013-05-14  6:01       ` Magnus Damm
2013-05-14  6:01         ` Magnus Damm
2013-05-14 15:31         ` Laurent Pinchart
2013-05-14 15:31           ` Laurent Pinchart
2013-05-13  8:53 ` [PATCH 3/3] ARM: mach-shmobile: lager: support GPIO switches Simon Horman
2013-05-13  8:53   ` Simon Horman
2013-05-13 13:25   ` Sergei Shtylyov [this message]
2013-05-13 13:25     ` Sergei Shtylyov
2013-05-13 22:35   ` Laurent Pinchart
2013-05-13 22:35     ` Laurent Pinchart
2013-05-14  2:59     ` Simon Horman
2013-05-14  2:59       ` Simon Horman
2013-05-14  6:09       ` Magnus Damm
2013-05-14  6:09         ` Magnus Damm
2013-05-14  8:38         ` Simon Horman
2013-05-14  8:38           ` Simon Horman
2013-05-14  9:24         ` Laurent Pinchart
2013-05-14  9:24           ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5190E9DE.6000502@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.