From: Jackson Liu <jackson870728@gmail.com>
To: andrew@codeconstruct.com.au, openbmc@lists.ozlabs.org
Cc: jackson.liu@quantatw.com
Subject: [PATCH linux dev-6.18 3/3] hwmon: (mp2925) Add vid offset for vid mode
Date: Thu, 19 Mar 2026 15:35:12 +0800 [thread overview]
Message-ID: <20260319073515.1577998-3-Jackson.Liu@quantatw.com> (raw)
In-Reply-To: <20260319073515.1577998-1-Jackson.Liu@quantatw.com>
From: Wensheng Wang <wenswang@yeah.net>
In vid mode, the mp2925 vout telemetry has 49 vid step offset, add
vid offset for this.
Signed-off-by: Wensheng Wang <wenswang@yeah.net>
Link: https://lore.kernel.org/r/20260106061348.170509-1-wenswang@yeah.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit a9c4ac630c8a38a0496c2b54cf27b318d38ab6e6)
---
drivers/hwmon/pmbus/mp2925.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/pmbus/mp2925.c b/drivers/hwmon/pmbus/mp2925.c
index 6bebd6023021..ad094842cf2d 100644
--- a/drivers/hwmon/pmbus/mp2925.c
+++ b/drivers/hwmon/pmbus/mp2925.c
@@ -40,6 +40,7 @@
struct mp2925_data {
struct pmbus_driver_info info;
int vout_scale[MP2925_PAGE_NUM];
+ int vid_offset[MP2925_PAGE_NUM];
};
#define to_mp2925_data(x) container_of(x, struct mp2925_data, info)
@@ -94,8 +95,15 @@ static int mp2925_read_word_data(struct i2c_client *client, int page, int phase,
if (ret < 0)
return ret;
- ret = DIV_ROUND_CLOSEST((ret & GENMASK(11, 0)) * data->vout_scale[page],
- MP2925_VOUT_DIV);
+ /*
+ * In vid mode, the MP2925 vout telemetry has 49 vid step offset, but
+ * PMBUS_VOUT_OV_FAULT_LIMIT and PMBUS_VOUT_UV_FAULT_LIMIT do not take
+ * this into consideration, its resolution is 1.95mV/LSB, as a result,
+ * format[PSC_VOLTAGE_OUT] can not be set to vid directly. Adding extra
+ * vid_offset variable for vout telemetry.
+ */
+ ret = DIV_ROUND_CLOSEST(((ret & GENMASK(11, 0)) + data->vid_offset[page]) *
+ data->vout_scale[page], MP2925_VOUT_DIV);
break;
case PMBUS_VOUT_OV_FAULT_LIMIT:
case PMBUS_VOUT_UV_FAULT_LIMIT:
@@ -231,10 +239,21 @@ mp2925_identify_vout_scale(struct i2c_client *client, struct pmbus_driver_info *
data->vout_scale[page] = 2560;
else
data->vout_scale[page] = 5120;
+
+ /*
+ * In vid mode, the MP2925 vout telemetry has 49 vid step offset, but
+ * PMBUS_VOUT_OV_FAULT_LIMIT and PMBUS_VOUT_UV_FAULT_LIMIT do not take
+ * this into consideration, its resolution is 1.95mV/LSB, as a result,
+ * format[PSC_VOLTAGE_OUT] can not be set to vid directly. Adding extra
+ * vid_offset variable for vout telemetry.
+ */
+ data->vid_offset[page] = 49;
} else if (FIELD_GET(GENMASK(4, 4), ret)) {
data->vout_scale[page] = 1;
+ data->vid_offset[page] = 0;
} else {
data->vout_scale[page] = 512;
+ data->vid_offset[page] = 0;
}
return 0;
--
2.43.0
prev parent reply other threads:[~2026-03-19 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 7:35 [PATCH linux dev-6.18 1/3] dt-bindings: hwmon: Add MPS mp2925 and mp2929 Jackson Liu
2026-03-19 7:35 ` [PATCH linux dev-6.18 2/3] hwmon: Add MP2925 and MP2929 driver Jackson Liu
2026-03-19 7:35 ` Jackson Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260319073515.1577998-3-Jackson.Liu@quantatw.com \
--to=jackson870728@gmail.com \
--cc=andrew@codeconstruct.com.au \
--cc=jackson.liu@quantatw.com \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox