From: Dmitry Tunin Date: Tue, 14 Aug 2018 05:54:38 +0000 (+0300) Subject: ath79: add support for indicating the boot state using multiple leds X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7a873974f7fd04b4d5563df2b7ed91e9be3b38b7;p=openwrt%2Fstaging%2Fdedeckeh.git ath79: add support for indicating the boot state using multiple leds Use diag.sh version used for apm821xx, ipq40xx and ipq806x, which supports different leds for the different boot states. The existing led sequences should be the same as before. Signed-off-by: Dmitry Tunin [reword commit message] Signed-off-by: Mathias Kresin --- diff --git a/target/linux/ath79/base-files/etc/diag.sh b/target/linux/ath79/base-files/etc/diag.sh old mode 100644 new mode 100755 index 5a21006528..a3a7047702 --- a/target/linux/ath79/base-files/etc/diag.sh +++ b/target/linux/ath79/base-files/etc/diag.sh @@ -2,21 +2,46 @@ . /lib/functions/leds.sh -status_led="$(get_dt_led status)" +boot="$(get_dt_led boot)" +failsafe="$(get_dt_led failsafe)" +running="$(get_dt_led running)" +upgrade="$(get_dt_led upgrade)" + +get_status_led() { + status_led="$boot" +} set_state() { + status_led="$boot" + case "$1" in preinit) status_led_blink_preinit ;; failsafe) + status_led_off + [ -n "$running" ] && { + status_led="$running" + status_led_off + } + status_led="$failsafe" status_led_blink_failsafe ;; preinit_regular) status_led_blink_preinit_regular ;; + upgrade) + [ -n "$running" ] && { + status_led="$upgrade" + status_led_blink_preinit_regular + } + ;; done) - status_led_on + status_led_off + [ -n "$running" ] && { + status_led="$running" + status_led_on + } ;; esac } diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts index 489f4a4072..c439d4f46d 100644 --- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts +++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts @@ -11,7 +11,10 @@ model = "D-Link DIR825B1"; aliases { - led-status = &orange_power; + led-boot = &orange_power; + led-failsafe = &orange_power; + led-running = &orange_power; + led-upgrade = &orange_power; }; chosen { diff --git a/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi b/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi index ef9984c86e..f584945273 100644 --- a/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi +++ b/target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi @@ -8,7 +8,10 @@ / { aliases { - led-status = &power_green; + led-boot = &power_green; + led-failsafe = &power_green; + led-running = &power_green; + led-upgrade = &power_green; }; chosen { diff --git a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi index 8ee4148ff9..f481157008 100644 --- a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi +++ b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi @@ -11,7 +11,10 @@ model = "Netgear WNR612 V2"; aliases { - led-status = &led_power; + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; }; gpio-keys-polled { @@ -28,7 +31,7 @@ gpio-leds { compatible = "gpio-leds"; - led_power: power { + power: power { label = "netgear:green:power"; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ath79/dts/ar7240_tplink_tl-wr74xn-v1.dtsi b/target/linux/ath79/dts/ar7240_tplink_tl-wr74xn-v1.dtsi index 80623d57bd..788d265cd3 100644 --- a/target/linux/ath79/dts/ar7240_tplink_tl-wr74xn-v1.dtsi +++ b/target/linux/ath79/dts/ar7240_tplink_tl-wr74xn-v1.dtsi @@ -7,7 +7,10 @@ / { aliases { - led-status = &led_system; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; gpio-keys-polled { diff --git a/target/linux/ath79/dts/ar7241_tplink.dtsi b/target/linux/ath79/dts/ar7241_tplink.dtsi index ef248793d9..4078ced7d0 100644 --- a/target/linux/ath79/dts/ar7241_tplink.dtsi +++ b/target/linux/ath79/dts/ar7241_tplink.dtsi @@ -7,7 +7,10 @@ / { aliases { - led-status = &led_system; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; gpio-keys-polled { diff --git a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts index ddddba23e4..2cb02503b7 100644 --- a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts +++ b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts @@ -11,7 +11,10 @@ model = "Ubiquiti UniFi AP"; aliases { - led-status = &dome_green; + led-boot = &dome_green; + led-failsafe = &dome_green; + led-running = &dome_green; + led-upgrade = &dome_green; }; extosc: ref { diff --git a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts index db4bcc6edc..0a142666ac 100644 --- a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts +++ b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts @@ -11,7 +11,10 @@ model = "AVM FRITZ!WLAN Repeater 300E"; aliases { - led-status = &power; + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; }; gpio-keys { diff --git a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts index 0cd90262b3..e899e02fe6 100644 --- a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts +++ b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts @@ -11,7 +11,10 @@ model = "TP-LINK TL-WR2543N/ND"; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; chosen { diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts index b97b57f586..5c6cb634d6 100644 --- a/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts +++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts @@ -11,7 +11,10 @@ model = "TP-Link TL-WR1043ND Version 1"; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; extosc: ref { diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts index 9928a80f52..f3927cc329 100644 --- a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts +++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts @@ -11,7 +11,10 @@ model = "TP-Link TL-WR941N/ND v2/v3"; aliases { - led-status = &led_system; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; keys { diff --git a/target/linux/ath79/dts/ar9330_glinet_ar150.dts b/target/linux/ath79/dts/ar9330_glinet_ar150.dts index 3b8f7a2324..34240f49a8 100644 --- a/target/linux/ath79/dts/ar9330_glinet_ar150.dts +++ b/target/linux/ath79/dts/ar9330_glinet_ar150.dts @@ -12,7 +12,9 @@ aliases { serial0 = &uart; - led-status = &wlan; + led-boot = &wlan; + led-failsafe = &wlan; + led-upgrade = &wlan; }; leds { diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts index 0332ec2656..dcd7f33f9d 100644 --- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts +++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts @@ -11,7 +11,10 @@ compatible = "embeddedwireless,dorin", "qca,ar9331"; aliases { - led-status = &status; + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; serial0 = &uart; }; diff --git a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts index 223eaa230c..d44ce67025 100644 --- a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts +++ b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts @@ -12,7 +12,10 @@ aliases { serial0 = &uart; - led-status = &led_system; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; gpio-keys-polled { diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts index 3045d22196..5f7519ef13 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts @@ -12,7 +12,10 @@ aliases { serial0 = &uart; - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; leds { diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi index e061cbe592..213a96556b 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi +++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi @@ -9,7 +9,10 @@ / { aliases { serial0 = &uart; - led-status = &led_system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; gpio-keys-polled { @@ -27,7 +30,7 @@ gpio-leds { compatible = "gpio-leds"; - led_system: system { + system: system { label = "tl-wr703n:blue:system"; gpios = <&gpio 27 GPIO_ACTIVE_LOW>; }; diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi index 770ab56821..f28e56b53b 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi +++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi @@ -12,7 +12,10 @@ aliases { serial0 = &uart; - led-status = &led_system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; gpio-keys-polled { @@ -64,7 +67,7 @@ gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; }; - led_system: system { + system: system { label = "tp-link:green:system"; gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; }; diff --git a/target/linux/ath79/dts/ar9341_pcs_cr3000.dts b/target/linux/ath79/dts/ar9341_pcs_cr3000.dts index dace6c338f..3a7903eed2 100644 --- a/target/linux/ath79/dts/ar9341_pcs_cr3000.dts +++ b/target/linux/ath79/dts/ar9341_pcs_cr3000.dts @@ -12,7 +12,10 @@ aliases { serial0 = &uart; - led-status = &status; + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; }; keys { diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts index 903044e000..206619ef5c 100644 --- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts +++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts @@ -15,7 +15,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; leds { diff --git a/target/linux/ath79/dts/ar9344_pcs_cap324.dts b/target/linux/ath79/dts/ar9344_pcs_cap324.dts index ada28d634a..bc146bb672 100644 --- a/target/linux/ath79/dts/ar9344_pcs_cap324.dts +++ b/target/linux/ath79/dts/ar9344_pcs_cap324.dts @@ -12,7 +12,10 @@ aliases { serial0 = &uart; - led-status = &status; + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; }; keys { diff --git a/target/linux/ath79/dts/ar9344_pcs_cr5000.dts b/target/linux/ath79/dts/ar9344_pcs_cr5000.dts index 7c9103ced3..869322ac40 100644 --- a/target/linux/ath79/dts/ar9344_pcs_cr5000.dts +++ b/target/linux/ath79/dts/ar9344_pcs_cr5000.dts @@ -12,7 +12,10 @@ aliases { serial0 = &uart; - led-status = &status; + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; }; keys { diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi index d2c88fc935..268df4700e 100644 --- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi +++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi @@ -10,7 +10,10 @@ compatible = "tplink,tl-wdr4300"; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; leds { diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dts index 7d1cce20a6..d73eae425d 100644 --- a/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dts +++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dts @@ -11,7 +11,10 @@ model = "TP-Link TL-WR841N/ND Version 11"; aliases { - led-status = &system_led; + led-boot = &system_led; + led-failsafe = &system_led; + led-running = &system_led; + led-upgrade = &system_led; }; }; diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v9.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v9.dts index c2c9a9d700..ac069eed27 100644 --- a/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v9.dts +++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v9.dts @@ -11,6 +11,9 @@ model = "TP-Link TL-WR841N/ND Version 9"; aliases { - led-status = &qss_led; + led-boot = &qss_led; + led-failsafe = &qss_led; + led-running = &qss_led; + led-upgrade = &qss_led; }; }; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts index 54b5349fe4..67db0ee875 100644 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts +++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts @@ -11,7 +11,10 @@ model = "I-O DATA WN-AC1600DGR2"; aliases { - led-status = &power; + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; }; chosen { diff --git a/target/linux/ath79/dts/qca9558_buffalo_bhr-4grv2.dts b/target/linux/ath79/dts/qca9558_buffalo_bhr-4grv2.dts index 25c673a58b..e2611e5bf0 100644 --- a/target/linux/ath79/dts/qca9558_buffalo_bhr-4grv2.dts +++ b/target/linux/ath79/dts/qca9558_buffalo_bhr-4grv2.dts @@ -11,7 +11,10 @@ model = "Buffalo BHR-4GRV2"; aliases { - led-status = &power; + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; }; chosen { diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts index 6020e469a3..748eec823b 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts @@ -15,7 +15,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; leds { diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi index d6fb29ecfa..1d6e9a0952 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi @@ -12,7 +12,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; gpio_leds: leds { diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts index 412cf2b0df..4a3cda5358 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts @@ -15,7 +15,10 @@ }; aliases { - led-status = &led_system; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; gpio_leds: leds { diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi index fb08f867de..c91d3cce46 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi @@ -12,7 +12,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; leds { diff --git a/target/linux/ath79/dts/qca9563_phicomm_k2t.dts b/target/linux/ath79/dts/qca9563_phicomm_k2t.dts index ca6d4ec883..e99a1afbce 100644 --- a/target/linux/ath79/dts/qca9563_phicomm_k2t.dts +++ b/target/linux/ath79/dts/qca9563_phicomm_k2t.dts @@ -11,7 +11,10 @@ compatible = "phicomm,k2t"; aliases { - led-status = &status_red; + led-boot = &status_red; + led-failsafe = &status_red; + led-running = &status_red; + led-upgrade = &status_red; }; chosen { diff --git a/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts b/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts index 852f1c9784..c2e2910a15 100644 --- a/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts +++ b/target/linux/ath79/dts/qca9563_tplink_re450-v2.dts @@ -15,7 +15,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; mdio-gpio0 = &mdio2; }; diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi index 056fe4eccc..3f6d48a786 100644 --- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi @@ -12,7 +12,10 @@ }; aliases { - led-status = &system; + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; }; gpio_leds: leds {