Fix restoring automatic fan mode on module unload

nct6687_restore_fan_control() could only restore manual fan control, but
not the automatic one due to the way it applied previous state of the
bit.
This commit is contained in:
xaizek
2024-01-20 17:22:35 +02:00
parent aba6f2b9ed
commit 3937b12170

View File

@@ -819,7 +819,8 @@ static void nct6687_restore_fan_control(struct nct6687_data *data, int index)
if (data->_restoreDefaultFanControlRequired[index])
{
u8 mode = nct6687_read(data, NCT6687_REG_FAN_CTRL_MODE(index));
mode = (u8)(mode & ~data->_initialFanControlMode[index]);
u8 bitMask = 0x01 << index;
mode = (u8)((mode & ~bitMask) | data->_initialFanControlMode[index]);
nct6687_write(data, NCT6687_REG_FAN_CTRL_MODE(index), mode);