[source] apm821xx: convert to dt based diag LED script
LEDE Commits
lede-commits at lists.infradead.org
Thu Dec 14 00:29:48 PST 2017
blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/6ad56fb34c7498084659f3bf1b501f104aa76879
commit 6ad56fb34c7498084659f3bf1b501f104aa76879
Author: Christian Lamparter <chunkeey at gmail.com>
AuthorDate: Tue Nov 28 22:51:07 2017 +0100
apm821xx: convert to dt based diag LED script
Please note that users with a Netgear WNDR4700
will need to update the device-tree partition
manually.
For instructions, please refere to commit 49856a4bb581
("apm821xx: make it possible to update the dtb partition on the WNDR4700")
Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
target/linux/apm821xx/base-files/etc/diag.sh | 48 +++++++++++++++-------------
target/linux/apm821xx/dts/MR24.dts | 8 +++--
target/linux/apm821xx/dts/MX60.dts | 8 +++--
target/linux/apm821xx/dts/apollo3g.dtsi | 8 +++--
target/linux/apm821xx/dts/wndr4700.dts | 8 +++--
5 files changed, 49 insertions(+), 31 deletions(-)
diff --git a/target/linux/apm821xx/base-files/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh
index eb9b04b..e45f2a8 100755
--- a/target/linux/apm821xx/base-files/etc/diag.sh
+++ b/target/linux/apm821xx/base-files/etc/diag.sh
@@ -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
}
diff --git a/target/linux/apm821xx/dts/MR24.dts b/target/linux/apm821xx/dts/MR24.dts
index 8d20872..75bb322 100644
--- a/target/linux/apm821xx/dts/MR24.dts
+++ b/target/linux/apm821xx/dts/MR24.dts
@@ -20,6 +20,10 @@
aliases {
serial0 = &UART1;
+ led-boot = &status;
+ led-failsafe = &failsafe;
+ led-running = &status;
+ led-upgrade = &status;
};
chosen {
@@ -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>;
};
diff --git a/target/linux/apm821xx/dts/MX60.dts b/target/linux/apm821xx/dts/MX60.dts
index 4ec0043..6c75363 100644
--- a/target/linux/apm821xx/dts/MX60.dts
+++ b/target/linux/apm821xx/dts/MX60.dts
@@ -20,6 +20,10 @@
aliases {
serial0 = &UART1;
+ led-boot = &status;
+ led-failsafe = &failsafe;
+ led-running = &status;
+ led-upgrade = &status;
};
chosen {
@@ -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>;
};
diff --git a/target/linux/apm821xx/dts/apollo3g.dtsi b/target/linux/apm821xx/dts/apollo3g.dtsi
index 783348a..09a8b85 100644
--- a/target/linux/apm821xx/dts/apollo3g.dtsi
+++ b/target/linux/apm821xx/dts/apollo3g.dtsi
@@ -14,6 +14,10 @@
aliases {
serial0 = &UART0;
+ led-boot = &status;
+ led-failsafe = &status;
+ led-running = &status;
+ led-upgrade = &status;
};
};
@@ -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>;
};
diff --git a/target/linux/apm821xx/dts/wndr4700.dts b/target/linux/apm821xx/dts/wndr4700.dts
index d1a65f3..2e0addf 100644
--- a/target/linux/apm821xx/dts/wndr4700.dts
+++ b/target/linux/apm821xx/dts/wndr4700.dts
@@ -19,6 +19,10 @@
aliases {
serial0 = &UART0;
+ led-boot = &status;
+ led-failsafe = &failsafe;
+ led-running = &status;
+ led-upgrade = &status;
};
chosen {
@@ -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";
More information about the lede-commits
mailing list