diff mbox series

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

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

Commit Message

Dmitry Osipenko July 31, 2021, 5:38 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.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 .../power/supply/summit,smb347-charger.yaml   | 30 +++++++++++++++++++
 .../dt-bindings/power/summit,smb347-charger.h |  4 +++
 2 files changed, 34 insertions(+)

Comments

Sebastian Reichel Aug. 6, 2021, 9:13 p.m. UTC | #1
Hi,

On Sat, Jul 31, 2021 at 08:38:35PM +0300, Dmitry Osipenko wrote:
> 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.
> 
> Reviewed-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

-- Sebastian

>  .../power/supply/summit,smb347-charger.yaml   | 30 +++++++++++++++++++
>  .../dt-bindings/power/summit,smb347-charger.h |  4 +++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml b/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
> index 983fc215c1e5..20862cdfc116 100644
> --- a/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
> @@ -73,6 +73,26 @@ 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.
> +
> +    unevaluatedProperties: false
> +
>  allOf:
>    - if:
>        properties:
> @@ -134,6 +154,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 +162,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
> -- 
> 2.32.0
>
Dmitry Osipenko Aug. 16, 2021, 3:39 p.m. UTC | #2
07.08.2021 00:13, Sebastian Reichel пишет:
> Hi,
> 
> On Sat, Jul 31, 2021 at 08:38:35PM +0300, Dmitry Osipenko wrote:
>> 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.
>>
>> Reviewed-by: Rob Herring <robh@kernel.org>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Sebastian, you can pick up these patches into the power tree:

dt-bindings: power: supply: smb347-charger: Document USB VBUS
regulator
power: supply: smb347-charger: Make smb347_set_writable() IRQ-safe
power: supply: smb347-charger: Utilize generic regmap caching
power: supply: smb347-charger: Add missing pin control activation
power: supply: smb347-charger: Implement USB VBUS regulator

The reset of the patches could go via the Tegra tree. It's probably a
bit too late for the Tegra patches since Thierry already made 5.15 PR,
but should be fine for the power. Thanks in advance!
Sebastian Reichel Aug. 16, 2021, 4:22 p.m. UTC | #3
Hi,

On Mon, Aug 16, 2021 at 06:39:09PM +0300, Dmitry Osipenko wrote:
> 07.08.2021 00:13, Sebastian Reichel пишет:
> > Hi,
> > 
> > On Sat, Jul 31, 2021 at 08:38:35PM +0300, Dmitry Osipenko wrote:
> >> 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.
> >>
> >> Reviewed-by: Rob Herring <robh@kernel.org>
> >> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> >> ---
> > 
> > Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Sebastian, you can pick up these patches into the power tree:
> 
> dt-bindings: power: supply: smb347-charger: Document USB VBUS
> regulator
> power: supply: smb347-charger: Make smb347_set_writable() IRQ-safe
> power: supply: smb347-charger: Utilize generic regmap caching
> power: supply: smb347-charger: Add missing pin control activation
> power: supply: smb347-charger: Implement USB VBUS regulator
> 
> The reset of the patches could go via the Tegra tree. It's probably a
> bit too late for the Tegra patches since Thierry already made 5.15 PR,
> but should be fine for the power. Thanks in advance!

Queued now.

-- Sebastian
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..20862cdfc116 100644
--- a/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
+++ b/Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
@@ -73,6 +73,26 @@  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.
+
+    unevaluatedProperties: false
+
 allOf:
   - if:
       properties:
@@ -134,6 +154,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 +162,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