Skip to contentSkip to conversation

regulator: Add FAN53880 support

PATCH Superseded Christoph Fritz 2 participants 6 messages Jun 30, 2020 – Jul 3, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover regulator: Add FAN53880 support

This patchset adds a regulator driver with dt-bindings documentation in the new yaml format for a power management IC from Fairchild (now ON Semiconductor) named FAN53880.

The chip was found on a camera sensor board which will get a v4lsubdev driver in the future.

The FAN53880 differs a lot compared to the older FAN53555 which already has driver support.

Christoph Fritz (2):
regulator: fan53880: Add initial support
dt-bindings: regulator: Document bindings for fan53880

 .../bindings/regulator/onnn,fan53880.yaml     |  85 +++++++++
 drivers/regulator/Kconfig                     |  10 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/fan53880.c                  | 179 ++++++++++++++++++
 4 files changed, 275 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml
 create mode 100644 drivers/regulator/fan53880.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/2 regulator: fan53880: Add initial support

This patch adds support for ON Semiconductor FAN53880 regulator.

The FAN53880 is an I2C porgrammable power management IC (PMIC) that contains a BUCK (step-down converter), four LDOs (low dropouts) and one BOOST (step-up converter). It is designed for mobile power applications.

---
 drivers/regulator/Kconfig    |  10 ++
 drivers/regulator/Makefile   |   1 +
 drivers/regulator/fan53880.c | 179 +++++++++++++++++++++++++++++++++++
 3 files changed, 190 insertions(+)
 create mode 100644 drivers/regulator/fan53880.c
drivers/regulator/Kconfig +10 -0
index edb1c4f8b496..69fcfdc50ada 100644
@@ -326,6 +326,16 @@ config REGULATOR_FAN53555
 	  input voltage supply of 2.5V to 5.5V. The output voltage is
 	  programmed through an I2C interface.
 
+config REGULATOR_FAN53880
+	tristate "Fairchild FAN53880 Regulator"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  This driver supports Fairchild (ON Semiconductor) FAN53880
+	  regulator. The regulator is a programmable power management IC
+	  (PMIC), it is controlled by I2C and provides one BUCK, one BOOST
+	  and four LDO outputs.
+
 config REGULATOR_GPIO
 	tristate "GPIO regulator support"
 	depends on GPIOLIB || COMPILE_TEST
drivers/regulator/Makefile +1 -0
index e8f163371071..7b7d2eeb78c2 100644
@@ -41,6 +41,7 @@ obj-$(CONFIG_REGULATOR_DA9211) += da9211-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o
+obj-$(CONFIG_REGULATOR_FAN53880) += fan53880.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_HI6421) += hi6421-regulator.o
 obj-$(CONFIG_REGULATOR_HI6421V530) += hi6421v530-regulator.o
drivers/regulator/fan53880.c new file +179 -0

179 lines not on this page · raw message

Signature · 1 line
2.20.1
maintainer
#2 lore raw

Re: [PATCH 1/2] regulator: fan53880: Add initial support

Quoted 6 lines · Christoph Fritz

This patch adds support for ON Semiconductor FAN53880 regulator.

The FAN53880 is an I2C porgrammable power management IC (PMIC) that contains a BUCK (step-down converter), four LDOs (low dropouts) and one BOOST (step-up converter). It is designed for mobile power applications.

This doesn't build with current code, there are *many* errors in the form

/mnt/kernel/drivers/regulator/fan53880.c:48:52: error: array type has incomplete element type 'struct regulator_linear_range'

   .linear_ranges =   (struct regulator_linear_range[]) { \
                                                    ^

/mnt/kernel/drivers/regulator/fan53880.c:63:2: note: in expansion of macro 'FAN53880_LDO'
FAN53880_LDO(1, "VIN12", 2800000),
^~~~~~~~~~~~
In file included from /mnt/kernel/drivers/regulator/fan53880.c:5:
/mnt/kernel/include/linux/regulator/driver.h:46:2: error: field name not in record or union initializer
.min = _min_uV, \
^
/mnt/kernel/drivers/regulator/fan53880.c:49:9: note: in expansion of macro 'REGULATOR_LINEAR_RANGE'

         REGULATOR_LINEAR_RANGE(_default, 0x0, 0x0, 0), \
         ^~~~~~~~~~~~~~~~~~~~~~

/mnt/kernel/drivers/regulator/fan53880.c:63:2: note: in expansion of macro 'FAN53880_LDO'
FAN53880_LDO(1, "VIN12", 2800000),
^~~~~~~~~~~~
/mnt/kernel/include/linux/regulator/driver.h:46:2: note: (near initialization for '(anonymous)')
.min = _min_uV, \
^
/mnt/kernel/drivers/regulator/fan53880.c:49:9: note: in expansion of macro 'REGULATOR_LINEAR_RANGE'

         REGULATOR_LINEAR_RANGE(_default, 0x0, 0x0, 0), \
         ^~~~~~~~~~~~~~~~~~~~~~

/mnt/kernel/drivers/regulator/fan53880.c:63:2: note: in expansion of macro 'FAN53880_LDO'
FAN53880_LDO(1, "VIN12", 2800000),
^~~~~~~~~~~~
/mnt/kernel/include/linux/regulator/driver.h:47:2: error: field name not in record or union initializer
.min_sel = _min_sel, \
^

most likely due to the conversion introduced in 60ab7f4153b6af46 (regulator: use linear_ranges helper). Please rebase against current code.

#3 lore raw

Re: [PATCH 1/2] regulator: fan53880: Add initial support

Quoted 9 lines · Mark Brown

/mnt/kernel/drivers/regulator/fan53880.c:63:2: note: in expansion of macro 'FAN53880_LDO'
FAN53880_LDO(1, "VIN12", 2800000),
^~~~~~~~~~~~
/mnt/kernel/include/linux/regulator/driver.h:47:2: error: field name not in record or union initializer
.min_sel = _min_sel, \
^

Quoted 3 lines

most likely due to the conversion introduced in 60ab7f4153b6af46 (regulator: use linear_ranges helper). Please rebase against current code.

Thanks for the hint, yeah that's it. After picking up a recent linux- next and adapting it works on current too.

Please let me respin the patches in a v2.

#4 lore raw

PATCH 2/2 dt-bindings: regulator: Document bindings for fan53880

In reply to Christoph Fritz

Add device tree binding information for fan53880 regulator driver.

---
 .../bindings/regulator/onnn,fan53880.yaml     | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml
Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml new file +85 -0
new file mode 100644
index 000000000000..eb61e04ef852
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/onnn,fan53880.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Onsemi FAN53880 PMIC
+
+maintainers:
+  - Christoph Fritz <[email protected]>
+
+description: |
+  The FAN53880 is an I2C porgrammable power management IC (PMIC)
+  that contains a BUCK (step-down converter), four low dropouts (LDO)
+  and one BOOST (step-up converter) output. It is designed for mobile
+  power applications.
+
+properties:
+  $nodename:
+    pattern: "pmic@[0-9a-f]{1,2}"
+  compatible:
+    enum:
+      - onnn,fan53880
+
+  reg:
+    maxItems: 1
+
+  VIN12-supply:
+    description: Input supply phandle(s) for LDO1 and LDO2
+
+  VIN3-supply:
+    description: Input supply phandle(s) for LDO3
+
+  VIN4-supply:
+    description: Input supply phandle(s) for LDO4
+
+  PVIN-supply:
+    description: Input supply phandle(s) for BUCK and BOOST
+
+  regulators:
+    type: object
+    $ref: regulator.yaml#
+    description: |
+      list of regulators provided by this controller, must be named
+      after their hardware counterparts LDO[1-4], BUCK and BOOST
+
+    patternProperties:
+      "^LDO[1-4]$":
+        type: object
+        $ref: regulator.yaml#
+
+      "^BUCK|BOOST$":
+        type: object
+        $ref: regulator.yaml#
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@35 {
+            compatible = "onnn,fan53880";
+            reg = <0x35>;
+
+            PVIN-supply = <&fixreg_example_vcc>;
+
+            regulators {
+                BUCK {
+                    regulator-min-microvolt = <1200000>;
+                    regulator-max-microvolt = <1200000>;
+                };
+            };
+       };
+     };
+...
Signature · 1 line
2.20.1
maintainer
#5 lore raw
In reply to Christoph Fritz
Quoted 8 lines · Christoph Fritz

This patchset adds a regulator driver with dt-bindings documentation in the new yaml format for a power management IC from Fairchild (now ON Semiconductor) named FAN53880.

The chip was found on a camera sensor board which will get a v4lsubdev driver in the future.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: fan53880: Add initial support

      commit: e6dea51e2d41679d37a81d0b1247c039092af46b
[2/2] dt-bindings: regulator: Document bindings for fan53880
      commit: 643ddb618a5fd1819e790e86be85ae50c2c4abc4

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark