Skip to content

Commit

Permalink
apm821xx: convert to dt based diag LED script
Browse files Browse the repository at this point in the history
Please note that users with a Netgear WNDR4700
will need to update the device-tree partition
manually.

For instructions, please refere to commit 49856a4
("apm821xx: make it possible to update the dtb partition on the WNDR4700")

Signed-off-by: Christian Lamparter <[email protected]>
  • Loading branch information
chunkeey authored and blogic committed Dec 14, 2017
1 parent da6fdce commit 6ad56fb
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 31 deletions.
48 changes: 25 additions & 23 deletions target/linux/apm821xx/base-files/etc/diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,42 @@
. /lib/functions.sh
. /lib/functions/leds.sh

get_status_led() {
local board=$(board_name)

case $board in
mbl|\
mr24|\
mx60|\
wndr4700)
status_led="$board:green:power"
;;

*)
;;
esac
}
boot="$(get_dt_led boot)"
failsafe="$(get_dt_led failsafe)"
running="$(get_dt_led running)"
upgrade="$(get_dt_led upgrade)"

set_state() {
get_status_led
status_led="$boot"

case "$1" in
preinit_regular)
status_led_blink_preinit_regular
;;
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
}
8 changes: 6 additions & 2 deletions target/linux/apm821xx/dts/MR24.dts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

aliases {
serial0 = &UART1;
led-boot = &status;
led-failsafe = &failsafe;
led-running = &status;
led-upgrade = &status;
};

chosen {
Expand Down Expand Up @@ -91,12 +95,12 @@
gpio-leds {
compatible = "gpio-leds";

power-green {
status: power-green {
label = "mr24:green:power";
gpios = <&GPIO0 18 GPIO_ACTIVE_LOW>;
};

power-orange {
failsafe: power-orange {
label = "mr24:orange:power";
gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>;
};
Expand Down
8 changes: 6 additions & 2 deletions target/linux/apm821xx/dts/MX60.dts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

aliases {
serial0 = &UART1;
led-boot = &status;
led-failsafe = &failsafe;
led-running = &status;
led-upgrade = &status;
};

chosen {
Expand Down Expand Up @@ -120,12 +124,12 @@
gpio-leds {
compatible = "gpio-leds";

power-green {
status: power-green {
label = "mx60:green:power";
gpios = <&GPIO0 18 GPIO_ACTIVE_LOW>;
};

power-orange {
failsafe: power-orange {
label = "mx60:orange:power";
gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>;
};
Expand Down
8 changes: 6 additions & 2 deletions target/linux/apm821xx/dts/apollo3g.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

aliases {
serial0 = &UART0;
led-boot = &status;
led-failsafe = &status;
led-running = &status;
led-upgrade = &status;
};
};

Expand Down Expand Up @@ -113,13 +117,13 @@
gpio-leds {
compatible = "gpio-leds";

power-red {
failsafe: power-red {
label = "mbl:red:power";
gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "panic";
};

power-green {
status: power-green {
label = "mbl:green:power";
gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>;
};
Expand Down
8 changes: 6 additions & 2 deletions target/linux/apm821xx/dts/wndr4700.dts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

aliases {
serial0 = &UART0;
led-boot = &status;
led-failsafe = &failsafe;
led-running = &status;
led-upgrade = &status;
};

chosen {
Expand Down Expand Up @@ -348,12 +352,12 @@

gpio-leds {
compatible = "gpio-leds";
power-green {
status: power-green {
label = "wndr4700:green:power";
gpios = <&GPIO0 8 GPIO_ACTIVE_HIGH>;
};

power-orange {
failsafe: power-orange {
label = "wndr4700:orange:power";
gpios = <&GPIO0 9 GPIO_ACTIVE_LOW>;
linux,default-trigger = "panic";
Expand Down

0 comments on commit 6ad56fb

Please sign in to comment.