diff mbox series

[1/4] dt-bindings: mfd: ricoh,rn5t618: ADC related nodes and properties

Message ID 20210703084224.31623-2-andreas@kemnade.info
State New
Headers show
Series [1/4] dt-bindings: mfd: ricoh,rn5t618: ADC related nodes and properties | expand

Commit Message

Andreas Kemnade July 3, 2021, 8:42 a.m. UTC
Add ADC related nodes and properties. This will allow to wire
up ADC channels to consumers, especially to measure input voltages
by the power subdevice.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 .../bindings/mfd/ricoh,rn5t618.yaml           | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)

Comments

Andreas Kemnade July 3, 2021, 4:43 p.m. UTC | #1
On Sat, 3 Jul 2021 17:02:45 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sat,  3 Jul 2021 10:42:21 +0200
> Andreas Kemnade <andreas@kemnade.info> wrote:
> 
> > Add ADC related nodes and properties. This will allow to wire
> > up ADC channels to consumers, especially to measure input voltages
> > by the power subdevice.
> > 
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> >  .../bindings/mfd/ricoh,rn5t618.yaml           | 53 +++++++++++++++++++
> >  1 file changed, 53 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > index 032a7fb0b4a7..185f87a14a54 100644
> > --- a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > +++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > @@ -73,6 +73,48 @@ properties:
> >      description: |
> >        See Documentation/devicetree/bindings/power/power-controller.txt
> >  
> > +  adc:
> > +    type: object
> > +
> > +    properties:
> > +      compatible:
> > +        enum:
> > +          - ricoh,rn5t618-adc
> > +          - ricoh,rc5t619-adc
> > +
> > +      "#io-channel-cells":
> > +        const: 1
> > +
> > +    additionalProperties: false
> > +
> > +    required:
> > +      - compatible
> > +      - "#io-channel-cells"  
> 
> Strictly required?  If not used below (where it is optional)
> then why do we require the ADC driver to provided the services?
> 
> I don't mind you leave it as it is though if you prefer - it doesn't
> do any harm!
> 
ok, it is not that strictly required.

Regards,
Andreas
Rob Herring July 12, 2021, 2:41 p.m. UTC | #2
On Sat, Jul 03, 2021 at 05:02:45PM +0100, Jonathan Cameron wrote:
> On Sat,  3 Jul 2021 10:42:21 +0200
> Andreas Kemnade <andreas@kemnade.info> wrote:
> 
> > Add ADC related nodes and properties. This will allow to wire
> > up ADC channels to consumers, especially to measure input voltages
> > by the power subdevice.
> > 
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> >  .../bindings/mfd/ricoh,rn5t618.yaml           | 53 +++++++++++++++++++
> >  1 file changed, 53 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > index 032a7fb0b4a7..185f87a14a54 100644
> > --- a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > +++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > @@ -73,6 +73,48 @@ properties:
> >      description: |
> >        See Documentation/devicetree/bindings/power/power-controller.txt
> >  
> > +  adc:
> > +    type: object
> > +
> > +    properties:
> > +      compatible:
> > +        enum:
> > +          - ricoh,rn5t618-adc
> > +          - ricoh,rc5t619-adc
> > +
> > +      "#io-channel-cells":
> > +        const: 1
> > +
> > +    additionalProperties: false
> > +
> > +    required:
> > +      - compatible
> > +      - "#io-channel-cells"
> 
> Strictly required?  If not used below (where it is optional)
> then why do we require the ADC driver to provided the services?
> 
> I don't mind you leave it as it is though if you prefer - it doesn't
> do any harm!

The device is either a provider or it is not regardless of whether 
there's a consumer, so I prefer this to be required. Also, if a consumer 
is in an overlay, then it is easier if we can rely on #io-channel-cells 
being present already.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
index 032a7fb0b4a7..185f87a14a54 100644
--- a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
+++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
@@ -73,6 +73,48 @@  properties:
     description: |
       See Documentation/devicetree/bindings/power/power-controller.txt
 
+  adc:
+    type: object
+
+    properties:
+      compatible:
+        enum:
+          - ricoh,rn5t618-adc
+          - ricoh,rc5t619-adc
+
+      "#io-channel-cells":
+        const: 1
+
+    additionalProperties: false
+
+    required:
+      - compatible
+      - "#io-channel-cells"
+
+  power:
+    type: object
+
+    properties:
+      compatible:
+        enum:
+          - ricoh,rn5t618-power
+          - ricoh,rc5t619-power
+
+      io-channels:
+        items:
+          - description: ADP Voltage Channel
+          - description: USB Voltage Channel
+
+      io-channel-names:
+        items:
+          - const: vadp
+          - const: vusb
+
+    additionalProperties: false
+
+    required:
+      - compatible
+
   regulators:
     type: object
 
@@ -96,6 +138,17 @@  examples:
         interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
         system-power-controller;
 
+        rn5t618_adc: adc {
+          compatible = "ricoh,rn5t618-adc";
+          #io-channel-cells = <1>;
+        };
+
+        power {
+          compatible = "ricoh,rn5t618-power";
+          io-channels = <&rn5t618_adc 2>, <&rn5t618_adc 3>;
+          io-channel-names = "vadp", "vusb";
+        };
+
         regulators {
           DCDC1 {
             regulator-min-microvolt = <1050000>;