diff mbox

[linux,dev-4.10,1/2] ARM: dts: aspeed: Add gpio-keys-polled for fan presence

Message ID 20170717212732.8629-2-cbostic@linux.vnet.ibm.com
State Superseded, archived
Headers show

Commit Message

Christopher Bostic July 17, 2017, 9:27 p.m. UTC
Define gpio-keys-polled.  Add pca-955x chip IO as GPIO source.

Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Andrew Jeffery July 18, 2017, 1:49 a.m. UTC | #1
On Mon, 2017-07-17 at 16:27 -0500, Christopher Bostic wrote:
> Define gpio-keys-polled.  Add pca-955x chip IO as GPIO source.
> 
> > Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
> ---
>  arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> index 34c5dfc..d60a1db 100644
> --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> @@ -62,6 +62,38 @@
> >  		};
> >  	};
>  
> > +	gpio-keys-polled {
> > +		compatible = "gpio-keys-polled";
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +		#poll-interval = <100>;
> > +		autorepeat;
> +
> > +		fan0-presence {
> > +			label = "fan0-presence";
> > +			gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
> +			linux,code = <232>;

I think I replied about your choice of codes in the previous series.
The thought that I eventually came to (after replying IIRC) was what
has sort-of happened naturally here by way of the PCA card being unable
to provide interrupts, forcing you to define a separate node using
gpio-keys-polled.

Anyway, the thought was to have one gpio-keys{,-polled} node per
gpiochip device. That gives us the namespacing that the gpiochip
phandle provides - i.e. all keys in a node must use the same gpiochip
phandle. This isolates the keys behind separate input devices, and thus
their codes don't need to be globally unique.

So in this case I'm suggesting:

    fan0-presence {
        label = "fan0-presence";
        gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
        linux,code = <4>;
    }

And likewise for the nodes below.

Cheers,

Andrew

> +		};
> +
> > +		fan1-presence {
> > +			label = "fan1-presence";
> > +			gpios = <&pca0 5 GPIO_ACTIVE_LOW>;
> > +			linux,code = <233>;
> > +		};
> +
> > +		fan2-presence {
> > +			label = "fan2-presence";
> > +			gpios = <&pca0 6 GPIO_ACTIVE_LOW>;
> > +			linux,code = <234>;
> > +		};
> +
> > +		fan3-presence {
> > +			label = "fan3-presence";
> > +			gpios = <&pca0 7 GPIO_ACTIVE_LOW>;
> > +			linux,code = <235>;
> > +		};
> > +	};
> +
> >  	leds {
> >  		compatible = "gpio-leds";
>  
> @@ -224,6 +256,8 @@
> >  		reg = <0x60>;
> >  		#address-cells = <1>;
> >  		#size-cells = <0>;
> > +		gpio-controller;
> > +		#gpio-cells = <2>;
>  
> > >  		fan0: led@0 {
> >  			label = "fan0";
Christopher Bostic July 18, 2017, 4:27 p.m. UTC | #2
On 7/17/17 8:49 PM, Andrew Jeffery wrote:
> On Mon, 2017-07-17 at 16:27 -0500, Christopher Bostic wrote:
>> Define gpio-keys-polled.  Add pca-955x chip IO as GPIO source.
>>
>>> Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
>> ---
>>   arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++
>>   1 file changed, 34 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
>> index 34c5dfc..d60a1db 100644
>> --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
>> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
>> @@ -62,6 +62,38 @@
>>>   		};
>>>   	};
>>   
>>> +	gpio-keys-polled {
>>> +		compatible = "gpio-keys-polled";
>>> +		#address-cells = <1>;
>>> +		#size-cells = <0>;
>>> +		#poll-interval = <100>;
>>> +		autorepeat;
>> +
>>> +		fan0-presence {
>>> +			label = "fan0-presence";
>>> +			gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
>> +			linux,code = <232>;
> I think I replied about your choice of codes in the previous series.
> The thought that I eventually came to (after replying IIRC) was what
> has sort-of happened naturally here by way of the PCA card being unable
> to provide interrupts, forcing you to define a separate node using
> gpio-keys-polled.
>
> Anyway, the thought was to have one gpio-keys{,-polled} node per
> gpiochip device. That gives us the namespacing that the gpiochip
> phandle provides - i.e. all keys in a node must use the same gpiochip
> phandle. This isolates the keys behind separate input devices, and thus
> their codes don't need to be globally unique.
>
> So in this case I'm suggesting:
>
>      fan0-presence {
>          label = "fan0-presence";
>          gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
>          linux,code = <4>;
>      }
>
> And likewise for the nodes below.

Hi Andrew,

I'll update per your suggestion.

Thanks for the input,
Chris

>
> Cheers,
>
> Andrew
>
>> +		};
>> +
>>> +		fan1-presence {
>>> +			label = "fan1-presence";
>>> +			gpios = <&pca0 5 GPIO_ACTIVE_LOW>;
>>> +			linux,code = <233>;
>>> +		};
>> +
>>> +		fan2-presence {
>>> +			label = "fan2-presence";
>>> +			gpios = <&pca0 6 GPIO_ACTIVE_LOW>;
>>> +			linux,code = <234>;
>>> +		};
>> +
>>> +		fan3-presence {
>>> +			label = "fan3-presence";
>>> +			gpios = <&pca0 7 GPIO_ACTIVE_LOW>;
>>> +			linux,code = <235>;
>>> +		};
>>> +	};
>> +
>>>   	leds {
>>>   		compatible = "gpio-leds";
>>   
>> @@ -224,6 +256,8 @@
>>>   		reg = <0x60>;
>>>   		#address-cells = <1>;
>>>   		#size-cells = <0>;
>>> +		gpio-controller;
>>> +		#gpio-cells = <2>;
>>   
>>>>   		fan0: led@0 {
>>>   			label = "fan0";
diff mbox

Patch

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
index 34c5dfc..d60a1db 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
@@ -62,6 +62,38 @@ 
 		};
 	};
 
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		#poll-interval = <100>;
+		autorepeat;
+
+		fan0-presence {
+			label = "fan0-presence";
+			gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
+			linux,code = <232>;
+		};
+
+		fan1-presence {
+			label = "fan1-presence";
+			gpios = <&pca0 5 GPIO_ACTIVE_LOW>;
+			linux,code = <233>;
+		};
+
+		fan2-presence {
+			label = "fan2-presence";
+			gpios = <&pca0 6 GPIO_ACTIVE_LOW>;
+			linux,code = <234>;
+		};
+
+		fan3-presence {
+			label = "fan3-presence";
+			gpios = <&pca0 7 GPIO_ACTIVE_LOW>;
+			linux,code = <235>;
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -224,6 +256,8 @@ 
 		reg = <0x60>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		gpio-controller;
+		#gpio-cells = <2>;
 
 		fan0: led@0 {
 			label = "fan0";