hwmon: (pmbus/core) export pmbus_check_and_notify_faults()

Factor of pmbus_fault_handler() into an exported helper so
drivers can notify sequence from a polling work item on boards
for which the chip's SMBALERT# pin is not wired to the
CPU. The interrupt handler becomes a thin wrapper.

Like the SMBALERT# path, the helper notifies and then clears the
latched faults unconditionally, so a polling caller inherits exactly
the interrupt semantics.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Link: https://lore.kernel.org/r/20260730-mpq8646_v0-v7-1-e7c7ad768d5d@free.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Vincent Jardin 2026-07-30 17:43:59 +02:00 committed by Guenter Roeck
parent 53a945a89d
commit bf69cb4197
2 changed files with 12 additions and 3 deletions

View File

@ -572,6 +572,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_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);
int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);

View File

@ -3461,10 +3461,9 @@ static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg,
return ret;
}
static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
void pmbus_check_and_notify_faults(struct i2c_client *client)
{
struct pmbus_data *data = pdata;
struct i2c_client *client = to_i2c_client(data->dev);
struct pmbus_data *data = i2c_get_clientdata(client);
int i, status, event;
guard(pmbus_lock)(client);
@ -3477,6 +3476,15 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
}
pmbus_clear_faults(client);
}
EXPORT_SYMBOL_NS_GPL(pmbus_check_and_notify_faults, "PMBUS");
static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
{
struct pmbus_data *data = pdata;
struct i2c_client *client = to_i2c_client(data->dev);
pmbus_check_and_notify_faults(client);
return IRQ_HANDLED;
}