Skip to contentSkip to conversation

DA9121 regulator support

PATCH Superseded Vincent Whitchurch 2 participants 5 messages Oct 29, 2020 – Nov 2, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover DA9121 regulator support

This series adds support for the DA9121, a "High-Performance, 10 A, Dual-Phase DC-DC Converter". The datasheet is currently available here:

https://www.dialog-semiconductor.com/sites/default/files/da9121_datasheet_2v3.pdf

Vincent Whitchurch (2):
dt-bindings: regulator: Add DA9121
regulator: Add support for DA9121 regulator

 .../bindings/regulator/dlg,da9121.yaml        |  42 +++++++
 drivers/regulator/Kconfig                     |  12 ++
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/da9121-regulator.c          | 111 ++++++++++++++++++
 4 files changed, 166 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
 create mode 100644 drivers/regulator/da9121-regulator.c
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/2 dt-bindings: regulator: Add DA9121

Add bindings for the Dialog Semiconductor DA9121 voltage regulator.

---
 .../bindings/regulator/dlg,da9121.yaml        | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
Documentation/devicetree/bindings/regulator/dlg,da9121.yaml new file +42 -0
new file mode 100644
index 000000000000..2e67cc164da9
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/dlg,da9121.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Dialog Semiconductor DA9121 voltage regulator
+
+maintainers:
+  - Vincent Whitchurch <[email protected]>
+
+allOf:
+  - $ref: regulator.yaml#
+
+properties:
+  compatible:
+    const: dlg,da9121
+
+  reg:
+    maxItems: 1
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      regulator@68 {
+        compatible = "dlg,da9121";
+        reg = <0x68>;
+
+        regulator-min-microvolt = <675000>;
+        regulator-max-microvolt = <825000>;
+      };
+    };
+
+...
Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/2 regulator: Add support for DA9121 regulator

In reply to Vincent Whitchurch

Add support for the Dialog Semiconductor DA9121, a single-channel dual-phase buck converter controlled via I2C.

---
 drivers/regulator/Kconfig            |  12 +++
 drivers/regulator/Makefile           |   1 +
 drivers/regulator/da9121-regulator.c | 111 +++++++++++++++++++++++++++
 3 files changed, 124 insertions(+)
 create mode 100644 drivers/regulator/da9121-regulator.c
drivers/regulator/Kconfig +12 -0
index 020a00d6696b..005a6036dd38 100644
@@ -303,6 +303,18 @@ config REGULATOR_DA9063
 	  This driver can also be built as a module. If so, the module
 	  will be called da9063-regulator.
 
+config REGULATOR_DA9121
+	tristate "Dialog Semiconductor DA9121 regulator"
+	depends on I2C && OF
+	select REGMAP_I2C
+	help
+	  Say y here to support for the Dialog Semiconductor DA9121.  The
+	  DA9210 is a dual-phase buck converter controlled through an I2C
+	  interface.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called da9121-regulator.
+
 config REGULATOR_DA9210
 	tristate "Dialog Semiconductor DA9210 regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index 6ebae516258e..6096862a1d60 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DA9055)	+= da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DA9062)	+= da9062-regulator.o
 obj-$(CONFIG_REGULATOR_DA9063)	+= da9063-regulator.o
+obj-$(CONFIG_REGULATOR_DA9121) += da9121-regulator.o
 obj-$(CONFIG_REGULATOR_DA9210) += da9210-regulator.o
 obj-$(CONFIG_REGULATOR_DA9211) += da9211-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
drivers/regulator/da9121-regulator.c new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.28.0
maintainer
#3 lore raw

Re: [PATCH 2/2] regulator: Add support for DA9121 regulator

drivers/regulator/da9121-regulator.c line 83

Quoted 3 lines · Vincent Whitchurch
drivers/regulator/da9121-regulator.c new file +3 -0
+	config.init_data = of_get_regulator_init_data(dev, dev->of_node, &da9121_reg);
+	if (!config.init_data)
+		return -ENOMEM;

Don't do this, the core can do the DT bit for you and there is no reason not to register the device if there are no constraints. -ENOMEM would also be the wrong error code here.

#4 lore raw

Re: [PATCH 2/2] regulator: Add support for DA9121 regulator

Quoted 9 lines · Mark Brown

drivers/regulator/da9121-regulator.c line 83

Quoted 3 lines · Vincent Whitchurch
drivers/regulator/da9121-regulator.c new file +3 -0
+	config.init_data = of_get_regulator_init_data(dev, dev->of_node, &da9121_reg);
+	if (!config.init_data)
+		return -ENOMEM;

Don't do this, the core can do the DT bit for you and there is no reason not to register the device if there are no constraints. -ENOMEM would also be the wrong error code here.

OK, thanks. I see that I can get the core to do it if I set ->of_match on the regulator_desc. I also see that there is some flexibility about the placement of the constraints (desc->regulators_node is optional).

This chip has only one output which the datasheet calls Buck1, so I will remove this call and set the desc.of_match field to get the driver to support a node which looks like this:

      regulator@68 {
        compatible = "dlg,da9121";
        reg = <0x68>;

        buck1 {
            regulator-min-microvolt = <675000>;
            regulator-max-microvolt = <825000>;
        };
      };