diff mbox series

dt-bindings: input: gpio-keys: allow generic 'interrupt-parent' for subnodes

Message ID 20240927081757.7022-2-wsa+renesas@sang-engineering.com (mailing list archive)
State Under Review
Delegated to: Geert Uytterhoeven
Headers show
Series dt-bindings: input: gpio-keys: allow generic 'interrupt-parent' for subnodes | expand

Commit Message

Wolfram Sang Sept. 27, 2024, 8:15 a.m. UTC
Allow interrupt-parent in the main node, so it can be inherited to all
subnodes. This is more compact and less error-prone.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

It would fix dtbs_check for arch/arm/boot/dts/renesas/r8a7779-marzen.dts
and would simplify arch/arm/boot/dts/renesas/r7s72100-rskrza1.dts.

Plus, it is the behaviour I would expect.

 Documentation/devicetree/bindings/input/gpio-keys.yaml | 3 +++
 1 file changed, 3 insertions(+)

Comments

Krzysztof Kozlowski Sept. 27, 2024, 8:30 a.m. UTC | #1
On 27/09/2024 10:15, Wolfram Sang wrote:
> Allow interrupt-parent in the main node, so it can be inherited to all
> subnodes. This is more compact and less error-prone.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> It would fix dtbs_check for arch/arm/boot/dts/renesas/r8a7779-marzen.dts
> and would simplify arch/arm/boot/dts/renesas/r7s72100-rskrza1.dts.
> 
> Plus, it is the behaviour I would expect.
> 
>  Documentation/devicetree/bindings/input/gpio-keys.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml
> index cc78c2152921..8fc331e01f7e 100644
> --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml
> +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml
> @@ -15,6 +15,9 @@ properties:
>        - gpio-keys
>        - gpio-keys-polled
>  
> +  interrupt-parent:
> +    description: Common interrupt parent for the following subnodes

That's a bit against DT spec:

"Nodes that represent interrupt-generating devices contain an
interrupt-parent property..."

but gpio-keys node you marked as interrupt-parent does not generate
interrupts, so I do not think this is correct.

If you want less lines in DTS, just switch to interrupts-extended.

Best regards,
Krzysztof
Wolfram Sang Sept. 27, 2024, 8:42 a.m. UTC | #2
> "Nodes that represent interrupt-generating devices contain an
> interrupt-parent property..."
> 
> but gpio-keys node you marked as interrupt-parent does not generate
> interrupts, so I do not think this is correct.

Agreed. Thanks for the heads up.
Geert Uytterhoeven Sept. 27, 2024, 9:09 a.m. UTC | #3
Hi Krzysztof,

On Fri, Sep 27, 2024 at 10:32 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> If you want less lines in DTS, just switch to interrupts-extended.

Oh cool!

Documentation/devicetree/bindings/interrupt-controller/interrupts.txt used to
explicitly prohibit this use case, but I seem to have missed
commit 6df58e485fd002f6 ("dt-bindings: Clarify interrupts-extended
usage") lifting that restriction.

/me thawes his old patches to make better use of interrupts-extended
in Renesas DTS files...

Gr{oetje,eeting}s,

                        Geert
Dmitry Torokhov Sept. 27, 2024, 9:27 p.m. UTC | #4
On Fri, Sep 27, 2024 at 10:30:12AM +0200, Krzysztof Kozlowski wrote:
> On 27/09/2024 10:15, Wolfram Sang wrote:
> > Allow interrupt-parent in the main node, so it can be inherited to all
> > subnodes. This is more compact and less error-prone.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > ---
> > 
> > It would fix dtbs_check for arch/arm/boot/dts/renesas/r8a7779-marzen.dts
> > and would simplify arch/arm/boot/dts/renesas/r7s72100-rskrza1.dts.
> > 
> > Plus, it is the behaviour I would expect.
> > 
> >  Documentation/devicetree/bindings/input/gpio-keys.yaml | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml
> > index cc78c2152921..8fc331e01f7e 100644
> > --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml
> > +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml
> > @@ -15,6 +15,9 @@ properties:
> >        - gpio-keys
> >        - gpio-keys-polled
> >  
> > +  interrupt-parent:
> > +    description: Common interrupt parent for the following subnodes
> 
> That's a bit against DT spec:
> 
> "Nodes that represent interrupt-generating devices contain an
> interrupt-parent property..."
> 
> but gpio-keys node you marked as interrupt-parent does not generate
> interrupts, so I do not think this is correct.

I think this can be read multiple ways. The device here is gpio-keys and
interrupt-parent would be attached to that node. Children nodes do not
represent individual devices, they just a convenient abstraction to
describe the hardware.

Thanks.
Krzysztof Kozlowski Sept. 28, 2024, 7:26 a.m. UTC | #5
On 27/09/2024 23:27, Dmitry Torokhov wrote:
> On Fri, Sep 27, 2024 at 10:30:12AM +0200, Krzysztof Kozlowski wrote:
>> On 27/09/2024 10:15, Wolfram Sang wrote:
>>> Allow interrupt-parent in the main node, so it can be inherited to all
>>> subnodes. This is more compact and less error-prone.
>>>
>>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>> ---
>>>
>>> It would fix dtbs_check for arch/arm/boot/dts/renesas/r8a7779-marzen.dts
>>> and would simplify arch/arm/boot/dts/renesas/r7s72100-rskrza1.dts.
>>>
>>> Plus, it is the behaviour I would expect.
>>>
>>>  Documentation/devicetree/bindings/input/gpio-keys.yaml | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml
>>> index cc78c2152921..8fc331e01f7e 100644
>>> --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml
>>> +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml
>>> @@ -15,6 +15,9 @@ properties:
>>>        - gpio-keys
>>>        - gpio-keys-polled
>>>  
>>> +  interrupt-parent:
>>> +    description: Common interrupt parent for the following subnodes
>>
>> That's a bit against DT spec:
>>
>> "Nodes that represent interrupt-generating devices contain an
>> interrupt-parent property..."
>>
>> but gpio-keys node you marked as interrupt-parent does not generate
>> interrupts, so I do not think this is correct.
> 
> I think this can be read multiple ways. The device here is gpio-keys and
> interrupt-parent would be attached to that node. Children nodes do not
> represent individual devices, they just a convenient abstraction to
> describe the hardware.

Not really. There is no device like "gpio-keys". Each key is a separate,
independent device. They are no grouped, they do no share anything. From
Linux perspective they share, but on hardware - zero common pieces,
independent devices.

And this is reflected in interrupts property. Individual devices
generating interrupts - so each key connected over GPIO - has interrupts
property.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml
index cc78c2152921..8fc331e01f7e 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys.yaml
+++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml
@@ -15,6 +15,9 @@  properties:
       - gpio-keys
       - gpio-keys-polled
 
+  interrupt-parent:
+    description: Common interrupt parent for the following subnodes
+
   autorepeat: true
 
   label: