Skip to content

Commit 1125bac

Browse files
cpackham-atlnzgroeck
authored andcommitted
hwmon: (pmbus/bpa-rs600) Add workaround for incorrect Pin max
BPD-RS600 modules running firmware v5.70 misreport the MFR_PIN_MAX. The indicate a maximum of 1640W instead of 700W. Detect the invalid reading and return a sensible value instead. Signed-off-by: Chris Packham <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 7a8c68c commit 1125bac

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/hwmon/pmbus/bpa-rs600.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ static int bpa_rs600_read_vin(struct i2c_client *client)
6565
return ret;
6666
}
6767

68+
/*
69+
* Firmware V5.70 incorrectly reports 1640W for MFR_PIN_MAX.
70+
* Deal with this by returning a sensible value.
71+
*/
72+
static int bpa_rs600_read_pin_max(struct i2c_client *client)
73+
{
74+
int ret;
75+
76+
ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_MFR_PIN_MAX);
77+
if (ret < 0)
78+
return ret;
79+
80+
/* Detect invalid 1640W (linear encoding) */
81+
if (ret == 0x0b34)
82+
/* Report 700W (linear encoding) */
83+
return 0x095e;
84+
85+
return ret;
86+
}
87+
6888
static int bpa_rs600_read_word_data(struct i2c_client *client, int page, int phase, int reg)
6989
{
7090
int ret;
@@ -91,6 +111,9 @@ static int bpa_rs600_read_word_data(struct i2c_client *client, int page, int pha
91111
case PMBUS_READ_VIN:
92112
ret = bpa_rs600_read_vin(client);
93113
break;
114+
case PMBUS_MFR_PIN_MAX:
115+
ret = bpa_rs600_read_pin_max(client);
116+
break;
94117
default:
95118
if (reg >= PMBUS_VIRT_BASE)
96119
ret = -ENXIO;

0 commit comments

Comments
 (0)