[openwrt/openwrt] mediatek: improve device tree for Acer Predator Connect W6

LEDE Commits lede-commits at lists.infradead.org
Thu Nov 28 10:58:40 PST 2024


ynezz pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/d491100f01aea270557b151a8ead3a82b785eea7

commit d491100f01aea270557b151a8ead3a82b785eea7
Author: George Oldfort <openwrt at 10099.de>
AuthorDate: Mon Nov 11 10:40:45 2024 +0100

    mediatek: improve device tree for Acer Predator Connect W6
    
    In order to prepare for OpenWrt support other Acer W6 devices and to get
    a step further to full hardware support for Acer Predator Connect W6, this
    commit
    - adjusts the product name ("Acer Predator Connect W6")
    - updates gpio LED labels to function/color scheme
    - show router status by using first rgb led instead of it's red color only
      (blue: booting/failsafe mode; red: sysupgrade; green: running – was: red)
    - changes switch/eth1 led configuration to reflect RX/TX activity and speed
      (green: full 1Gbps/2.5Gbps speed; amber: lower speed; blink: RX/TX)
    - shortens dummy dm-mod.create string in bootargs
    - enables W6's i2c interface
    
    This is the third of four commits into which the original commit was split
    to make reviews easier and more targeted.
    
    Signed-off-by: George Oldfort <openwrt at 10099.de>
    Link: https://github.com/openwrt/openwrt/pull/16861
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
    (cherry picked from commit d42075dcefa407a03a30663879688475bb912729)
    Link: https://github.com/openwrt/openwrt/pull/17097
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 .../mediatek/dts/mt7986a-acer-predator-w6.dts      | 90 +++++++++++++++-------
 .../linux/mediatek/dts/mt7986a-acer-w6-common.dtsi | 47 +++++++----
 target/linux/mediatek/image/filogic.mk             |  2 +-
 3 files changed, 94 insertions(+), 45 deletions(-)

diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts
index 8c86fd31d8..5002326d70 100644
--- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts
+++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts
@@ -4,107 +4,143 @@
 #include "mt7986a-acer-w6-common.dtsi"
 
 / {
-	model = "Acer Predator W6";
+	model = "Acer Predator Connect W6";
 	compatible = "acer,predator-w6", "mediatek,mt7986a";
 
 	aliases {
 		serial0 = &uart0;
-		led-boot = &led_status;
-		led-failsafe = &led_status;
-		led-running = &led_status;
-		led-upgrade = &led_status;
+		led-boot = &led_status_blue;
+		led-failsafe = &led_status_blue;
+		led-running = &led_status_green;
+		led-upgrade = &led_status_red;
 	};
 
 	leds {
 		compatible = "gpio-leds";
 
-		led_status: led-0 {
-			label = "ant0:red";
+		led_status_red: led-0 {
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <0>;
 			gpios = <&pio 1 GPIO_ACTIVE_HIGH>;
 		};
 
-		led-1 {
-			label = "ant0:green";
+		led_status_green: led-1 {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <0>;
 			gpios = <&pio 2 GPIO_ACTIVE_HIGH>;
 		};
 
-		led-2 {
-			label = "ant0:blue";
+		led_status_blue: led-2 {
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <0>;
 			gpios = <&pio 36 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-3 {
-			label = "ant1:red";
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <1>;
 			gpios = <&pio 35 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-4 {
-			label = "ant1:green";
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <1>;
 			gpios = <&pio 34 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-5 {
-			label = "ant1:blue";
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <1>;
 			gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-6 {
-			label = "ant2:red";
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <2>;
 			gpios = <&pio 38 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-7 {
-			label = "ant2:green";
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <2>;
 			gpios = <&pio 37 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-8 {
-			label = "ant2:blue";
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <2>;
 			gpios = <&pio 26 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-9 {
-			label = "ant3:red";
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <3>;
 			gpios = <&pio 25 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-10 {
-			label = "ant3:green";
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <3>;
 			gpios = <&pio 24 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-11 {
-			label = "ant3:blue";
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <3>;
 			gpios = <&pio 23 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-12 {
-			label = "ant4:red";
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <4>;
 			gpios = <&pio 28 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-13 {
-			label = "ant4:green";
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <4>;
 			gpios = <&pio 27 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-14 {
-			label = "ant4:blue";
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <4>;
 			gpios = <&pio 32 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-15 {
-			label = "ant5:red";
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <5>;
 			gpios = <&pio 45 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-16 {
-			label = "ant5:green";
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <5>;
 			gpios = <&pio 44 GPIO_ACTIVE_HIGH>;
 		};
 
 		led-17 {
-			label = "ant5:blue";
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_STATUS;
+			function-enumerator = <5>;
 			gpios = <&pio 43 GPIO_ACTIVE_HIGH>;
 		};
 	};
@@ -151,7 +187,7 @@
 		reset-assert-us = <10000>;
 		reset-deassert-us = <10000>;
 		/* LED0: nc ; LED1: nc ; LED2: amber ; LED3: green */
-		mxl,led-config = <0x0 0x0 0x370 0x80>;
+		mxl,led-config = <0x0 0x0 0x370 0x380>;
 	};
 };
 
diff --git a/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi b/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi
index cca03684fb..03913f04e1 100644
--- a/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi
+++ b/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi
@@ -9,7 +9,7 @@
 / {
 	chosen {
 		stdout-path = "serial0:115200n8";
-		bootargs = "dm-mod.create=\"dm-verity,,,ro,0 31544 verity 1 PARTLABEL=rootfs PARTLABEL=rootfs 4096 4096 3943 3944 sha256 2f969fa9e9e4e20b37746f22633e85b178f5db7c143e11f92733a704299cc933 2dd56e34b15c6c84573cf26c4392028421061d2c808975217b45e9a5b49d2087\" rootfstype=squashfs,ext4 rootwait root=/dev/mmcblk0p6 fstools_ignore_partname=1";
+		bootargs = "dm-mod.create=\"acer,,,ro,0 1 zero 1 0 0 0\" rootfstype=squashfs,ext4 rootwait root=/dev/mmcblk0p6 fstools_ignore_partname=1";
 	};
 
 	memory at 0 {
@@ -171,6 +171,13 @@
 			drive-strength = <4>;
 		};
 	};
+
+	i2c_pins: i2c-pins {
+		mux {
+			function = "i2c";
+			groups = "i2c";
+		};
+	};
 };
 
 &trng {
@@ -185,6 +192,12 @@
 	status = "okay";
 };
 
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c_pins>;
+	status = "okay";
+};
+
 &mmc0 {
 	status = "okay";
 	pinctrl-names = "default", "state_uhs";
@@ -321,13 +334,13 @@
 					reg = <0>;
 
 					mediatek,led-config = <
-						0x21 0x8009 /* BASIC_CTRL */
+						0x21 0x8008 /* BASIC_CTRL */
 						0x22 0x0c00 /* ON_DURATION */
 						0x23 0x1400 /* BLINK_DURATION */
 						0x24 0xc001 /* LED0_ON_CTRL */
-						0x25 0x0000 /* LED0_BLINK_CTRL */
-						0x26 0xc007 /* LED1_ON_CTRL */
-						0x27 0x003f /* LED1_BLINK_CTRL */
+						0x25 0x0003 /* LED0_BLINK_CTRL */
+						0x26 0xc006 /* LED1_ON_CTRL */
+						0x27 0x003c /* LED1_BLINK_CTRL */
 					>;
 				};
 
@@ -335,13 +348,13 @@
 					reg = <1>;
 
 					mediatek,led-config = <
-						0x21 0x8009 /* BASIC_CTRL */
+						0x21 0x8008 /* BASIC_CTRL */
 						0x22 0x0c00 /* ON_DURATION */
 						0x23 0x1400 /* BLINK_DURATION */
 						0x24 0xc001 /* LED0_ON_CTRL */
-						0x25 0x0000 /* LED0_BLINK_CTRL */
-						0x26 0xc007 /* LED1_ON_CTRL */
-						0x27 0x003f /* LED1_BLINK_CTRL */
+						0x25 0x0003 /* LED0_BLINK_CTRL */
+						0x26 0xc006 /* LED1_ON_CTRL */
+						0x27 0x003c /* LED1_BLINK_CTRL */
 					>;
 				};
 
@@ -349,13 +362,13 @@
 					reg = <2>;
 
 					mediatek,led-config = <
-						0x21 0x8009 /* BASIC_CTRL */
+						0x21 0x8008 /* BASIC_CTRL */
 						0x22 0x0c00 /* ON_DURATION */
 						0x23 0x1400 /* BLINK_DURATION */
 						0x24 0xc001 /* LED0_ON_CTRL */
-						0x25 0x0000 /* LED0_BLINK_CTRL */
-						0x26 0xc007 /* LED1_ON_CTRL */
-						0x27 0x003f /* LED1_BLINK_CTRL */
+						0x25 0x0003 /* LED0_BLINK_CTRL */
+						0x26 0xc006 /* LED1_ON_CTRL */
+						0x27 0x003c /* LED1_BLINK_CTRL */
 					>;
 				};
 
@@ -363,13 +376,13 @@
 					reg = <3>;
 
 					mediatek,led-config = <
-						0x21 0x8009 /* BASIC_CTRL */
+						0x21 0x8008 /* BASIC_CTRL */
 						0x22 0x0c00 /* ON_DURATION */
 						0x23 0x1400 /* BLINK_DURATION */
 						0x24 0xc001 /* LED0_ON_CTRL */
-						0x25 0x0000 /* LED0_BLINK_CTRL */
-						0x26 0xc007 /* LED1_ON_CTRL */
-						0x27 0x003f /* LED1_BLINK_CTRL */
+						0x25 0x0003 /* LED0_BLINK_CTRL */
+						0x26 0xc006 /* LED1_ON_CTRL */
+						0x27 0x003c /* LED1_BLINK_CTRL */
 					>;
 				};
 			};
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index cb5c102b1e..838a433bf4 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -152,7 +152,7 @@ TARGET_DEVICES += acelink_ew-7886cax
 
 define Device/acer_predator-w6
   DEVICE_VENDOR := Acer
-  DEVICE_MODEL := Predator W6
+  DEVICE_MODEL := Predator Connect W6
   DEVICE_DTS := mt7986a-acer-predator-w6
   DEVICE_DTS_DIR := ../dts
   DEVICE_DTS_LOADADDR := 0x47000000




More information about the lede-commits mailing list