Skip to content

Commit bc8a557

Browse files
Zynngregkh
authored andcommitted
hwmon: (pmbus/max34440) Fix OC fault limits
commit 2b52278 upstream. The max34* family have the IOUT_OC_WARN_LIMIT and IOUT_OC_CRIT_LIMIT registers swapped. Cc: stable@vger.kernel.org Signed-off-by: Steve Foreman <foremans@google.com> [groeck: Updated subject, use C comment style, tab after defines] [groeck: Added missing break; statements (by alexandru.ardelean@analog.com)] Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9767f1d commit bc8a557

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/hwmon/pmbus/max34440.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };
3131
#define MAX34440_STATUS_OT_FAULT BIT(5)
3232
#define MAX34440_STATUS_OT_WARN BIT(6)
3333

34+
/*
35+
* The whole max344* family have IOUT_OC_WARN_LIMIT and IOUT_OC_FAULT_LIMIT
36+
* swapped from the standard pmbus spec addresses.
37+
*/
38+
#define MAX34440_IOUT_OC_WARN_LIMIT 0x46
39+
#define MAX34440_IOUT_OC_FAULT_LIMIT 0x4A
40+
3441
#define MAX34451_MFR_CHANNEL_CONFIG 0xe4
3542
#define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3f
3643

@@ -49,6 +56,14 @@ static int max34440_read_word_data(struct i2c_client *client, int page,
4956
const struct max34440_data *data = to_max34440_data(info);
5057

5158
switch (reg) {
59+
case PMBUS_IOUT_OC_FAULT_LIMIT:
60+
ret = pmbus_read_word_data(client, page, phase,
61+
MAX34440_IOUT_OC_FAULT_LIMIT);
62+
break;
63+
case PMBUS_IOUT_OC_WARN_LIMIT:
64+
ret = pmbus_read_word_data(client, page, phase,
65+
MAX34440_IOUT_OC_WARN_LIMIT);
66+
break;
5267
case PMBUS_VIRT_READ_VOUT_MIN:
5368
ret = pmbus_read_word_data(client, page, phase,
5469
MAX34440_MFR_VOUT_MIN);
@@ -115,6 +130,14 @@ static int max34440_write_word_data(struct i2c_client *client, int page,
115130
int ret;
116131

117132
switch (reg) {
133+
case PMBUS_IOUT_OC_FAULT_LIMIT:
134+
ret = pmbus_write_word_data(client, page, MAX34440_IOUT_OC_FAULT_LIMIT,
135+
word);
136+
break;
137+
case PMBUS_IOUT_OC_WARN_LIMIT:
138+
ret = pmbus_write_word_data(client, page, MAX34440_IOUT_OC_WARN_LIMIT,
139+
word);
140+
break;
118141
case PMBUS_VIRT_RESET_POUT_HISTORY:
119142
ret = pmbus_write_word_data(client, page,
120143
MAX34446_MFR_POUT_PEAK, 0);

0 commit comments

Comments
 (0)