hwmon: (adm1275) Make sure we are reading enough data for different chips
authorChu Lin <linchuyuan@google.com>
Thu, 9 Jul 2020 04:06:12 +0000 (04:06 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 9 Jul 2020 14:02:35 +0000 (07:02 -0700)
commit6d1d41c075a1a54ba03370e268171fec20e06563
tree0c11b3f334f291397aedbed5c68baaf43f15d9cb
parent14b0e83dc4f1e52b94acaeb85a18fd7fdd46d2dc
hwmon: (adm1275) Make sure we are reading enough data for different chips

Issue:
When PEC is enabled, binding adm1272 to the adm1275 would
fail due to PEC error. See below:
adm1275: probe of xxxx failed with error -74

Diagnosis:
Per the datasheet of adm1272, adm1278, adm1293 and amd1294,
PMON_CONFIG (0xd4) is 16bits wide. On the other hand,
PMON_CONFIG (0xd4) for adm1275 is 8bits wide. The driver should not
assume everything is 8bits wide and read only 8bits from it.

Solution:
If it is adm1272, adm1278, adm1293 and adm1294, use i2c_read_word.
Else, use i2c_read_byte

Testing:
Binding adm1272 to the driver.
The change is only tested on adm1272.

Signed-off-by: Chu Lin <linchuyuan@google.com>
Link: https://lore.kernel.org/r/20200709040612.3977094-1-linchuyuan@google.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/adm1275.c