• Patryk Biel's avatar
    hwmon: (pmbus) Conditionally clear individual status bits for pmbus rev >= 1.2 · 20471071
    Patryk Biel authored
    The current implementation of pmbus_show_boolean assumes that all devices
    support write-back operation of status register to clear pending warnings
    or faults. Since clearing individual bits in the status registers was only
    introduced in PMBus specification 1.2, this operation may not be supported
    by some older devices. This can result in an error while reading boolean
    attributes such as temp1_max_alarm.
    
    Fetch PMBus revision supported by the device and modify pmbus_show_boolean
    so that it only tries to clear individual status bits if the device is
    compliant with PMBus specs >= 1.2. Otherwise clear all fault indicators
    on the current page after a fault status was reported.
    
    Fixes: 35f165f0 ("hwmon: (pmbus) Clear pmbus fault/warning bits after read")
    Signed-off-by: default avatarPatryk Biel <pbiel7@gmail.com>
    Message-ID: <20240909-pmbus-status-reg-clearing-v1-1-f1c0d68c6408@gmail.com>
    [groeck:
     Rewrote description
     Moved revision detection code ahead of clear faults command
     Assigned revision if return value from PMBUS_REVISION command is 0
     Improved return value check from calling _pmbus_write_byte_data()]
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    20471071
pmbus_core.c 91.2 KB