Kirkwood: add LaCie Network Space Max v2 support
Subsystems (3)
PATCH 1/3 Kirkwood: add LaCie Network Space Max v2 support
From: Simon Guinot <[email protected]>
--- arch/arm/mach-kirkwood/Kconfig | 6 +++++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/netspace_v2-setup.c | 29 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-kirkwood/Kconfig +6 -0
@@ -94,6 +94,12 @@ config MACH_INETSPACE_V2 Say 'Y' here if you want your kernel to support the LaCie Internet Space v2 NAS. +config MACH_NETSPACE_MAX_V2 + bool "LaCie Network Space Max v2 NAS Board" + help + Say 'Y' here if you want your kernel to support the + LaCie Network Space Max v2 NAS. + config MACH_NET2BIG_V2 bool "LaCie 2Big Network v2 NAS Board" help
arch/arm/mach-kirkwood/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o +obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o obj-$(CONFIG_MACH_T5325) += t5325-setup.o
arch/arm/mach-kirkwood/netspace_v2-setup.c +29 -0
@@ -126,6 +126,18 @@ static void __init netspace_v2_sata_power_init(void) }if (err)pr_err ("netspace_v2: failed to setup SATA0 power\n" ); + +if (machine_is_netspace_max_v2 ()) { + err =gpio_request (NETSPACE_V2_GPIO_SATA1_POWER ,"SATA1 power" ); +if (err ==0 ) { + err =gpio_direction_output ( +NETSPACE_V2_GPIO_SATA1_POWER ,1 ); +if (err) +gpio_free (NETSPACE_V2_GPIO_SATA1_POWER ); + } +if (err) +pr_err ("netspace_v2: failed to setup SATA1 power\n" ); + } }/*****************************************************************************
@@ -249,6 +261,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {MPP4_NF_IO6 ,MPP5_NF_IO7 , MPP6_SYSRST_OUTn, +MPP7_GPO ,/* Fan speed (bit 1) */ MPP8_TW0_SDA ,MPP9_TW0_SCK , MPP10_UART0_TXD,
@@ -256,10 +269,13 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {MPP12_GPO ,/* Red led */ MPP14_GPIO ,/* USB fuse */ MPP16_GPIO ,/* SATA 0 power */ +MPP17_GPIO ,/* SATA 1 power */ MPP18_NF_IO0 ,MPP19_NF_IO1 , MPP20_SATA1_ACTn, MPP21_SATA0_ACTn, +MPP22_GPIO ,/* Fan speed (bit 0) */ +MPP23_GPIO ,/* Fan power */ MPP24_GPIO ,/* USB mode select */ MPP25_GPIO ,/* Fan rotation fail */ MPP26_GPIO, /* USB device vbus */
@@ -268,6 +284,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {MPP30_GPIO ,/* Blue led (command register) */ MPP31_GPIO ,/* Board power off */ MPP32_GPIO ,/* Power button (0 = Released, 1 = Pushed) */ +MPP33_GPO ,/* Fan speed (bit 2) */ 0 };
@@ -332,3 +349,15 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2") .timer = &netspace_v2_timer, MACHINE_END#endif + +#ifdef CONFIG_MACH_NETSPACE_MAX_V2 +MACHINE_START (NETSPACE_MAX_V2 ,"LaCie Network Space Max v2" ) + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = netspace_v2_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &netspace_v2_timer, +MACHINE_END +#endif
Signature · 1 line
1.6.3.1
PATCH 2/3 leds: add LED driver for Network Space v2 LEDs
From: Simon Guinot <[email protected]>
This patch add a LED class driver for the dual-GPIO LEDs found on the Network Space v2 board (and parents). This include Internet Space v2, Network Space (Max) v2 and d2 Network v2 boards.
This dual-GPIO LED is wired to a CPLD and can blink in relation with the SATA activity. The driver expose this capability through a "sata" sysfs attribute.
--- drivers/leds/Kconfig | 8 + drivers/leds/Makefile | 1 + drivers/leds/leds-ns2.c | 338 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/leds-ns2.h | 20 +++ 4 files changed, 367 insertions(+), 0 deletions(-) create mode 100644 drivers/leds/leds-ns2.c create mode 100644 include/linux/leds-ns2.h
drivers/leds/Kconfig +8 -0
@@ -302,6 +302,14 @@ config LEDS_MC13783 This option enable support for on-chip LED drivers found on Freescale Semiconductor MC13783 PMIC. +config LEDS_NS2 + tristate "LED support for Network Space v2 GPIO LEDs" + depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 + help + This option enable support for the dual-GPIO LED found on the + Network Space v2 board (and parents). This include Internet Space v2, + Network Space (Max) v2 and d2 Network v2 boards. + config LEDS_TRIGGERS bool "LED Trigger support" help
drivers/leds/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o +obj-$(CONFIG_LEDS_NS2) += leds-ns2.o # LED SPI Drivers obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
drivers/leds/leds-ns2.c new file +338 -0
338 lines not on this page · raw message
include/linux/leds-ns2.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* leds-ns2.h - platform data structure for Network Space v2 LED driver +*/ + +#ifndef __LEDS_NS2_H +#define __LEDS_NS2_H + +struct ns2_led { +const char *name; +const char *default_trigger; +unsigned cmd; +unsigned slow; +}; + +struct ns2_led_platform_data { +int num_leds; +struct ns2_led *leds; +}; + +#endif /* __LEDS_NS2_H */
Signature · 1 line
1.6.3.1
PATCH 3/3 Kirkwood: update LED support for Network Space v2
From: Simon Guinot <[email protected]>
--- arch/arm/mach-kirkwood/netspace_v2-setup.c | 71 ++++++++++++---------------- 1 files changed, 30 insertions(+), 41 deletions(-)
arch/arm/mach-kirkwood/netspace_v2-setup.c +30 -41
@@ -35,6 +35,7 @@#include <linux/gpio.h> #include <linux/gpio_keys.h> #include <linux/leds.h> +#include <linux/leds-ns2.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/time.h>
@@ -172,36 +173,12 @@ static struct platform_device netspace_v2_gpio_buttons = {* GPIO LEDs ****************************************************************************/ -/* -* The blue front LED is wired to a CPLD and can blink in relation with the -* SATA activity. -* -* The following array detail the different LED registers and the combination -* of their possible values: -* -* cmd_led | slow_led | /SATA active | LED state -* | | | -* 1 | 0 | x | off -* - | 1 | x | on -* 0 | 0 | 1 | on -* 0 | 0 | 0 | blink (rate 300ms) -*/ -#define NETSPACE_V2_GPIO_RED_LED 12 -#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29 -#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30 -static struct gpio_led netspace_v2_gpio_led_pins[] = { { - .name ="ns_v2:blue:sata" , - .default_trigger ="default-on" , - .gpio =NETSPACE_V2_GPIO_BLUE_LED_CMD , - .active_low =1 , - }, - { - .name ="ns_v2:red:fail" , - .gpio =NETSPACE_V2_GPIO_RED_LED , + .name ="ns_v2:red:fail" , + .gpio =NETSPACE_V2_GPIO_RED_LED , }, };
@@ -218,22 +195,33 @@ static struct platform_device netspace_v2_gpio_leds = { }, }; -static void __init netspace_v2_gpio_leds_init (void ) -{ -int err; +/***************************************************************************** +* Dual-GPIO CPLD LEDs +****************************************************************************/ -/* Configure register slow_led to allow SATA activity LED blinking */ - err =gpio_request (NETSPACE_V2_GPIO_BLUE_LED_SLOW ,"blue LED slow" ); -if (err ==0 ) { - err =gpio_direction_output (NETSPACE_V2_GPIO_BLUE_LED_SLOW ,0 ); -if (err) -gpio_free (NETSPACE_V2_GPIO_BLUE_LED_SLOW ); - } -if (err) -pr_err ("netspace_v2: failed to configure blue LED slow GPIO\n" ); +#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29 +#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30 -platform_device_register (&netspace_v2_gpio_leds); -} +static struct ns2_led netspace_v2_led_pins[] = { + { + .name ="ns_v2:blue:sata" , + .cmd =NETSPACE_V2_GPIO_BLUE_LED_CMD , + .slow =NETSPACE_V2_GPIO_BLUE_LED_SLOW , + }, +}; + +static struct ns2_led_platform_data netspace_v2_leds_data = { + .num_leds =ARRAY_SIZE (netspace_v2_led_pins), + .leds = netspace_v2_led_pins, +}; + +static struct platform_device netspace_v2_leds = { + .name ="leds-ns2" , + .id =-1 , + .dev = { + .platform_data = &netspace_v2_leds_data, + }, +};/***************************************************************************** * Timer
@@ -316,7 +304,8 @@ static void __init netspace_v2_init(void)i2c_register_board_info (0 , netspace_v2_i2c_info,ARRAY_SIZE (netspace_v2_i2c_info)); -netspace_v2_gpio_leds_init (); +platform_device_register (&netspace_v2_leds); +platform_device_register (&netspace_v2_gpio_leds);platform_device_register (&netspace_v2_gpio_buttons); if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&
Signature · 1 line
1.6.3.1
PATCH 2/3 leds: add LED driver for Network Space v2 LEDs
In reply to Simon GuinotQuoted 11 lines · Simon Guinot
From: Simon Guinot <[email protected]>
This patch add a LED class driver for the dual-GPIO LEDs found on the Network Space v2 board (and parents). This include Internet Space v2, Network Space (Max) v2 and d2 Network v2 boards.
This dual-GPIO LED is wired to a CPLD and can blink in relation with the SATA activity. The driver expose this capability through a "sata" sysfs attribute.
Signed-off-by Simon Guinot <[email protected]>
[...]
drivers/leds/Kconfig config LEDS_MC13783 · line 307
Quoted 3 lines
drivers/leds/Kconfig +3
-0+config LEDS_NS2 + tristate "LED support for Network Space v2 GPIO LEDs" + depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2
You could add a "default y" here.
Quoted 8 lines
drivers/leds/leds-ns2.c new file +8
-0+enum ns2_led_modes { +NS_V2_LED_OFF , +NS_V2_LED_ON , +NS_V2_LED_SATA , +}; + +struct ns2_led_mode_value { +enum ns2_led_modes mode;
drivers/leds/leds-ns2.c line 66
Quoted 10 lines
drivers/leds/leds-ns2.c new file +10
-0+int cmd_level; +int slow_level; +}; + +struct ns2_led_mode_value ns2_led_modval[] = { + {NS_V2_LED_OFF ,1 ,0 }, + {NS_V2_LED_ON ,0 ,1 }, + {NS_V2_LED_ON ,1 ,1 }, + {NS_V2_LED_SATA ,0 ,0 }, +};
You probably want to make this static.
include/linux/leds-ns2.h
Quoted 5 lines
include/linux/leds-ns2.h new file +0
-0
This is probably not the best location for this file as it is really specific to a particular device and not generic for the kernel. You could create it in arch/arm/mach-kirkwood/include/mach/leds-ns2.h instead, and include it with #include <mach/leds-ns2.h>.
Nicolas
PATCH 2/3 leds: add LED driver for Network Space v2 LEDs
Hi Nicolas,
Quoted 12 lines · Nicolas Pitre
Quoted 10 lines · Simon Guinot
From: Simon Guinot <[email protected]>
This patch add a LED class driver for the dual-GPIO LEDs found on the Network Space v2 board (and parents). This include Internet Space v2, Network Space (Max) v2 and d2 Network v2 boards.
This dual-GPIO LED is wired to a CPLD and can blink in relation with the SATA activity. The driver expose this capability through a "sata" sysfs attribute.
Quoted 8 lines
Quoted 1 line
Signed-off-by Simon Guinot <[email protected]>[...]
drivers/leds/Kconfig config LEDS_MC13783 · line 307
Quoted 3 lines
drivers/leds/Kconfig +3
-0+config LEDS_NS2 + tristate "LED support for Network Space v2 GPIO LEDs" + depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2You could add a "default y" here.
OK
Quoted 13 lines
Quoted 13 lines
drivers/leds/leds-ns2.c new file +12
-0+enum ns2_led_modes { +NS_V2_LED_OFF , +NS_V2_LED_ON , +NS_V2_LED_SATA , +}; + +struct ns2_led_mode_value { +enum ns2_led_modes mode; +int cmd_level; +int slow_level; +}; +
Quoted 8 lines
drivers/leds/leds-ns2.c line 66
Quoted 6 lines
drivers/leds/leds-ns2.c new file +6
-0+struct ns2_led_mode_value ns2_led_modval[] = { + {NS_V2_LED_OFF ,1 ,0 }, + {NS_V2_LED_ON ,0 ,1 }, + {NS_V2_LED_ON ,1 ,1 }, + {NS_V2_LED_SATA ,0 ,0 }, +};You probably want to make this static.
Yes, I want.
Quoted 11 lines
include/linux/leds-ns2.h
Quoted 6 lines
include/linux/leds-ns2.h new file +0
-0This is probably not the best location for this file as it is really specific to a particular device and not generic for the kernel. You could create it in
arch/arm/mach-kirkwood/include/mach/leds-ns2.hinstead, and include it with #include <mach/leds-ns2.h>.
OK
Thanks for your review.
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100706/1907afce/attachment.sig>
PATCH v2 1/3 Kirkwood: add LaCie Network Space Max v2 support
In reply to Nicolas PitreFrom: Simon Guinot <[email protected]>
--- arch/arm/mach-kirkwood/Kconfig | 6 +++++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/netspace_v2-setup.c | 29 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-kirkwood/Kconfig +6 -0
@@ -94,6 +94,12 @@ config MACH_INETSPACE_V2 Say 'Y' here if you want your kernel to support the LaCie Internet Space v2 NAS. +config MACH_NETSPACE_MAX_V2 + bool "LaCie Network Space Max v2 NAS Board" + help + Say 'Y' here if you want your kernel to support the + LaCie Network Space Max v2 NAS. + config MACH_NET2BIG_V2 bool "LaCie 2Big Network v2 NAS Board" help
arch/arm/mach-kirkwood/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o +obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o obj-$(CONFIG_MACH_T5325) += t5325-setup.o
arch/arm/mach-kirkwood/netspace_v2-setup.c +29 -0
@@ -126,6 +126,18 @@ static void __init netspace_v2_sata_power_init(void) }if (err)pr_err ("netspace_v2: failed to setup SATA0 power\n" ); + +if (machine_is_netspace_max_v2 ()) { + err =gpio_request (NETSPACE_V2_GPIO_SATA1_POWER ,"SATA1 power" ); +if (err ==0 ) { + err =gpio_direction_output ( +NETSPACE_V2_GPIO_SATA1_POWER ,1 ); +if (err) +gpio_free (NETSPACE_V2_GPIO_SATA1_POWER ); + } +if (err) +pr_err ("netspace_v2: failed to setup SATA1 power\n" ); + } }/*****************************************************************************
@@ -249,6 +261,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {MPP4_NF_IO6 ,MPP5_NF_IO7 , MPP6_SYSRST_OUTn, +MPP7_GPO ,/* Fan speed (bit 1) */ MPP8_TW0_SDA ,MPP9_TW0_SCK , MPP10_UART0_TXD,
@@ -256,10 +269,13 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {MPP12_GPO ,/* Red led */ MPP14_GPIO ,/* USB fuse */ MPP16_GPIO ,/* SATA 0 power */ +MPP17_GPIO ,/* SATA 1 power */ MPP18_NF_IO0 ,MPP19_NF_IO1 , MPP20_SATA1_ACTn, MPP21_SATA0_ACTn, +MPP22_GPIO ,/* Fan speed (bit 0) */ +MPP23_GPIO ,/* Fan power */ MPP24_GPIO ,/* USB mode select */ MPP25_GPIO ,/* Fan rotation fail */ MPP26_GPIO, /* USB device vbus */
@@ -268,6 +284,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {MPP30_GPIO ,/* Blue led (command register) */ MPP31_GPIO ,/* Board power off */ MPP32_GPIO ,/* Power button (0 = Released, 1 = Pushed) */ +MPP33_GPO ,/* Fan speed (bit 2) */ 0 };
@@ -332,3 +349,15 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2") .timer = &netspace_v2_timer, MACHINE_END#endif + +#ifdef CONFIG_MACH_NETSPACE_MAX_V2 +MACHINE_START (NETSPACE_MAX_V2 ,"LaCie Network Space Max v2" ) + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = netspace_v2_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &netspace_v2_timer, +MACHINE_END +#endif
Signature · 1 line
1.6.3.1
PATCH v2 2/3 leds: add LED driver for Network Space v2 LEDs
From: Simon Guinot <[email protected]>
This patch add a LED class driver for the dual-GPIO LEDs found on the Network Space v2 board (and parents). This include Internet Space v2, Network Space (Max) v2 and d2 Network v2 boards.
This dual-GPIO LED is wired to a CPLD and can blink in relation with the SATA activity. The driver expose this capability through a "sata" sysfs attribute.
--- arch/arm/mach-kirkwood/include/mach/leds-ns2.h | 26 ++ drivers/leds/Kconfig | 9 + drivers/leds/Makefile | 1 + drivers/leds/leds-ns2.c | 338 ++++++++++++++++++++++++ 4 files changed, 374 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-kirkwood/include/mach/leds-ns2.h create mode 100644 drivers/leds/leds-ns2.c
arch/arm/mach-kirkwood/include/mach/leds-ns2.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* arch/arm/mach-kirkwood/include/mach/leds-ns2.h +* +* Platform data structure for Network Space v2 LED driver +* +* This file is licensed under the terms of the GNU General Public +* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +#ifndef __MACH_LEDS_NS2_H +#define __MACH_LEDS_NS2_H + +struct ns2_led { +const char *name; +const char *default_trigger; +unsigned cmd; +unsigned slow; +}; + +struct ns2_led_platform_data { +int num_leds; +struct ns2_led *leds; +}; + +#endif /* __MACH_LEDS_NS2_H */
drivers/leds/Kconfig +9 -0
@@ -302,6 +302,15 @@ config LEDS_MC13783 This option enable support for on-chip LED drivers found on Freescale Semiconductor MC13783 PMIC. +config LEDS_NS2 + tristate "LED support for Network Space v2 GPIO LEDs" + depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 + default y + help + This option enable support for the dual-GPIO LED found on the + Network Space v2 board (and parents). This include Internet Space v2, + Network Space (Max) v2 and d2 Network v2 boards. + config LEDS_TRIGGERS bool "LED Trigger support" help
drivers/leds/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o +obj-$(CONFIG_LEDS_NS2) += leds-ns2.o # LED SPI Drivers obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
drivers/leds/leds-ns2.c new file +338 -0
338 lines not on this page · raw message
Signature · 1 line
1.6.3.1
PATCH v2 3/3 Kirkwood: update LED support for Network Space v2
From: Simon Guinot <[email protected]>
--- arch/arm/mach-kirkwood/netspace_v2-setup.c | 71 ++++++++++++---------------- 1 files changed, 30 insertions(+), 41 deletions(-)
arch/arm/mach-kirkwood/netspace_v2-setup.c +30 -41
@@ -39,6 +39,7 @@#include <asm/mach/arch.h> #include <asm/mach/time.h> #include <mach/kirkwood.h> +#include <mach/leds-ns2.h> #include <plat/time.h> #include "common.h" #include "mpp.h"
@@ -172,36 +173,12 @@ static struct platform_device netspace_v2_gpio_buttons = {* GPIO LEDs ****************************************************************************/ -/* -* The blue front LED is wired to a CPLD and can blink in relation with the -* SATA activity. -* -* The following array detail the different LED registers and the combination -* of their possible values: -* -* cmd_led | slow_led | /SATA active | LED state -* | | | -* 1 | 0 | x | off -* - | 1 | x | on -* 0 | 0 | 1 | on -* 0 | 0 | 0 | blink (rate 300ms) -*/ -#define NETSPACE_V2_GPIO_RED_LED 12 -#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29 -#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30 -static struct gpio_led netspace_v2_gpio_led_pins[] = { { - .name ="ns_v2:blue:sata" , - .default_trigger ="default-on" , - .gpio =NETSPACE_V2_GPIO_BLUE_LED_CMD , - .active_low =1 , - }, - { - .name ="ns_v2:red:fail" , - .gpio =NETSPACE_V2_GPIO_RED_LED , + .name ="ns_v2:red:fail" , + .gpio =NETSPACE_V2_GPIO_RED_LED , }, };
@@ -218,22 +195,33 @@ static struct platform_device netspace_v2_gpio_leds = { }, }; -static void __init netspace_v2_gpio_leds_init (void ) -{ -int err; +/***************************************************************************** +* Dual-GPIO CPLD LEDs +****************************************************************************/ -/* Configure register slow_led to allow SATA activity LED blinking */ - err =gpio_request (NETSPACE_V2_GPIO_BLUE_LED_SLOW ,"blue LED slow" ); -if (err ==0 ) { - err =gpio_direction_output (NETSPACE_V2_GPIO_BLUE_LED_SLOW ,0 ); -if (err) -gpio_free (NETSPACE_V2_GPIO_BLUE_LED_SLOW ); - } -if (err) -pr_err ("netspace_v2: failed to configure blue LED slow GPIO\n" ); +#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29 +#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30 -platform_device_register (&netspace_v2_gpio_leds); -} +static struct ns2_led netspace_v2_led_pins[] = { + { + .name ="ns_v2:blue:sata" , + .cmd =NETSPACE_V2_GPIO_BLUE_LED_CMD , + .slow =NETSPACE_V2_GPIO_BLUE_LED_SLOW , + }, +}; + +static struct ns2_led_platform_data netspace_v2_leds_data = { + .num_leds =ARRAY_SIZE (netspace_v2_led_pins), + .leds = netspace_v2_led_pins, +}; + +static struct platform_device netspace_v2_leds = { + .name ="leds-ns2" , + .id =-1 , + .dev = { + .platform_data = &netspace_v2_leds_data, + }, +};/***************************************************************************** * Timer
@@ -316,7 +304,8 @@ static void __init netspace_v2_init(void)i2c_register_board_info (0 , netspace_v2_i2c_info,ARRAY_SIZE (netspace_v2_i2c_info)); -netspace_v2_gpio_leds_init (); +platform_device_register (&netspace_v2_leds); +platform_device_register (&netspace_v2_gpio_leds);platform_device_register (&netspace_v2_gpio_buttons); if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&
Signature · 1 line
1.6.3.1