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 v2] hwmon: (pmbus) Clear only CML invalid command fault during probe
Date: Thu, 19 Nov 2026 01:32:08 +0000 [thread overview]
Message-ID: <20261119013208.4089480-1-akorn@google.com> (raw)
During driver initialization and register capability probing, pmbus_core
and the generic pmbus driver send CLEAR_FAULTS (0x03) to clear any
communication or command faults triggered while probing unsupported
registers. However, CLEAR_FAULTS unconditionally clears all latched
fault status bits across the device, including hardware power fault
registers such as STATUS_WORD, STATUS_VOUT, STATUS_IOUT, and
STATUS_MFR_SPECIFIC. As a result, a BMC reboot or driver re-probe erases
pre-existing voltage regulator fault telemetry before monitoring or
diagnostic tools can inspect it.
Simply omitting fault clearing during probe is not viable because
probing unsupported commands (such as PMBUS_PAGE on single-page PMBus
devices) asserts PB_CML_FAULT_INVALID_COMMAND in STATUS_CML. Leaving
that bit latched causes pmbus_check_status_cml() to fail subsequent
capability checks (including PMBUS_VOUT_MODE and sensor discovery) with
-EIO.
Starting with PMBus Revision 1.2, individual bits in STATUS_CML can be
cleared via Write-1-to-Clear (W1C), a mechanism pmbus_core already uses
in pmbus_get_boolean(). Introduce pmbus_clear_cml_fault() and export
pmbus_clear_cml_faults() in the "PMBUS" module namespace to write
PB_CML_FAULT_INVALID_COMMAND to PMBUS_STATUS_CML during device
initialization, register probing, and pmbus_identify() on PMBus 1.2+
devices while preserving all other latched fault bits. Fall back to
pmbus_clear_fault_page() on PMBus < 1.2 devices or if writing
PMBUS_STATUS_CML fails.
Tested on BMC hardware across 130 hwmon devices (105 PMBus devices
covering tda38740/xdpe1a2g5b, isl68137/raa228234, adm1266,
ltc4286/ltc4287, and generic pmbus regulators including TI
tps546e25/tps546b25 and factory write-protected converters), verifying
that all devices probe cleanly with no -EIO regressions. Also verified
via unbind, fault injection, and re-bind across both driver-specific and
generic pmbus_identify() paths that PB_CML_FAULT_INVALID_COMMAND in
PMBUS_STATUS_CML is cleared on probe while other STATUS_CML and
STATUS_WORD fault bits remain preserved, and verified clean fallback
when writing PMBUS_STATUS_CML is NACKed.
Signed-off-by: Arthur Korn <akorn@google.com>
---
Changes in v2:
- Fall back to pmbus_clear_fault_page() if writing PMBUS_STATUS_CML
fails (e.g. NACK on devices that do not support W1C on STATUS_CML).
- Export pmbus_clear_cml_faults() in the "PMBUS" namespace and use it in
pmbus_identify() (pmbus.c) so generic pmbus devices also preserve
non-CML faults during probe.
- Re-tested on hardware covering generic pmbus_identify() fault
preservation and the STATUS_CML write-failure fallback path.
drivers/hwmon/pmbus/pmbus.c | 2 +-
drivers/hwmon/pmbus/pmbus.h | 1 +
drivers/hwmon/pmbus/pmbus_core.c | 30 +++++++++++++++++++++++++-----
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index f8189c11..f239dafb 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -113,7 +113,7 @@ static int pmbus_identify(struct i2c_client *client,
info->pages = 1;
}
- pmbus_clear_faults(client);
+ pmbus_clear_cml_faults(client);
}
if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index 5525c048..8170098f 100644
--- a/drivers/hwmon/pmbus/pmbus.h
+++ b/drivers/hwmon/pmbus/pmbus.h
@@ -581,6 +581,7 @@ int pmbus_write_byte_data(struct i2c_client *client, int page, u8 reg,
int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg,
u8 mask, u8 value);
void pmbus_clear_faults(struct i2c_client *client);
+void pmbus_clear_cml_faults(struct i2c_client *client);
void pmbus_check_and_notify_faults(struct i2c_client *client);
bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);
bool pmbus_check_word_register(struct i2c_client *client, int page, int reg);
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index b3aa7f1a..a5255ffb 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -717,6 +717,26 @@ void pmbus_clear_faults(struct i2c_client *client)
}
EXPORT_SYMBOL_NS_GPL(pmbus_clear_faults, "PMBUS");
+static void pmbus_clear_cml_fault(struct i2c_client *client, int page)
+{
+ struct pmbus_data *data = i2c_get_clientdata(client);
+
+ if (data->revision < PMBUS_REV_12 ||
+ _pmbus_write_byte_data(client, page, PMBUS_STATUS_CML,
+ PB_CML_FAULT_INVALID_COMMAND) < 0)
+ pmbus_clear_fault_page(client, page);
+}
+
+void pmbus_clear_cml_faults(struct i2c_client *client)
+{
+ struct pmbus_data *data = i2c_get_clientdata(client);
+ int i;
+
+ for (i = 0; i < data->info->pages; i++)
+ pmbus_clear_cml_fault(client, i);
+}
+EXPORT_SYMBOL_NS_GPL(pmbus_clear_cml_faults, "PMBUS");
+
static int pmbus_check_status_cml(struct i2c_client *client)
{
struct pmbus_data *data = i2c_get_clientdata(client);
@@ -745,7 +765,7 @@ static bool pmbus_check_register(struct i2c_client *client,
if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
data->read_status(client, -1);
if (reg < PMBUS_VIRT_BASE)
- pmbus_clear_fault_page(client, -1);
+ pmbus_clear_cml_fault(client, -1);
return rv >= 0;
}
@@ -762,7 +782,7 @@ static bool pmbus_check_status_register(struct i2c_client *client, int page)
status = -EIO;
}
- pmbus_clear_fault_page(client, -1);
+ pmbus_clear_cml_fault(client, -1);
return status >= 0;
}
@@ -790,7 +810,7 @@ static bool __maybe_unused pmbus_check_block_register(struct i2c_client *client,
rv = pmbus_check_status_cml(client);
if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
data->read_status(client, -1);
- pmbus_clear_fault_page(client, -1);
+ pmbus_clear_cml_fault(client, -1);
return rv >= 0;
}
@@ -3053,9 +3073,9 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
}
if (data->info->pages)
- pmbus_clear_faults(client);
+ pmbus_clear_cml_faults(client);
else
- pmbus_clear_fault_page(client, -1);
+ pmbus_clear_cml_fault(client, -1);
if (info->identify) {
ret = (*info->identify)(client, info);
--
2.56.1.703.gf848ed807c-goog
next reply other threads:[~2026-11-19 1:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 1:32 Arthur Korn [this message]
2026-11-19 2:08 ` [PATCH v2] hwmon: (pmbus) Clear only CML invalid command fault during probe sashiko-bot
2026-11-19 2:29 ` Guenter Roeck
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=20261119013208.4089480-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.