diff mbox series

[v2,1/2] dt-bindings: gpio: Add gpio-line-names to STMPE GPIO

Message ID 20230724063520.182888-1-alexander.stein@ew.tq-group.com
State New
Headers show
Series [v2,1/2] dt-bindings: gpio: Add gpio-line-names to STMPE GPIO | expand

Commit Message

Alexander Stein July 24, 2023, 6:35 a.m. UTC
This is a gpio-controller, so gpio-line-names should be allowed as well.
stmpe2403 supports up to 24 GPIOs.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v2:
* Add min/maxItems

 Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Krzysztof Kozlowski July 24, 2023, 7:24 a.m. UTC | #1
On 24/07/2023 08:35, Alexander Stein wrote:
> This is a gpio-controller, so gpio-line-names should be allowed as well.
> pca9532 supports up to 16 GPIOs.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> Changes in v2:
> * Add min/maxItems
> 
>  Documentation/devicetree/bindings/leds/nxp,pca953x.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/leds/nxp,pca953x.yaml b/Documentation/devicetree/bindings/leds/nxp,pca953x.yaml
> index edf6f55df685..9610bca57dd5 100644
> --- a/Documentation/devicetree/bindings/leds/nxp,pca953x.yaml
> +++ b/Documentation/devicetree/bindings/leds/nxp,pca953x.yaml
> @@ -29,6 +29,10 @@ properties:
>  
>    gpio-controller: true
>  
> +  gpio-line-names:
> +    minItems: 1

GPIO expander which adds only one GPIO? That would be weird. Are sure?
Which model supports 1 GPIO?

Best regards,
Krzysztof
Alexander Stein July 24, 2023, 7:58 a.m. UTC | #2
Hi,

Am Montag, 24. Juli 2023, 09:23:09 CEST schrieb Krzysztof Kozlowski:
> On 24/07/2023 08:35, Alexander Stein wrote:
> > This is a gpio-controller, so gpio-line-names should be allowed as well.
> > stmpe2403 supports up to 24 GPIOs.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > Changes in v2:
> > * Add min/maxItems
> > 
> >  Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
> > b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml index
> > 22c0cae73425..4555f1644a4d 100644
> > --- a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
> > +++ b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
> > 
> > @@ -28,6 +28,10 @@ properties:
> >    gpio-controller: true
> > 
> > +  gpio-line-names:
> > +    minItems: 1
> > +    maxItems: 24
> > +
> 
> I am sure there is no variant with one GPIO.

That's true. But if only one GPIO is actually connected there is no use 
enforcing to add empty entries.
AFAIK it is also allowed to provide an incomplete array.

Best regards,
Alexander
Krzysztof Kozlowski July 24, 2023, 9:54 a.m. UTC | #3
On 24/07/2023 09:58, Alexander Stein wrote:
> Hi,
> 
> Am Montag, 24. Juli 2023, 09:23:09 CEST schrieb Krzysztof Kozlowski:
>> On 24/07/2023 08:35, Alexander Stein wrote:
>>> This is a gpio-controller, so gpio-line-names should be allowed as well.
>>> stmpe2403 supports up to 24 GPIOs.
>>>
>>> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
>>> ---
>>> Changes in v2:
>>> * Add min/maxItems
>>>
>>>  Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
>>> b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml index
>>> 22c0cae73425..4555f1644a4d 100644
>>> --- a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
>>> +++ b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
>>>
>>> @@ -28,6 +28,10 @@ properties:
>>>    gpio-controller: true
>>>
>>> +  gpio-line-names:
>>> +    minItems: 1
>>> +    maxItems: 24
>>> +
>>
>> I am sure there is no variant with one GPIO.
> 
> That's true. But if only one GPIO is actually connected there is no use 
> enforcing to add empty entries.
> AFAIK it is also allowed to provide an incomplete array.

Did you test it? Linux prints warning. Warning means "not allowed".

The expectation is that the rest are named "NC".

Best regards,
Krzysztof
Krzysztof Kozlowski July 24, 2023, 1:35 p.m. UTC | #4
On 24/07/2023 13:44, Alexander Stein wrote:

>>>>>  Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml | 4 ++++
>>>>>  1 file changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
>>>>> b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml index
>>>>> 22c0cae73425..4555f1644a4d 100644
>>>>> --- a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
>>>>> +++ b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
>>>>>
>>>>> @@ -28,6 +28,10 @@ properties:
>>>>>    gpio-controller: true
>>>>>
>>>>> +  gpio-line-names:
>>>>> +    minItems: 1
>>>>> +    maxItems: 24
>>>>> +
>>>>
>>>> I am sure there is no variant with one GPIO.
>>>
>>> That's true. But if only one GPIO is actually connected there is no use
>>> enforcing to add empty entries.
>>> AFAIK it is also allowed to provide an incomplete array.
>>
>> Did you test it? Linux prints warning. Warning means "not allowed".
> 
> I did and I don't see any warnings.
> I using the following (modified) GPIO subnode on an stmpe811 chip:
> gpio {
> 	compatible = "st,stmpe-gpio";
> 	gpio-controller;
> 	#gpio-cells = <2>;
> 	interrupt-controller;
> 	#interrupt-cells = <2>;
> 	/* GPIO 5-7 used for touch */
> 	st,norequest-mask = <0xf0>;
> 	gpio-line-names = "GPIO_ADC_I2C1_1";
> };
> 
> I only see the warning "stmpe-gpio stmpe-gpio: DMA mask not set", but that's a 
> different matter.
> Only GPIO 0-3 are connected. Original property is
> gpio-line-names = "GPIO_ADC_I2C1_1",
> 	        "GPIO_ADC_I2C1_2",
> 	        "GPIO_ADC_I2C1_3",
> 	        "GPIO_ADC_I2C1_4";
> 
> Also gpioinfo shows that the gpiochip has 8 pins while only the first one is 
> named.
> 
> gpiochip7 - 8 lines:
>         line   0: "GPIO_ADC_I2C1_1" unused input active-high 
>         line   1:      unnamed       unused   input  active-high 
>         line   2:      unnamed       unused   input  active-high 
>         line   3:      unnamed       unused   input  active-high 
>         line   4:      unnamed       unused   input  active-high 
>         line   5:      unnamed       unused   input  active-high 
>         line   6:      unnamed       unused   input  active-high 
>         line   7:      unnamed       unused   input  active-high
> 
> 
> If 4 GPIOs are named the output shows names for lines 1-3 accordingly, but no 
> errors/warnings as well.
> 
>> The expectation is that the rest are named "NC".
> 
> Where does this expectation come from? Is there any pending change I am not 
> aware of?
> 

Hm, indeed, I mistaken the case for multiple gpio chips in one device
(so having an offset). Bindings are actually explicitly allowing array
for only some GPIOs.

Best regards,
Krzysztof
Krzysztof Kozlowski July 24, 2023, 1:36 p.m. UTC | #5
On 24/07/2023 08:35, Alexander Stein wrote:
> This is a gpio-controller, so gpio-line-names should be allowed as well.
> pca9532 supports up to 16 GPIOs.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Bartosz Golaszewski July 29, 2023, 2 p.m. UTC | #6
On Mon, Jul 24, 2023 at 8:35 AM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> This is a gpio-controller, so gpio-line-names should be allowed as well.
> stmpe2403 supports up to 24 GPIOs.
>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> Changes in v2:
> * Add min/maxItems
>
>  Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
> index 22c0cae73425..4555f1644a4d 100644
> --- a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
> +++ b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
> @@ -28,6 +28,10 @@ properties:
>
>    gpio-controller: true
>
> +  gpio-line-names:
> +    minItems: 1
> +    maxItems: 24
> +
>    interrupt-controller: true
>
>    st,norequest-mask:
> --
> 2.34.1
>

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
index 22c0cae73425..4555f1644a4d 100644
--- a/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/st,stmpe-gpio.yaml
@@ -28,6 +28,10 @@  properties:
 
   gpio-controller: true
 
+  gpio-line-names:
+    minItems: 1
+    maxItems: 24
+
   interrupt-controller: true
 
   st,norequest-mask: