diff mbox series

[RFC] dt-bindings: regulator: twl-regulator: convert to yaml

Message ID 20240528065756.1962482-1-andreas@kemnade.info (mailing list archive)
State New
Headers show
Series [RFC] dt-bindings: regulator: twl-regulator: convert to yaml | expand

Commit Message

Andreas Kemnade May 28, 2024, 6:57 a.m. UTC
Convert the regulator bindings to yaml files. To allow only the regulator
compatible corresponding to the toplevel mfd compatible, split the file
into one per device.

To not need to allow any subnode name, specify clearly node names
for all the regulators.

Drop one twl5030 compatible due to no documentation on mfd side and no
users of the twl5030.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
Reason for being RFC:
the integration into ti,twl.yaml seems not to work as expected
make dt_binding_check crashes without any clear error message
if used on the ti,twl.yaml

 .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
 .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
 .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
 .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
 .../bindings/regulator/twl-regulator.txt      |  80 ----
 5 files changed, 935 insertions(+), 81 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
 create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
 create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt

Comments

Krzysztof Kozlowski May 28, 2024, 10:04 a.m. UTC | #1
On 28/05/2024 08:57, Andreas Kemnade wrote:
> Convert the regulator bindings to yaml files. To allow only the regulator
> compatible corresponding to the toplevel mfd compatible, split the file
> into one per device.
> 
> To not need to allow any subnode name, specify clearly node names
> for all the regulators.
> 
> Drop one twl5030 compatible due to no documentation on mfd side and no
> users of the twl5030.
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> Reason for being RFC:
> the integration into ti,twl.yaml seems not to work as expected
> make dt_binding_check crashes without any clear error message
> if used on the ti,twl.yaml
> 
>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
>  .../bindings/regulator/twl-regulator.txt      |  80 ----
>  5 files changed, 935 insertions(+), 81 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> index c2357fecb56cc..4ced6e471d338 100644
> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> @@ -50,7 +50,7 @@ allOf:
>            properties:
>              compatible:
>                const: ti,twl4030-wdt
> -
> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml

That's not needed, just like othehr refs below.

>    - if:
>        properties:
>          compatible:
> @@ -63,6 +63,7 @@ allOf:
>            properties:
>              compatible:
>                const: ti,twl6030-gpadc
> +        $ref: /schemas/regulator/ti,twl6030-regulator.yaml
>    - if:
>        properties:
>          compatible:
> @@ -75,6 +76,7 @@ allOf:
>            properties:
>              compatible:
>                const: ti,twl6032-gpadc
> +        $ref: /schemas/regulator/ti,twl6032-regulator.yaml
>  

>  properties:
>    compatible:
> diff --git a/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml b/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> new file mode 100644
> index 0000000000000..9623c110605ef
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> @@ -0,0 +1,402 @@
> +# SPDX-License-Identifier: (GPL-2.0)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/ti,twl4030-regulator.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Regulators in the TWL4030 PMIC
> +
> +maintainers:
> +  - Andreas Kemnade <andreas@kemnade.info>
> +
> +properties:
> +  regulator-vaux1:
> +    type: object
> +    $ref: regulator.yaml#
> +    unevaluatedProperties: false
> +    properties:
> +      compatible:
> +        const: "ti,twl4030-vaux1"

No quotes

> +
> +      regulator-initial-mode:
> +        items:
> +          - items:
> +              enum:
> +                - 0x08 # Sleep mode, the nominal output voltage is maintained
> +                       # with low power consumption with low load current capability
> +                - 0x0e # Active mode, the regulator can deliver its nominal output
> +                       # voltage with full-load current capability
> +
> +    required:
> +      - compatible
> +
> +  regulator-vaux2:
> +    type: object
> +    $ref: regulator.yaml#
> +    unevaluatedProperties: false
> +    properties:
> +      compatible:
> +        const: "ti,twl4030-vaux2"
> +
> +      regulator-initial-mode:
> +        items:
> +          - items:
> +              enum:
> +                - 0x08 # Sleep mode, the nominal output voltage is maintained
> +                       # with low power consumption with low load current capability
> +                - 0x0e # Active mode, the regulator can deliver its nominal output
> +                       # voltage with full-load current capability

These entries are the same. Just use patternProperties and enum for
compatible.


Best regards,
Krzysztof
Andreas Kemnade May 28, 2024, 11:16 a.m. UTC | #2
On Tue, 28 May 2024 12:04:22 +0200
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On 28/05/2024 08:57, Andreas Kemnade wrote:
> > Convert the regulator bindings to yaml files. To allow only the regulator
> > compatible corresponding to the toplevel mfd compatible, split the file
> > into one per device.
> > 
> > To not need to allow any subnode name, specify clearly node names
> > for all the regulators.
> > 
> > Drop one twl5030 compatible due to no documentation on mfd side and no
> > users of the twl5030.
> > 
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> > Reason for being RFC:
> > the integration into ti,twl.yaml seems not to work as expected
> > make dt_binding_check crashes without any clear error message
> > if used on the ti,twl.yaml
> > 
> >  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
> >  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
> >  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
> >  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
> >  .../bindings/regulator/twl-regulator.txt      |  80 ----
> >  5 files changed, 935 insertions(+), 81 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> >  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
> >  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
> >  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > index c2357fecb56cc..4ced6e471d338 100644
> > --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > @@ -50,7 +50,7 @@ allOf:
> >            properties:
> >              compatible:
> >                const: ti,twl4030-wdt
> > -
> > +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml  
> 
> That's not needed, just like othehr refs below.
> 
but how to prevent error messages like this:

arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1

esp. the regulator parts without adding stuff to ti,twl.yaml?

> >    - if:
> >        properties:
> >          compatible:
> > @@ -63,6 +63,7 @@ allOf:
> >            properties:
> >              compatible:
> >                const: ti,twl6030-gpadc
> > +        $ref: /schemas/regulator/ti,twl6030-regulator.yaml
> >    - if:
> >        properties:
> >          compatible:
> > @@ -75,6 +76,7 @@ allOf:
> >            properties:
> >              compatible:
> >                const: ti,twl6032-gpadc
> > +        $ref: /schemas/regulator/ti,twl6032-regulator.yaml
> >    
> 
> >  properties:
> >    compatible:
> > diff --git a/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml b/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> > new file mode 100644
> > index 0000000000000..9623c110605ef
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> > @@ -0,0 +1,402 @@
> > +# SPDX-License-Identifier: (GPL-2.0)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/regulator/ti,twl4030-regulator.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Regulators in the TWL4030 PMIC
> > +
> > +maintainers:
> > +  - Andreas Kemnade <andreas@kemnade.info>
> > +
> > +properties:
> > +  regulator-vaux1:
> > +    type: object
> > +    $ref: regulator.yaml#
> > +    unevaluatedProperties: false
> > +    properties:
> > +      compatible:
> > +        const: "ti,twl4030-vaux1"  
> 
> No quotes
> 
Ack.

> > +
> > +      regulator-initial-mode:
> > +        items:
> > +          - items:
> > +              enum:
> > +                - 0x08 # Sleep mode, the nominal output voltage is maintained
> > +                       # with low power consumption with low load current capability
> > +                - 0x0e # Active mode, the regulator can deliver its nominal output
> > +                       # voltage with full-load current capability
> > +
> > +    required:
> > +      - compatible
> > +
> > +  regulator-vaux2:
> > +    type: object
> > +    $ref: regulator.yaml#
> > +    unevaluatedProperties: false
> > +    properties:
> > +      compatible:
> > +        const: "ti,twl4030-vaux2"
> > +
> > +      regulator-initial-mode:
> > +        items:
> > +          - items:
> > +              enum:
> > +                - 0x08 # Sleep mode, the nominal output voltage is maintained
> > +                       # with low power consumption with low load current capability
> > +                - 0x0e # Active mode, the regulator can deliver its nominal output
> > +                       # voltage with full-load current capability  
> 
> These entries are the same. Just use patternProperties and enum for
> compatible.
> 
hmm, if I am using that, how do I prevent e.g. constructions like this to be
valid?

regulator-vaux2 {
	compatible = "ti,twl4030-vaux1";
};

Regards,
Andreas
Krzysztof Kozlowski May 28, 2024, 11:25 a.m. UTC | #3
On 28/05/2024 13:16, Andreas Kemnade wrote:
> On Tue, 28 May 2024 12:04:22 +0200
> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> 
>> On 28/05/2024 08:57, Andreas Kemnade wrote:
>>> Convert the regulator bindings to yaml files. To allow only the regulator
>>> compatible corresponding to the toplevel mfd compatible, split the file
>>> into one per device.
>>>
>>> To not need to allow any subnode name, specify clearly node names
>>> for all the regulators.
>>>
>>> Drop one twl5030 compatible due to no documentation on mfd side and no
>>> users of the twl5030.
>>>
>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
>>> ---
>>> Reason for being RFC:
>>> the integration into ti,twl.yaml seems not to work as expected
>>> make dt_binding_check crashes without any clear error message
>>> if used on the ti,twl.yaml
>>>
>>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
>>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
>>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
>>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
>>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
>>>  5 files changed, 935 insertions(+), 81 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
>>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
>>> index c2357fecb56cc..4ced6e471d338 100644
>>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
>>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
>>> @@ -50,7 +50,7 @@ allOf:
>>>            properties:
>>>              compatible:
>>>                const: ti,twl4030-wdt
>>> -
>>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml  
>>
>> That's not needed, just like othehr refs below.
>>
> but how to prevent error messages like this:
> 
> arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
> 
> esp. the regulator parts without adding stuff to ti,twl.yaml?

Eh? That's a watchdog, not regulator. Why do you add ref to regulator?

...

>>> +
>>> +  regulator-vaux2:
>>> +    type: object
>>> +    $ref: regulator.yaml#
>>> +    unevaluatedProperties: false
>>> +    properties:
>>> +      compatible:
>>> +        const: "ti,twl4030-vaux2"
>>> +
>>> +      regulator-initial-mode:
>>> +        items:
>>> +          - items:
>>> +              enum:
>>> +                - 0x08 # Sleep mode, the nominal output voltage is maintained
>>> +                       # with low power consumption with low load current capability
>>> +                - 0x0e # Active mode, the regulator can deliver its nominal output
>>> +                       # voltage with full-load current capability  
>>
>> These entries are the same. Just use patternProperties and enum for
>> compatible.
>>
> hmm, if I am using that, how do I prevent e.g. constructions like this to be
> valid?
> 
> regulator-vaux2 {
> 	compatible = "ti,twl4030-vaux1";
> };
> 

Why would node name matter if you have compatible? The entire point of
compatibles is to not to rely on node names.

Best regards,
Krzysztof
Andreas Kemnade May 28, 2024, 1:06 p.m. UTC | #4
On Tue, 28 May 2024 13:25:29 +0200
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On 28/05/2024 13:16, Andreas Kemnade wrote:
> > On Tue, 28 May 2024 12:04:22 +0200
> > Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >   
> >> On 28/05/2024 08:57, Andreas Kemnade wrote:  
> >>> Convert the regulator bindings to yaml files. To allow only the regulator
> >>> compatible corresponding to the toplevel mfd compatible, split the file
> >>> into one per device.
> >>>
> >>> To not need to allow any subnode name, specify clearly node names
> >>> for all the regulators.
> >>>
> >>> Drop one twl5030 compatible due to no documentation on mfd side and no
> >>> users of the twl5030.
> >>>
> >>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> >>> ---
> >>> Reason for being RFC:
> >>> the integration into ti,twl.yaml seems not to work as expected
> >>> make dt_binding_check crashes without any clear error message
> >>> if used on the ti,twl.yaml
> >>>
> >>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
> >>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
> >>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
> >>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
> >>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
> >>>  5 files changed, 935 insertions(+), 81 deletions(-)
> >>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> >>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
> >>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
> >>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> >>> index c2357fecb56cc..4ced6e471d338 100644
> >>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> >>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> >>> @@ -50,7 +50,7 @@ allOf:
> >>>            properties:
> >>>              compatible:
> >>>                const: ti,twl4030-wdt
> >>> -
> >>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml    
> >>
> >> That's not needed, just like othehr refs below.
> >>  
> > but how to prevent error messages like this:
> > 
> > arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
> > 
> > esp. the regulator parts without adding stuff to ti,twl.yaml?  
> 
> Eh? That's a watchdog, not regulator. Why do you add ref to regulator?
> 
hmm, wrongly indented? At what level doet it belong? But as the regualor.yaml stuff can
be shortened, maybe just add it directly to ti,twl.yaml to avoid that trouble.

> ...
> 
> >>> +
> >>> +  regulator-vaux2:
> >>> +    type: object
> >>> +    $ref: regulator.yaml#
> >>> +    unevaluatedProperties: false
> >>> +    properties:
> >>> +      compatible:
> >>> +        const: "ti,twl4030-vaux2"
> >>> +
> >>> +      regulator-initial-mode:
> >>> +        items:
> >>> +          - items:
> >>> +              enum:
> >>> +                - 0x08 # Sleep mode, the nominal output voltage is maintained
> >>> +                       # with low power consumption with low load current capability
> >>> +                - 0x0e # Active mode, the regulator can deliver its nominal output
> >>> +                       # voltage with full-load current capability    
> >>
> >> These entries are the same. Just use patternProperties and enum for
> >> compatible.
> >>  
> > hmm, if I am using that, how do I prevent e.g. constructions like this to be
> > valid?
> > 
> > regulator-vaux2 {
> > 	compatible = "ti,twl4030-vaux1";
> > };
> >   
> 
> Why would node name matter if you have compatible? The entire point of
> compatibles is to not to rely on node names.
> 
Hmm, even if we rely on them, it should somehow match what is inside that node
usually. We have @xx and reg=<xx>; e.g. So relax the stuff to allowing
any regulator-.* as node name independently of the contents?

And since that all is then shorter, maybe add stuff just directly to ti,twl.yaml?

Regards,
Andreas
Krzysztof Kozlowski May 28, 2024, 1:54 p.m. UTC | #5
On 28/05/2024 15:06, Andreas Kemnade wrote:
> On Tue, 28 May 2024 13:25:29 +0200
> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> 
>> On 28/05/2024 13:16, Andreas Kemnade wrote:
>>> On Tue, 28 May 2024 12:04:22 +0200
>>> Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>>   
>>>> On 28/05/2024 08:57, Andreas Kemnade wrote:  
>>>>> Convert the regulator bindings to yaml files. To allow only the regulator
>>>>> compatible corresponding to the toplevel mfd compatible, split the file
>>>>> into one per device.
>>>>>
>>>>> To not need to allow any subnode name, specify clearly node names
>>>>> for all the regulators.
>>>>>
>>>>> Drop one twl5030 compatible due to no documentation on mfd side and no
>>>>> users of the twl5030.
>>>>>
>>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
>>>>> ---
>>>>> Reason for being RFC:
>>>>> the integration into ti,twl.yaml seems not to work as expected
>>>>> make dt_binding_check crashes without any clear error message
>>>>> if used on the ti,twl.yaml
>>>>>
>>>>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
>>>>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
>>>>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
>>>>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
>>>>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
>>>>>  5 files changed, 935 insertions(+), 81 deletions(-)
>>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
>>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
>>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
>>>>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
>>>>> index c2357fecb56cc..4ced6e471d338 100644
>>>>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
>>>>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
>>>>> @@ -50,7 +50,7 @@ allOf:
>>>>>            properties:
>>>>>              compatible:
>>>>>                const: ti,twl4030-wdt
>>>>> -
>>>>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml    
>>>>
>>>> That's not needed, just like othehr refs below.
>>>>  
>>> but how to prevent error messages like this:
>>>
>>> arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
>>>
>>> esp. the regulator parts without adding stuff to ti,twl.yaml?  
>>
>> Eh? That's a watchdog, not regulator. Why do you add ref to regulator?
>>
> hmm, wrongly indented? At what level doet it belong? But as the regualor.yaml stuff can
> be shortened, maybe just add it directly to ti,twl.yaml to avoid that trouble.

I don't follow. The diff here and in other two places suggest you add
twl-regulator reference to wdt/gpio/whatnot nodes, not to regulators.

> 
>> ...
>>
>>>>> +
>>>>> +  regulator-vaux2:
>>>>> +    type: object
>>>>> +    $ref: regulator.yaml#
>>>>> +    unevaluatedProperties: false
>>>>> +    properties:
>>>>> +      compatible:
>>>>> +        const: "ti,twl4030-vaux2"
>>>>> +
>>>>> +      regulator-initial-mode:
>>>>> +        items:
>>>>> +          - items:
>>>>> +              enum:
>>>>> +                - 0x08 # Sleep mode, the nominal output voltage is maintained
>>>>> +                       # with low power consumption with low load current capability
>>>>> +                - 0x0e # Active mode, the regulator can deliver its nominal output
>>>>> +                       # voltage with full-load current capability    
>>>>
>>>> These entries are the same. Just use patternProperties and enum for
>>>> compatible.
>>>>  
>>> hmm, if I am using that, how do I prevent e.g. constructions like this to be
>>> valid?
>>>
>>> regulator-vaux2 {
>>> 	compatible = "ti,twl4030-vaux1";
>>> };
>>>   
>>
>> Why would node name matter if you have compatible? The entire point of
>> compatibles is to not to rely on node names.
>>
> Hmm, even if we rely on them, it should somehow match what is inside that node
> usually. We have @xx and reg=<xx>; e.g. So relax the stuff to allowing

I don't follow what reg has anything to do with it. There are no reg
properties in regulator nodes.

> any regulator-.* as node name independently of the contents?

As I said: patternProperties+enum

BTW, the example in MFD (so main node) is heavily incomplete. This
should be full, complete, passing dt_binding_check example.

> 
> And since that all is then shorter, maybe add stuff just directly to ti,twl.yaml?

Sure.


Best regards,
Krzysztof
Conor Dooley May 28, 2024, 2:36 p.m. UTC | #6
On Tue, May 28, 2024 at 03:54:05PM +0200, Krzysztof Kozlowski wrote:
> On 28/05/2024 15:06, Andreas Kemnade wrote:
> > On Tue, 28 May 2024 13:25:29 +0200
> > Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > 
> >> On 28/05/2024 13:16, Andreas Kemnade wrote:
> >>> On Tue, 28 May 2024 12:04:22 +0200
> >>> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >>>   
> >>>> On 28/05/2024 08:57, Andreas Kemnade wrote:  
> >>>>> Convert the regulator bindings to yaml files. To allow only the regulator
> >>>>> compatible corresponding to the toplevel mfd compatible, split the file
> >>>>> into one per device.
> >>>>>
> >>>>> To not need to allow any subnode name, specify clearly node names
> >>>>> for all the regulators.
> >>>>>
> >>>>> Drop one twl5030 compatible due to no documentation on mfd side and no
> >>>>> users of the twl5030.
> >>>>>
> >>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> >>>>> ---
> >>>>> Reason for being RFC:
> >>>>> the integration into ti,twl.yaml seems not to work as expected
> >>>>> make dt_binding_check crashes without any clear error message
> >>>>> if used on the ti,twl.yaml
> >>>>>
> >>>>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
> >>>>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
> >>>>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
> >>>>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
> >>>>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
> >>>>>  5 files changed, 935 insertions(+), 81 deletions(-)
> >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
> >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
> >>>>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> >>>>>
> >>>>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> >>>>> index c2357fecb56cc..4ced6e471d338 100644
> >>>>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> >>>>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> >>>>> @@ -50,7 +50,7 @@ allOf:
> >>>>>            properties:
> >>>>>              compatible:
> >>>>>                const: ti,twl4030-wdt
> >>>>> -
> >>>>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml    
> >>>>
> >>>> That's not needed, just like othehr refs below.
> >>>>  
> >>> but how to prevent error messages like this:
> >>>
> >>> arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
> >>>
> >>> esp. the regulator parts without adding stuff to ti,twl.yaml?  
> >>
> >> Eh? That's a watchdog, not regulator. Why do you add ref to regulator?
> >>
> > hmm, wrongly indented? At what level doet it belong? But as the regualor.yaml stuff can
> > be shortened, maybe just add it directly to ti,twl.yaml to avoid that trouble.
> 
> I don't follow. The diff here and in other two places suggest you add
> twl-regulator reference to wdt/gpio/whatnot nodes, not to regulators.

The diff may look like that, but I think they're just trying to add it
as a subnode of the pmic. There are other nodes, like the madc that do
this in the same file:
        madc:
          type: object
          $ref: /schemas/iio/adc/ti,twl4030-madc.yaml
          unevaluatedProperties: false

I guess this is what was being attempted, albeit incorrectly.
Andreas Kemnade May 28, 2024, 3:48 p.m. UTC | #7
On Tue, 28 May 2024 15:36:40 +0100
Conor Dooley <conor@kernel.org> wrote:

> On Tue, May 28, 2024 at 03:54:05PM +0200, Krzysztof Kozlowski wrote:
> > On 28/05/2024 15:06, Andreas Kemnade wrote:  
> > > On Tue, 28 May 2024 13:25:29 +0200
> > > Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > >   
> > >> On 28/05/2024 13:16, Andreas Kemnade wrote:  
> > >>> On Tue, 28 May 2024 12:04:22 +0200
> > >>> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > >>>     
> > >>>> On 28/05/2024 08:57, Andreas Kemnade wrote:    
> > >>>>> Convert the regulator bindings to yaml files. To allow only the regulator
> > >>>>> compatible corresponding to the toplevel mfd compatible, split the file
> > >>>>> into one per device.
> > >>>>>
> > >>>>> To not need to allow any subnode name, specify clearly node names
> > >>>>> for all the regulators.
> > >>>>>
> > >>>>> Drop one twl5030 compatible due to no documentation on mfd side and no
> > >>>>> users of the twl5030.
> > >>>>>
> > >>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > >>>>> ---
> > >>>>> Reason for being RFC:
> > >>>>> the integration into ti,twl.yaml seems not to work as expected
> > >>>>> make dt_binding_check crashes without any clear error message
> > >>>>> if used on the ti,twl.yaml
> > >>>>>
> > >>>>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
> > >>>>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
> > >>>>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
> > >>>>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
> > >>>>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
> > >>>>>  5 files changed, 935 insertions(+), 81 deletions(-)
> > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
> > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
> > >>>>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> > >>>>>
> > >>>>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > >>>>> index c2357fecb56cc..4ced6e471d338 100644
> > >>>>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > >>>>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > >>>>> @@ -50,7 +50,7 @@ allOf:
> > >>>>>            properties:
> > >>>>>              compatible:
> > >>>>>                const: ti,twl4030-wdt
> > >>>>> -
> > >>>>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml      
> > >>>>
> > >>>> That's not needed, just like othehr refs below.
> > >>>>    
> > >>> but how to prevent error messages like this:
> > >>>
> > >>> arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
> > >>>
> > >>> esp. the regulator parts without adding stuff to ti,twl.yaml?    
> > >>
> > >> Eh? That's a watchdog, not regulator. Why do you add ref to regulator?
> > >>  
> > > hmm, wrongly indented? At what level doet it belong? But as the regualor.yaml stuff can
> > > be shortened, maybe just add it directly to ti,twl.yaml to avoid that trouble.  
> > 
> > I don't follow. The diff here and in other two places suggest you add
> > twl-regulator reference to wdt/gpio/whatnot nodes, not to regulators.  
> 
> The diff may look like that, but I think they're just trying to add it
> as a subnode of the pmic. There are other nodes, like the madc that do
> this in the same file:
>         madc:
>           type: object
>           $ref: /schemas/iio/adc/ti,twl4030-madc.yaml
>           unevaluatedProperties: false
> 
> I guess this is what was being attempted, albeit incorrectly.

correct. No regulators node, just everything directly as a subnode of
the pmic. Well, I have now something using patternProperties directly itn ti,twl.yaml
including a more detailed example which does not upset dt_binding_check.
I am running dtbs_check to check if anything is odd. the 4030 variant seems
to be ok, waiting for some dtbs containing 603X now.

But somehow I would feel better if I would understand what was syntactically
wrong with my original proposal. I have totally no idea yet.

The error message of dt_binding_check is also meaningless:
 CHKDT   Documentation/devicetree/bindings
Traceback (most recent call last):
  File "/home/andi/.local/bin/dt-doc-validate", line 64, in <module>
    ret |= check_doc(f)
           ^^^^^^^^^^^^
  File "/home/andi/.local/bin/dt-doc-validate", line 32, in check_doc
    for error in sorted(dtsch.iter_errors(), key=lambda e: e.linecol):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andi/.local/pipx/venvs/dtschema/lib/python3.11/site-packages/dtschema/schema.py", line 125, in iter_errors
    self.annotate_error(scherr, meta_schema, scherr.schema_path)
  File "/home/andi/.local/pipx/venvs/dtschema/lib/python3.11/site-packages/dtschema/schema.py", line 104, in annotate_error
    schema = schema[p]
             ~~~~~~^^^
KeyError: 'type'
  LINT    Documentation/devicetree/bindings

IMHO this should be improved.
	
Regards,
Andreas
Conor Dooley May 28, 2024, 3:53 p.m. UTC | #8
On Tue, May 28, 2024 at 05:48:49PM +0200, Andreas Kemnade wrote:
> On Tue, 28 May 2024 15:36:40 +0100
> Conor Dooley <conor@kernel.org> wrote:
> 
> > On Tue, May 28, 2024 at 03:54:05PM +0200, Krzysztof Kozlowski wrote:
> > > On 28/05/2024 15:06, Andreas Kemnade wrote:  
> > > > On Tue, 28 May 2024 13:25:29 +0200
> > > > Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > >   
> > > >> On 28/05/2024 13:16, Andreas Kemnade wrote:  
> > > >>> On Tue, 28 May 2024 12:04:22 +0200
> > > >>> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > >>>     
> > > >>>> On 28/05/2024 08:57, Andreas Kemnade wrote:    
> > > >>>>> Convert the regulator bindings to yaml files. To allow only the regulator
> > > >>>>> compatible corresponding to the toplevel mfd compatible, split the file
> > > >>>>> into one per device.
> > > >>>>>
> > > >>>>> To not need to allow any subnode name, specify clearly node names
> > > >>>>> for all the regulators.
> > > >>>>>
> > > >>>>> Drop one twl5030 compatible due to no documentation on mfd side and no
> > > >>>>> users of the twl5030.
> > > >>>>>
> > > >>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > > >>>>> ---
> > > >>>>> Reason for being RFC:
> > > >>>>> the integration into ti,twl.yaml seems not to work as expected
> > > >>>>> make dt_binding_check crashes without any clear error message
> > > >>>>> if used on the ti,twl.yaml
> > > >>>>>
> > > >>>>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
> > > >>>>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
> > > >>>>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
> > > >>>>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
> > > >>>>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
> > > >>>>>  5 files changed, 935 insertions(+), 81 deletions(-)
> > > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> > > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
> > > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
> > > >>>>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> > > >>>>>
> > > >>>>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > > >>>>> index c2357fecb56cc..4ced6e471d338 100644
> > > >>>>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > > >>>>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > > >>>>> @@ -50,7 +50,7 @@ allOf:
> > > >>>>>            properties:
> > > >>>>>              compatible:
> > > >>>>>                const: ti,twl4030-wdt
> > > >>>>> -
> > > >>>>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml      
> > > >>>>
> > > >>>> That's not needed, just like othehr refs below.
> > > >>>>    
> > > >>> but how to prevent error messages like this:
> > > >>>
> > > >>> arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
> > > >>>
> > > >>> esp. the regulator parts without adding stuff to ti,twl.yaml?    
> > > >>
> > > >> Eh? That's a watchdog, not regulator. Why do you add ref to regulator?
> > > >>  
> > > > hmm, wrongly indented? At what level doet it belong? But as the regualor.yaml stuff can
> > > > be shortened, maybe just add it directly to ti,twl.yaml to avoid that trouble.  
> > > 
> > > I don't follow. The diff here and in other two places suggest you add
> > > twl-regulator reference to wdt/gpio/whatnot nodes, not to regulators.  
> > 
> > The diff may look like that, but I think they're just trying to add it
> > as a subnode of the pmic. There are other nodes, like the madc that do
> > this in the same file:
> >         madc:
> >           type: object
> >           $ref: /schemas/iio/adc/ti,twl4030-madc.yaml
> >           unevaluatedProperties: false
> > 
> > I guess this is what was being attempted, albeit incorrectly.
> 
> correct. No regulators node, just everything directly as a subnode of
> the pmic. Well, I have now something using patternProperties directly itn ti,twl.yaml
> including a more detailed example which does not upset dt_binding_check.
> I am running dtbs_check to check if anything is odd. the 4030 variant seems
> to be ok, waiting for some dtbs containing 603X now.
> 
> But somehow I would feel better if I would understand what was syntactically
> wrong with my original proposal. I have totally no idea yet.

If you want to create a child node, you can't just reference another
schema willy nilly. You need to create a property of type object, as was
done elsewhere in the file.

> The error message of dt_binding_check is also meaningless:
>  CHKDT   Documentation/devicetree/bindings
> Traceback (most recent call last):
>   File "/home/andi/.local/bin/dt-doc-validate", line 64, in <module>
>     ret |= check_doc(f)
>            ^^^^^^^^^^^^
>   File "/home/andi/.local/bin/dt-doc-validate", line 32, in check_doc
>     for error in sorted(dtsch.iter_errors(), key=lambda e: e.linecol):
>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/andi/.local/pipx/venvs/dtschema/lib/python3.11/site-packages/dtschema/schema.py", line 125, in iter_errors
>     self.annotate_error(scherr, meta_schema, scherr.schema_path)
>   File "/home/andi/.local/pipx/venvs/dtschema/lib/python3.11/site-packages/dtschema/schema.py", line 104, in annotate_error
>     schema = schema[p]
>              ~~~~~~^^^
> KeyError: 'type'
>   LINT    Documentation/devicetree/bindings
> 
> IMHO this should be improved.

What I see with your patch applied is:
/stuff/linux-dt/Documentation/devicetree/bindings/mfd/ti,twl.yaml: ignoring, error in schema: allOf: 0: then: properties: $ref

Not a great error either, but not a crash like you see. What version of
dt-schema are you using?
Andreas Kemnade May 28, 2024, 4:55 p.m. UTC | #9
On Tue, 28 May 2024 16:53:46 +0100
Conor Dooley <conor@kernel.org> wrote:

> On Tue, May 28, 2024 at 05:48:49PM +0200, Andreas Kemnade wrote:
> > On Tue, 28 May 2024 15:36:40 +0100
> > Conor Dooley <conor@kernel.org> wrote:
> >   
> > > On Tue, May 28, 2024 at 03:54:05PM +0200, Krzysztof Kozlowski wrote:  
> > > > On 28/05/2024 15:06, Andreas Kemnade wrote:    
> > > > > On Tue, 28 May 2024 13:25:29 +0200
> > > > > Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > >     
> > > > >> On 28/05/2024 13:16, Andreas Kemnade wrote:    
> > > > >>> On Tue, 28 May 2024 12:04:22 +0200
> > > > >>> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > >>>       
> > > > >>>> On 28/05/2024 08:57, Andreas Kemnade wrote:      
> > > > >>>>> Convert the regulator bindings to yaml files. To allow only the regulator
> > > > >>>>> compatible corresponding to the toplevel mfd compatible, split the file
> > > > >>>>> into one per device.
> > > > >>>>>
> > > > >>>>> To not need to allow any subnode name, specify clearly node names
> > > > >>>>> for all the regulators.
> > > > >>>>>
> > > > >>>>> Drop one twl5030 compatible due to no documentation on mfd side and no
> > > > >>>>> users of the twl5030.
> > > > >>>>>
> > > > >>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > > > >>>>> ---
> > > > >>>>> Reason for being RFC:
> > > > >>>>> the integration into ti,twl.yaml seems not to work as expected
> > > > >>>>> make dt_binding_check crashes without any clear error message
> > > > >>>>> if used on the ti,twl.yaml
> > > > >>>>>
> > > > >>>>>  .../devicetree/bindings/mfd/ti,twl.yaml       |   4 +-
> > > > >>>>>  .../regulator/ti,twl4030-regulator.yaml       | 402 ++++++++++++++++++
> > > > >>>>>  .../regulator/ti,twl6030-regulator.yaml       | 292 +++++++++++++
> > > > >>>>>  .../regulator/ti,twl6032-regulator.yaml       | 238 +++++++++++
> > > > >>>>>  .../bindings/regulator/twl-regulator.txt      |  80 ----
> > > > >>>>>  5 files changed, 935 insertions(+), 81 deletions(-)
> > > > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
> > > > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
> > > > >>>>>  create mode 100644 Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
> > > > >>>>>  delete mode 100644 Documentation/devicetree/bindings/regulator/twl-regulator.txt
> > > > >>>>>
> > > > >>>>> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > > > >>>>> index c2357fecb56cc..4ced6e471d338 100644
> > > > >>>>> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > > > >>>>> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> > > > >>>>> @@ -50,7 +50,7 @@ allOf:
> > > > >>>>>            properties:
> > > > >>>>>              compatible:
> > > > >>>>>                const: ti,twl4030-wdt
> > > > >>>>> -
> > > > >>>>> +        $ref: /schemas/regulator/ti,twl4030-regulator.yaml        
> > > > >>>>
> > > > >>>> That's not needed, just like othehr refs below.
> > > > >>>>      
> > > > >>> but how to prevent error messages like this:
> > > > >>>
> > > > >>> arch/arm/boot/dts/ti/omap/omap2430-sdp.dtb: twl@48: Unevaluated properties are not allowed ('gpio', 'keypad', 'pwm', 'pwmled', 'regulator-vaux1', 'regulator-vaux2', 'regulator-vaux3', 'regulator-vaux4', 'regulator-vdac', 'regulator-vdd1', 'regulator-vintana1', 'regulator-vintana2', 'regulator-vintdig', 'regulator-vio', 'regulator-vmmc1', 'regulator-vmmc2', 'regulator-vpll1', 'regulator-vpll2', 'regulator-vsim', 'regulator-vusb1v5', 'regulator-vusb1v8', 'regulator-vusb3v1
> > > > >>>
> > > > >>> esp. the regulator parts without adding stuff to ti,twl.yaml?      
> > > > >>
> > > > >> Eh? That's a watchdog, not regulator. Why do you add ref to regulator?
> > > > >>    
> > > > > hmm, wrongly indented? At what level doet it belong? But as the regualor.yaml stuff can
> > > > > be shortened, maybe just add it directly to ti,twl.yaml to avoid that trouble.    
> > > > 
> > > > I don't follow. The diff here and in other two places suggest you add
> > > > twl-regulator reference to wdt/gpio/whatnot nodes, not to regulators.    
> > > 
> > > The diff may look like that, but I think they're just trying to add it
> > > as a subnode of the pmic. There are other nodes, like the madc that do
> > > this in the same file:
> > >         madc:
> > >           type: object
> > >           $ref: /schemas/iio/adc/ti,twl4030-madc.yaml
> > >           unevaluatedProperties: false
> > > 
> > > I guess this is what was being attempted, albeit incorrectly.  
> > 
> > correct. No regulators node, just everything directly as a subnode of
> > the pmic. Well, I have now something using patternProperties directly itn ti,twl.yaml
> > including a more detailed example which does not upset dt_binding_check.
> > I am running dtbs_check to check if anything is odd. the 4030 variant seems
> > to be ok, waiting for some dtbs containing 603X now.
> > 
> > But somehow I would feel better if I would understand what was syntactically
> > wrong with my original proposal. I have totally no idea yet.  
> 
> If you want to create a child node, you can't just reference another
> schema willy nilly. You need to create a property of type object, as was
> done elsewhere in the file.
> 
hmm, by $ref regulator.yaml I can successfully create the child node
regulator-state-mem, so what is the difference to creating e.g. a child
node named regulator-vaux1 by $ref ti,twl4030-regulator.yaml

still a bit confused.

> > The error message of dt_binding_check is also meaningless:
> >  CHKDT   Documentation/devicetree/bindings
> > Traceback (most recent call last):
> >   File "/home/andi/.local/bin/dt-doc-validate", line 64, in <module>
> >     ret |= check_doc(f)
> >            ^^^^^^^^^^^^
> >   File "/home/andi/.local/bin/dt-doc-validate", line 32, in check_doc
> >     for error in sorted(dtsch.iter_errors(), key=lambda e: e.linecol):
> >                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >   File "/home/andi/.local/pipx/venvs/dtschema/lib/python3.11/site-packages/dtschema/schema.py", line 125, in iter_errors
> >     self.annotate_error(scherr, meta_schema, scherr.schema_path)
> >   File "/home/andi/.local/pipx/venvs/dtschema/lib/python3.11/site-packages/dtschema/schema.py", line 104, in annotate_error
> >     schema = schema[p]
> >              ~~~~~~^^^
> > KeyError: 'type'
> >   LINT    Documentation/devicetree/bindings
> > 
> > IMHO this should be improved.  
> 
> What I see with your patch applied is:
> /stuff/linux-dt/Documentation/devicetree/bindings/mfd/ti,twl.yaml: ignoring, error in schema: allOf: 0: then: properties: $ref
> 
> Not a great error either, but not a crash like you see. What version of
> dt-schema are you using?

2023.9
ok, but there is 2024.4... Upgraded and got your error

Regards,
Andreas
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
index c2357fecb56cc..4ced6e471d338 100644
--- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
+++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
@@ -50,7 +50,7 @@  allOf:
           properties:
             compatible:
               const: ti,twl4030-wdt
-
+        $ref: /schemas/regulator/ti,twl4030-regulator.yaml
   - if:
       properties:
         compatible:
@@ -63,6 +63,7 @@  allOf:
           properties:
             compatible:
               const: ti,twl6030-gpadc
+        $ref: /schemas/regulator/ti,twl6030-regulator.yaml
   - if:
       properties:
         compatible:
@@ -75,6 +76,7 @@  allOf:
           properties:
             compatible:
               const: ti,twl6032-gpadc
+        $ref: /schemas/regulator/ti,twl6032-regulator.yaml
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml b/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
new file mode 100644
index 0000000000000..9623c110605ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/ti,twl4030-regulator.yaml
@@ -0,0 +1,402 @@ 
+# SPDX-License-Identifier: (GPL-2.0)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/ti,twl4030-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulators in the TWL4030 PMIC
+
+maintainers:
+  - Andreas Kemnade <andreas@kemnade.info>
+
+properties:
+  regulator-vaux1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vaux1"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vaux2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vaux2"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vaux3:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vaux3"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vaux4:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vaux4"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vmmc1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vmmc1"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vmmc2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vmmc2"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vpll1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vpll1"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vpll2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vpll2"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vsim:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vsim"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vdac:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vdac"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vintana2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vintana2"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vio:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vio"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vdd1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vdd1"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vdd2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vdd2"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vintana1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vintana1"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vintdig:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vintdig"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vusb1v5:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vusb1v5"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vusb1v8:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vusb1v8"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+  regulator-vusb3v1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl4030-vusb3v1"
+
+      regulator-initial-mode:
+        items:
+          - items:
+              enum:
+                - 0x08 # Sleep mode, the nominal output voltage is maintained
+                       # with low power consumption with low load current capability
+                - 0x0e # Active mode, the regulator can deliver its nominal output
+                       # voltage with full-load current capability
+
+    required:
+      - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    regulator-vaux1 {
+        compatible = "ti,twl4030-vaux1";
+        regulator-min-microvolt  = <1000000>;
+        regulator-max-microvolt  = <3000000>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml b/Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
new file mode 100644
index 0000000000000..bda4c83a789d9
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/ti,twl6030-regulator.yaml
@@ -0,0 +1,292 @@ 
+# SPDX-License-Identifier: (GPL-2.0)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/ti,twl6030-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulators in the TWL6030 PMIC
+
+maintainers:
+  - Andreas Kemnade <andreas@kemnade.info>
+
+properties:
+  regulator-vaux1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vaux1"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vaux2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vaux2"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vaux3:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vaux3"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vmmc:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vmmc"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vpp:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vpp"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vusim:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vusim"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vana:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vana"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vcxio:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vcxio"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vdac:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vdac"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vusb:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vusb"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-v1v8:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-v1v8"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-v2v1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-v2v1"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vdd1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vdd1"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vdd2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vdd2"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vdd3:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6030-vdd3"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    regulator-vaux1 {
+        compatible = "ti,twl6030-vaux1";
+        regulator-min-microvolt  = <1000000>;
+        regulator-max-microvolt  = <3000000>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml b/Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
new file mode 100644
index 0000000000000..2e9871e178151
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/ti,twl6032-regulator.yaml
@@ -0,0 +1,238 @@ 
+# SPDX-License-Identifier: (GPL-2.0)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/ti,twl6032-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulators in the TWL6032 PMIC
+
+maintainers:
+  - Andreas Kemnade <andreas@kemnade.info>
+
+properties:
+  regulator-ldo1:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo1"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldo2:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo2"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldo3:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo3"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldo4:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo4"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldo5:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo5"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldo6:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo6"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldo7:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldo7"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldoln:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldoln"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-ldousb:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-ldousb"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-smps3:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-smps3"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-smps4:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-smps4"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+  regulator-vio:
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    properties:
+      compatible:
+        const: "ti,twl6032-vio"
+      ti,retain-on-reset:
+        description:
+          Does not turn off the supplies during warm
+          reset. Could be needed for VMMC, as TWL6030
+          reset sequence for this signal does not comply
+          with the SD specification.
+        type: boolean
+
+    required:
+      - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    regulator-ldo1 {
+        compatible = "ti,twl6032-ldo1";
+        regulator-min-microvolt  = <1000000>;
+        regulator-max-microvolt  = <3000000>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/regulator/twl-regulator.txt b/Documentation/devicetree/bindings/regulator/twl-regulator.txt
deleted file mode 100644
index 549f80436debc..0000000000000
--- a/Documentation/devicetree/bindings/regulator/twl-regulator.txt
+++ /dev/null
@@ -1,80 +0,0 @@ 
-TWL family of regulators
-
-Required properties:
-For twl6030 regulators/LDOs
-- compatible:
-  - "ti,twl6030-vaux1" for VAUX1 LDO
-  - "ti,twl6030-vaux2" for VAUX2 LDO
-  - "ti,twl6030-vaux3" for VAUX3 LDO
-  - "ti,twl6030-vmmc" for VMMC LDO
-  - "ti,twl6030-vpp" for VPP LDO
-  - "ti,twl6030-vusim" for VUSIM LDO
-  - "ti,twl6030-vana" for VANA LDO
-  - "ti,twl6030-vcxio" for VCXIO LDO
-  - "ti,twl6030-vdac" for VDAC LDO
-  - "ti,twl6030-vusb" for VUSB LDO
-  - "ti,twl6030-v1v8" for V1V8 LDO
-  - "ti,twl6030-v2v1" for V2V1 LDO
-  - "ti,twl6030-vdd1" for VDD1 SMPS
-  - "ti,twl6030-vdd2" for VDD2 SMPS
-  - "ti,twl6030-vdd3" for VDD3 SMPS
-For twl6032 regulators/LDOs
-- compatible:
-  - "ti,twl6032-ldo1" for LDO1 LDO
-  - "ti,twl6032-ldo2" for LDO2 LDO
-  - "ti,twl6032-ldo3" for LDO3 LDO
-  - "ti,twl6032-ldo4" for LDO4 LDO
-  - "ti,twl6032-ldo5" for LDO5 LDO
-  - "ti,twl6032-ldo6" for LDO6 LDO
-  - "ti,twl6032-ldo7" for LDO7 LDO
-  - "ti,twl6032-ldoln" for LDOLN LDO
-  - "ti,twl6032-ldousb" for LDOUSB LDO
-  - "ti,twl6032-smps3" for SMPS3 SMPS
-  - "ti,twl6032-smps4" for SMPS4 SMPS
-  - "ti,twl6032-vio" for VIO SMPS
-For twl4030 regulators/LDOs
-- compatible:
-  - "ti,twl4030-vaux1" for VAUX1 LDO
-  - "ti,twl4030-vaux2" for VAUX2 LDO
-  - "ti,twl5030-vaux2" for VAUX2 LDO
-  - "ti,twl4030-vaux3" for VAUX3 LDO
-  - "ti,twl4030-vaux4" for VAUX4 LDO
-  - "ti,twl4030-vmmc1" for VMMC1 LDO
-  - "ti,twl4030-vmmc2" for VMMC2 LDO
-  - "ti,twl4030-vpll1" for VPLL1 LDO
-  - "ti,twl4030-vpll2" for VPLL2 LDO
-  - "ti,twl4030-vsim" for VSIM LDO
-  - "ti,twl4030-vdac" for VDAC LDO
-  - "ti,twl4030-vintana2" for VINTANA2 LDO
-  - "ti,twl4030-vio" for VIO LDO
-  - "ti,twl4030-vdd1" for VDD1 SMPS
-  - "ti,twl4030-vdd2" for VDD2 SMPS
-  - "ti,twl4030-vintana1" for VINTANA1 LDO
-  - "ti,twl4030-vintdig" for VINTDIG LDO
-  - "ti,twl4030-vusb1v5" for VUSB1V5 LDO
-  - "ti,twl4030-vusb1v8" for VUSB1V8 LDO
-  - "ti,twl4030-vusb3v1" for VUSB3V1 LDO
-
-Optional properties:
-- Any optional property defined in bindings/regulator/regulator.txt
-For twl4030 regulators/LDOs:
- - regulator-initial-mode:
-  - 0x08 - Sleep mode, the nominal output voltage is maintained with low power
-           consumption with low load current capability.
-  - 0x0e - Active mode, the regulator can deliver its nominal output voltage
-           with full-load current capability.
-
-Example:
-
-	xyz: regulator@0 {
-		compatible = "ti,twl6030-vaux1";
-		regulator-min-microvolt  = <1000000>;
-		regulator-max-microvolt  = <3000000>;
-	};
-
-For twl6030 regulators/LDOs:
-
- - ti,retain-on-reset: Does not turn off the supplies during warm
-                       reset. Could be needed for VMMC, as TWL6030
-                       reset sequence for this signal does not comply
-                       with the SD specification.