diff mbox series

[3/3] arm64: dts: rockchip: Add saradc node to rk3588s-indiedroid-nova

Message ID 20230908164156.2846-4-macroalpha82@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add Additional Functionality to Indiedroid Nova | expand

Commit Message

Chris Morgan Sept. 8, 2023, 4:41 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

Add ADC support for the Indiedroid Nova, as well as the two ADC buttons
found on the device. The buttons are documented as "boot" and
"recovery". The boot button is used by the bootloader to boot into USB
recovery mode. The recovery button use is currently unknown.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 .../dts/rockchip/rk3588s-indiedroid-nova.dts  | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Krzysztof Kozlowski Sept. 12, 2023, 8:31 a.m. UTC | #1
On 08/09/2023 18:41, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add ADC support for the Indiedroid Nova, as well as the two ADC buttons
> found on the device. The buttons are documented as "boot" and
> "recovery". The boot button is used by the bootloader to boot into USB
> recovery mode. The recovery button use is currently unknown.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>  .../dts/rockchip/rk3588s-indiedroid-nova.dts  | 34 +++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> index 1e2336d3065b..4c2d662d9c97 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> @@ -3,6 +3,7 @@
>  /dts-v1/;
>  
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/linux-event-codes.h>
>  #include <dt-bindings/pinctrl/rockchip.h>
>  #include <dt-bindings/usb/pd.h>
>  #include "rk3588s.dtsi"
> @@ -11,6 +12,34 @@ / {
>  	model = "Indiedroid Nova";
>  	compatible = "indiedroid,nova", "rockchip,rk3588s";
>  
> +	adc_keys0 {

No underscores in node names.

Suffixes usually are after -

Best regards,
Krzysztof
Chris Morgan Sept. 15, 2023, 4:49 p.m. UTC | #2
On Tue, Sep 12, 2023 at 10:31:19AM +0200, Krzysztof Kozlowski wrote:
> On 08/09/2023 18:41, Chris Morgan wrote:
> > From: Chris Morgan <macromorgan@hotmail.com>
> > 
> > Add ADC support for the Indiedroid Nova, as well as the two ADC buttons
> > found on the device. The buttons are documented as "boot" and
> > "recovery". The boot button is used by the bootloader to boot into USB
> > recovery mode. The recovery button use is currently unknown.
> > 
> > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > ---
> >  .../dts/rockchip/rk3588s-indiedroid-nova.dts  | 34 +++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> > index 1e2336d3065b..4c2d662d9c97 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> > +++ b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> > @@ -3,6 +3,7 @@
> >  /dts-v1/;
> >  
> >  #include <dt-bindings/gpio/gpio.h>
> > +#include <dt-bindings/input/linux-event-codes.h>
> >  #include <dt-bindings/pinctrl/rockchip.h>
> >  #include <dt-bindings/usb/pd.h>
> >  #include "rk3588s.dtsi"
> > @@ -11,6 +12,34 @@ / {
> >  	model = "Indiedroid Nova";
> >  	compatible = "indiedroid,nova", "rockchip,rk3588s";
> >  
> > +	adc_keys0 {
> 
> No underscores in node names.

My apologies, I should have known better...

> 
> Suffixes usually are after -
> 

Thank you.

> Best regards,
> Krzysztof
> 

I'll correct this and resend.

Chris
Chris Morgan Sept. 15, 2023, 5:05 p.m. UTC | #3
On Fri, Sep 15, 2023 at 11:49:05AM -0500, Chris Morgan wrote:
> On Tue, Sep 12, 2023 at 10:31:19AM +0200, Krzysztof Kozlowski wrote:
> > On 08/09/2023 18:41, Chris Morgan wrote:
> > > From: Chris Morgan <macromorgan@hotmail.com>
> > > 
> > > Add ADC support for the Indiedroid Nova, as well as the two ADC buttons
> > > found on the device. The buttons are documented as "boot" and
> > > "recovery". The boot button is used by the bootloader to boot into USB
> > > recovery mode. The recovery button use is currently unknown.
> > > 
> > > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > > ---
> > >  .../dts/rockchip/rk3588s-indiedroid-nova.dts  | 34 +++++++++++++++++++
> > >  1 file changed, 34 insertions(+)
> > > 
> > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> > > index 1e2336d3065b..4c2d662d9c97 100644
> > > --- a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> > > +++ b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
> > > @@ -3,6 +3,7 @@
> > >  /dts-v1/;
> > >  
> > >  #include <dt-bindings/gpio/gpio.h>
> > > +#include <dt-bindings/input/linux-event-codes.h>
> > >  #include <dt-bindings/pinctrl/rockchip.h>
> > >  #include <dt-bindings/usb/pd.h>
> > >  #include "rk3588s.dtsi"
> > > @@ -11,6 +12,34 @@ / {
> > >  	model = "Indiedroid Nova";
> > >  	compatible = "indiedroid,nova", "rockchip,rk3588s";
> > >  
> > > +	adc_keys0 {
> > 
> > No underscores in node names.
> 
> My apologies, I should have known better...
> 
> > 
> > Suffixes usually are after -
> > 
> 
> Thank you.
> 
> > Best regards,
> > Krzysztof
> > 
> 
> I'll correct this and resend.
> 
> Chris

Sorry, one more thing. I've checked for examples of adc-keys naming and
in every instance I see it as adc-keys (or adc-keys0 and adc-keys1 in a
few examples). Is the proper way going forward something like key0-adc
and key1-adc?

Thank you,
Chris.
Krzysztof Kozlowski Sept. 16, 2023, 8:34 p.m. UTC | #4
On 15/09/2023 19:05, Chris Morgan wrote:
> On Fri, Sep 15, 2023 at 11:49:05AM -0500, Chris Morgan wrote:
>> On Tue, Sep 12, 2023 at 10:31:19AM +0200, Krzysztof Kozlowski wrote:
>>> On 08/09/2023 18:41, Chris Morgan wrote:
>>>> From: Chris Morgan <macromorgan@hotmail.com>
>>>>
>>>> Add ADC support for the Indiedroid Nova, as well as the two ADC buttons
>>>> found on the device. The buttons are documented as "boot" and
>>>> "recovery". The boot button is used by the bootloader to boot into USB
>>>> recovery mode. The recovery button use is currently unknown.
>>>>
>>>> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
>>>> ---
>>>>  .../dts/rockchip/rk3588s-indiedroid-nova.dts  | 34 +++++++++++++++++++
>>>>  1 file changed, 34 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
>>>> index 1e2336d3065b..4c2d662d9c97 100644
>>>> --- a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
>>>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
>>>> @@ -3,6 +3,7 @@
>>>>  /dts-v1/;
>>>>  
>>>>  #include <dt-bindings/gpio/gpio.h>
>>>> +#include <dt-bindings/input/linux-event-codes.h>
>>>>  #include <dt-bindings/pinctrl/rockchip.h>
>>>>  #include <dt-bindings/usb/pd.h>
>>>>  #include "rk3588s.dtsi"
>>>> @@ -11,6 +12,34 @@ / {
>>>>  	model = "Indiedroid Nova";
>>>>  	compatible = "indiedroid,nova", "rockchip,rk3588s";
>>>>  
>>>> +	adc_keys0 {
>>>
>>> No underscores in node names.
>>
>> My apologies, I should have known better...
>>
>>>
>>> Suffixes usually are after -
>>>
>>
>> Thank you.
>>
>>> Best regards,
>>> Krzysztof
>>>
>>
>> I'll correct this and resend.
>>
>> Chris
> 
> Sorry, one more thing. I've checked for examples of adc-keys naming and
> in every instance I see it as adc-keys (or adc-keys0 and adc-keys1 in a
> few examples). Is the proper way going forward something like key0-adc
> and key1-adc?

I meant by suffix "-0" or "-1", so:

adc-keys-0
adc-keys-1

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
index 1e2336d3065b..4c2d662d9c97 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts
@@ -3,6 +3,7 @@ 
 /dts-v1/;
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/pinctrl/rockchip.h>
 #include <dt-bindings/usb/pd.h>
 #include "rk3588s.dtsi"
@@ -11,6 +12,34 @@  / {
 	model = "Indiedroid Nova";
 	compatible = "indiedroid,nova", "rockchip,rk3588s";
 
+	adc_keys0 {
+		compatible = "adc-keys";
+		io-channel-names = "buttons";
+		io-channels = <&saradc 0>;
+		keyup-threshold-microvolt = <1800000>;
+		poll-interval = <100>;
+
+		button-boot {
+			label = "boot";
+			linux,code = <KEY_PROG1>;
+			press-threshold-microvolt = <18000>;
+		};
+	};
+
+	adc_keys1 {
+		compatible = "adc-keys";
+		io-channel-names = "buttons";
+		io-channels = <&saradc 1>;
+		keyup-threshold-microvolt = <1800000>;
+		poll-interval = <100>;
+
+		button-recovery {
+			label = "recovery";
+			linux,code = <KEY_PROG2>;
+			press-threshold-microvolt = <18000>;
+		};
+	};
+
 	aliases {
 		mmc0 = &sdhci;
 		mmc1 = &sdmmc;
@@ -410,6 +439,11 @@  typec5v_pwren: typec5v-pwren {
 	};
 };
 
+&saradc {
+	vref-supply = <&vcca_1v8_s0>;
+	status = "okay";
+};
+
 /* HS400 modes seemed to cause io errors. */
 &sdhci {
 	bus-width = <8>;