Skip to content

Commit f067d55

Browse files
bjwymangroeck
authored andcommitted
hwmon: (pmbus/ibm-cffps) max_power_out swap changes
The bytes for max_power_out from the ibm-cffps devices differ in byte order for some power supplies. The Witherspoon power supply returns the bytes in MSB/LSB order. The Rainier power supply returns the bytes in LSB/MSB order. The Witherspoon power supply uses version cffps1. The Rainier power supply should use version cffps2. If version is cffps1, swap the bytes before output to max_power_out. Tested: Witherspoon before: 3148. Witherspoon after: 3148. Rainier before: 53255. Rainier after: 2000. Signed-off-by: Brandon Wyman <[email protected]> Reviewed-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] [groeck: Replaced yoda programming] Signed-off-by: Guenter Roeck <[email protected]>
1 parent ffa2600 commit f067d55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/hwmon/pmbus/ibm-cffps.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,14 @@ static ssize_t ibm_cffps_debugfs_read(struct file *file, char __user *buf,
171171
cmd = CFFPS_SN_CMD;
172172
break;
173173
case CFFPS_DEBUGFS_MAX_POWER_OUT:
174-
rc = i2c_smbus_read_word_swapped(psu->client,
175-
CFFPS_MAX_POWER_OUT_CMD);
174+
if (psu->version == cffps1) {
175+
rc = i2c_smbus_read_word_swapped(psu->client,
176+
CFFPS_MAX_POWER_OUT_CMD);
177+
} else {
178+
rc = i2c_smbus_read_word_data(psu->client,
179+
CFFPS_MAX_POWER_OUT_CMD);
180+
}
181+
176182
if (rc < 0)
177183
return rc;
178184

0 commit comments

Comments
 (0)