[PATCH v2 01/32] dt-bindings: mfd: samsung,s2mps11: add s2mpg10

André Draszik posted 32 patches 8 months, 3 weeks ago
There is a newer version of this series
[PATCH v2 01/32] dt-bindings: mfd: samsung,s2mps11: add s2mpg10
Posted by André Draszik 8 months, 3 weeks ago
The Samsung S2MPG10 PMIC is similar to the existing PMICs supported by
this binding.

It is a Power Management IC for mobile applications with buck
converters, various LDOs, power meters, RTC, clock outputs, and
additional GPIOs interfaces.

Unlike other Samsung PMICs, communication is not via I2C, but via the
Samsung ACPM firmware, it therefore doesn't need a 'reg' property but
needs to be a child of the ACPM firmware node instead.

S2MPG10 can also act as a system power controller allowing
implementation of a true cold-reset of the system.

Support for the other components like regulators and power meters will
be added in subsequent future patches.

Signed-off-by: André Draszik <andre.draszik@linaro.org>

---
v2:
* drop ACPM phandle 'exynos,acpm-ipc', and expect this to be a child
  node of ACPM directly instead
* allow, but still don't enforce, regulators subnode, to ease adding it
  in the future
* deny 'reg' property, it's incorrect to optionally have it for S2MPG10
* enforce 'interrupts' or 'interrupts-extended' property. S2MPG10 can
  not work without. Note this is done as-is using the oneOf, because
  dtschema's fixups.py doesn't handle this nesting itself
---
 .../devicetree/bindings/mfd/samsung,s2mps11.yaml   | 28 ++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
index ac5d0c149796b6a4034b5d4245bfa8be0433cfab..62d0e9f8a4d39add50a986af1836cfdcf065ad48 100644
--- a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
+++ b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
@@ -20,6 +20,7 @@ description: |
 properties:
   compatible:
     enum:
+      - samsung,s2mpg10-pmic
       - samsung,s2mps11-pmic
       - samsung,s2mps13-pmic
       - samsung,s2mps14-pmic
@@ -58,16 +59,39 @@ properties:
       reset (setting buck voltages to default values).
     type: boolean
 
+  system-power-controller: true
+
   wakeup-source: true
 
 required:
   - compatible
-  - reg
-  - regulators
 
 additionalProperties: false
 
 allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: samsung,s2mpg10-pmic
+    then:
+      properties:
+        reg: false
+        samsung,s2mps11-acokb-ground: false
+        samsung,s2mps11-wrstbi-ground: false
+
+      oneOf:
+        - required: [interrupts]
+        - required: [interrupts-extended]
+
+    else:
+      properties:
+        system-power-controller: false
+
+      required:
+        - reg
+        - regulators
+
   - if:
       properties:
         compatible:

-- 
2.49.0.472.ge94155a9ec-goog

Re: [PATCH v2 01/32] dt-bindings: mfd: samsung,s2mps11: add s2mpg10
Posted by Krzysztof Kozlowski 8 months, 3 weeks ago
On Fri, Mar 28, 2025 at 01:28:47PM +0000, André Draszik wrote:
>  allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: samsung,s2mpg10-pmic
> +    then:
> +      properties:
> +        reg: false
> +        samsung,s2mps11-acokb-ground: false
> +        samsung,s2mps11-wrstbi-ground: false
> +
> +      oneOf:
> +        - required: [interrupts]
> +        - required: [interrupts-extended]

Drop, you should require only interrupts.

OTOH, why regulators subnode is not needed? Commit msg mentions they
exist, so they should be required. Binding does not change because you
added or did not add yet some driver support.

Best regards,
Krzysztof
Re: [PATCH v2 01/32] dt-bindings: mfd: samsung,s2mps11: add s2mpg10
Posted by André Draszik 8 months, 3 weeks ago
Hi Krzysztof,

On Mon, 2025-03-31 at 09:34 +0200, Krzysztof Kozlowski wrote:
> On Fri, Mar 28, 2025 at 01:28:47PM +0000, André Draszik wrote:
> >  allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: samsung,s2mpg10-pmic
> > +    then:
> > +      properties:
> > +        reg: false
> > +        samsung,s2mps11-acokb-ground: false
> > +        samsung,s2mps11-wrstbi-ground: false
> > +
> > +      oneOf:
> > +        - required: [interrupts]
> > +        - required: [interrupts-extended]
> 
> Drop, you should require only interrupts.

As mentioned in the commit message comments, it doesn't work with
just interrupts. It appears that dtschema's fixups.py doesn't
handle this case. With just interrupts, DT validation will fail
if the DT uses interrupts-extended. There was at least one other
binding that specified interrupts in the same way, so I went with
the same approach.

> OTOH, why regulators subnode is not needed? Commit msg mentions they
> exist, so they should be required. Binding does not change because you
> added or did not add yet some driver support.

I wanted to avoid DT validation errors, because we haven't started
working on regulators yet, and it might take a little while until
everything is in place.

I'll make it required in the next version.

Thanks!

Andre'
Re: [PATCH v2 01/32] dt-bindings: mfd: samsung,s2mps11: add s2mpg10
Posted by Krzysztof Kozlowski 5 months, 3 weeks ago
On 31/03/2025 11:50, André Draszik wrote:
> Hi Krzysztof,
> 
> On Mon, 2025-03-31 at 09:34 +0200, Krzysztof Kozlowski wrote:
>> On Fri, Mar 28, 2025 at 01:28:47PM +0000, André Draszik wrote:
>>>  allOf:
>>> +  - if:
>>> +      properties:
>>> +        compatible:
>>> +          contains:
>>> +            const: samsung,s2mpg10-pmic
>>> +    then:
>>> +      properties:
>>> +        reg: false
>>> +        samsung,s2mps11-acokb-ground: false
>>> +        samsung,s2mps11-wrstbi-ground: false
>>> +
>>> +      oneOf:
>>> +        - required: [interrupts]
>>> +        - required: [interrupts-extended]
>>
>> Drop, you should require only interrupts.
> 
> As mentioned in the commit message comments, it doesn't work with
> just interrupts. It appears that dtschema's fixups.py doesn't
> handle this case. With just interrupts, DT validation will fail
> if the DT uses interrupts-extended. There was at least one other
> binding that specified interrupts in the same way, so I went with
> the same approach.

Please add a comment about this above oneOf.


Best regards,
Krzysztof