aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83627ehf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r--drivers/hwmon/w83627ehf.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 0e0af0445222..5276d1933dbc 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,
1319{ 1319{
1320 struct w83627ehf_data *data = dev_get_drvdata(dev); 1320 struct w83627ehf_data *data = dev_get_drvdata(dev);
1321 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1321 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1322 struct w83627ehf_sio_data *sio_data = dev->platform_data;
1322 int nr = sensor_attr->index; 1323 int nr = sensor_attr->index;
1323 unsigned long val; 1324 unsigned long val;
1324 int err; 1325 int err;
@@ -1330,6 +1331,11 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
1330 1331
1331 if (val > 1) 1332 if (val > 1)
1332 return -EINVAL; 1333 return -EINVAL;
1334
1335 /* On NCT67766F, DC mode is only supported for pwm1 */
1336 if (sio_data->kind == nct6776 && nr && val != 1)
1337 return -EINVAL;
1338
1333 mutex_lock(&data->update_lock); 1339 mutex_lock(&data->update_lock);
1334 reg = w83627ehf_read_value(data, W83627EHF_REG_PWM_ENABLE[nr]); 1340 reg = w83627ehf_read_value(data, W83627EHF_REG_PWM_ENABLE[nr]);
1335 data->pwm_mode[nr] = val; 1341 data->pwm_mode[nr] = val;
@@ -1914,9 +1920,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data,
1914 fan4min = 0; 1920 fan4min = 0;
1915 fan5pin = 0; 1921 fan5pin = 0;
1916 } else if (sio_data->kind == nct6776) { 1922 } else if (sio_data->kind == nct6776) {
1917 fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40); 1923 bool gpok = superio_inb(sio_data->sioreg, 0x27) & 0x80;
1918 fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01); 1924
1919 fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02); 1925 superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
1926 regval = superio_inb(sio_data->sioreg, SIO_REG_ENABLE);
1927
1928 if (regval & 0x80)
1929 fan3pin = gpok;
1930 else
1931 fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40);
1932
1933 if (regval & 0x40)
1934 fan4pin = gpok;
1935 else
1936 fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01);
1937
1938 if (regval & 0x20)
1939 fan5pin = gpok;
1940 else
1941 fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02);
1942
1920 fan4min = fan4pin; 1943 fan4min = fan4pin;
1921 } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { 1944 } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
1922 fan3pin = 1; 1945 fan3pin = 1;
@@ -2331,11 +2354,6 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
2331 for (i = 0; i < data->pwm_num; i++) 2354 for (i = 0; i < data->pwm_num; i++)
2332 data->pwm_enable_orig[i] = data->pwm_enable[i]; 2355 data->pwm_enable_orig[i] = data->pwm_enable[i];
2333 2356
2334 /* Read pwm data to save original values */
2335 w83627ehf_update_pwm_common(dev, data);
2336 for (i = 0; i < data->pwm_num; i++)
2337 data->pwm_enable_orig[i] = data->pwm_enable[i];
2338
2339 /* Register sysfs hooks */ 2357 /* Register sysfs hooks */
2340 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) { 2358 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) {
2341 err = device_create_file(dev, &sda_sf3_arrays[i].dev_attr); 2359 err = device_create_file(dev, &sda_sf3_arrays[i].dev_attr);