diff options
Diffstat (limited to 'drivers/hwmon/nct6775.c')
-rw-r--r-- | drivers/hwmon/nct6775.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index fdf24f008d75..aebce560bfaf 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -1513,7 +1513,7 @@ static void nct6775_update_pwm(struct device *dev) | |||
1513 | duty_is_dc = data->REG_PWM_MODE[i] && | 1513 | duty_is_dc = data->REG_PWM_MODE[i] && |
1514 | (nct6775_read_value(data, data->REG_PWM_MODE[i]) | 1514 | (nct6775_read_value(data, data->REG_PWM_MODE[i]) |
1515 | & data->PWM_MODE_MASK[i]); | 1515 | & data->PWM_MODE_MASK[i]); |
1516 | data->pwm_mode[i] = duty_is_dc; | 1516 | data->pwm_mode[i] = !duty_is_dc; |
1517 | 1517 | ||
1518 | fanmodecfg = nct6775_read_value(data, data->REG_FAN_MODE[i]); | 1518 | fanmodecfg = nct6775_read_value(data, data->REG_FAN_MODE[i]); |
1519 | for (j = 0; j < ARRAY_SIZE(data->REG_PWM); j++) { | 1519 | 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) | |||
2397 | struct nct6775_data *data = nct6775_update_device(dev); | 2397 | struct nct6775_data *data = nct6775_update_device(dev); |
2398 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 2398 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
2399 | 2399 | ||
2400 | return sprintf(buf, "%d\n", !data->pwm_mode[sattr->index]); | 2400 | return sprintf(buf, "%d\n", data->pwm_mode[sattr->index]); |
2401 | } | 2401 | } |
2402 | 2402 | ||
2403 | static ssize_t | 2403 | static ssize_t |
@@ -2418,9 +2418,9 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
2418 | if (val > 1) | 2418 | if (val > 1) |
2419 | return -EINVAL; | 2419 | return -EINVAL; |
2420 | 2420 | ||
2421 | /* Setting DC mode is not supported for all chips/channels */ | 2421 | /* Setting DC mode (0) is not supported for all chips/channels */ |
2422 | if (data->REG_PWM_MODE[nr] == 0) { | 2422 | if (data->REG_PWM_MODE[nr] == 0) { |
2423 | if (val) | 2423 | if (!val) |
2424 | return -EINVAL; | 2424 | return -EINVAL; |
2425 | return count; | 2425 | return count; |
2426 | } | 2426 | } |
@@ -2429,7 +2429,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
2429 | data->pwm_mode[nr] = val; | 2429 | data->pwm_mode[nr] = val; |
2430 | reg = nct6775_read_value(data, data->REG_PWM_MODE[nr]); | 2430 | reg = nct6775_read_value(data, data->REG_PWM_MODE[nr]); |
2431 | reg &= ~data->PWM_MODE_MASK[nr]; | 2431 | reg &= ~data->PWM_MODE_MASK[nr]; |
2432 | if (val) | 2432 | if (!val) |
2433 | reg |= data->PWM_MODE_MASK[nr]; | 2433 | reg |= data->PWM_MODE_MASK[nr]; |
2434 | nct6775_write_value(data, data->REG_PWM_MODE[nr], reg); | 2434 | nct6775_write_value(data, data->REG_PWM_MODE[nr], reg); |
2435 | mutex_unlock(&data->update_lock); | 2435 | mutex_unlock(&data->update_lock); |