diff mbox series

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

Message ID 12e65a99f1b52c52b7372e900a203063b30c74b5.1728350655.git.unicorn_wang@outlook.com (mailing list archive)
State Handled Elsewhere
Headers show
Series Add power key for pioneer box | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 136.62s
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1275.74s
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1515.44s
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 21.11s
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 23.07s
conchuod/patch-1-test-6 success .github/scripts/patches/tests/checkpatch.sh took 0.40s
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 44.02s
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.00s
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.50s
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.00s
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.03s

Commit Message

Chen Wang Oct. 8, 2024, 1:43 a.m. UTC
From: Chen Wang <unicorn_wang@outlook.com>

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.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
---
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Inochi Amaoto Oct. 8, 2024, 5:18 a.m. UTC | #1
On Tue, Oct 08, 2024 at 09:43:52AM +0800, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
> 
> 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.
> 
> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
> ---
>  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> index a3f9d6f22566..be596d01ff8d 100644
> --- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> +++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> @@ -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.

> +#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 {
> -- 
> 2.34.1
>
Krzysztof Kozlowski Oct. 8, 2024, 9:28 a.m. UTC | #2
On 08/10/2024 07:18, Inochi Amaoto wrote:
> On Tue, Oct 08, 2024 at 09:43:52AM +0800, Chen Wang wrote:
>> From: Chen Wang <unicorn_wang@outlook.com>
>>
>> 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.
>>
>> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
>> ---
>>  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
>> index a3f9d6f22566..be596d01ff8d 100644
>> --- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
>> +++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
>> @@ -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

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
Inochi Amaoto Oct. 8, 2024, 9:46 a.m. UTC | #3
On Tue, Oct 08, 2024 at 11:28:24AM +0200, Krzysztof Kozlowski wrote:
> On 08/10/2024 07:18, Inochi Amaoto wrote:
> > On Tue, Oct 08, 2024 at 09:43:52AM +0800, Chen Wang wrote:
> >> From: Chen Wang <unicorn_wang@outlook.com>
> >>
> >> 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.
> >>
> >> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
> >> ---
> >>  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts      | 15 +++++++++++++++
> >>  1 file changed, 15 insertions(+)
> >>
> >> diff --git a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> >> index a3f9d6f22566..be596d01ff8d 100644
> >> --- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> >> +++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> >> @@ -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
> 
> 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
diff mbox series

Patch

diff --git a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
index a3f9d6f22566..be596d01ff8d 100644
--- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
+++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
@@ -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 {