mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 1/2] hwmon: (pmbus/max16601) Support byte data writes on VSA rail
@ 2026-11-20  2:44 Arthur Korn
  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 19:28 ` [PATCH v3 1/2] hwmon: (pmbus/max16601) Support byte data writes on VSA rail Guenter Roeck
  0 siblings, 2 replies; 4+ messages in thread
From: Arthur Korn @ 2026-11-20  2:44 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon, linux-kernel, Arthur Korn

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


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

end of thread, other threads:[~2026-11-20 19:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  2:44 [PATCH v3 1/2] hwmon: (pmbus/max16601) Support byte data writes on VSA rail Arthur Korn
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 19:28   ` Guenter Roeck
2026-11-20 19:28 ` [PATCH v3 1/2] hwmon: (pmbus/max16601) Support byte data writes on VSA rail Guenter Roeck

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

all inboxes | Powered by JetHome®