• Guenter Roeck's avatar
    hwmon: (pmbus/adm1275) Fix problems with temperature monitoring on ADM1272 · b153a0bb
    Guenter Roeck authored
    The PMON_CONFIG register on ADM1272 is a 16 bit register. Writing a 8 bit
    value into it clears the upper 8 bits of the register, resulting in
    unexpected side effects. Fix by writing the 16 bit register value.
    
    Also, it has been reported that temperature readings are sometimes widely
    inaccurate, to the point where readings may result in device shutdown due
    to errant overtemperature faults. Improve by enabling temperature sampling.
    
    While at it, move the common code for ADM1272 and ADM1278 into a separate
    function, and clarify in the error message that an attempt was made to
    enable both VOUT and temperature monitoring.
    
    Last but not least, return the error code reported by the underlying I2C
    controller and not -ENODEV if updating the PMON_CONFIG register fails.
    After all, this does not indicate that the chip is not present, but an
    error in the communication with the chip.
    
    Fixes: 4ff0ce22 ("hwmon: (pmbus/adm1275) Add support for ADM1272")
    Fixes: 9da9c2dc ("hwmon: (adm1275) enable adm1272 temperature reporting")
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20230602213447.3557346-1-linux@roeck-us.netSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    b153a0bb
adm1275.c 22.7 KB