public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [RFC PATCH] dt-bindings: regulator: twl-regulator: convert to yaml
Date: Tue, 28 May 2024 15:54:05 +0200	[thread overview]
Message-ID: <3a29c775-4131-4047-9777-4146e6c8eed0@kernel.org> (raw)
In-Reply-To: <20240528150647.40385d08@aktux>

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


  reply	other threads:[~2024-05-28 13:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28  6:57 [RFC PATCH] dt-bindings: regulator: twl-regulator: convert to yaml Andreas Kemnade
2024-05-28 10:04 ` Krzysztof Kozlowski
2024-05-28 11:16   ` Andreas Kemnade
2024-05-28 11:25     ` Krzysztof Kozlowski
2024-05-28 13:06       ` Andreas Kemnade
2024-05-28 13:54         ` Krzysztof Kozlowski [this message]
2024-05-28 14:36           ` Conor Dooley
2024-05-28 15:48             ` Andreas Kemnade
2024-05-28 15:53               ` Conor Dooley
2024-05-28 16:55                 ` Andreas Kemnade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a29c775-4131-4047-9777-4146e6c8eed0@kernel.org \
    --to=krzk@kernel.org \
    --cc=andreas@kemnade.info \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox