diff mbox series

[v3,06/12] dt-bindings: power: supply: smb347-charger: Document USB VBUS regulator

Message ID 20210704225433.32029-7-digetx@gmail.com
State Superseded
Headers show
Series Add OTG mode support to Tegra USB PHY, SMB347 and Nexus 7 | expand

Commit Message

Dmitry Osipenko July 4, 2021, 10:54 p.m. UTC
SMB347 can supply power to USB VBUS, which is required by OTG-cable
devices that want to switch USB port into the host mode. Add USB VBUS
regulator properties.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 .../power/supply/summit,smb347-charger.yaml   | 28 +++++++++++++++++++
 .../dt-bindings/power/summit,smb347-charger.h |  4 +++
 2 files changed, 32 insertions(+)

Comments

Dmitry Osipenko July 13, 2021, 12:22 a.m. UTC | #1
12.07.2021 18:39, Rob Herring пишет:
>> +  summit,inok-polarity:
>> +    description: |
>> +      Polarity of INOK signal indicating presence of external power supply.
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    enum:
>> +      - 0 # SMB3XX_SYSOK_INOK_ACTIVE_LOW
>> +      - 1 # SMB3XX_SYSOK_INOK_ACTIVE_HIGH
>> +
>> +  usb-vbus:
>> +    $ref: "../../regulator/regulator.yaml#"
>> +    type: object
>        unevaluatedProperties: false
> 
> With that,
> 
> Reviewed-by: Rob Herring <robh@kernel.org>
> 

I tried to add the unevaluatedProperties + a random unrelated property
to the example usb-vbus node and dt_binding_check is happy with that. So
the unevaluatedProperties has no effect, is it supposed to be so?
Rob Herring July 14, 2021, 11:01 p.m. UTC | #2
On Tue, Jul 13, 2021 at 03:22:40AM +0300, Dmitry Osipenko wrote:
> 12.07.2021 18:39, Rob Herring пишет:
> >> +  summit,inok-polarity:
> >> +    description: |
> >> +      Polarity of INOK signal indicating presence of external power supply.
> >> +    $ref: /schemas/types.yaml#/definitions/uint32
> >> +    enum:
> >> +      - 0 # SMB3XX_SYSOK_INOK_ACTIVE_LOW
> >> +      - 1 # SMB3XX_SYSOK_INOK_ACTIVE_HIGH
> >> +
> >> +  usb-vbus:
> >> +    $ref: "../../regulator/regulator.yaml#"
> >> +    type: object
> >        unevaluatedProperties: false
> > 
> > With that,
> > 
> > Reviewed-by: Rob Herring <robh@kernel.org>
> > 
> 
> I tried to add the unevaluatedProperties + a random unrelated property
> to the example usb-vbus node and dt_binding_check is happy with that. So
> the unevaluatedProperties has no effect, is it supposed to be so?

Yes, until support lands upstream[1].

Rob

[1] https://github.com/Julian/jsonschema/pull/817
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml b/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
index 983fc215c1e5..cd3d834f734d 100644
--- a/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
+++ b/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
@@ -73,6 +73,24 @@  properties:
       - 1 # SMB3XX_SOFT_TEMP_COMPENSATE_CURRENT Current compensation
       - 2 # SMB3XX_SOFT_TEMP_COMPENSATE_VOLTAGE Voltage compensation
 
+  summit,inok-polarity:
+    description: |
+      Polarity of INOK signal indicating presence of external power supply.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 0 # SMB3XX_SYSOK_INOK_ACTIVE_LOW
+      - 1 # SMB3XX_SYSOK_INOK_ACTIVE_HIGH
+
+  usb-vbus:
+    $ref: "../../regulator/regulator.yaml#"
+    type: object
+
+    properties:
+      summit,needs-inok-toggle:
+        type: boolean
+        description: INOK signal is fixed and polarity needs to be toggled
+                     in order to enable/disable output mode.
+
 allOf:
   - if:
       properties:
@@ -134,6 +152,7 @@  examples:
             reg = <0x7f>;
 
             summit,enable-charge-control = <SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH>;
+            summit,inok-polarity = <SMB3XX_SYSOK_INOK_ACTIVE_LOW>;
             summit,chip-temperature-threshold-celsius = <110>;
             summit,mains-current-limit-microamp = <2000000>;
             summit,usb-current-limit-microamp = <500000>;
@@ -141,6 +160,15 @@  examples:
             summit,enable-mains-charging;
 
             monitored-battery = <&battery>;
+
+            usb-vbus {
+                regulator-name = "usb_vbus";
+                regulator-min-microvolt = <5000000>;
+                regulator-max-microvolt = <5000000>;
+                regulator-min-microamp = <750000>;
+                regulator-max-microamp = <750000>;
+                summit,needs-inok-toggle;
+            };
         };
     };
 
diff --git a/include/dt-bindings/power/summit,smb347-charger.h b/include/dt-bindings/power/summit,smb347-charger.h
index d918bf321a71..3205699b5e41 100644
--- a/include/dt-bindings/power/summit,smb347-charger.h
+++ b/include/dt-bindings/power/summit,smb347-charger.h
@@ -16,4 +16,8 @@ 
 #define SMB3XX_CHG_ENABLE_PIN_ACTIVE_LOW	1
 #define SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH	2
 
+/* Polarity of INOK signal */
+#define SMB3XX_SYSOK_INOK_ACTIVE_LOW		0
+#define SMB3XX_SYSOK_INOK_ACTIVE_HIGH		1
+
 #endif