MIPS: BCM47XX: Prepare support for LEDs
Subsystems (2)
Rafał Miłecki
maintainerPATCH 1/1 MIPS: BCM47XX: Prepare support for LEDs
So far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs.
--- arch/mips/bcm47xx/Kconfig | 2 ++ arch/mips/bcm47xx/Makefile | 2 +- arch/mips/bcm47xx/leds.c | 71 ++++++++++++++++++++++++++++++++++++++++++++ arch/mips/bcm47xx/setup.c | 7 +++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 arch/mips/bcm47xx/leds.c
arch/mips/bcm47xx/Kconfig +2 -0
@@ -12,6 +12,7 @@ config BCM47XX_SSB select SSB_PCICORE_HOSTMODE if PCI select SSB_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -28,6 +29,7 @@ config BCM47XX_BCMA select BCMA_DRIVER_PCI_HOSTMODE if PCI select BCMA_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
arch/mips/bcm47xx/Makefile +1 -1
@@ -4,6 +4,6 @@ # obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o -obj-y += board.o +obj-y += board.o leds.o obj-y += gpio.o obj-y += cfe_env.o
arch/mips/bcm47xx/leds.c new file +71 -0
71 lines not on this page · raw message
arch/mips/bcm47xx/setup.c +6 -0
@@ -45,6 +46,9 @@ EXPORT_SYMBOL(bcm47xx_bus);enum bcm47xx_bus_type bcm47xx_bus_type;EXPORT_SYMBOL (bcm47xx_bus_type); +/* leds.c */ +int __init bcm47xx_leds_register (void ); +static void bcm47xx_machine_restart (char *command) {printk (KERN_ALERT "Please stand by while rebooting the system...\n" );
@@ -272,6 +276,9 @@ static int __init bcm47xx_register_bus_complete(void)break ;#endif } + +bcm47xx_leds_register (); +return 0 ; }device_initcall (bcm47xx_register_bus_complete);
Signature · 1 line
1.7.10.4
Rafał Miłecki
maintainerPATCH v2 1/1 MIPS: BCM47XX: Prepare support for LEDs
So far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs.
---
V2: use bcm47xx_private.h instead of ugly define in setup.c
--- arch/mips/bcm47xx/Kconfig | 2 + arch/mips/bcm47xx/Makefile | 2 +- arch/mips/bcm47xx/bcm47xx_private.h | 9 +++++ arch/mips/bcm47xx/leds.c | 73 +++++++++++++++++++++++++++++++++++ arch/mips/bcm47xx/setup.c | 6 +++ 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 arch/mips/bcm47xx/bcm47xx_private.h create mode 100644 arch/mips/bcm47xx/leds.c
arch/mips/bcm47xx/Kconfig +2 -0
@@ -12,6 +12,7 @@ config BCM47XX_SSB select SSB_PCICORE_HOSTMODE if PCI select SSB_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -28,6 +29,7 @@ config BCM47XX_BCMA select BCMA_DRIVER_PCI_HOSTMODE if PCI select BCMA_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
arch/mips/bcm47xx/Makefile +1 -1
@@ -4,6 +4,6 @@ # obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o -obj-y += board.o +obj-y += board.o leds.o obj-y += gpio.o obj-y += cfe_env.o
arch/mips/bcm47xx/bcm47xx_private.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef LINUX_BCM47XX_PRIVATE_H_ +#define LINUX_BCM47XX_PRIVATE_H_ + +#include <linux/kernel.h> + +/* leds.c */ +void __init bcm47xx_leds_register (void ); + +#endif
arch/mips/bcm47xx/leds.c new file +73 -0
73 lines not on this page · raw message
arch/mips/bcm47xx/setup.c +6 -0
@@ -26,6 +26,8 @@* 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "bcm47xx_private.h" +#include <linux/export.h> #include <linux/types.h> #include <linux/ssb/ssb.h>
@@ -37,6 +39,7 @@#include <asm/reboot.h> #include <asm/time.h> #include <bcm47xx.h> +#include <bcm47xx_board.h> #include <bcm47xx_nvram.h> union bcm47xx_bus bcm47xx_bus;
@@ -272,6 +275,9 @@ static int __init bcm47xx_register_bus_complete(void)break ;#endif } + +bcm47xx_leds_register (); +return 0 ; }device_initcall (bcm47xx_register_bus_complete);
Signature · 1 line
1.7.10.4
Rafał Miłecki
maintainerPATCH v3 1/1 MIPS: BCM47XX: Prepare support for LEDs
So far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs.
---
V2: use bcm47xx_private.h instead of ugly define in setup.c
V3: don't add #include <bcm47xx_data.h> in setup.c. No need to.
--- arch/mips/bcm47xx/Kconfig | 2 + arch/mips/bcm47xx/Makefile | 2 +- arch/mips/bcm47xx/bcm47xx_private.h | 9 +++++ arch/mips/bcm47xx/leds.c | 73 +++++++++++++++++++++++++++++++++++ arch/mips/bcm47xx/setup.c | 5 +++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 arch/mips/bcm47xx/bcm47xx_private.h create mode 100644 arch/mips/bcm47xx/leds.c
arch/mips/bcm47xx/Kconfig +2 -0
@@ -12,6 +12,7 @@ config BCM47XX_SSB select SSB_PCICORE_HOSTMODE if PCI select SSB_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -28,6 +29,7 @@ config BCM47XX_BCMA select BCMA_DRIVER_PCI_HOSTMODE if PCI select BCMA_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
arch/mips/bcm47xx/Makefile +1 -1
@@ -4,6 +4,6 @@ # obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o -obj-y += board.o +obj-y += board.o leds.o obj-y += gpio.o obj-y += cfe_env.o
arch/mips/bcm47xx/bcm47xx_private.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef LINUX_BCM47XX_PRIVATE_H_ +#define LINUX_BCM47XX_PRIVATE_H_ + +#include <linux/kernel.h> + +/* leds.c */ +void __init bcm47xx_leds_register (void ); + +#endif
arch/mips/bcm47xx/leds.c new file +73 -0
73 lines not on this page · raw message
arch/mips/bcm47xx/setup.c +5 -0
@@ -26,6 +26,8 @@* 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "bcm47xx_private.h" +#include <linux/export.h> #include <linux/types.h> #include <linux/ssb/ssb.h>
@@ -272,6 +274,9 @@ static int __init bcm47xx_register_bus_complete(void)break ;#endif } + +bcm47xx_leds_register (); +return 0 ; }device_initcall (bcm47xx_register_bus_complete);
Signature · 1 line
1.7.10.4
Quoted 6 lines · Rafał Miłecki
So far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs.
Signed-off-by Rafał Miłecki <[email protected]>
Quoted 163 lines
---
V2: usebcm47xx_private.hinstead of ugly define insetup.c
V3: don't add #include <bcm47xx_data.h> insetup.c. No need to.--- arch/mips/bcm47xx/Kconfig | 2 + arch/mips/bcm47xx/Makefile | 2 +- arch/mips/bcm47xx/bcm47xx_private.h | 9 +++++ arch/mips/bcm47xx/leds.c | 73 +++++++++++++++++++++++++++++++++++ arch/mips/bcm47xx/setup.c | 5 +++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 arch/mips/bcm47xx/bcm47xx_private.h create mode 100644 arch/mips/bcm47xx/leds.carch/mips/bcm47xx/Kconfig +2
-0@@ -12,6 +12,7 @@ config BCM47XX_SSB select SSB_PCICORE_HOSTMODE if PCI select SSB_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.@@ -28,6 +29,7 @@ config BCM47XX_BCMA select BCMA_DRIVER_PCI_HOSTMODE if PCI select BCMA_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.arch/mips/bcm47xx/Makefile +1
-1@@ -4,6 +4,6 @@ # obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o -obj-y += board.o +obj-y += board.o leds.o obj-y += gpio.o obj-y += cfe_env.oarch/mips/bcm47xx/bcm47xx_private.h new file +9
-0@@ -0,0 +1,9 @@ +#ifndef LINUX_BCM47XX_PRIVATE_H_ +#define LINUX_BCM47XX_PRIVATE_H_ + +#include <linux/kernel.h> + +/* leds.c */ +void __init bcm47xx_leds_register (void ); + +#endif arch/mips/bcm47xx/leds.c new file +73
-0@@ -0,0 +1,73 @@ +#include "bcm47xx_private.h" + +#include <linux/leds.h> +#include <bcm47xx_board.h> + +static const struct gpio_led +bcm47xx_leds_netgear_wndr4500_v1_leds[]__initconst = { + { + .name ="bcm47xx:green:wps" , + .gpio =1 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, + { + .name ="bcm47xx:green:power" , + .gpio =2 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, + { + .name ="bcm47xx:orange:power" , + .gpio =3 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, + { + .name ="bcm47xx:green:usb1" , + .gpio =8 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, + { + .name ="bcm47xx:green:2ghz" , + .gpio =9 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, + { + .name ="bcm47xx:blue:5ghz" , + .gpio =11 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, + { + .name ="bcm47xx:green:usb2" , + .gpio =14 , + .active_low =1 , + .default_state =LEDS_GPIO_DEFSTATE_KEEP , + }, +}; + +static struct gpio_led_platform_data bcm47xx_leds_pdata; + +#define bcm47xx_set_pdata (dev_leds) do { \ + bcm47xx_leds_pdata.leds = dev_leds; \ + bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \ +} while (0) + +void __init bcm47xx_leds_register (void ) +{ +enum bcm47xx_board board =bcm47xx_board_get (); + +switch (board) { +case BCM47XX_BOARD_NETGEAR_WNDR4500V1 : +bcm47xx_set_pdata (bcm47xx_leds_netgear_wndr4500_v1_leds); +break ; +default : +pr_debug ("No LEDs configuration found for this device\n" ); +return ; + } + +gpio_led_register_device (-1 , &bcm47xx_leds_pdata); +}arch/mips/bcm47xx/setup.c +5
-0@@ -26,6 +26,8 @@* 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "bcm47xx_private.h" +#include <linux/export.h> #include <linux/types.h> #include <linux/ssb/ssb.h> @@ -272,6 +274,9 @@ static int __init bcm47xx_register_bus_complete(void)break ;#endif } + +bcm47xx_leds_register (); +return 0 ; }device_initcall (bcm47xx_register_bus_complete);
Rafał Miłecki
maintainerPATCH v4 1/1 MIPS: BCM47XX: Prepare support for LEDs
In reply to Rafał MiłeckiSo far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs.
---
V2: use bcm47xx_private.h instead of ugly define in setup.c
V3: don't add #include <bcm47xx_data.h> in setup.c. No need to.
V4: rebase on top of upstream-sfr. I pray this to be the correct one
--- arch/mips/bcm47xx/Kconfig | 2 + arch/mips/bcm47xx/Makefile | 2 +- arch/mips/bcm47xx/bcm47xx_private.h | 9 +++++ arch/mips/bcm47xx/leds.c | 73 +++++++++++++++++++++++++++++++++++ arch/mips/bcm47xx/setup.c | 5 +++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 arch/mips/bcm47xx/bcm47xx_private.h create mode 100644 arch/mips/bcm47xx/leds.c
arch/mips/bcm47xx/Kconfig +2 -0
@@ -11,6 +11,7 @@ config BCM47XX_SSB select SSB_PCICORE_HOSTMODE if PCI select SSB_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -27,6 +28,7 @@ config BCM47XX_BCMA select BCMA_DRIVER_PCI_HOSTMODE if PCI select BCMA_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
arch/mips/bcm47xx/Makefile +1 -1
@@ -4,5 +4,5 @@ # obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o -obj-y += board.o +obj-y += board.o leds.o obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
arch/mips/bcm47xx/bcm47xx_private.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef LINUX_BCM47XX_PRIVATE_H_ +#define LINUX_BCM47XX_PRIVATE_H_ + +#include <linux/kernel.h> + +/* leds.c */ +void __init bcm47xx_leds_register (void ); + +#endif
arch/mips/bcm47xx/leds.c new file +73 -0
73 lines not on this page · raw message
arch/mips/bcm47xx/setup.c +5 -0
@@ -26,6 +26,8 @@* 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "bcm47xx_private.h" +#include <linux/export.h> #include <linux/types.h> #include <linux/ssb/ssb.h>
@@ -239,6 +241,9 @@ static int __init bcm47xx_register_bus_complete(void)break ;#endif } + +bcm47xx_leds_register (); +return 0 ; }device_initcall (bcm47xx_register_bus_complete);
Signature · 1 line
1.7.10.4
Rafał Miłecki
maintainerPATCH v4 1/1 MIPS: BCM47XX: Prepare support for LEDs
So far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs.
---
V2: use bcm47xx_private.h instead of ugly define in setup.c
V3: don't add #include <bcm47xx_data.h> in setup.c. No need to.
V4: rebase on top of upstream-sfr. I pray this to be the correct one REBASED on top of linux-john.git mips-next-3.14
--- arch/mips/bcm47xx/Kconfig | 2 + arch/mips/bcm47xx/Makefile | 2 +- arch/mips/bcm47xx/bcm47xx_private.h | 9 +++++ arch/mips/bcm47xx/leds.c | 73 +++++++++++++++++++++++++++++++++++ arch/mips/bcm47xx/setup.c | 6 +++ 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 arch/mips/bcm47xx/bcm47xx_private.h create mode 100644 arch/mips/bcm47xx/leds.c
arch/mips/bcm47xx/Kconfig +2 -0
@@ -12,6 +12,7 @@ config BCM47XX_SSB select SSB_PCICORE_HOSTMODE if PCI select SSB_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -29,6 +30,7 @@ config BCM47XX_BCMA select BCMA_DRIVER_PCI_HOSTMODE if PCI select BCMA_DRIVER_GPIO select GPIOLIB + select LEDS_GPIO_REGISTER default y help Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
arch/mips/bcm47xx/Makefile +1 -1
@@ -4,5 +4,5 @@ # obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o -obj-y += board.o +obj-y += board.o leds.o obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
arch/mips/bcm47xx/bcm47xx_private.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef LINUX_BCM47XX_PRIVATE_H_ +#define LINUX_BCM47XX_PRIVATE_H_ + +#include <linux/kernel.h> + +/* leds.c */ +void __init bcm47xx_leds_register (void ); + +#endif
arch/mips/bcm47xx/leds.c new file +73 -0
73 lines not on this page · raw message
arch/mips/bcm47xx/setup.c +6 -0
@@ -26,6 +26,8 @@* 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "bcm47xx_private.h" +#include <linux/export.h> #include <linux/types.h> #include <linux/ethtool.h>
@@ -262,7 +264,11 @@ static int __init bcm47xx_register_bus_complete(void)break ;#endif } + +bcm47xx_leds_register (); +fixed_phy_add (PHY_POLL ,0 , &bcm47xx_fixed_phy_status); +return 0 ; }device_initcall (bcm47xx_register_bus_complete);
Signature · 1 line
1.7.10.4