From: Rafał Miłecki Date: Tue, 3 Apr 2018 13:16:33 +0000 (+0200) Subject: brcm47xx: add Luxul XAP-1500 and XWR-1750 WiFi LEDs X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=16efb0c1c6c7702e694aef8f297b57b7c10b98c1;p=openwrt%2Fstaging%2Fadrian.git brcm47xx: add Luxul XAP-1500 and XWR-1750 WiFi LEDs Signed-off-by: Rafał Miłecki --- diff --git a/target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch b/target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch new file mode 100644 index 0000000000..d14719ba3d --- /dev/null +++ b/target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch @@ -0,0 +1,86 @@ +From 272641206100e89656038180da12eff4f03d79d1 Mon Sep 17 00:00:00 2001 +From: Dan Haab +Date: Tue, 27 Mar 2018 11:24:34 -0600 +Subject: [PATCH] MIPS: BCM47XX: Add Luxul XAP1500/XWR1750 WiFi LEDs + +Some Luxul devices use PCIe connected GPIO LEDs that are not available +until the PCI subsytem and its drivers load. Using the same array for +these LEDs would block registering any LEDs until all GPIOs become +available. This may be undesired behavior as some LEDs should be +available as early as possible (e.g. system status LED). This patch will +allow registering available LEDs while deferring these PCIe GPIO +connected 'extra' LEDs until they become available. + +Signed-off-by: Dan Haab +Cc: Ralf Baechle +Cc: Hauke Mehrtens +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/18952/ +Signed-off-by: James Hogan +--- + arch/mips/bcm47xx/leds.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +--- a/arch/mips/bcm47xx/leds.c ++++ b/arch/mips/bcm47xx/leds.c +@@ -408,6 +408,12 @@ bcm47xx_leds_luxul_xap_1500_v1[] __initc + }; + + static const struct gpio_led ++bcm47xx_leds_luxul_xap1500_v1_extra[] __initconst = { ++ BCM47XX_GPIO_LED(44, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF), ++ BCM47XX_GPIO_LED(76, "green", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), ++}; ++ ++static const struct gpio_led + bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = { + BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), + BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), +@@ -434,6 +440,11 @@ bcm47xx_leds_luxul_xwr_1750_v1[] __initc + BCM47XX_GPIO_LED(15, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), + }; + ++static const struct gpio_led ++bcm47xx_leds_luxul_xwr1750_v1_extra[] __initconst = { ++ BCM47XX_GPIO_LED(76, "green", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), ++}; ++ + /* Microsoft */ + + static const struct gpio_led +@@ -527,6 +538,12 @@ static struct gpio_led_platform_data bcm + bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \ + } while (0) + ++static struct gpio_led_platform_data bcm47xx_leds_pdata_extra __initdata = {}; ++#define bcm47xx_set_pdata_extra(dev_leds) do { \ ++ bcm47xx_leds_pdata_extra.leds = dev_leds; \ ++ bcm47xx_leds_pdata_extra.num_leds = ARRAY_SIZE(dev_leds); \ ++} while (0) ++ + void __init bcm47xx_leds_register(void) + { + enum bcm47xx_board board = bcm47xx_board_get(); +@@ -704,6 +721,7 @@ void __init bcm47xx_leds_register(void) + break; + case BCM47XX_BOARD_LUXUL_XAP_1500_V1: + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1); ++ bcm47xx_set_pdata_extra(bcm47xx_leds_luxul_xap1500_v1_extra); + break; + case BCM47XX_BOARD_LUXUL_XBR_4400_V1: + bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1); +@@ -716,6 +734,7 @@ void __init bcm47xx_leds_register(void) + break; + case BCM47XX_BOARD_LUXUL_XWR_1750_V1: + bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); ++ bcm47xx_set_pdata_extra(bcm47xx_leds_luxul_xwr1750_v1_extra); + break; + + case BCM47XX_BOARD_MICROSOFT_MN700: +@@ -759,4 +778,6 @@ void __init bcm47xx_leds_register(void) + } + + gpio_led_register_device(-1, &bcm47xx_leds_pdata); ++ if (bcm47xx_leds_pdata_extra.num_leds) ++ gpio_led_register_device(0, &bcm47xx_leds_pdata_extra); + } diff --git a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch index 82303856bf..c5f97ba493 100644 --- a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch +++ b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch @@ -201,7 +201,7 @@ bcm47xx_leds_linksys_wrt54g_generic[] __initconst = { BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), -@@ -532,6 +547,9 @@ void __init bcm47xx_leds_register(void) +@@ -549,6 +564,9 @@ void __init bcm47xx_leds_register(void) enum bcm47xx_board board = bcm47xx_board_get(); switch (board) { @@ -211,7 +211,7 @@ case BCM47XX_BOARD_ASUS_RTN12: bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); break; -@@ -665,6 +683,9 @@ void __init bcm47xx_leds_register(void) +@@ -682,6 +700,9 @@ void __init bcm47xx_leds_register(void) case BCM47XX_BOARD_LINKSYS_WRT310NV1: bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); break; diff --git a/target/linux/brcm47xx/patches-4.9/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch b/target/linux/brcm47xx/patches-4.9/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch new file mode 100644 index 0000000000..d14719ba3d --- /dev/null +++ b/target/linux/brcm47xx/patches-4.9/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch @@ -0,0 +1,86 @@ +From 272641206100e89656038180da12eff4f03d79d1 Mon Sep 17 00:00:00 2001 +From: Dan Haab +Date: Tue, 27 Mar 2018 11:24:34 -0600 +Subject: [PATCH] MIPS: BCM47XX: Add Luxul XAP1500/XWR1750 WiFi LEDs + +Some Luxul devices use PCIe connected GPIO LEDs that are not available +until the PCI subsytem and its drivers load. Using the same array for +these LEDs would block registering any LEDs until all GPIOs become +available. This may be undesired behavior as some LEDs should be +available as early as possible (e.g. system status LED). This patch will +allow registering available LEDs while deferring these PCIe GPIO +connected 'extra' LEDs until they become available. + +Signed-off-by: Dan Haab +Cc: Ralf Baechle +Cc: Hauke Mehrtens +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/18952/ +Signed-off-by: James Hogan +--- + arch/mips/bcm47xx/leds.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +--- a/arch/mips/bcm47xx/leds.c ++++ b/arch/mips/bcm47xx/leds.c +@@ -408,6 +408,12 @@ bcm47xx_leds_luxul_xap_1500_v1[] __initc + }; + + static const struct gpio_led ++bcm47xx_leds_luxul_xap1500_v1_extra[] __initconst = { ++ BCM47XX_GPIO_LED(44, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF), ++ BCM47XX_GPIO_LED(76, "green", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), ++}; ++ ++static const struct gpio_led + bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = { + BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), + BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), +@@ -434,6 +440,11 @@ bcm47xx_leds_luxul_xwr_1750_v1[] __initc + BCM47XX_GPIO_LED(15, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), + }; + ++static const struct gpio_led ++bcm47xx_leds_luxul_xwr1750_v1_extra[] __initconst = { ++ BCM47XX_GPIO_LED(76, "green", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), ++}; ++ + /* Microsoft */ + + static const struct gpio_led +@@ -527,6 +538,12 @@ static struct gpio_led_platform_data bcm + bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \ + } while (0) + ++static struct gpio_led_platform_data bcm47xx_leds_pdata_extra __initdata = {}; ++#define bcm47xx_set_pdata_extra(dev_leds) do { \ ++ bcm47xx_leds_pdata_extra.leds = dev_leds; \ ++ bcm47xx_leds_pdata_extra.num_leds = ARRAY_SIZE(dev_leds); \ ++} while (0) ++ + void __init bcm47xx_leds_register(void) + { + enum bcm47xx_board board = bcm47xx_board_get(); +@@ -704,6 +721,7 @@ void __init bcm47xx_leds_register(void) + break; + case BCM47XX_BOARD_LUXUL_XAP_1500_V1: + bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1); ++ bcm47xx_set_pdata_extra(bcm47xx_leds_luxul_xap1500_v1_extra); + break; + case BCM47XX_BOARD_LUXUL_XBR_4400_V1: + bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1); +@@ -716,6 +734,7 @@ void __init bcm47xx_leds_register(void) + break; + case BCM47XX_BOARD_LUXUL_XWR_1750_V1: + bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); ++ bcm47xx_set_pdata_extra(bcm47xx_leds_luxul_xwr1750_v1_extra); + break; + + case BCM47XX_BOARD_MICROSOFT_MN700: +@@ -759,4 +778,6 @@ void __init bcm47xx_leds_register(void) + } + + gpio_led_register_device(-1, &bcm47xx_leds_pdata); ++ if (bcm47xx_leds_pdata_extra.num_leds) ++ gpio_led_register_device(0, &bcm47xx_leds_pdata_extra); + } diff --git a/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch index 82303856bf..c5f97ba493 100644 --- a/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch +++ b/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch @@ -201,7 +201,7 @@ bcm47xx_leds_linksys_wrt54g_generic[] __initconst = { BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), -@@ -532,6 +547,9 @@ void __init bcm47xx_leds_register(void) +@@ -549,6 +564,9 @@ void __init bcm47xx_leds_register(void) enum bcm47xx_board board = bcm47xx_board_get(); switch (board) { @@ -211,7 +211,7 @@ case BCM47XX_BOARD_ASUS_RTN12: bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); break; -@@ -665,6 +683,9 @@ void __init bcm47xx_leds_register(void) +@@ -682,6 +700,9 @@ void __init bcm47xx_leds_register(void) case BCM47XX_BOARD_LINKSYS_WRT310NV1: bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); break;