mirror of
https://github.com/Fred78290/nct6687d
synced 2025-01-15 15:41:03 +01:00
Merge pull request #91 from desowin/pwm-readback-fan2go-workaround
[RFC] Update cached pwm values on pwm store
This commit is contained in:
commit
0ee35ed954
1 changed files with 12 additions and 1 deletions
11
nct6687.c
11
nct6687.c
|
@ -789,6 +789,8 @@ static ssize_t store_pwm(struct device *dev, struct device_attribute *attr, cons
|
||||||
struct nct6687_data *data = dev_get_drvdata(dev);
|
struct nct6687_data *data = dev_get_drvdata(dev);
|
||||||
int index = sattr->index;
|
int index = sattr->index;
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
int retry;
|
||||||
|
u16 readback;
|
||||||
u16 mode;
|
u16 mode;
|
||||||
u8 bitMask;
|
u8 bitMask;
|
||||||
|
|
||||||
|
@ -809,8 +811,17 @@ static ssize_t store_pwm(struct device *dev, struct device_attribute *attr, cons
|
||||||
msleep(50);
|
msleep(50);
|
||||||
nct6687_write(data, NCT6687_REG_PWM_WRITE(index), val);
|
nct6687_write(data, NCT6687_REG_PWM_WRITE(index), val);
|
||||||
nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND(index), NCT6687_FAN_CFG_DONE);
|
nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND(index), NCT6687_FAN_CFG_DONE);
|
||||||
|
|
||||||
|
for (retry = 0; retry < 20; retry++) {
|
||||||
msleep(50);
|
msleep(50);
|
||||||
|
|
||||||
|
readback = nct6687_read(data, NCT6687_REG_PWM(index));
|
||||||
|
if (readback == val)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
data->pwm[index] = readback;
|
||||||
|
data->pwm_enable[index] = nct6687_get_pwm_enable(data, index);
|
||||||
|
|
||||||
mutex_unlock(&data->update_lock);
|
mutex_unlock(&data->update_lock);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in a new issue