diff options
author | Arnd Hannemann <arnd@arndnet.de> | 2010-08-14 15:45:21 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-08-16 00:18:20 -0400 |
commit | 2863e935a59b36d55522af8620112c64a56b4022 (patch) | |
tree | 9e627b69b8e09d2d5446a7e58b56584715ed8196 | |
parent | a4909b52682c1e2ac858754c8bc46f2501e67dee (diff) |
ARM: mach-shmobile: AP4EVB: use gpio-leds for leds.
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>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | 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 23d472f9525e..98c1cf76c2b4 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/sh_clk.h> | 39 | #include <linux/sh_clk.h> |
40 | #include <linux/gpio.h> | 40 | #include <linux/gpio.h> |
41 | #include <linux/input.h> | 41 | #include <linux/input.h> |
42 | #include <linux/leds.h> | ||
42 | #include <linux/input/sh_keysc.h> | 43 | #include <linux/input/sh_keysc.h> |
43 | #include <linux/usb/r8a66597.h> | 44 | #include <linux/usb/r8a66597.h> |
44 | 45 | ||
@@ -650,7 +651,44 @@ static struct platform_device hdmi_device = { | |||
650 | }, | 651 | }, |
651 | }; | 652 | }; |
652 | 653 | ||
654 | static struct gpio_led ap4evb_leds[] = { | ||
655 | { | ||
656 | .name = "led4", | ||
657 | .gpio = GPIO_PORT185, | ||
658 | .default_state = LEDS_GPIO_DEFSTATE_ON, | ||
659 | }, | ||
660 | { | ||
661 | .name = "led2", | ||
662 | .gpio = GPIO_PORT186, | ||
663 | .default_state = LEDS_GPIO_DEFSTATE_ON, | ||
664 | }, | ||
665 | { | ||
666 | .name = "led3", | ||
667 | .gpio = GPIO_PORT187, | ||
668 | .default_state = LEDS_GPIO_DEFSTATE_ON, | ||
669 | }, | ||
670 | { | ||
671 | .name = "led1", | ||
672 | .gpio = GPIO_PORT188, | ||
673 | .default_state = LEDS_GPIO_DEFSTATE_ON, | ||
674 | } | ||
675 | }; | ||
676 | |||
677 | static struct gpio_led_platform_data ap4evb_leds_pdata = { | ||
678 | .num_leds = ARRAY_SIZE(ap4evb_leds), | ||
679 | .leds = &ap4evb_leds, | ||
680 | }; | ||
681 | |||
682 | static struct platform_device leds_device = { | ||
683 | .name = "leds-gpio", | ||
684 | .id = 0, | ||
685 | .dev = { | ||
686 | .platform_data = &ap4evb_leds_pdata, | ||
687 | }, | ||
688 | }; | ||
689 | |||
653 | static struct platform_device *ap4evb_devices[] __initdata = { | 690 | static struct platform_device *ap4evb_devices[] __initdata = { |
691 | &leds_device, | ||
654 | &nor_flash_device, | 692 | &nor_flash_device, |
655 | &smc911x_device, | 693 | &smc911x_device, |
656 | &sdhi0_device, | 694 | &sdhi0_device, |
@@ -840,20 +878,6 @@ static void __init ap4evb_init(void) | |||
840 | gpio_request(GPIO_FN_CS5A, NULL); | 878 | gpio_request(GPIO_FN_CS5A, NULL); |
841 | gpio_request(GPIO_FN_IRQ6_39, NULL); | 879 | gpio_request(GPIO_FN_IRQ6_39, NULL); |
842 | 880 | ||
843 | /* enable LED 1 - 4 */ | ||
844 | gpio_request(GPIO_PORT185, NULL); | ||
845 | gpio_request(GPIO_PORT186, NULL); | ||
846 | gpio_request(GPIO_PORT187, NULL); | ||
847 | gpio_request(GPIO_PORT188, NULL); | ||
848 | gpio_direction_output(GPIO_PORT185, 1); | ||
849 | gpio_direction_output(GPIO_PORT186, 1); | ||
850 | gpio_direction_output(GPIO_PORT187, 1); | ||
851 | gpio_direction_output(GPIO_PORT188, 1); | ||
852 | gpio_export(GPIO_PORT185, 0); | ||
853 | gpio_export(GPIO_PORT186, 0); | ||
854 | gpio_export(GPIO_PORT187, 0); | ||
855 | gpio_export(GPIO_PORT188, 0); | ||
856 | |||
857 | /* enable Debug switch (S6) */ | 881 | /* enable Debug switch (S6) */ |
858 | gpio_request(GPIO_PORT32, NULL); | 882 | gpio_request(GPIO_PORT32, NULL); |
859 | gpio_request(GPIO_PORT33, NULL); | 883 | gpio_request(GPIO_PORT33, NULL); |