[PATCH v1] power: regulator: mpq8785: match the MPS MPQ8646

Vincent Jardin <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
Add the MPQ8646, which handles the same case as the MPQ8785.

It shares the info table, and it shares the VOUT:
both parts report VID in VOUT_MODE while actually encoding VOUT
as DIRECT with m=64 R=1, which mpq8785_identify_vout() already fixes up.

Linux does the same thing from the other side:
drivers/hwmon/pmbus/mpq8646.c intercepts PMBUS_VOUT_MODE in
read_byte_data() and returns DIRECT when the chip says
VID.

Linux gained the compatible in the shared binding
(Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml,
commit e7ba3115134b "dt-bindings: hwmon: pmbus: add MPS MPQ8646"),
which groups it with mps,mpq8785 for mps,vout-fb-divider-ratio-permille,
the same here.

Verified against silicon on a board whose +0V8_VDD rail is an
MPQ8646: the chip self-reports MODEL="MPQ8646" with VOUT_MODE=0x17.

Signed-off-by: Vincent Jardin <[email protected]>

---

 drivers/power/regulator/Kconfig   | 4 ++--
 drivers/power/regulator/mpq8785.c | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 00a25acfdf9..8d4d6e69e46 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -598,12 +598,12 @@ config DM_REGULATOR_PMBUS_GENERIC
 	  m / b / R coefficients) need handling.
 
 config DM_REGULATOR_MPQ8785
-	bool "MPS MPQ8785 / MPM3695 / MPM82504 PMBus voltage regulator"
+	bool "MPS MPQ8785 / MPQ8646 / MPM3695 / MPM82504 PMBus voltage regulator"
 	depends on DM_REGULATOR_PMBUS_HELPER
 	help
 	  Driver for the Monolithic Power Systems MPQ8785 family of
 	  digital multiphase voltage regulators with PMBus. Supports
-	  MPM3695, MPM3695-25, MPM82504, and MPQ8785. Adapted from the
+	  MPM3695, MPM3695-25, MPM82504, MPQ8785 and MPQ8646. Adapted from the
 	  Linux drivers/hwmon/pmbus/mpq8785.c reference.
 
 config SANDBOX_PMBUS
diff --git a/drivers/power/regulator/mpq8785.c b/drivers/power/regulator/mpq8785.c
index dc321f0e410..72bfaa5bf8c 100644
--- a/drivers/power/regulator/mpq8785.c
+++ b/drivers/power/regulator/mpq8785.c
@@ -32,6 +32,7 @@ enum mpq_chip_id {
 	MPQ_MPM3695_25  = 1,
 	MPQ_MPM82504    = 2,
 	MPQ_MPQ8785     = 3,
+	MPQ_MPQ8646     = 4,
 };
 
 /*
@@ -398,6 +399,7 @@ static struct pmbus_driver_info *mpq8785_pick_info(enum mpq_chip_id chip_id)
 	case MPQ_MPM82504:
 		return &mpm82504_info;
 	case MPQ_MPQ8785:
+	case MPQ_MPQ8646:
 	default:
 		return &mpq8785_info;
 	}
@@ -444,8 +446,8 @@ static int mpq8785_probe(struct udevice *dev)
 		}
 	}
 
-	/* MPQ8785 specific: refine VOUT format from VOUT_MODE. */
-	if (chip_id == MPQ_MPQ8785)
+	/* MPQ8785/MPQ8646 specific: refine VOUT format from VOUT_MODE. */
+	if (chip_id == MPQ_MPQ8785 || chip_id == MPQ_MPQ8646)
 		mpq8785_identify_vout(priv->i2c_dev);
 
 	/* Apply mps,vout-fb-divider-ratio-permille if present in DT. */
@@ -481,6 +483,7 @@ static const struct udevice_id mpq8785_ids[] = {
 	{ .compatible = "mps,mpm3695-25", .data = MPQ_MPM3695_25 },
 	{ .compatible = "mps,mpm82504",   .data = MPQ_MPM82504 },
 	{ .compatible = "mps,mpq8785",    .data = MPQ_MPQ8785 },
+	{ .compatible = "mps,mpq8646",    .data = MPQ_MPQ8646 },
 	{ }
 };
 
---
base-commit: 6073c36b2c8d39afe3ecc789b281667a3ddebc70
branch: for-upstream/power-regulator-mpq8646-v1

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.