From 893035004ac65b46599adda56cf4ce047205ed12 Mon Sep 17 00:00:00 2001 From: acoul Date: Thu, 31 Mar 2016 21:50:35 +0300 Subject: [PATCH] linux/ar71xx: rework led code isolation --- .../ar71xx/patches-3.18/999_led_fix.patch | 163 +++++++++++++ .../ar71xx/patches-4.1/999_led_fix.patch | 217 ++++++++++++++++++ 2 files changed, 380 insertions(+) create mode 100644 target/linux/ar71xx/patches-4.1/999_led_fix.patch diff --git a/target/linux/ar71xx/patches-3.18/999_led_fix.patch b/target/linux/ar71xx/patches-3.18/999_led_fix.patch index 39c9da2c8f..5c784f24da 100644 --- a/target/linux/ar71xx/patches-3.18/999_led_fix.patch +++ b/target/linux/ar71xx/patches-3.18/999_led_fix.patch @@ -52,3 +52,166 @@ spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info)); spi_register_board_info(rb4xx_microsd_info, ARRAY_SIZE(rb4xx_microsd_info)); +--- a/arch/mips/ath79/mach-rb91x.c ++++ b/arch/mips/ath79/mach-rb91x.c +@@ -33,7 +33,9 @@ + + #include "common.h" + #include "dev-eth.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-nfc.h" + #include "dev-usb.h" + #include "dev-spi.h" +@@ -186,6 +188,7 @@ static struct ath79_spi_platform_data rb + .num_chipselect = 2, + }; + ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb711gr100_leds[] __initdata = { + { + .name = "rb:green:led1", +@@ -223,6 +226,7 @@ static struct gpio_led rb711gr100_leds[] + .active_low = 0, + }, + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct at803x_platform_data rb91x_at803x_data = { + .disable_smarteee = 1, +@@ -332,10 +336,10 @@ static void __init rb711gr100_setup(void + platform_device_register_data(NULL, "gpio-latch", -1, + &rb711gr100_gpio_latch_data, + sizeof(rb711gr100_gpio_latch_data)); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb711gr100_leds), + rb711gr100_leds); +- ++#endif /* CONFIG_NEW_LEDS */ + flags = rb711gr100_get_flags(info); + + if (flags & RB91X_FLAG_USB) +--- a/arch/mips/ath79/mach-rb922.c ++++ b/arch/mips/ath79/mach-rb922.c +@@ -28,7 +28,9 @@ + #include "common.h" + #include "dev-gpio-buttons.h" + #include "dev-eth.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-m25p80.h" + #include "dev-nfc.h" + #include "dev-usb.h" +@@ -80,7 +82,7 @@ static struct flash_platform_data rb922g + .parts = rb922gs_spi_partitions, + .nr_parts = ARRAY_SIZE(rb922gs_spi_partitions), + }; +- ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb922gs_leds[] __initdata = { + { + .name = "rb:green:user", +@@ -88,7 +90,7 @@ static struct gpio_led rb922gs_leds[] __ + .active_low = 1, + }, + }; +- ++#endif /* CONFIG_NEW_LEDS */ + static struct gpio_keys_button rb922gs_gpio_keys[] __initdata = { + { + .desc = "Reset button", +@@ -221,7 +223,9 @@ static void __init rb922gs_setup(void) + ath79_register_eth(0); + + ath79_register_pci(); ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb922gs_leds), rb922gs_leds); ++#endif /* CONFIG_NEW_LEDS */ + ath79_register_gpio_keys_polled(-1, RB922_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rb922gs_gpio_keys), + rb922gs_gpio_keys); +--- a/arch/mips/ath79/mach-rb95x.c ++++ b/arch/mips/ath79/mach-rb95x.c +@@ -36,7 +36,9 @@ + #include "dev-wmac.h" + #include "machtypes.h" + #include "routerboot.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + + #define RB95X_GPIO_NAND_NCE 14 + +@@ -58,7 +60,7 @@ static struct mtd_partition rb95x_nand_p + .size = MTDPART_SIZ_FULL, + }, + }; +- ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb951ui_leds_gpio[] __initdata = { + { + .name = "rb:green:wlan", +@@ -90,6 +92,7 @@ static struct gpio_led rb951ui_leds_gpio + .active_low = 1, + } + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct ar8327_pad_cfg rb95x_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_RGMII, +@@ -249,9 +252,10 @@ static void __init rb951ui_setup(void) + + rb95x_wlan_init(); + ath79_register_usb(); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb951ui_leds_gpio), + rb951ui_leds_gpio); ++#endif /* CONFIG_NEW_LEDS */ + } + + MIPS_MACHINE(ATH79_MACH_RB_951U, "951HnD", "MikroTik RouterBOARD 951Ui-2HnD", +--- a/arch/mips/ath79/mach-rbsxtlite.c ++++ b/arch/mips/ath79/mach-rbsxtlite.c +@@ -30,7 +30,9 @@ + #include "common.h" + #include "dev-ap9x-pci.h" + #include "dev-gpio-buttons.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-eth.h" + #include "dev-m25p80.h" + #include "dev-nfc.h" +@@ -74,7 +76,7 @@ static struct mtd_partition rbsxtlite_na + .size = MTDPART_SIZ_FULL, + }, + }; +- ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rbsxtlite_leds_gpio[] __initdata = { + { + .name = "rb:green:user", +@@ -111,6 +113,7 @@ static struct gpio_led rbsxtlite_leds_gp + .gpio = SXTLITE_GPIO_LED_POWER, + }, + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct gpio_keys_button rbsxtlite_gpio_keys[] __initdata = { + { +@@ -206,9 +209,10 @@ static void __init rbsxtlite_setup(void) + return; + rbsxtlite_nand_init(); + rbsxtlite_wlan_init(); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rbsxtlite_leds_gpio), + rbsxtlite_leds_gpio); ++#endif /* CONFIG_NEW_LEDS */ + ath79_register_gpio_keys_polled(-1, SXTLITE_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rbsxtlite_gpio_keys), + rbsxtlite_gpio_keys); diff --git a/target/linux/ar71xx/patches-4.1/999_led_fix.patch b/target/linux/ar71xx/patches-4.1/999_led_fix.patch new file mode 100644 index 0000000000..5c784f24da --- /dev/null +++ b/target/linux/ar71xx/patches-4.1/999_led_fix.patch @@ -0,0 +1,217 @@ +--- a/arch/mips/ath79/mach-rb4xx.c ++++ b/arch/mips/ath79/mach-rb4xx.c +@@ -26,7 +26,9 @@ + #include "common.h" + #include "dev-eth.h" + #include "dev-gpio-buttons.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-usb.h" + #include "machtypes.h" + #include "pci.h" +@@ -44,6 +46,7 @@ + #define RB4XX_KEYS_POLL_INTERVAL 20 /* msecs */ + #define RB4XX_KEYS_DEBOUNCE_INTERVAL (3 * RB4XX_KEYS_POLL_INTERVAL) + ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb4xx_leds_gpio[] __initdata = { + { + .name = "rb4xx:yellow:user", +@@ -71,6 +74,7 @@ static struct gpio_led rb4xx_leds_gpio[] + .active_low = 0, + }, + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct gpio_keys_button rb4xx_gpio_keys[] __initdata = { + { +@@ -223,10 +227,10 @@ static void __init rb4xx_generic_setup(v + { + ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN | + AR71XX_GPIO_FUNC_SPI_CS2_EN); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), + rb4xx_leds_gpio); +- ++#endif /* CONFIG_NEW_LEDS */ + ath79_register_gpio_keys_polled(-1, RB4XX_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rb4xx_gpio_keys), + rb4xx_gpio_keys); +@@ -424,10 +428,10 @@ static void __init rb493g_setup(void) + { + ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN | + AR71XX_GPIO_FUNC_SPI_CS2_EN); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), + rb4xx_leds_gpio); +- ++#endif /* CONFIG_NEW_LEDS */ + spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info)); + spi_register_board_info(rb4xx_microsd_info, + ARRAY_SIZE(rb4xx_microsd_info)); +--- a/arch/mips/ath79/mach-rb91x.c ++++ b/arch/mips/ath79/mach-rb91x.c +@@ -33,7 +33,9 @@ + + #include "common.h" + #include "dev-eth.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-nfc.h" + #include "dev-usb.h" + #include "dev-spi.h" +@@ -186,6 +188,7 @@ static struct ath79_spi_platform_data rb + .num_chipselect = 2, + }; + ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb711gr100_leds[] __initdata = { + { + .name = "rb:green:led1", +@@ -223,6 +226,7 @@ static struct gpio_led rb711gr100_leds[] + .active_low = 0, + }, + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct at803x_platform_data rb91x_at803x_data = { + .disable_smarteee = 1, +@@ -332,10 +336,10 @@ static void __init rb711gr100_setup(void + platform_device_register_data(NULL, "gpio-latch", -1, + &rb711gr100_gpio_latch_data, + sizeof(rb711gr100_gpio_latch_data)); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb711gr100_leds), + rb711gr100_leds); +- ++#endif /* CONFIG_NEW_LEDS */ + flags = rb711gr100_get_flags(info); + + if (flags & RB91X_FLAG_USB) +--- a/arch/mips/ath79/mach-rb922.c ++++ b/arch/mips/ath79/mach-rb922.c +@@ -28,7 +28,9 @@ + #include "common.h" + #include "dev-gpio-buttons.h" + #include "dev-eth.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-m25p80.h" + #include "dev-nfc.h" + #include "dev-usb.h" +@@ -80,7 +82,7 @@ static struct flash_platform_data rb922g + .parts = rb922gs_spi_partitions, + .nr_parts = ARRAY_SIZE(rb922gs_spi_partitions), + }; +- ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb922gs_leds[] __initdata = { + { + .name = "rb:green:user", +@@ -88,7 +90,7 @@ static struct gpio_led rb922gs_leds[] __ + .active_low = 1, + }, + }; +- ++#endif /* CONFIG_NEW_LEDS */ + static struct gpio_keys_button rb922gs_gpio_keys[] __initdata = { + { + .desc = "Reset button", +@@ -221,7 +223,9 @@ static void __init rb922gs_setup(void) + ath79_register_eth(0); + + ath79_register_pci(); ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb922gs_leds), rb922gs_leds); ++#endif /* CONFIG_NEW_LEDS */ + ath79_register_gpio_keys_polled(-1, RB922_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rb922gs_gpio_keys), + rb922gs_gpio_keys); +--- a/arch/mips/ath79/mach-rb95x.c ++++ b/arch/mips/ath79/mach-rb95x.c +@@ -36,7 +36,9 @@ + #include "dev-wmac.h" + #include "machtypes.h" + #include "routerboot.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + + #define RB95X_GPIO_NAND_NCE 14 + +@@ -58,7 +60,7 @@ static struct mtd_partition rb95x_nand_p + .size = MTDPART_SIZ_FULL, + }, + }; +- ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rb951ui_leds_gpio[] __initdata = { + { + .name = "rb:green:wlan", +@@ -90,6 +92,7 @@ static struct gpio_led rb951ui_leds_gpio + .active_low = 1, + } + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct ar8327_pad_cfg rb95x_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_RGMII, +@@ -249,9 +252,10 @@ static void __init rb951ui_setup(void) + + rb95x_wlan_init(); + ath79_register_usb(); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rb951ui_leds_gpio), + rb951ui_leds_gpio); ++#endif /* CONFIG_NEW_LEDS */ + } + + MIPS_MACHINE(ATH79_MACH_RB_951U, "951HnD", "MikroTik RouterBOARD 951Ui-2HnD", +--- a/arch/mips/ath79/mach-rbsxtlite.c ++++ b/arch/mips/ath79/mach-rbsxtlite.c +@@ -30,7 +30,9 @@ + #include "common.h" + #include "dev-ap9x-pci.h" + #include "dev-gpio-buttons.h" ++#ifdef CONFIG_NEW_LEDS + #include "dev-leds-gpio.h" ++#endif /* CONFIG_NEW_LEDS */ + #include "dev-eth.h" + #include "dev-m25p80.h" + #include "dev-nfc.h" +@@ -74,7 +76,7 @@ static struct mtd_partition rbsxtlite_na + .size = MTDPART_SIZ_FULL, + }, + }; +- ++#ifdef CONFIG_NEW_LEDS + static struct gpio_led rbsxtlite_leds_gpio[] __initdata = { + { + .name = "rb:green:user", +@@ -111,6 +113,7 @@ static struct gpio_led rbsxtlite_leds_gp + .gpio = SXTLITE_GPIO_LED_POWER, + }, + }; ++#endif /* CONFIG_NEW_LEDS */ + + static struct gpio_keys_button rbsxtlite_gpio_keys[] __initdata = { + { +@@ -206,9 +209,10 @@ static void __init rbsxtlite_setup(void) + return; + rbsxtlite_nand_init(); + rbsxtlite_wlan_init(); +- ++#ifdef CONFIG_NEW_LEDS + ath79_register_leds_gpio(-1, ARRAY_SIZE(rbsxtlite_leds_gpio), + rbsxtlite_leds_gpio); ++#endif /* CONFIG_NEW_LEDS */ + ath79_register_gpio_keys_polled(-1, SXTLITE_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rbsxtlite_gpio_keys), + rbsxtlite_gpio_keys); -- 2.35.1