ath79: add support for indicating the boot state using multiple leds
authorDmitry Tunin <hanipouspilot@gmail.com>
Tue, 14 Aug 2018 05:54:38 +0000 (08:54 +0300)
committerMathias Kresin <dev@kresin.me>
Wed, 15 Aug 2018 05:42:36 +0000 (07:42 +0200)
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 <hanipouspilot@gmail.com>
[reword commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
33 files changed:
target/linux/ath79/base-files/etc/diag.sh [changed mode: 0644->0755]
target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
target/linux/ath79/dts/ar7161_netgear_wndr3700.dtsi
target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
target/linux/ath79/dts/ar7240_tplink_tl-wr74xn-v1.dtsi
target/linux/ath79/dts/ar7241_tplink.dtsi
target/linux/ath79/dts/ar7241_ubnt_unifi.dts
target/linux/ath79/dts/ar7242_avm_fritz300e.dts
target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts
target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts
target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts
target/linux/ath79/dts/ar9330_glinet_ar150.dts
target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
target/linux/ath79/dts/ar9331_pisen_wmm003n.dts
target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts
target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi
target/linux/ath79/dts/ar9341_pcs_cr3000.dts
target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
target/linux/ath79/dts/ar9344_pcs_cap324.dts
target/linux/ath79/dts/ar9344_pcs_cr5000.dts
target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dts
target/linux/ath79/dts/qca9533_tplink_tl-wr841-v9.dts
target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts
target/linux/ath79/dts/qca9558_buffalo_bhr-4grv2.dts
target/linux/ath79/dts/qca9558_ocedo_koala.dts
target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi
target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
target/linux/ath79/dts/qca9563_phicomm_k2t.dts
target/linux/ath79/dts/qca9563_tplink_re450-v2.dts
target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi

old mode 100644 (file)
new mode 100755 (executable)
index 5a21006..a3a7047
@@ -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
 }
index 489f4a4072cca9be79dc8c2ca35f4093cd9f8710..c439d4f46def418424d51bf8887f4f95e194f7f9 100644 (file)
        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 {
index ef9984c86e4051953a63b45a4acc6df75ae2df14..f58494527397ff2cb51c1582601f086e64ff6a40 100644 (file)
@@ -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 {
index 8ee4148ff93d7b4e5b691133197449d0c45c897a..f481157008448c0c645da2fc8ef81c3b4b176977 100644 (file)
        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>;
                };
index 80623d57bded164326b5eb835355a9cb63b584c0..788d265cd349207b7e602c8a0da2dd12cb9b8545 100644 (file)
@@ -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 {
index ef248793d90f99bc47818778b073caed2c665b4f..4078ced7d0a9405e1f51eeadc75efbc0d1588384 100644 (file)
@@ -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 {
index ddddba23e4e2f511349750bd4e3b431f2a51b3a4..2cb02503b72b702430dfa230b3e869615d1631c1 100644 (file)
        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 {
index db4bcc6edc050918d7e5e5b447dc26d15cb99097..0a142666ac69e5319eb77486d4421b8617354699 100644 (file)
        model = "AVM FRITZ!WLAN Repeater 300E";
 
        aliases {
-               led-status = &power;
+               led-boot = &power;
+               led-failsafe = &power;
+               led-running = &power;
+               led-upgrade = &power;
        };
 
        gpio-keys {
index 0cd90262b327c8434984c38957f8825d1f6968dc..e899e02fe6805933c7e4922f413aac9cadcdddbb 100644 (file)
        model = "TP-LINK TL-WR2543N/ND";
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        chosen {
index b97b57f5865ba7cb63c8ea6ec6ba42d3161792d2..5c6cb634d63b23dd2e8e0d3378940088eaeb970d 100644 (file)
        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 {
index 9928a80f52e1619f77c63638d343ef1092484fd0..f3927cc3299ed4b6db7e94a0d51b4ce4f75bac84 100644 (file)
        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 {
index 3b8f7a2324c8495370f8fbfb0e92b8d0780ef47f..34240f49a86567009b535133297fb6b4cbdde0a5 100644 (file)
@@ -12,7 +12,9 @@
 
        aliases {
                serial0 = &uart;
-               led-status = &wlan;
+               led-boot = &wlan;
+               led-failsafe = &wlan;
+               led-upgrade = &wlan;
        };
 
        leds {
index 0332ec2656014fe3fb1e79f0e517183499144a70..dcd7f33f9d5d3ad60baba67697be98a302141ae7 100644 (file)
        compatible = "embeddedwireless,dorin", "qca,ar9331";
 
        aliases {
-               led-status = &status;
+               led-boot = &status;
+               led-failsafe = &status;
+               led-running = &status;
+               led-upgrade = &status;
                serial0 = &uart;
        };
 
index 223eaa230ca2e50d1f3d6b785ac34bf04851d862..d44ce67025a49eed07192b0722c72981f2b6c729 100644 (file)
 
        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 {
index 3045d22196834e361845aaeb35a6b5bd4448c727..5f7519ef13080f4716b55f831b720e5cf15f05b7 100644 (file)
 
        aliases {
                serial0 = &uart;
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        leds {
index e061cbe59293300b6f43aab427d1a4d17ae1ea83..213a96556b6ad6e5fca46bd53017d2fe32899279 100644 (file)
@@ -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>;
                };
index 770ab56821c506d66b3f50e33382677fe87e7e00..f28e56b53b867854aa725fbf38e94a7fe256790c 100644 (file)
 
        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>;
                };
index dace6c338f1f6794559ec2839219df9f1d67eb65..3a7903eed22b07d8b6235ab16fc06acc4604a2df 100644 (file)
 
        aliases {
                serial0 = &uart;
-               led-status = &status;
+               led-boot = &status;
+               led-failsafe = &status;
+               led-running = &status;
+               led-upgrade = &status;
        };
 
        keys {
index 903044e000a8ee5ac4f9bf6567f3489f61520071..206619ef5c9d42b31ffe9f7c05a5f9a3a37548df 100644 (file)
        };
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        leds {
index ada28d634a69274baffd28f1da99ea44f25ae093..bc146bb672c56037f42c00bf72589d1858b8ebea 100644 (file)
 
        aliases {
                serial0 = &uart;
-               led-status = &status;
+               led-boot = &status;
+               led-failsafe = &status;
+               led-running = &status;
+               led-upgrade = &status;
        };
 
        keys {
index 7c9103ced3c327c9689c1fdc85a16c7d48fab645..869322ac403e0bc2989fca8ee7f3e30354d88b91 100644 (file)
 
        aliases {
                serial0 = &uart;
-               led-status = &status;
+               led-boot = &status;
+               led-failsafe = &status;
+               led-running = &status;
+               led-upgrade = &status;
        };
 
        keys {
index d2c88fc935c64ac2726bdd03830cd67802bc07f7..268df4700e96a4a5dd71467ba20cfede262642db 100644 (file)
        compatible = "tplink,tl-wdr4300";
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        leds {
index 7d1cce20a6371528c4d877136c317213da4ec9f7..d73eae425d57e5973f82c075ae0b5c132e8fbafd 100644 (file)
        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;
        };
 };
 
index c2c9a9d70038296bc009b3d2f5a7a6cbb5ffbd05..ac069eed276dd2f6d830414b22854564b52cc1d4 100644 (file)
@@ -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;
        };
 };
index 54b5349fe4f6f2996a4804043168be204b97dc03..67db0ee875bc03ce28c8d8b892195f5f8d57a396 100644 (file)
        model = "I-O DATA WN-AC1600DGR2";
 
        aliases {
-               led-status = &power;
+               led-boot = &power;
+               led-failsafe = &power;
+               led-running = &power;
+               led-upgrade = &power;
        };
 
        chosen {
index 25c673a58b573546b1ca812d6c6d94f42ef64a65..e2611e5bf0654dafa6739bd07ebb3f88613526ba 100644 (file)
        model = "Buffalo BHR-4GRV2";
 
        aliases {
-               led-status = &power;
+               led-boot = &power;
+               led-failsafe = &power;
+               led-running = &power;
+               led-upgrade = &power;
        };
 
        chosen {
index 6020e469a311be526d36e6a7e90a13eb6721c288..748eec823bfa5b37f2a7d8ce496811bec08c37f3 100644 (file)
        };
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        leds {
index d6fb29ecfa172bd38403111d7a39580af64bca8e..1d6e9a09526fc42a4a6f57ad5474a491aca23db1 100644 (file)
        };
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        gpio_leds: leds {
index 412cf2b0df4ad92e22d8625e8e9bbe60b23211e5..4a3cda535868b05c9235073d96205fbb9dd24e1b 100644 (file)
        };
 
        aliases {
-               led-status = &led_system;
+               led-boot = &led_system;
+               led-failsafe = &led_system;
+               led-running = &led_system;
+               led-upgrade = &led_system;
        };
 
        gpio_leds: leds {
index fb08f867de1073f1f01cd7f03adbb3f78707f7c2..c91d3cce46c6f8db1977a90cb5c61f27f545cf2a 100644 (file)
        };
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        leds {
index ca6d4ec883e0e18138585e5c106e5b955af803df..e99a1afbce6a03f7165e2f8147efee3844cd0a51 100644 (file)
        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 {
index 852f1c9784d92774b56fbb29b557c9f585ba9a88..c2e2910a15a89d4b151bb63703ffdc787cb41c55 100644 (file)
        };
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
                mdio-gpio0 = &mdio2;
        };
 
index 056fe4eccc5b188a4246aa28fab4528298a37b32..3f6d48a78684b2b53242bf451b404f6202587287 100644 (file)
        };
 
        aliases {
-               led-status = &system;
+               led-boot = &system;
+               led-failsafe = &system;
+               led-running = &system;
+               led-upgrade = &system;
        };
 
        gpio_leds: leds {