Skip to content

Commit 509c3a3

Browse files
jbrun3tgroeck
authored andcommitted
hwmon: (pmbus/core) clear faults after setting smbalert mask
pmbus_write_smbalert_mask() ignores the errors if the chip can't set smbalert mask the standard way. It is not necessarily a problem for the irq support if the chip is otherwise properly setup but it may leave an uncleared fault behind. pmbus_core will pick the fault on the next register_check(). The register check will fails regardless of the actual register support by the chip. This leads to missing attributes or debugfs entries for chips that should provide them. We cannot rely on register_check() as PMBUS_SMBALERT_MASK may be read-only. Unconditionally clear the page fault after setting PMBUS_SMBALERT_MASK to avoid the problem. Suggested-by: Guenter Roeck <[email protected]> Fixes: 221819c ("hwmon: (pmbus/core) Add interrupt support") Signed-off-by: Jerome Brunet <[email protected]> Message-ID: <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 7a750b3 commit 509c3a3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/hwmon/pmbus/pmbus_core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3277,7 +3277,17 @@ static int pmbus_regulator_notify(struct pmbus_data *data, int page, int event)
32773277

32783278
static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg, u8 val)
32793279
{
3280-
return _pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8));
3280+
int ret;
3281+
3282+
ret = _pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8));
3283+
3284+
/*
3285+
* Clear fault systematically in case writing PMBUS_SMBALERT_MASK
3286+
* is not supported by the chip.
3287+
*/
3288+
pmbus_clear_fault_page(client, page);
3289+
3290+
return ret;
32813291
}
32823292

32833293
static irqreturn_t pmbus_fault_handler(int irq, void *pdata)

0 commit comments

Comments
 (0)