Skip to contentSkip to conversation

riscv: defconfig: enable "heartbeat" led trigger

PATCH Superseded FUKAUMI Naoki 1 participant 4 messages Jun 24, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 riscv: defconfig: enable "heartbeat" led trigger

following JH7110 based boards have a LED for heartbeat.

- Milk-V Mars
- Pine64 Star64
- StarFive VisionFive 2

This patch adds and enables related configuration for it.

Changes in v2:
- reword commit message to include other JH7110 based boards

---
 arch/riscv/configs/defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/configs/defconfig +6 -0
index 3f1f055866af..5f5582d7d7fd 100644
@@ -147,6 +147,7 @@ CONFIG_MICREL_PHY=y
 CONFIG_MICROSEMI_PHY=y
 CONFIG_MOTORCOMM_PHY=y
 CONFIG_CAN_RCAR_CANFD=m
+# CONFIG_INPUT_LEDS is not set
 CONFIG_INPUT_MOUSEDEV=y
 CONFIG_KEYBOARD_SUN4I_LRADC=m
 CONFIG_SERIAL_8250=y
@@ -246,6 +247,11 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_STARFIVE=y
 CONFIG_MMC_SDHI=y
 CONFIG_MMC_SUNXI=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_SUN6I=y
 CONFIG_DMADEVICES=y
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/4 riscv: dts: starfive: enable heartbeat LED for Milk-V Mars

Milk-V Mars has a green LED to show system load[1]. This patch enables a green LED as a heartbeat LED.

[1] https://github.com/milkv-mars/mars-buildroot-sdk/blob/dev/linux/arch/riscv/boot/dts/starfive/jh7110-milkv-mars.dtsi#L79

Changes in v2:
- reorder properties in led-0

---
 arch/riscv/boot/dts/starfive/jh7110-milkv-mars.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-milkv-mars.dts +13 -0
index fa0eac78e0ba..1ca9657fef0e 100644
@@ -4,11 +4,24 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 #include "jh7110-common.dtsi"
 
 / {
 	model = "Milk-V Mars";
 	compatible = "milkv,mars", "starfive,jh7110";
+
+	leds {
+		compatible = "gpio-leds";
+
+		led-0 {
+			gpios = <&aongpio 3 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_HEARTBEAT;
+			linux,default-trigger = "heartbeat";
+		};
+	};
 };
 
 &gmac0 {
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 3/4 riscv: dts: starfive: enable heartbeat LED for Pine64 Star64

In reply to FUKAUMI Naoki

Pine64 Star64 has a blue LED to show system load[1]. This patch enables a blue LED as a heartbeat LED.

[1] https://github.com/Fishwaldo/Star64_linux/blob/Star64_devel/arch/riscv/boot/dts/starfive/jh7110-pine64-star64.dtsi#L79

Changes in v2:
- new

---
 .../boot/dts/starfive/jh7110-pine64-star64.dts      | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-pine64-star64.dts +13 -0
index 2d41f18e0359..6749e9b51593 100644
@@ -4,6 +4,8 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 #include "jh7110-common.dtsi"
 
 / {
@@ -12,6 +14,17 @@ / {
 	aliases {
 		ethernet1 = &gmac1;
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led-0 {
+			gpios = <&aongpio 3 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_HEARTBEAT;
+			linux,default-trigger = "heartbeat";
+		};
+	};
 };
 
 &gmac0 {
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 4/4 riscv: dts: starfive: enable heartbeat LED for StarFive VisionFive 2

In reply to FUKAUMI Naoki

StarFive VisionFive 2 has a green LED to show system load[1]. This patch enables a green LED as a heartbeat LED.

[1] https://github.com/starfive-tech/linux/blob/a61d1d826ca3060fd76ab31d37c691fc09b52fc0/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi#L79

Changes in v2:
- new

---
 .../dts/starfive/jh7110-starfive-visionfive-2.dtsi  | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +13 -0
index 9d70f21c86fc..e5808268fe8c 100644
@@ -5,12 +5,25 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 #include "jh7110-common.dtsi"
 
 / {
 	aliases {
 		ethernet1 = &gmac1;
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led-0 {
+			gpios = <&aongpio 3 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_HEARTBEAT;
+			linux,default-trigger = "heartbeat";
+		};
+	};
 };
 
 &gmac1 {
Signature · 1 line
2.43.0