diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-01-27 17:56:06 -0800 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-01-29 13:06:07 -0800 |
commit | ad77c3e1808f07fa70f707b1c92a683b7c7d3f85 (patch) | |
tree | 114fda730a4d3d03a89854a228a6927075335a6a /drivers/hwmon/w83627ehf.c | |
parent | 6edf3c30af01854c416f8654d3d5d2652470afd4 (diff) | |
download | linux-ad77c3e1808f07fa70f707b1c92a683b7c7d3f85.tar.bz2 |
hwmon: (w83627ehf) Disable setting DC mode for pwm2, pwm3 on NCT6776F
NCT6776F only supports pwm mode for pwm2 and pwm3. Return error if an attempt
is made to set those pwm channels to DC mode.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org # 3.0+
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 0e0af0445222..2dfae7d7cc5b 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1319,6 +1319,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr, { struct w83627ehf_data *data = dev_get_drvdata(dev); struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + struct w83627ehf_sio_data *sio_data = dev->platform_data; int nr = sensor_attr->index; unsigned long val; int err; @@ -1330,6 +1331,11 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr, if (val > 1) return -EINVAL; + + /* On NCT67766F, DC mode is only supported for pwm1 */ + if (sio_data->kind == nct6776 && nr && val != 1) + return -EINVAL; + mutex_lock(&data->update_lock); reg = w83627ehf_read_value(data, W83627EHF_REG_PWM_ENABLE[nr]); data->pwm_mode[nr] = val; |