Skip to contentSkip to conversation

Add power key for pioneer box

PATCH Applied Chen Wang 3 participants 7 messages Oct 8, 2024 – Oct 22, 2024

Subsystems (3)
lore
Share & tools
lore

Chen Wang

author
#0 lore raw

cover Add power key for pioneer box

From: Chen Wang <[email protected]>

Add power key for pioneer box.

Thanks,
Chen

---

Changes in v1:
The patch is based on v6.12-rc1.

---

Chen Wang (1):
riscv: sophgo: dts: add power key for pioneer box

 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/1 riscv: sophgo: dts: add power key for pioneer box

From: Chen Wang <[email protected]>

There is a power button on the front panel of the pioneer box. Short pressing the button will trigger the onboard MCU to notify SG2042 through GPIO22 to enter the power-off process.

---
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +15 -0
index a3f9d6f22566..be596d01ff8d 100644
@@ -5,6 +5,9 @@
 
 #include "sg2042.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
 / {
 	model = "Milk-V Pioneer";
 	compatible = "milkv,pioneer", "sophgo,sg2042";
@@ -12,6 +15,18 @@ / {
 	chosen {
 		stdout-path = "serial0";
 	};
+
+	gpio-power {
+		compatible = "gpio-keys";
+
+		key-power {
+			label = "Power Key";
+			linux,code = <KEY_POWER>;
+			gpios = <&port0a 22 GPIO_ACTIVE_HIGH>;
+			linux,input-type = <EV_KEY>;
+			debounce-interval = <100>;
+		};
+	};
 };
 
 &cgi_main {
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH 1/1] riscv: sophgo: dts: add power key for pioneer box

Quoted 16 lines · Chen Wang

From: Chen Wang <[email protected]>

There is a power button on the front panel of the pioneer box. Short pressing the button will trigger the onboard MCU to notify SG2042 through GPIO22 to enter the power-off process.

---
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +0 -0
index a3f9d6f22566..be596d01ff8d 100644

arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts line 8

Quoted 4 lines
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +1 -0
@@ -5,6 +5,9 @@
 
 #include "sg2042.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>

Just move this include into sg204.dtsi. It seems you forgot to add include when sumbitting GPIO dt patch.

Quoted 27 lines
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +14 -0
+#include <dt-bindings/input/input.h>
+
 / {
 	model = "Milk-V Pioneer";
 	compatible = "milkv,pioneer", "sophgo,sg2042";
@@ -12,6 +15,18 @@ / {
 	chosen {
 		stdout-path = "serial0";
 	};
+
+	gpio-power {
+		compatible = "gpio-keys";
+
+		key-power {
+			label = "Power Key";
+			linux,code = <KEY_POWER>;
+			gpios = <&port0a 22 GPIO_ACTIVE_HIGH>;
+			linux,input-type = <EV_KEY>;
+			debounce-interval = <100>;
+		};
+	};
 };
 
 &cgi_main {
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH 1/1] riscv: sophgo: dts: add power key for pioneer box

Quoted 18 lines · Inochi Amaoto
Quoted 17 lines · Chen Wang

From: Chen Wang <[email protected]>

There is a power button on the front panel of the pioneer box. Short pressing the button will trigger the onboard MCU to notify SG2042 through GPIO22 to enter the power-off process.

---
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +0 -0
index a3f9d6f22566..be596d01ff8d 100644
@@ -5,6 +5,9 @@
 
Quoted 5 lines

arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts line 8

Quoted 3 lines
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +1 -0
 #include "sg2042.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>

Just move this include into sg204.dtsi. It seems you forgot to

sg204.dtsi does not use this header, so why it should be there?

DTS does not differ here from C. You include only what is being directly used.

Best regards,
Krzysztof

maintainer
#4 lore raw

Re: [PATCH 1/1] riscv: sophgo: dts: add power key for pioneer box

Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Inochi Amaoto
Quoted 19 lines · Chen Wang

From: Chen Wang <[email protected]>

There is a power button on the front panel of the pioneer box. Short pressing the button will trigger the onboard MCU to notify SG2042 through GPIO22 to enter the power-off process.

---
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +0 -0
index a3f9d6f22566..be596d01ff8d 100644
@@ -5,6 +5,9 @@
 
 #include "sg2042.dtsi"
 
Quoted 9 lines
Quoted 3 lines

arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts line 8

Quoted 1 line
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +1 -0
+#include <dt-bindings/gpio/gpio.h>

Just move this include into sg204.dtsi. It seems you forgot to

sg204.dtsi does not use this header, so why it should be there?

DTS does not differ here from C. You include only what is being directly used.

OK, it is my misunderstanding, I thought this header is binded to the GPIO device. Let's drop my advice.

Regard,
Inochi

maintainer
#5 lore raw
In reply to Chen Wang
Quoted 14 lines · Chen Wang

From: Chen Wang <[email protected]>

Add power key for pioneer box.

Thanks,
Chen

---

Changes in v1:
The patch is based on v6.12-rc1.

---

Quoted 11 lines

Chen Wang (1):
riscv: sophgo: dts: add power key for pioneer box

 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc

Signature · 1 line
2.34.1

If the cover has no meaningful information, you can send the patch directly and put the changelog in the patch under the first "---".

Regards,
Inochi