lantiq: use dsl led defined in DTS
authorJohn Crispin <john@openwrt.org>
Fri, 1 Jan 2016 21:18:38 +0000 (21:18 +0000)
committerJohn Crispin <john@openwrt.org>
Fri, 1 Jan 2016 21:18:38 +0000 (21:18 +0000)
dsl_control (dsl_notify.sh) is the only process which is aware of the
state of the atm/ptm interface. Use the dsl led exclusive for the dsl
line state.

On boards which don't have a distinct internet and a dsl led, let the
netdev status of the atm interface trigger the shared led.

Triggering the shared led according to the status of the ppp interface
isn't suitable, since the led would be switched of if the ppp
connection goes down, but the line is still in sync.

Signed-off-by: Mathias Kresin <openwrt@kresin.me>
SVN-Revision: 48040

target/linux/lantiq/base-files/etc/board.d/01_leds
target/linux/lantiq/base-files/sbin/dsl_notify.sh
target/linux/lantiq/dts/ARV452CQW.dts
target/linux/lantiq/dts/VG3503J.dtsi

index 7a25b6d36fde53c6008c69de7b256e35dee99018..a95c72c3a9a55abf36fd1a97fd19f6d2e7e66d5e 100755 (executable)
@@ -12,14 +12,21 @@ board_config_update
 [ -n "$(lantiq_is_dt_led_chosen wifi)" ] && ucidef_set_led_wlan "wifi" "wifi" "$(lantiq_get_dt_led_chosen wifi)" "phy0tpt"
 [ -n "$(lantiq_is_dt_led_chosen usb)" ] && ucidef_set_led_usbdev "usb" "usb" "$(lantiq_get_dt_led_chosen usb)" "1-1"
 [ -n "$(lantiq_is_dt_led_chosen usb2)" ] && ucidef_set_led_usbdev "usb2" "usb2" "$(lantiq_get_dt_led_chosen usb2)" "2-1"
-[ -n "$(lantiq_is_dt_led_chosen internet)" ] && ucidef_set_led_netdev "internet" "internet" "$(lantiq_get_dt_led_chosen internet)" "pppoe-wan"
+
+[ -n "$(lantiq_is_dt_led_chosen internet)" ] && {
+       interface="nas0"
+
+       [ -n "$(lantiq_is_dt_led_chosen dsl)" ] && {
+               interface="pppoe-wan"
+               ucidef_set_led_default "dsl" "dsl" "$(lantiq_get_dt_led_chosen dsl)" "0"
+       }
+
+       ucidef_set_led_netdev "internet" "internet" "$(lantiq_get_dt_led_chosen internet)" "$interface"
+}
 
 board=$(lantiq_board_name)
 
 case "$board" in
-VG3503J)
-       ucidef_set_led_netdev "vdsl" "vdsl" "bt:green:dsl" "ptm0"
-       ;;
 BTHOMEHUBV2B)
        ucidef_set_led_default "power" "power" "soc:blue:power" "1"
        ;;
@@ -34,19 +41,16 @@ VGV7510KW22)
        ucidef_set_led_default "power" "power" "power" "1"
        ucidef_set_led_default "power2" "power2" "power2" "0"
        ucidef_set_led_wlan "wifi" "wifi" "wifi" "phy0radio"
-       ucidef_set_led_netdev "dsl" "dsl" "dsl" "nas0"
        ;;
 VGV7519)
        ucidef_set_led_default "power" "power" "power" "0"
        ucidef_set_led_default "power2" "power2" "power2" "1"
        ucidef_set_led_wlan "wifi" "wifi" "wireless_yellow" "phy0radio"
-       ucidef_set_led_netdev "broadband_yellow" "broadband_yellow" "broadband_yellow" "nas0"
        ;;
 P2812HNUF*)
        ucidef_set_led_default "power" "power" "power" "0"
        ucidef_set_led_default "power2" "power2" "power2" "1"
        ucidef_set_led_wlan "wifi" "wifi" "wireless_green" "phy0radio"
-       ucidef_set_led_netdev "dsl" "dsl" "dsl" "nas0"
        ;;
 ARV7519RW22)
        ucidef_set_led_default "power" "power" "power" "1"
@@ -55,7 +59,6 @@ ARV7519RW22)
 ARV8539PW22)
         ucidef_set_led_default "power" "power" "soc:green:power" "1"
         ucidef_set_led_default "power2" "power2" "soc:red:power" "0"
-        ucidef_set_led_netdev "dsl" "dsl" "soc:green:dsl" "nas0"
         ;;
 *)
        ;;
index b514e257d4b8e256f0cdb82a6d23463f6d628a15..01d04881c4c61eb8e667eca2a70bf37ce4fa15aa 100755 (executable)
 include /lib/network
 scan_interfaces
 
-local default
+local led
 config_load system
-config_get default led_adsl default
-if [ "$default" != 1 ]; then
+config_get led led_dsl sysfs
+if [ -n "$led" ]; then
        case "$DSL_INTERFACE_STATUS" in
-         "HANDSHAKE")  led_timer dsl 500 500;;
-         "TRAINING")   led_timer dsl 200 200;;
-         "UP")         led_on dsl;;
-         *)            led_off dsl
+         "HANDSHAKE")  led_timer $led 500 500;;
+         "TRAINING")   led_timer $led 200 200;;
+         "UP")         led_on $led;;
+         *)            led_off $led
        esac
 fi
 
index 320e5f59fa795330c0b0c57071fe0261f43595fb..38618f15d0c07be78a48e3799b3de2602fabf713 100644 (file)
@@ -9,7 +9,7 @@
                bootargs = "console=ttyLTQ0,115200 init=/etc/preinit";
 
                leds {
-                       dsl = &dsl;
+                       internet = &dsl;
                        power1 = &power1;
                        usb = &usb;
                        wifi = &wifi;
index 50ab0b64af64c7fd96e4e06905761e885931ff28..e56792353464e6006cc59291f9bc412cb4cf9681 100644 (file)
@@ -7,7 +7,7 @@
                bootargs = "console=ttyLTQ0,115200 init=/etc/preinit";
 
                leds {
-                       dsl = &dsl;
+                       internet = &dsl;
                        power = &power;
                        power2 = &power2;
                };