* [PATCH][RFC] ARM: mach-shmobile: AP4EVB: use gpio-leds for leds.
@ 2010-08-14 19:45 Arnd Hannemann
2010-08-16 4:23 ` Paul Mundt
2010-08-16 6:59 ` Arnd Hannemann
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Hannemann @ 2010-08-14 19:45 UTC (permalink / raw)
To: linux-sh
This allows control of the leds on the AP4EVB board by kernel events (triggers)
like mmc0/mmc1. In userland, the leds won't be available anymore over
/sys/class/gpio but via /sys/class/leds.
Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
---
arch/arm/mach-shmobile/board-ap4evb.c | 52 ++++++++++++++++++++++++---------
1 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 23d472f..88fdd40 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -39,6 +39,7 @@
#include <linux/sh_clk.h>
#include <linux/gpio.h>
#include <linux/input.h>
+#include <linux/leds.h>
#include <linux/input/sh_keysc.h>
#include <linux/usb/r8a66597.h>
@@ -650,7 +651,44 @@ static struct platform_device hdmi_device = {
},
};
+static struct gpio_led ap4evb_leds[] = {
+ {
+ .name = "led4",
+ .gpio = GPIO_PORT185,
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ },
+ {
+ .name = "led2",
+ .gpio = GPIO_PORT186,
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ },
+ {
+ .name = "led3",
+ .gpio = GPIO_PORT187,
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ },
+ {
+ .name = "led1",
+ .gpio = GPIO_PORT188,
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ }
+};
+
+static struct gpio_led_platform_data ap4evb_leds_pdata = {
+ .num_leds = ARRAY_SIZE(ap4evb_leds),
+ .leds = &ap4evb_leds,
+};
+
+static struct platform_device leds_device = {
+ .name = "leds-gpio",
+ .id = 0,
+ .dev = {
+ .platform_data = &ap4evb_leds_pdata,
+ },
+};
+
static struct platform_device *ap4evb_devices[] __initdata = {
+ &leds_device,
&nor_flash_device,
&smc911x_device,
&sdhi0_device,
@@ -840,20 +878,6 @@ static void __init ap4evb_init(void)
gpio_request(GPIO_FN_CS5A, NULL);
gpio_request(GPIO_FN_IRQ6_39, NULL);
- /* enable LED 1 - 4 */
- gpio_request(GPIO_PORT185, NULL);
- gpio_request(GPIO_PORT186, NULL);
- gpio_request(GPIO_PORT187, NULL);
- gpio_request(GPIO_PORT188, NULL);
- gpio_direction_output(GPIO_PORT185, 1);
- gpio_direction_output(GPIO_PORT186, 1);
- gpio_direction_output(GPIO_PORT187, 1);
- gpio_direction_output(GPIO_PORT188, 1);
- gpio_export(GPIO_PORT185, 0);
- gpio_export(GPIO_PORT186, 0);
- gpio_export(GPIO_PORT187, 0);
- gpio_export(GPIO_PORT188, 0);
-
/* enable Debug switch (S6) */
gpio_request(GPIO_PORT32, NULL);
gpio_request(GPIO_PORT33, NULL);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH][RFC] ARM: mach-shmobile: AP4EVB: use gpio-leds for leds.
2010-08-14 19:45 [PATCH][RFC] ARM: mach-shmobile: AP4EVB: use gpio-leds for leds Arnd Hannemann
@ 2010-08-16 4:23 ` Paul Mundt
2010-08-16 6:59 ` Arnd Hannemann
1 sibling, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2010-08-16 4:23 UTC (permalink / raw)
To: linux-sh
On Sat, Aug 14, 2010 at 09:45:21PM +0200, Arnd Hannemann wrote:
> This allows control of the leds on the AP4EVB board by kernel events (triggers)
> like mmc0/mmc1. In userland, the leds won't be available anymore over
> /sys/class/gpio but via /sys/class/leds.
>
> Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
A few minor nits. For starters, your editor has added trailing whitespace
all over the place, so please run future patches through checkpatch for
basic sanity checks first.
> +static struct gpio_led ap4evb_leds[] = {
[snip]
> +};
> +
> +static struct gpio_led_platform_data ap4evb_leds_pdata = {
> + .num_leds = ARRAY_SIZE(ap4evb_leds),
> + .leds = &ap4evb_leds,
> +};
> +
Here you obviously want .leds = ap4evb_leds. Has this been tested?
I'll apply it with those fixes, since it's a reasonable direction to go.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH][RFC] ARM: mach-shmobile: AP4EVB: use gpio-leds for leds.
2010-08-14 19:45 [PATCH][RFC] ARM: mach-shmobile: AP4EVB: use gpio-leds for leds Arnd Hannemann
2010-08-16 4:23 ` Paul Mundt
@ 2010-08-16 6:59 ` Arnd Hannemann
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Hannemann @ 2010-08-16 6:59 UTC (permalink / raw)
To: linux-sh
Hi Paul,
Am 16.08.2010 06:23, schrieb Paul Mundt:
> On Sat, Aug 14, 2010 at 09:45:21PM +0200, Arnd Hannemann wrote:
>> This allows control of the leds on the AP4EVB board by kernel
>> events (triggers) like mmc0/mmc1. In userland, the leds won't be
>> available anymore over /sys/class/gpio but via /sys/class/leds.
>>
>> Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
>
> A few minor nits. For starters, your editor has added trailing
> whitespace all over the place, so please run future patches through
> checkpatch for basic sanity checks first.
Ok, will do and resend.
>> +static struct gpio_led ap4evb_leds[] = {
> [snip]
>> +}; + +static struct gpio_led_platform_data ap4evb_leds_pdata = { +
>> .num_leds = ARRAY_SIZE(ap4evb_leds), + .leds = &ap4evb_leds, +}; +
> Here you obviously want .leds = ap4evb_leds. Has this been tested?
Yes, this has been tested, I wonder why it worked...
> I'll apply it with those fixes, since it's a reasonable direction to
> go.
Thanks,
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-16 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-14 19:45 [PATCH][RFC] ARM: mach-shmobile: AP4EVB: use gpio-leds for leds Arnd Hannemann
2010-08-16 4:23 ` Paul Mundt
2010-08-16 6:59 ` Arnd Hannemann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox