Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Arthur Korn <akorn@google.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Arthur Korn <akorn@google.com>
Subject: [PATCH v3 1/2] hwmon: (pmbus/max16601) Support byte data writes on VSA rail
Date: Fri, 20 Nov 2026 02:44:15 +0000	[thread overview]
Message-ID: <20261120024416.338876-1-akorn@google.com> (raw)

MAX16601 exposes the secondary VSA rail on virtual PMBus page 2 backed
by a separate I2C client (data->vsa), while page 1 is a read-only
virtual page for VCORE input current and power telemetry. Although the
driver routes byte reads on page 2 to data->vsa via max16601_read_byte()
and PMBUS_CLEAR_FAULTS byte writes via max16601_write_byte(), it does
not implement write_byte_data(), and max16601_write_byte() falls through
to -ENODATA on virtual page 1.

As a result, PMBus 1.2+ byte-data status writes from pmbus_core (such as
clearing individual status bits in pmbus_get_boolean() or clearing
STATUS_CML faults during probe) on page 2 are sent to the primary VCORE
client instead of data->vsa, and byte writes on virtual page 1 fall
through to page 0.

Implement max16601_write_byte_data() mirroring max16601_read_byte() to
forward page 2 byte-data writes to data->vsa and reject virtual page 1
with -EOPNOTSUPP, and reject virtual page 1 in max16601_write_byte() as
well.

Fixes: 2138f8853a00 ("hwmon: (pmbus) Driver for Maxim MAX16601")
Signed-off-by: Arthur Korn <akorn@google.com>
---
Changes in v3:
- New preparatory patch to route MAX16601 page 2 (VSA) byte-data writes
  to data->vsa and reject virtual page 1 byte/byte-data writes.

 drivers/hwmon/pmbus/max16601.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/max16601.c b/drivers/hwmon/pmbus/max16601.c
index 2eca7525..f9138fc0 100644
--- a/drivers/hwmon/pmbus/max16601.c
+++ b/drivers/hwmon/pmbus/max16601.c
@@ -153,14 +153,28 @@ static int max16601_write_byte(struct i2c_client *client, int page, u8 reg)
 	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
 	struct max16601_data *data = to_max16601_data(info);
 
-	if (page == 2) {
-		if (reg == PMBUS_CLEAR_FAULTS)
+	if (page > 0) {
+		if (page == 2 && reg == PMBUS_CLEAR_FAULTS)
 			return i2c_smbus_write_byte(data->vsa, reg);
 		return -EOPNOTSUPP;
 	}
 	return -ENODATA;
 }
 
+static int max16601_write_byte_data(struct i2c_client *client, int page,
+				    int reg, u8 value)
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max16601_data *data = to_max16601_data(info);
+
+	if (page > 0) {
+		if (page == 2)	/* VSA */
+			return i2c_smbus_write_byte_data(data->vsa, reg, value);
+		return -EOPNOTSUPP;
+	}
+	return -ENODATA;
+}
+
 static int max16601_write_word(struct i2c_client *client, int page, int reg,
 			       u16 value)
 {
@@ -252,6 +266,7 @@ static struct pmbus_driver_info max16601_info = {
 	.read_byte_data = max16601_read_byte,
 	.read_word_data = max16601_read_word,
 	.write_byte = max16601_write_byte,
+	.write_byte_data = max16601_write_byte_data,
 	.write_word_data = max16601_write_word,
 };
 
-- 
2.56.1.703.gf848ed807c-goog


             reply	other threads:[~2026-11-20  2:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  2:44 Arthur Korn [this message]
2026-11-20  2:44 ` [PATCH v3 2/2] hwmon: (pmbus) Clear only CML command and data faults during probe Arthur Korn
2026-11-20  2:52   ` sashiko-bot
2026-11-20  2:47 ` [PATCH v3 1/2] hwmon: (pmbus/max16601) Support byte data writes on VSA rail sashiko-bot

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=20261120024416.338876-1-akorn@google.com \
    --to=akorn@google.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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