diff mbox series

[v4,4/4] hwmon: (pmbus/mpq2286) Add a support for mpq2286 Power Management IC

Message ID 20231011164754.449399-5-saravanan@linumiz.com (mailing list archive)
State Accepted
Headers show
Series Add support for mpq2286 PMIC IC | expand

Commit Message

Saravanan Sekar Oct. 11, 2023, 4:47 p.m. UTC
The MPQ2286 is a programmable, high frequency synchronous buck regulator
designed to power a variety of Automotive system peripherals. Single buck
converters with hardware monitoring capability is configurable over PMBus
interface.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
---
 drivers/hwmon/pmbus/mpq7932.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Oct. 26, 2023, 12:52 a.m. UTC | #1
On Wed, Oct 11, 2023 at 10:17:54PM +0530, Saravanan Sekar wrote:
> The MPQ2286 is a programmable, high frequency synchronous buck regulator
> designed to power a variety of Automotive system peripherals. Single buck
> converters with hardware monitoring capability is configurable over PMBus
> interface.
> 
> Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>

Applied, after fixing the subject. Its tag needs to reference
the driver, not the added chip.

Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/mpq7932.c b/drivers/hwmon/pmbus/mpq7932.c
index 723c314a57a2..67487867c70f 100644
--- a/drivers/hwmon/pmbus/mpq7932.c
+++ b/drivers/hwmon/pmbus/mpq7932.c
@@ -21,6 +21,7 @@ 
 #define MPQ7932_N_VOLTAGES		256
 #define MPQ7932_VOUT_MAX		0xFF
 #define MPQ7932_NUM_PAGES		6
+#define MPQ2286_NUM_PAGES		1
 
 #define MPQ7932_TON_DELAY		0x60
 #define MPQ7932_VOUT_STARTUP_SLEW	0xA3
@@ -48,6 +49,11 @@  static struct regulator_desc mpq7932_regulators_desc[] = {
 	PMBUS_REGULATOR_STEP("buck", 5, MPQ7932_N_VOLTAGES,
 			     MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN),
 };
+
+static const struct regulator_desc mpq7932_regulators_desc_one[] = {
+	PMBUS_REGULATOR_STEP_ONE("buck", MPQ7932_N_VOLTAGES,
+				 MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN),
+};
 #endif
 
 static int mpq7932_write_word_data(struct i2c_client *client, int page, int reg,
@@ -116,7 +122,10 @@  static int mpq7932_probe(struct i2c_client *client)
 
 #if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR)
 	info->num_regulators = info->pages;
-	info->reg_desc = mpq7932_regulators_desc;
+	if (info->num_regulators == 1)
+		info->reg_desc = mpq7932_regulators_desc_one;
+	else
+		info->reg_desc = mpq7932_regulators_desc;
 #endif
 
 	info->read_word_data = mpq7932_read_word_data;
@@ -129,12 +138,14 @@  static int mpq7932_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id mpq7932_of_match[] = {
+	{ .compatible = "mps,mpq2286", .data = (void *)MPQ2286_NUM_PAGES },
 	{ .compatible = "mps,mpq7932", .data = (void *)MPQ7932_NUM_PAGES },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mpq7932_of_match);
 
 static const struct i2c_device_id mpq7932_id[] = {
+	{ "mpq2286", },
 	{ "mpq7932", },
 	{ },
 };