Skip to contentSkip to conversation

Add Richtek RT5190A PMIC support

PATCH Superseded cy_huang 2 participants 8 messages Mar 7, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

cy_huang

author
#0 lore raw

cover Add Richtek RT5190A PMIC support

From: ChiYuan Huang <[email protected]>

This patch series add Richtek RT5190A PMIC support.

ChiYuan Huang (2):
dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC
regulator: rt5190a: Add support for Richtek RT5190A PMIC

 .../regulator/richtek,rt5190a-regulator.yaml       | 138 ++++++
 drivers/regulator/Kconfig                          |  10 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/rt5190a-regulator.c              | 461 +++++++++++++++++++++
 4 files changed, 610 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
 create mode 100644 drivers/regulator/rt5190a-regulator.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC

From: ChiYuan Huang <[email protected]>

Add bindings for Richtek RT5190A PMIC.

---
 .../regulator/richtek,rt5190a-regulator.yaml       | 138 +++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +138 -0
new file mode 100644
index 00000000..b9f5836
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT5190A PMIC Regulator
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
+  synchronous buck converters, 1 LDO, I2C control interface and peripherial
+  logical control.
+
+  It also supports mute AC OFF depop sound and quick setting storage while
+  input power is removed.
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt5190a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vin2-supply:
+    description: phandle to buck2 input voltage.
+
+  vin3-supply:
+    description: phandle to buck3 input voltage.
+
+  vin4-supply:
+    description: phandle to buck4 input voltage.
+
+  vinldo-supply:
+    description: phandle to ldo input voltage
+
+  richtek,buck1-fixed-microvolt:
+    description: buck1 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,buck4-fixed-microvolt:
+    description: buck4 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,ldo-fixed-microvolt:
+    description: ldo fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,mute-enable:
+    description: this can be used to enable mute function.
+    type: boolean
+
+  regulators:
+    type: object
+
+    patternProperties:
+      "^buck[1-4]$|^ldo$":
+        type: object
+        $ref: regulator.yaml#
+        description: |
+          regulator description for buck[1-4] and ldo.
+
+        properties:
+          richtek,latchup-enable:
+            type: boolean
+            description: |
+              If specified, undervolt protection mode changes from the default
+              hiccup to latchup.
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - richtek,buck1-fixed-microvolt
+  - richtek,buck4-fixed-microvolt
+  - richtek,ldo-fixed-microvolt
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rt5190a@64 {
+        compatible = "richtek,rt5190a";
+        reg = <0x64>;
+        interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;
+        vin2-supply = <&rt5190_buck1>;
+        vin3-supply = <&rt5190_buck1>;
+        vin4-supply = <&rt5190_buck1>;
+        richtek,buck1-fixed-microvolt = <5090000>;
+        richtek,buck4-fixed-microvolt = <850000>;
+        richtek,ldo-fixed-microvolt = <1200000>;
+
+        regulators {
+          rt5190_buck1: buck1 {
+            regulator-name = "rt5190a-buck1";
+            regulator-allowed-modes = <0 1>;
+            regulator-boot-on;
+          };
+          buck2 {
+            regulator-name = "rt5190a-buck2";
+            regulator-min-microvolt = <600000>;
+            regulator-max-microvolt = <1400000>;
+            regulator-boot-on;
+          };
+          buck3 {
+            regulator-name = "rt5190a-buck3";
+            regulator-min-microvolt = <600000>;
+            regulator-max-microvolt = <1400000>;
+            regulator-boot-on;
+          };
+          buck4 {
+            regulator-name = "rt5190a-buck4";
+            regulator-allowed-modes = <0 1>;
+            regulator-boot-on;
+          };
+          ldo {
+            regulator-name = "rt5190a-ldo";
+            regulator-boot-on;
+          };
+        };
+      };
+    };
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC

Quoted 51 lines · cy_huang

From: ChiYuan Huang <[email protected]>

Add bindings for Richtek RT5190A PMIC.

---
 .../regulator/richtek,rt5190a-regulator.yaml       | 138 +++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +35 -0
new file mode 100644
index 00000000..b9f5836
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT5190A PMIC Regulator
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
+  synchronous buck converters, 1 LDO, I2C control interface and peripherial
+  logical control.
+
+  It also supports mute AC OFF depop sound and quick setting storage while
+  input power is removed.
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt5190a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vin2-supply:
+    description: phandle to buck2 input voltage.
+
+  vin3-supply:
+    description: phandle to buck3 input voltage.

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 45

Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +10 -0
+
+  vin4-supply:
+    description: phandle to buck4 input voltage.
+
+  vinldo-supply:
+    description: phandle to ldo input voltage
+
+  richtek,buck1-fixed-microvolt:
+    description: buck1 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"

You should use standard bindings for it.

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 56

Quoted 11 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +11 -0
+
+  richtek,buck4-fixed-microvolt:
+    description: buck4 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,ldo-fixed-microvolt:
+    description: ldo fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,mute-enable:
+    description: this can be used to enable mute function.

Please describe what is "mute" function". Your description copied property name, so it is not useful.

Quoted 32 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +32 -0
+    type: boolean
+
+  regulators:
+    type: object
+
+    patternProperties:
+      "^buck[1-4]$|^ldo$":
+        type: object
+        $ref: regulator.yaml#
+        description: |
+          regulator description for buck[1-4] and ldo.
+
+        properties:
+          richtek,latchup-enable:
+            type: boolean
+            description: |
+              If specified, undervolt protection mode changes from the default
+              hiccup to latchup.
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - richtek,buck1-fixed-microvolt
+  - richtek,buck4-fixed-microvolt
+  - richtek,ldo-fixed-microvolt
+  - regulators
+
+additionalProperties: false

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +10 -0
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rt5190a@64 {

Generic node name, so "pmic".

Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +4 -0
+        compatible = "richtek,rt5190a";
+        reg = <0x64>;
+        interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;
+        vin2-supply = <&rt5190_buck1>;

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 112

Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +10 -0
+        vin3-supply = <&rt5190_buck1>;
+        vin4-supply = <&rt5190_buck1>;
+        richtek,buck1-fixed-microvolt = <5090000>;
+        richtek,buck4-fixed-microvolt = <850000>;
+        richtek,ldo-fixed-microvolt = <1200000>;
+
+        regulators {
+          rt5190_buck1: buck1 {
+            regulator-name = "rt5190a-buck1";
+            regulator-allowed-modes = <0 1>;

Please describe these in header file in bindings and mention as one of regulator properties with description and enum.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC

Krzysztof Kozlowski <[email protected]> 於 2022年3月7日 週一 下午7:14寫道:

Quoted 57 lines · cy_huang
Quoted 55 lines

From: ChiYuan Huang <[email protected]>

Add bindings for Richtek RT5190A PMIC.

---
 .../regulator/richtek,rt5190a-regulator.yaml       | 138 +++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +39 -0
new file mode 100644
index 00000000..b9f5836
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT5190A PMIC Regulator
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
+  synchronous buck converters, 1 LDO, I2C control interface and peripherial
+  logical control.
+
+  It also supports mute AC OFF depop sound and quick setting storage while
+  input power is removed.
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt5190a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vin2-supply:
+    description: phandle to buck2 input voltage.
+
+  vin3-supply:
+    description: phandle to buck3 input voltage.
+
+  vin4-supply:
+    description: phandle to buck4 input voltage.
+
Quoted 9 lines

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +6 -0
+  vinldo-supply:
+    description: phandle to ldo input voltage
+
+  richtek,buck1-fixed-microvolt:
+    description: buck1 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"

You should use standard bindings for it.

Sorry, I didn't get the point for the meaning 'standard binding'. Do you mean to change 'richtek,buck1-fixed-microvolt' or 'uint32' definition? This voltage depends on the external resistor selection. It's 'fixed' by the application.

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +6 -0
+
+  richtek,buck4-fixed-microvolt:
+    description: buck4 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,ldo-fixed-microvolt:
Quoted 9 lines

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 56

Quoted 5 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +5 -0
+    description: ldo fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+
+  richtek,mute-enable:
+    description: this can be used to enable mute function.

Please describe what is "mute" function". Your description copied property name, so it is not useful.

OK, I'll describe more detailed.

Quoted 36 lines
Quoted 36 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +36 -0
+    type: boolean
+
+  regulators:
+    type: object
+
+    patternProperties:
+      "^buck[1-4]$|^ldo$":
+        type: object
+        $ref: regulator.yaml#
+        description: |
+          regulator description for buck[1-4] and ldo.
+
+        properties:
+          richtek,latchup-enable:
+            type: boolean
+            description: |
+              If specified, undervolt protection mode changes from the default
+              hiccup to latchup.
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - richtek,buck1-fixed-microvolt
+  - richtek,buck4-fixed-microvolt
+  - richtek,ldo-fixed-microvolt
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
Quoted 9 lines

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 98

Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +6 -0
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      rt5190a@64 {

Generic node name, so "pmic".

Ack in next.

Quoted 15 lines
Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +4 -0
+        compatible = "richtek,rt5190a";
+        reg = <0x64>;
+        interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;
+        vin2-supply = <&rt5190_buck1>;

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 112

Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +10 -0
+        vin3-supply = <&rt5190_buck1>;
+        vin4-supply = <&rt5190_buck1>;
+        richtek,buck1-fixed-microvolt = <5090000>;
+        richtek,buck4-fixed-microvolt = <850000>;
+        richtek,ldo-fixed-microvolt = <1200000>;
+
+        regulators {
+          rt5190_buck1: buck1 {
+            regulator-name = "rt5190a-buck1";
+            regulator-allowed-modes = <0 1>;
Quoted 3 lines

Please describe these in header file in bindings and mention as one of regulator properties with description and enum.

OK, will add one dt-binding header file for the constant and mentioned as one regulator property.
Ack in next.

Quoted 4 lines

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC

Quoted 67 lines · ChiYuan Huang

Krzysztof Kozlowski <[email protected]> 於 2022年3月7日 週一 下午7:14寫道:

Quoted 57 lines · cy_huang
Quoted 55 lines

From: ChiYuan Huang <[email protected]>

Add bindings for Richtek RT5190A PMIC.

---
 .../regulator/richtek,rt5190a-regulator.yaml       | 138 +++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +39 -0
new file mode 100644
index 00000000..b9f5836
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT5190A PMIC Regulator
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
+  synchronous buck converters, 1 LDO, I2C control interface and peripherial
+  logical control.
+
+  It also supports mute AC OFF depop sound and quick setting storage while
+  input power is removed.
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt5190a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vin2-supply:
+    description: phandle to buck2 input voltage.
+
+  vin3-supply:
+    description: phandle to buck3 input voltage.
+
+  vin4-supply:
+    description: phandle to buck4 input voltage.
+
Quoted 9 lines

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +6 -0
+  vinldo-supply:
+    description: phandle to ldo input voltage
+
+  richtek,buck1-fixed-microvolt:
+    description: buck1 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"

You should use standard bindings for it.

Quoted 4 lines

Sorry, I didn't get the point for the meaning 'standard binding'. Do you mean to change 'richtek,buck1-fixed-microvolt' or 'uint32' definition? This voltage depends on the external resistor selection. It's 'fixed' by the application.

I meant that you should not have dedicated binding to set regulator voltage, but use regulator-min/max-microvolt instead, within one regulator node. Just set min/max to same level and handle it in the driver. See for example:
drivers/regulator/scmi-regulator.c

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC

HI, Krzysztof:

Krzysztof Kozlowski <[email protected]> 於 2022年3月7日 週一 下午9:27寫道:

Quoted 74 lines · ChiYuan Huang
Quoted 67 lines

Krzysztof Kozlowski <[email protected]> 於 2022年3月7日 週一 下午7:14寫道:

Quoted 57 lines · cy_huang
Quoted 55 lines

From: ChiYuan Huang <[email protected]>

Add bindings for Richtek RT5190A PMIC.

---
 .../regulator/richtek,rt5190a-regulator.yaml       | 138 +++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +39 -0
new file mode 100644
index 00000000..b9f5836
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT5190A PMIC Regulator
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
+  synchronous buck converters, 1 LDO, I2C control interface and peripherial
+  logical control.
+
+  It also supports mute AC OFF depop sound and quick setting storage while
+  input power is removed.
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt5190a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vin2-supply:
+    description: phandle to buck2 input voltage.
+
+  vin3-supply:
+    description: phandle to buck3 input voltage.
+
+  vin4-supply:
+    description: phandle to buck4 input voltage.
+
Quoted 9 lines

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +6 -0
+  vinldo-supply:
+    description: phandle to ldo input voltage
+
+  richtek,buck1-fixed-microvolt:
+    description: buck1 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"

You should use standard bindings for it.

Quoted 4 lines

Sorry, I didn't get the point for the meaning 'standard binding'. Do you mean to change 'richtek,buck1-fixed-microvolt' or 'uint32' definition? This voltage depends on the external resistor selection. It's 'fixed' by the application.

Quoted 6 lines

I meant that you should not have dedicated binding to set regulator voltage, but use regulator-min/max-microvolt instead, within one regulator node. Just set min/max to same level and handle it in the driver. See for example:
drivers/regulator/scmi-regulator.c

As I know, regulator-min/max-microvolt is used as the usage constraint.

But out buck1/buck4/ldo vout is defined by
Vout = VFb * (1 + R1/R2) where R1/R2 is chosen by the circuit design.

It seems not similar with the scmi-regulator.

Do you really suggest to use regulator-min/max-microvolt????

Quoted 3 lines

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5190A PMIC

Quoted 77 lines · ChiYuan Huang

HI, Krzysztof:

Krzysztof Kozlowski <[email protected]> 於 2022年3月7日 週一 下午9:27寫道:

Quoted 74 lines · ChiYuan Huang
Quoted 71 lines

Krzysztof Kozlowski <[email protected]> 於 2022年3月7日 週一 下午7:14寫道:

Quoted 57 lines · cy_huang
Quoted 55 lines

From: ChiYuan Huang <[email protected]>

Add bindings for Richtek RT5190A PMIC.

---
 .../regulator/richtek,rt5190a-regulator.yaml       | 138 +++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +39 -0
new file mode 100644
index 00000000..b9f5836
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT5190A PMIC Regulator
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
+  synchronous buck converters, 1 LDO, I2C control interface and peripherial
+  logical control.
+
+  It also supports mute AC OFF depop sound and quick setting storage while
+  input power is removed.
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt5190a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vin2-supply:
+    description: phandle to buck2 input voltage.
+
+  vin3-supply:
+    description: phandle to buck3 input voltage.
+
+  vin4-supply:
+    description: phandle to buck4 input voltage.
+
Quoted 9 lines

Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml line 45

Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml new file +6 -0
+  vinldo-supply:
+    description: phandle to ldo input voltage
+
+  richtek,buck1-fixed-microvolt:
+    description: buck1 fixed voltage that depends on the external resistor.
+    $ref: "/schemas/types.yaml#/definitions/uint32"

You should use standard bindings for it.

Sorry, I didn't get the point for the meaning 'standard binding'. Do you mean to change 'richtek,buck1-fixed-microvolt' or 'uint32' definition? This voltage depends on the external resistor selection. It's 'fixed' by the application.

Quoted 7 lines
Quoted 6 lines

I meant that you should not have dedicated binding to set regulator voltage, but use regulator-min/max-microvolt instead, within one regulator node. Just set min/max to same level and handle it in the driver. See for example:
drivers/regulator/scmi-regulator.c

As I know, regulator-min/max-microvolt is used as the usage constraint.

True, bindings mention the consumers, but I don't think this is treated literally.

Quoted 7 lines

But out buck1/buck4/ldo vout is defined by
Vout = VFb * (1 + R1/R2) where R1/R2 is chosen by the circuit design.

It seems not similar with the scmi-regulator.

Do you really suggest to use regulator-min/max-microvolt????

The same as existing fixed-regulator. Why this regulator should be different than fixed-regulator?

Best regards,
Krzysztof

author
#7 lore raw

PATCH 2/2 regulator: rt5190a: Add support for Richtek RT5190A PMIC

In reply to cy_huang

From: ChiYuan Huang <[email protected]>

Add support for Richtek RT5190A PMIC.

---
 drivers/regulator/Kconfig             |  10 +
 drivers/regulator/Makefile            |   1 +
 drivers/regulator/rt5190a-regulator.c | 461 ++++++++++++++++++++++++++++++++++
 3 files changed, 472 insertions(+)
 create mode 100644 drivers/regulator/rt5190a-regulator.c
drivers/regulator/Kconfig +10 -0
index 1c35fed2..850e954 100644
@@ -1046,6 +1046,16 @@ config REGULATOR_RT5033
 	  RT5033 PMIC. The device supports multiple regulators like
 	  current source, LDO and Buck.
 
+config REGULATOR_RT5190A
+	tristate "Richtek RT5190A PMIC"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  This adds support for voltage regulator in Richtek RT5190A PMIC.
+	  It integratas 1 channel buck controller, 3 channels high efficiency
+	  buck converters, 1 LDO, mute AC OFF depop function, with the general
+	  I2C control interface.
+
 config REGULATOR_RT6160
 	tristate "Richtek RT6160 BuckBoost voltage regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index 2e1b087..28d816a9 100644
@@ -126,6 +126,7 @@ obj-$(CONFIG_REGULATOR_ROHM)	+= rohm-regulator.o
 obj-$(CONFIG_REGULATOR_RT4801)	+= rt4801-regulator.o
 obj-$(CONFIG_REGULATOR_RT4831)	+= rt4831-regulator.o
 obj-$(CONFIG_REGULATOR_RT5033)	+= rt5033-regulator.o
+obj-$(CONFIG_REGULATOR_RT5190A) += rt5190a-regulator.o
 obj-$(CONFIG_REGULATOR_RT6160)	+= rt6160-regulator.o
 obj-$(CONFIG_REGULATOR_RT6245)	+= rt6245-regulator.o
 obj-$(CONFIG_REGULATOR_RTMV20)	+= rtmv20-regulator.o
drivers/regulator/rt5190a-regulator.c new file +461 -0

461 lines not on this page · raw message

Signature · 1 line
2.7.4