|
@@ -1513,7 +1513,7 @@ static void nct6775_update_pwm(struct device *dev)
|
|
|
duty_is_dc = data->REG_PWM_MODE[i] &&
|
|
|
(nct6775_read_value(data, data->REG_PWM_MODE[i])
|
|
|
& data->PWM_MODE_MASK[i]);
|
|
|
- data->pwm_mode[i] = duty_is_dc;
|
|
|
+ data->pwm_mode[i] = !duty_is_dc;
|
|
|
|
|
|
fanmodecfg = nct6775_read_value(data, data->REG_FAN_MODE[i]);
|
|
|
for (j = 0; j < ARRAY_SIZE(data->REG_PWM); j++) {
|
|
@@ -2397,7 +2397,7 @@ show_pwm_mode(struct device *dev, struct device_attribute *attr, char *buf)
|
|
|
struct nct6775_data *data = nct6775_update_device(dev);
|
|
|
struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
|
|
|
|
|
|
- return sprintf(buf, "%d\n", !data->pwm_mode[sattr->index]);
|
|
|
+ return sprintf(buf, "%d\n", data->pwm_mode[sattr->index]);
|
|
|
}
|
|
|
|
|
|
static ssize_t
|
|
@@ -2418,9 +2418,9 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
|
|
|
if (val > 1)
|
|
|
return -EINVAL;
|
|
|
|
|
|
- /* Setting DC mode is not supported for all chips/channels */
|
|
|
+ /* Setting DC mode (0) is not supported for all chips/channels */
|
|
|
if (data->REG_PWM_MODE[nr] == 0) {
|
|
|
- if (val)
|
|
|
+ if (!val)
|
|
|
return -EINVAL;
|
|
|
return count;
|
|
|
}
|
|
@@ -2429,7 +2429,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
|
|
|
data->pwm_mode[nr] = val;
|
|
|
reg = nct6775_read_value(data, data->REG_PWM_MODE[nr]);
|
|
|
reg &= ~data->PWM_MODE_MASK[nr];
|
|
|
- if (val)
|
|
|
+ if (!val)
|
|
|
reg |= data->PWM_MODE_MASK[nr];
|
|
|
nct6775_write_value(data, data->REG_PWM_MODE[nr], reg);
|
|
|
mutex_unlock(&data->update_lock);
|