diff mbox series

[v2,2/3] dt-bindings: pinctrl: sx150xq: allow gpio line naming

Message ID 20241031151238.67753-3-hs@denx.de
State New
Headers show
Series arm64: dts: imx8mp: add support for the ABB SoM and carrier | expand

Commit Message

Heiko Schocher Oct. 31, 2024, 3:12 p.m. UTC
Adding gpio-line-names property works fine for this
device node, but dtb check drops warning:

'gpio-line-names' does not match any of the regexes: '-cfg$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/pinctrl/semtech,sx1501q.yaml#

Allow to add property gpio-line-names for this devices.

Signed-off-by: Heiko Schocher <hs@denx.de>

---
checkpatch shows
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
'gpio-line-names' does not match any of the regexes: '-cfg$', 'pinctrl-[0-9]+'

Ignored, as it is a make output, which helps to understand the
reason for adding this patch.

Changes in v2:
patch dt-bindings: pinctrl: sx150xq: allow gpio line naming new in v2

 .../devicetree/bindings/pinctrl/semtech,sx1501q.yaml          | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Krzysztof Kozlowski Oct. 31, 2024, 6:14 p.m. UTC | #1
On 31/10/2024 16:12, Heiko Schocher wrote:
> Adding gpio-line-names property works fine for this
> device node, but dtb check drops warning:
> 
> 'gpio-line-names' does not match any of the regexes: '-cfg$', 'pinctrl-[0-9]+'
> from schema $id: http://devicetree.org/schemas/pinctrl/semtech,sx1501q.yaml#
> 
> Allow to add property gpio-line-names for this devices.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> 
> ---
> checkpatch shows
> WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
> 'gpio-line-names' does not match any of the regexes: '-cfg$', 'pinctrl-[0-9]+'

No worries, this can be ignored. Warning messages can pass the limit (up
to some point).

> 
> Ignored, as it is a make output, which helps to understand the
> reason for adding this patch.
> 
> Changes in v2:
> patch dt-bindings: pinctrl: sx150xq: allow gpio line naming new in v2
> 
>  .../devicetree/bindings/pinctrl/semtech,sx1501q.yaml          | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
> index 4214d7311f6b..fd0936545bb8 100644
> --- a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
> @@ -26,6 +26,10 @@ properties:
>    reg:
>      maxItems: 1
>  
> +  gpio-line-names:
> +    minItems: 1

I think gpio-line-names should always match the actual number of GPIOs
for given device. Do you have here devices with 1 gpio? This could be
further constrained in if:then sections.


Best regards,
Krzysztof
Heiko Schocher Nov. 2, 2024, 5:24 a.m. UTC | #2
Hello Krzysztof,

On 31.10.24 19:14, Krzysztof Kozlowski wrote:
> On 31/10/2024 16:12, Heiko Schocher wrote:
>> Adding gpio-line-names property works fine for this
>> device node, but dtb check drops warning:
>>
>> 'gpio-line-names' does not match any of the regexes: '-cfg$', 'pinctrl-[0-9]+'
>> from schema $id: http://devicetree.org/schemas/pinctrl/semtech,sx1501q.yaml#
>>
>> Allow to add property gpio-line-names for this devices.
>>
>> Signed-off-by: Heiko Schocher <hs@denx.de>
>>
>> ---
>> checkpatch shows
>> WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
>> 'gpio-line-names' does not match any of the regexes: '-cfg$', 'pinctrl-[0-9]+'
> 
> No worries, this can be ignored. Warning messages can pass the limit (up
> to some point).

Fine, thanks!

>> Ignored, as it is a make output, which helps to understand the
>> reason for adding this patch.
>>
>> Changes in v2:
>> patch dt-bindings: pinctrl: sx150xq: allow gpio line naming new in v2
>>
>>   .../devicetree/bindings/pinctrl/semtech,sx1501q.yaml          | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
>> index 4214d7311f6b..fd0936545bb8 100644
>> --- a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
>> +++ b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
>> @@ -26,6 +26,10 @@ properties:
>>     reg:
>>       maxItems: 1
>>   
>> +  gpio-line-names:
>> +    minItems: 1
> 
> I think gpio-line-names should always match the actual number of GPIOs
> for given device. Do you have here devices with 1 gpio? This could be
> further constrained in if:then sections.

I have the device with "sx150x_16_pins", see drivers/pinctrl/pinctrl-sx150x.c

I started with minItems, because I thought it is okay to allow
less names... (as I did in patch 3/3) but see now, that other drivers have
minItems = maxItems.

So I think I should add to my patch the following part:

hs@threadripper:linux  [aristainetos3-dts-v3] $ git diff
diff --git a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml 
b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
index fd0936545bb8..0872ee1c6fa6 100644
--- a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
@@ -91,6 +91,45 @@ required:

  allOf:
    - $ref: pinctrl.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - semtech,sx1501q
+              - semtech,sx1504q
+              - semtech,sx1507q
+    then:
+       properties:
+          gpio-line-names:
+              minItems: 5
+              maxItems: 5
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - semtech,sx1502q
+              - semtech,sx1505q
+              - semtech,sx1508q
+    then:
+       properties:
+          gpio-line-names:
+              minItems: 9
+              maxItems: 9
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - semtech,sx1503q
+              - semtech,sx1506q
+              - semtech,sx1509q
+    then:
+       properties:
+          gpio-line-names:
+              minItems: 17
+              maxItems: 17
    - if:
        not:
          properties:

With that, dtb checks than claim (as expected) for my 3/3 patch
from this seris:
"""
imx8mp-aristainetos3-proton2s.dtb: pinctrl@3f: gpio-line-names: ['RELAY0', 'RELAY1', 'RELAY2', 
'HEATER', 'FAN', 'SPARE', 'CLEAR', 'FAULT'] is too short
"""

So, I adapt that too in a next version of the patchset, if above
change is okay... is it?

Thanks for your review!

bye,
Heiko
Krzysztof Kozlowski Nov. 2, 2024, 7:56 a.m. UTC | #3
On 02/11/2024 06:24, Heiko Schocher wrote:
>>>     reg:
>>>       maxItems: 1
>>>   
>>> +  gpio-line-names:
>>> +    minItems: 1
>>
>> I think gpio-line-names should always match the actual number of GPIOs
>> for given device. Do you have here devices with 1 gpio? This could be
>> further constrained in if:then sections.
> 
> I have the device with "sx150x_16_pins", see drivers/pinctrl/pinctrl-sx150x.c
> 
> I started with minItems, because I thought it is okay to allow
> less names... (as I did in patch 3/3) but see now, that other drivers have
> minItems = maxItems.
> 
> So I think I should add to my patch the following part:

Yes, but in top-level you keep widest constraints, so min 5 max 17.

> 
> hs@threadripper:linux  [aristainetos3-dts-v3] $ git diff
> diff --git a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml 
> b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
> index fd0936545bb8..0872ee1c6fa6 100644
> --- a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
> @@ -91,6 +91,45 @@ required:
> 
>   allOf:
>     - $ref: pinctrl.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - semtech,sx1501q
> +              - semtech,sx1504q
> +              - semtech,sx1507q
> +    then:
> +       properties:
> +          gpio-line-names:
> +              minItems: 5
> +              maxItems: 5
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - semtech,sx1502q
> +              - semtech,sx1505q
> +              - semtech,sx1508q
> +    then:
> +       properties:
> +          gpio-line-names:
> +              minItems: 9
> +              maxItems: 9
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - semtech,sx1503q
> +              - semtech,sx1506q
> +              - semtech,sx1509q
> +    then:
> +       properties:
> +          gpio-line-names:
> +              minItems: 17
> +              maxItems: 17
>     - if:
>         not:
>           properties:


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
index 4214d7311f6b..fd0936545bb8 100644
--- a/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml
@@ -26,6 +26,10 @@  properties:
   reg:
     maxItems: 1
 
+  gpio-line-names:
+    minItems: 1
+    maxItems: 17
+
   interrupts:
     maxItems: 1