Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support
@ 2026-09-10  8:51 Tapio Reijonen
  2026-09-10  8:51 ` [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210 Tapio Reijonen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Tapio Reijonen @ 2026-09-10  8:51 UTC (permalink / raw)
  To: Saravanan Sekar, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-kernel, devicetree, Tapio Reijonen

This series adds support for the Monolithic Power Systems MPQ4210, a 40V
synchronous four-switch buck-boost controller with an I2C interface.

The output voltage is programmed through an 11-bit feedback reference DAC
with a 1mV step and is then scaled by an external feedback resistor
divider, so the divider ratio has to be described in the device tree. The
same ratio applies to the reference slew rate, so the four rates that the
Control 1 SR field selects are scaled into a per-device ramp_delay_table
and the field is exposed through regulator_set_ramp_delay_regmap(). The
current limit, switching frequency, dither and interrupt registers are
left at their reset values.

Only 0.3V to 2.047V of the DAC range is specified, so linear_min_sel
holds the driver to that and the lower selectors are not offered. On a
board with a gain of 14 that is the difference between a floor of 4.2V
and one of 0V, and the lower part of that range does not regulate.

Scaling the ramp table is a deliberate difference from ltc3589 and
mp886x, which read an equivalent feedback-divider property but keep their
ramp values unscaled. Every other constraint in the device tree is
expressed at the regulator output, so the selectable rates have to be as
well, or regulator-ramp-delay would select the wrong SR encoding. It does
mean the reachable rates are board specific and no value can be copied
between boards, so the binding documents how they are derived and shows
the calculation in its example.

Two details are worth a reviewer's attention.

Enable follows the start-up sequence the datasheet spells out: commit the
reference with the GO bit, wait 200ms, then set ENPWR. That is why
.enable is open coded rather than using regulator_enable_regmap.

Control 1 bit 2 is documented only as "Reserved", but the datasheet notes
that it must be set to one before the IC starts up. Its reset value is
zero, so probe sets it.

One consequence of the hardware worth spelling out: the MPQ4210 does not
respond on the I2C bus while EN is deasserted. The enable GPIO is
therefore claimed and asserted before the first register access and held
for the lifetime of the device, rather than being handed to the core as
regulator_config::ena_gpiod, which would drop the bus along with the
output.

Tested on an i.MX6SX board, regulator behind an I2C mux, feedback divider
100k/7.685k giving a gain of 14.0124, a 14012uV step and a 4.204V floor:

- A 16 point staircase from 4.204V to 25.2V: the commanded voltage, the
  value read back and the selector decoded from the two reference
  registers agree exactly at every point, and a meter on the rail
  follows.
- With the rail up and no regulator-ramp-delay in the device tree,
  Control 1 reads 0x45: SR at its reset value, bit 2 set, GO
  self-cleared and ENPWR set. Interrupt status reads clear.
- regulator-ramp-delay picks the SR encoding as intended. 1050, an exact
  entry of this board's scaled table, gives 0x85. 3000, above every
  entry, warns "Can't set ramp-delay 3000, setting 2101" and gives 0xC5.
- Sampling Control 1 across a disable and re-enable shows 0x45, 0x44,
  0x45, so ENPWR is cleared and restored as expected.
- Enable takes 230ms, against roughly 16ms for a plain register write on
  this bus.

Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
Tapio Reijonen (2):
      regulator: dt-bindings: Add MPS MPQ4210
      regulator: Add MPS MPQ4210 buck-boost regulator driver

 .../devicetree/bindings/regulator/mps,mpq4210.yaml |  69 ++++++
 MAINTAINERS                                        |   6 +
 drivers/regulator/Kconfig                          |  11 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/mpq4210.c                        | 243 +++++++++++++++++++++
 5 files changed, 330 insertions(+)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260903-mpq4210-regulator-d4b58046299a

Best regards,
-- 
Tapio Reijonen <tapio.reijonen@vaisala.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210
  2026-09-10  8:51 [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Tapio Reijonen
@ 2026-09-10  8:51 ` Tapio Reijonen
  2026-09-10  9:01   ` sashiko-bot
  2026-09-11  8:45   ` Krzysztof Kozlowski
  2026-09-10  8:51 ` [PATCH 2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver Tapio Reijonen
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: Tapio Reijonen @ 2026-09-10  8:51 UTC (permalink / raw)
  To: Saravanan Sekar, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-kernel, devicetree, Tapio Reijonen

The MPQ4210 is a 40V synchronous four-switch buck-boost controller with
an I2C interface. Its output voltage is programmed through an 11-bit
feedback reference DAC covering 0 to 2.047V in 1mV steps, and is then
scaled by an external feedback resistor divider, so the divider ratio
has to be described in the device tree for the driver to translate
reference voltages into output voltages.

The divider is given in ohms rather than the kilo ohms used by
mps,mp886x.yaml because the bottom resistor is not necessarily a whole
number of kilo ohms.

The same divider scales the reference ramp rate, so unlike the other
bindings that scale by a feedback divider there is no portable value a
board can copy into regulator-ramp-delay. Describe how the selectable
rates are derived from the four reference slew rates, and show the
calculation in the example.

Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
 .../devicetree/bindings/regulator/mps,mpq4210.yaml | 69 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 ++
 2 files changed, 74 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..e9e7a87e7533d0948927a459e9af711d1e07e572
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mps,mpq4210.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Monolithic Power Systems MPQ4210 buck-boost regulator
+
+maintainers:
+  - Tapio Reijonen <tapio.reijonen@vaisala.com>
+
+description:
+  The MPQ4210 is a synchronous four-switch buck-boost controller with an I2C
+  interface. The output voltage is programmed through an 11-bit feedback
+  reference DAC and scaled by an external feedback resistor divider.
+
+  The controller ramps the feedback reference at 38, 50, 75 or 150 mV/ms.
+  The divider scales the ramp rate along with the voltage, so the output
+  ramp rates that regulator-ramp-delay can select are those values
+  multiplied by (R1 + R2) / R2.
+
+allOf:
+  - $ref: regulator.yaml#
+
+properties:
+  compatible:
+    const: mps,mpq4210
+
+  reg:
+    maxItems: 1
+
+  enable-gpios:
+    description: GPIO connected to the EN pin. If absent, EN is assumed to
+      be permanently asserted.
+    maxItems: 1
+
+  mps,fb-voltage-divider:
+    description: An array of two integers containing the resistor values R1
+      and R2 of the output feedback voltage divider in ohms.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    maxItems: 2
+
+required:
+  - compatible
+  - reg
+  - mps,fb-voltage-divider
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        regulator@64 {
+            compatible = "mps,mpq4210";
+            reg = <0x64>;
+            regulator-name = "vout";
+            regulator-min-microvolt = <4000000>;
+            regulator-max-microvolt = <20000000>;
+            enable-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+            /* R1 = 82 kOhm, R2 = 9.1 kOhm */
+            mps,fb-voltage-divider = <82000 9100>;
+            /* 50 mV/ms reference ramp x (82000 + 9100) / 9100 */
+            regulator-ramp-delay = <500>;
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a19da74d00c9dfb48e900df71a86d4686d3ec2c..eb552bff791bed27b86d5e2a398d0d96253efc6f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18372,6 +18372,11 @@ F:	scripts/module*
 F:	tools/testing/selftests/kmod/
 F:	tools/testing/selftests/module/
 
+MONOLITHIC POWER SYSTEM MPQ4210 REGULATOR DRIVER
+M:	Tapio Reijonen <tapio.reijonen@vaisala.com>
+S:	Maintained
+F:	Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
+
 MONOLITHIC POWER SYSTEM PMIC DRIVER
 M:	Saravanan Sekar <sravanhome@gmail.com>
 S:	Maintained

-- 
2.47.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver
  2026-09-10  8:51 [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Tapio Reijonen
  2026-09-10  8:51 ` [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210 Tapio Reijonen
@ 2026-09-10  8:51 ` Tapio Reijonen
  2026-09-11 18:48   ` Uwe Kleine-König
  2026-09-10 15:58 ` [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Mark Brown
  2026-09-10 15:58 ` Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Tapio Reijonen @ 2026-09-10  8:51 UTC (permalink / raw)
  To: Saravanan Sekar, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-kernel, devicetree, Tapio Reijonen

The MPQ4210 is a 40V synchronous four-switch buck-boost controller with
an I2C interface. Add a driver exposing voltage control and enable
control through the regulator interface.

The output voltage is programmed by an 11-bit feedback reference DAC with
a 1mV step, split across REF_LSB[2:0] and REF_MSB[7:0], and is then
scaled by the external feedback divider described in the device tree.
Only 0.3V to 2.047V of that range is specified, so linear_min_sel holds
the driver to it and the lower selectors are not offered. Scaled by the
divider, that floor is not zero: 4.2V on a board with a gain of 14, and
the core narrows regulator-min-microvolt to it.

The same divider ratio applies to the slew rate, so the four reference
slew rates that the Control 1 SR field selects are scaled into a
per-device ramp_delay_table and the field is exposed through
regulator_set_ramp_delay_regmap(). ramp_delay is initialised from the
rate SR is currently programmed for, so the core waits in proportion to
the size of each change; a board that sets regulator-ramp-delay
reprograms SR and the core uses that value instead.

Enabling follows the start-up sequence in the datasheet: commit the
reference with the GO bit, wait 200ms, then set ENPWR. Control 1 bit 2 is
documented as reserved but has to be set before the controller starts up,
so probe sets it. The controller does not respond on the bus while EN is
deasserted, so the enable GPIO is claimed before the first register
access.

Link: https://www.monolithicpower.com/en/mpq4210.html
Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
 MAINTAINERS                 |   1 +
 drivers/regulator/Kconfig   |  11 ++
 drivers/regulator/Makefile  |   1 +
 drivers/regulator/mpq4210.c | 243 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 256 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index eb552bff791bed27b86d5e2a398d0d96253efc6f..78d28c103eb14d90e2566a00a089e66e34d0839b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18376,6 +18376,7 @@ MONOLITHIC POWER SYSTEM MPQ4210 REGULATOR DRIVER
 M:	Tapio Reijonen <tapio.reijonen@vaisala.com>
 S:	Maintained
 F:	Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
+F:	drivers/regulator/mpq4210.c
 
 MONOLITHIC POWER SYSTEM PMIC DRIVER
 M:	Saravanan Sekar <sravanhome@gmail.com>
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 89789ac7a786c8c4c4a750cdcaa27a205762ac18..df7742533f22cacd4b012259f6e10d1e663c87c4 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -870,6 +870,17 @@ config REGULATOR_MP886X
 	help
 	  This driver supports the MP8869 voltage regulator.
 
+config REGULATOR_MPQ4210
+	tristate "MPS MPQ4210 regulator driver"
+	depends on I2C && OF
+	select REGMAP_I2C
+	help
+	  This driver supports the MPQ4210 synchronous buck-boost controller.
+	  It supports get/set voltage, enable/disable and ramp rate selection
+	  through the regulator interface.
+	  Say M here if you want to include support for the regulator as a
+	  module. The module will be named "mpq4210".
+
 config REGULATOR_MPQ7920
 	tristate "Monolithic MPQ7920 PMIC"
 	depends on I2C && OF
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 5a764cec8df834de6f7775574e4bbd1d4dd8f6ef..af69a0ee877d8afaf80b3b4c293661b5900ac78a 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -104,6 +104,7 @@ obj-$(CONFIG_REGULATOR_MCP16502) += mcp16502.o
 obj-$(CONFIG_REGULATOR_MP5416) += mp5416.o
 obj-$(CONFIG_REGULATOR_MP8859) += mp8859.o
 obj-$(CONFIG_REGULATOR_MP886X) += mp886x.o
+obj-$(CONFIG_REGULATOR_MPQ4210) += mpq4210.o
 obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6315) += mt6315-regulator.o
diff --git a/drivers/regulator/mpq4210.c b/drivers/regulator/mpq4210.c
new file mode 100644
index 0000000000000000000000000000000000000000..227136d8225805a759d2d6545637858ea7122b89
--- /dev/null
+++ b/drivers/regulator/mpq4210.c
@@ -0,0 +1,243 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Monolithic Power Systems MPQ4210 buck-boost regulator
+ *
+ * Copyright (c) 2026 Vaisala Oyj
+ */
+
+#include <linux/bitfield.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/math.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/of_regulator.h>
+
+#define MPQ4210_REF_LSB			0x00
+#define MPQ4210_REF_LSB_MASK		GENMASK(2, 0)
+#define MPQ4210_REF_LSB_BITS		3
+#define MPQ4210_REF_MSB			0x01
+#define MPQ4210_CONTROL1		0x02
+#define MPQ4210_CONTROL1_SR		GENMASK(7, 6)
+#define MPQ4210_CONTROL1_RESERVED	BIT(2)
+#define MPQ4210_CONTROL1_GO		BIT(1)
+#define MPQ4210_CONTROL1_ENPWR		BIT(0)
+#define MPQ4210_INT_MASK		0x06
+
+/*
+ * The feedback reference is an 11 bit value with a 1mV step. The datasheet
+ * specifies no reference below 0.3V, so those selectors are not offered.
+ */
+#define MPQ4210_REF_MIN			0x12c
+#define MPQ4210_REF_MAX			0x7ff
+#define MPQ4210_REF_STEP_UV		1000
+
+#define MPQ4210_ENPWR_DELAY_MS		200
+
+/* Feedback reference slew rate per MPQ4210_CONTROL1_SR value, in uV/us. */
+static const unsigned int mpq4210_ref_slew_rate[] = { 38, 50, 75, 150 };
+
+static const struct regmap_config mpq4210_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = MPQ4210_INT_MASK,
+};
+
+/* Scale a feedback reference value by the output voltage divider ratio. */
+static unsigned int mpq4210_scale(unsigned int val, u32 r1, u32 r2)
+{
+	u64 tmp = (u64)val * (r1 + r2);
+
+	do_div(tmp, r2);
+
+	return tmp;
+}
+
+static int mpq4210_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
+{
+	int ret;
+
+	ret = regmap_write(rdev->regmap, MPQ4210_REF_LSB,
+			   sel & MPQ4210_REF_LSB_MASK);
+	if (ret)
+		return ret;
+
+	ret = regmap_write(rdev->regmap, MPQ4210_REF_MSB,
+			   sel >> MPQ4210_REF_LSB_BITS);
+	if (ret)
+		return ret;
+
+	return regmap_set_bits(rdev->regmap, MPQ4210_CONTROL1,
+			       MPQ4210_CONTROL1_GO);
+}
+
+static int mpq4210_get_voltage_sel(struct regulator_dev *rdev)
+{
+	unsigned int lsb, msb;
+	int ret;
+
+	ret = regmap_read(rdev->regmap, MPQ4210_REF_MSB, &msb);
+	if (ret)
+		return ret;
+
+	ret = regmap_read(rdev->regmap, MPQ4210_REF_LSB, &lsb);
+	if (ret)
+		return ret;
+
+	return (msb << MPQ4210_REF_LSB_BITS) | (lsb & MPQ4210_REF_LSB_MASK);
+}
+
+static int mpq4210_enable(struct regulator_dev *rdev)
+{
+	int ret;
+
+	ret = regmap_set_bits(rdev->regmap, MPQ4210_CONTROL1,
+			      MPQ4210_CONTROL1_GO);
+	if (ret)
+		return ret;
+
+	/* The reference has to settle before power switching may start. */
+	msleep(MPQ4210_ENPWR_DELAY_MS);
+
+	return regmap_set_bits(rdev->regmap, MPQ4210_CONTROL1,
+			       MPQ4210_CONTROL1_ENPWR);
+}
+
+static const struct regulator_ops mpq4210_regulator_ops = {
+	.set_voltage_sel = mpq4210_set_voltage_sel,
+	.get_voltage_sel = mpq4210_get_voltage_sel,
+	.list_voltage = regulator_list_voltage_linear,
+	.set_ramp_delay = regulator_set_ramp_delay_regmap,
+	.enable = mpq4210_enable,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
+static const struct regulator_desc mpq4210_regulator = {
+	.name = "mpq4210",
+	.type = REGULATOR_VOLTAGE,
+	.owner = THIS_MODULE,
+	.ops = &mpq4210_regulator_ops,
+	.n_voltages = MPQ4210_REF_MAX + 1,
+	.linear_min_sel = MPQ4210_REF_MIN,
+	.enable_reg = MPQ4210_CONTROL1,
+	.enable_mask = MPQ4210_CONTROL1_ENPWR,
+	.ramp_reg = MPQ4210_CONTROL1,
+	.ramp_mask = MPQ4210_CONTROL1_SR,
+	.n_ramp_values = ARRAY_SIZE(mpq4210_ref_slew_rate),
+};
+
+static int mpq4210_i2c_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct regulator_config config = { };
+	struct regulator_desc *desc;
+	struct regulator_dev *rdev;
+	struct gpio_desc *enable;
+	struct regmap *regmap;
+	unsigned int *slew;
+	unsigned int i, val;
+	u32 r[2];
+	int ret;
+
+	ret = of_property_read_u32_array(dev->of_node, "mps,fb-voltage-divider",
+					 r, ARRAY_SIZE(r));
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "failed to read mps,fb-voltage-divider\n");
+
+	if (!r[1])
+		return dev_err_probe(dev, -EINVAL,
+				     "feedback divider R2 must not be zero\n");
+
+	/* The controller does not answer on the bus while EN is deasserted. */
+	enable = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
+	if (IS_ERR(enable))
+		return dev_err_probe(dev, PTR_ERR(enable),
+				     "failed to get enable GPIO\n");
+
+	regmap = devm_regmap_init_i2c(client, &mpq4210_regmap_config);
+	if (IS_ERR(regmap))
+		return dev_err_probe(dev, PTR_ERR(regmap),
+				     "failed to init regmap\n");
+
+	desc = devm_kmemdup(dev, &mpq4210_regulator, sizeof(*desc), GFP_KERNEL);
+	if (!desc)
+		return -ENOMEM;
+
+	desc->min_uV = mpq4210_scale(MPQ4210_REF_MIN * MPQ4210_REF_STEP_UV,
+				     r[0], r[1]);
+	desc->uV_step = mpq4210_scale(MPQ4210_REF_STEP_UV, r[0], r[1]);
+
+	slew = devm_kcalloc(dev, ARRAY_SIZE(mpq4210_ref_slew_rate),
+			    sizeof(*slew), GFP_KERNEL);
+	if (!slew)
+		return -ENOMEM;
+
+	for (i = 0; i < ARRAY_SIZE(mpq4210_ref_slew_rate); i++)
+		slew[i] = mpq4210_scale(mpq4210_ref_slew_rate[i], r[0], r[1]);
+
+	desc->ramp_delay_table = slew;
+
+	ret = regmap_read(regmap, MPQ4210_CONTROL1, &val);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to read control 1\n");
+
+	/* The core overrides this if the board sets regulator-ramp-delay. */
+	desc->ramp_delay = slew[FIELD_GET(MPQ4210_CONTROL1_SR, val)];
+
+	/*
+	 * Documented as reserved, but the datasheet requires it to be set
+	 * before the controller starts up.
+	 */
+	ret = regmap_set_bits(regmap, MPQ4210_CONTROL1,
+			      MPQ4210_CONTROL1_RESERVED);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to write control 1\n");
+
+	config.dev = dev;
+	config.regmap = regmap;
+	config.of_node = dev->of_node;
+	config.init_data = of_get_regulator_init_data(dev, dev->of_node, desc);
+	if (!config.init_data)
+		return -ENOMEM;
+
+	rdev = devm_regulator_register(dev, desc, &config);
+	if (IS_ERR(rdev))
+		return dev_err_probe(dev, PTR_ERR(rdev),
+				     "failed to register regulator\n");
+
+	return 0;
+}
+
+static const struct of_device_id mpq4210_of_match[] = {
+	{ .compatible = "mps,mpq4210" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, mpq4210_of_match);
+
+static const struct i2c_device_id mpq4210_i2c_id[] = {
+	{ .name = "mpq4210" },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, mpq4210_i2c_id);
+
+static struct i2c_driver mpq4210_regulator_driver = {
+	.driver = {
+		.name = "mpq4210",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
+		.of_match_table = mpq4210_of_match,
+	},
+	.probe = mpq4210_i2c_probe,
+	.id_table = mpq4210_i2c_id,
+};
+
+module_i2c_driver(mpq4210_regulator_driver);
+
+MODULE_DESCRIPTION("Monolithic Power Systems MPQ4210 voltage regulator driver");
+MODULE_AUTHOR("Tapio Reijonen <tapio.reijonen@vaisala.com>");
+MODULE_LICENSE("GPL");

-- 
2.47.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210
  2026-09-10  8:51 ` [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210 Tapio Reijonen
@ 2026-09-10  9:01   ` sashiko-bot
  2026-09-11  8:45   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-09-10  9:01 UTC (permalink / raw)
  To: Tapio Reijonen; +Cc: devicetree, conor+dt, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `mps,fb-voltage-divider` property schema omits `minItems: 2` or an explicit `items` list, allowing incomplete arrays to pass validation.
--

commit 9d4fa47cff6967eb8bf59f67ec44cae66abc946a
Author: Tapio Reijonen <tapio.reijonen@vaisala.com>

regulator: dt-bindings: Add MPS MPQ4210

This commit introduces a new device tree binding for the MPQ4210
buck-boost controller. It specifies standard regulator properties and
adds the mps,fb-voltage-divider property to scale reference voltages.

> diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
> new file mode 100644
> index 0000000000000..e9e7a87e7533d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml

[ ... ]

> +  mps,fb-voltage-divider:
> +    description: An array of two integers containing the resistor values R1
> +      and R2 of the output feedback voltage divider in ohms.
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    maxItems: 2

[Severity: Low]
Does this schema allow incomplete arrays to pass validation?

The property description mentions an array of two integers for R1 and R2,
but without minItems: 2 or an explicit items list, a device tree node with
only one element could silently pass dt_binding_check.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-mpq4210-regulator-v1-0-d37e208dfc8d@vaisala.com?part=1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support
  2026-09-10  8:51 [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Tapio Reijonen
  2026-09-10  8:51 ` [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210 Tapio Reijonen
  2026-09-10  8:51 ` [PATCH 2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver Tapio Reijonen
@ 2026-09-10 15:58 ` Mark Brown
  2026-09-10 15:58 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2026-09-10 15:58 UTC (permalink / raw)
  To: Tapio Reijonen
  Cc: Saravanan Sekar, Liam Girdwood, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

On Thu, Sep 10, 2026 at 08:51:40AM +0000, Tapio Reijonen wrote:

> One consequence of the hardware worth spelling out: the MPQ4210 does not
> respond on the I2C bus while EN is deasserted. The enable GPIO is
> therefore claimed and asserted before the first register access and held
> for the lifetime of the device, rather than being handed to the core as
> regulator_config::ena_gpiod, which would drop the bus along with the
> output.

This is what regmap's cache only mode is for.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support
  2026-09-10  8:51 [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Tapio Reijonen
                   ` (2 preceding siblings ...)
  2026-09-10 15:58 ` [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Mark Brown
@ 2026-09-10 15:58 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2026-09-10 15:58 UTC (permalink / raw)
  To: Saravanan Sekar, Liam Girdwood, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Tapio Reijonen
  Cc: linux-kernel, devicetree

On Thu, 10 Sep 2026 08:51:40 +0000, Tapio Reijonen wrote:
> regulator: Add MPS MPQ4210 buck-boost regulator support
> 
> This series adds support for the Monolithic Power Systems MPQ4210, a 40V
> synchronous four-switch buck-boost controller with an I2C interface.
> 
> The output voltage is programmed through an 11-bit feedback reference DAC
> with a 1mV step and is then scaled by an external feedback resistor
> divider, so the divider ratio has to be described in the device tree. The
> same ratio applies to the reference slew rate, so the four rates that the
> Control 1 SR field selects are scaled into a per-device ramp_delay_table
> and the field is exposed through regulator_set_ramp_delay_regmap(). The
> current limit, switching frequency, dither and interrupt registers are
> left at their reset values.
> 
> [...]

Applied to

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

Thanks!

[1/2] regulator: dt-bindings: Add MPS MPQ4210
      https://git.kernel.org/broonie/regulator/c/e3c05a881fc9
[2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver
      https://git.kernel.org/broonie/regulator/c/61879d561e91

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210
  2026-09-10  8:51 ` [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210 Tapio Reijonen
  2026-09-10  9:01   ` sashiko-bot
@ 2026-09-11  8:45   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-11  8:45 UTC (permalink / raw)
  To: Tapio Reijonen
  Cc: Saravanan Sekar, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-kernel, devicetree

On Thu, Sep 10, 2026 at 08:51:41AM +0000, Tapio Reijonen wrote:
> The MPQ4210 is a 40V synchronous four-switch buck-boost controller with
> an I2C interface. Its output voltage is programmed through an 11-bit
> feedback reference DAC covering 0 to 2.047V in 1mV steps, and is then
> scaled by an external feedback resistor divider, so the divider ratio
> has to be described in the device tree for the driver to translate
> reference voltages into output voltages.
> 
> The divider is given in ohms rather than the kilo ohms used by
> mps,mp886x.yaml because the bottom resistor is not necessarily a whole
> number of kilo ohms.
> 
> The same divider scales the reference ramp rate, so unlike the other
> bindings that scale by a feedback divider there is no portable value a
> board can copy into regulator-ramp-delay. Describe how the selectable
> rates are derived from the four reference slew rates, and show the
> calculation in the example.
> 
> Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
> ---
>  .../devicetree/bindings/regulator/mps,mpq4210.yaml | 69 ++++++++++++++++++++++
>  MAINTAINERS                                        |  5 ++
>  2 files changed, 74 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..e9e7a87e7533d0948927a459e9af711d1e07e572
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/mps,mpq4210.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/mps,mpq4210.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Monolithic Power Systems MPQ4210 buck-boost regulator
> +
> +maintainers:
> +  - Tapio Reijonen <tapio.reijonen@vaisala.com>
> +
> +description:
> +  The MPQ4210 is a synchronous four-switch buck-boost controller with an I2C
> +  interface. The output voltage is programmed through an 11-bit feedback
> +  reference DAC and scaled by an external feedback resistor divider.
> +
> +  The controller ramps the feedback reference at 38, 50, 75 or 150 mV/ms.
> +  The divider scales the ramp rate along with the voltage, so the output
> +  ramp rates that regulator-ramp-delay can select are those values
> +  multiplied by (R1 + R2) / R2.
> +
> +allOf:
> +  - $ref: regulator.yaml#
> +
> +properties:
> +  compatible:
> +    const: mps,mpq4210
> +
> +  reg:
> +    maxItems: 1
> +
> +  enable-gpios:
> +    description: GPIO connected to the EN pin. If absent, EN is assumed to
> +      be permanently asserted.
> +    maxItems: 1
> +
> +  mps,fb-voltage-divider:
> +    description: An array of two integers containing the resistor values R1
> +      and R2 of the output feedback voltage divider in ohms.

Nope, use common property suffix - ohms.

If this was applied, please send a fixup now.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver
  2026-09-10  8:51 ` [PATCH 2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver Tapio Reijonen
@ 2026-09-11 18:48   ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2026-09-11 18:48 UTC (permalink / raw)
  To: Tapio Reijonen
  Cc: Saravanan Sekar, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

Hello,

On Thu, Sep 10, 2026 at 08:51:42AM +0000, Tapio Reijonen wrote:
> +#include <linux/i2c.h>
> [...]
> +#include <linux/mod_devicetable.h>

Please don't add new includes for <linux/mod_devicetable.h>, this header
is supposed to go away. For i2c_device_id and of_device_id you can rely
on <linux/i2c.h> to provide both. If you want to go full iwyu use
<linux/device-id/i2c.h> and <linux/device-id/of.h> respectively.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-09-11 18:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10  8:51 [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Tapio Reijonen
2026-09-10  8:51 ` [PATCH 1/2] regulator: dt-bindings: Add MPS MPQ4210 Tapio Reijonen
2026-09-10  9:01   ` sashiko-bot
2026-09-11  8:45   ` Krzysztof Kozlowski
2026-09-10  8:51 ` [PATCH 2/2] regulator: Add MPS MPQ4210 buck-boost regulator driver Tapio Reijonen
2026-09-11 18:48   ` Uwe Kleine-König
2026-09-10 15:58 ` [PATCH 0/2] regulator: Add MPS MPQ4210 buck-boost regulator support Mark Brown
2026-09-10 15:58 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox