diff options
author | Jean Delvare <khali@linux-fr.org> | 2011-11-04 07:00:48 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-11-04 07:00:48 -0400 |
commit | eff7687d473c31cba3876c13e97eebc708eb8582 (patch) | |
tree | 59f2bcc34e01a7c125a335a45d42010bc66b2dc1 /drivers/hwmon | |
parent | 6ba71de5f81bbf639b5dcea2bc2c33cdb87ed782 (diff) |
hwmon: (w83627ehf) Add support for the W83627UHG
This is essentially a stripped down version of the W83627DHG. Noticeable
difference is that it is still powered with +5V, as older models, even
though the ADC resolution is 8 mV as newer models have.
Thanks to Ulf Bruman (Saab Group) for doing all the testing.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 5 | ||||
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 148 |
2 files changed, 125 insertions, 28 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 279a509dca9f..9ec854ae118b 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -1282,7 +1282,7 @@ config SENSORS_W83627HF | |||
1282 | will be called w83627hf. | 1282 | will be called w83627hf. |
1283 | 1283 | ||
1284 | config SENSORS_W83627EHF | 1284 | config SENSORS_W83627EHF |
1285 | tristate "Winbond W83627EHF/EHG/DHG, W83667HG, NCT6775F, NCT6776F" | 1285 | tristate "Winbond W83627EHF/EHG/DHG/UHG, W83667HG, NCT6775F, NCT6776F" |
1286 | depends on !PPC | 1286 | depends on !PPC |
1287 | select HWMON_VID | 1287 | select HWMON_VID |
1288 | help | 1288 | help |
@@ -1292,7 +1292,8 @@ config SENSORS_W83627EHF | |||
1292 | This driver also supports the W83627EHG, which is the lead-free | 1292 | This driver also supports the W83627EHG, which is the lead-free |
1293 | version of the W83627EHF, and the W83627DHG, which is a similar | 1293 | version of the W83627EHF, and the W83627DHG, which is a similar |
1294 | chip suited for specific Intel processors that use PECI such as | 1294 | chip suited for specific Intel processors that use PECI such as |
1295 | the Core 2 Duo. | 1295 | the Core 2 Duo. And also the W83627UHG, which is a stripped down |
1296 | version of the W83627DHG (as far as hardware monitoring goes.) | ||
1296 | 1297 | ||
1297 | This driver also supports Nuvoton W83667HG, W83667HG-B, NCT6775F | 1298 | This driver also supports Nuvoton W83667HG, W83667HG-B, NCT6775F |
1298 | (also known as W83667HG-I), and NCT6776F. | 1299 | (also known as W83667HG-I), and NCT6776F. |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 81534cbd0aff..483cb268781e 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | w83627ehf - Driver for the hardware monitoring functionality of | 2 | w83627ehf - Driver for the hardware monitoring functionality of |
3 | the Winbond W83627EHF Super-I/O chip | 3 | the Winbond W83627EHF Super-I/O chip |
4 | Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> | 4 | Copyright (C) 2005-2011 Jean Delvare <khali@linux-fr.org> |
5 | Copyright (C) 2006 Yuan Mu (Winbond), | 5 | Copyright (C) 2006 Yuan Mu (Winbond), |
6 | Rudolf Marek <r.marek@assembler.cz> | 6 | Rudolf Marek <r.marek@assembler.cz> |
7 | David Hubbard <david.c.hubbard@gmail.com> | 7 | David Hubbard <david.c.hubbard@gmail.com> |
@@ -39,6 +39,7 @@ | |||
39 | 0x8860 0xa1 | 39 | 0x8860 0xa1 |
40 | w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3 | 40 | w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3 |
41 | w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3 | 41 | w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3 |
42 | w83627uhg 8 2 2 2 0xa230 0xc1 0x5ca3 | ||
42 | w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3 | 43 | w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3 |
43 | w83667hg-b 9 5 3 4 0xb350 0xc1 0x5ca3 | 44 | w83667hg-b 9 5 3 4 0xb350 0xc1 0x5ca3 |
44 | nct6775f 9 4 3 9 0xb470 0xc1 0x5ca3 | 45 | nct6775f 9 4 3 9 0xb470 0xc1 0x5ca3 |
@@ -61,14 +62,17 @@ | |||
61 | #include <linux/io.h> | 62 | #include <linux/io.h> |
62 | #include "lm75.h" | 63 | #include "lm75.h" |
63 | 64 | ||
64 | enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg, w83667hg_b, nct6775, | 65 | enum kinds { |
65 | nct6776 }; | 66 | w83627ehf, w83627dhg, w83627dhg_p, w83627uhg, |
67 | w83667hg, w83667hg_b, nct6775, nct6776, | ||
68 | }; | ||
66 | 69 | ||
67 | /* used to set data->name = w83627ehf_device_names[data->sio_kind] */ | 70 | /* used to set data->name = w83627ehf_device_names[data->sio_kind] */ |
68 | static const char * const w83627ehf_device_names[] = { | 71 | static const char * const w83627ehf_device_names[] = { |
69 | "w83627ehf", | 72 | "w83627ehf", |
70 | "w83627dhg", | 73 | "w83627dhg", |
71 | "w83627dhg", | 74 | "w83627dhg", |
75 | "w83627uhg", | ||
72 | "w83667hg", | 76 | "w83667hg", |
73 | "w83667hg", | 77 | "w83667hg", |
74 | "nct6775", | 78 | "nct6775", |
@@ -104,6 +108,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); | |||
104 | #define SIO_W83627EHG_ID 0x8860 | 108 | #define SIO_W83627EHG_ID 0x8860 |
105 | #define SIO_W83627DHG_ID 0xa020 | 109 | #define SIO_W83627DHG_ID 0xa020 |
106 | #define SIO_W83627DHG_P_ID 0xb070 | 110 | #define SIO_W83627DHG_P_ID 0xb070 |
111 | #define SIO_W83627UHG_ID 0xa230 | ||
107 | #define SIO_W83667HG_ID 0xa510 | 112 | #define SIO_W83667HG_ID 0xa510 |
108 | #define SIO_W83667HG_B_ID 0xb350 | 113 | #define SIO_W83667HG_B_ID 0xb350 |
109 | #define SIO_NCT6775_ID 0xb470 | 114 | #define SIO_NCT6775_ID 0xb470 |
@@ -388,18 +393,23 @@ div_from_reg(u8 reg) | |||
388 | return 1 << reg; | 393 | return 1 << reg; |
389 | } | 394 | } |
390 | 395 | ||
391 | /* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */ | 396 | /* Some of the voltage inputs have internal scaling, the tables below |
392 | 397 | * contain 8 (the ADC LSB in mV) * scaling factor * 100 */ | |
393 | static u8 scale_in[10] = { 8, 8, 16, 16, 8, 8, 8, 16, 16, 8 }; | 398 | static const u16 scale_in_common[10] = { |
399 | 800, 800, 1600, 1600, 800, 800, 800, 1600, 1600, 800 | ||
400 | }; | ||
401 | static const u16 scale_in_w83627uhg[9] = { | ||
402 | 800, 800, 3328, 3424, 800, 800, 0, 3328, 3400 | ||
403 | }; | ||
394 | 404 | ||
395 | static inline long in_from_reg(u8 reg, u8 nr) | 405 | static inline long in_from_reg(u8 reg, u8 nr, const u16 *scale_in) |
396 | { | 406 | { |
397 | return reg * scale_in[nr]; | 407 | return DIV_ROUND_CLOSEST(reg * scale_in[nr], 100); |
398 | } | 408 | } |
399 | 409 | ||
400 | static inline u8 in_to_reg(u32 val, u8 nr) | 410 | static inline u8 in_to_reg(u32 val, u8 nr, const u16 *scale_in) |
401 | { | 411 | { |
402 | return SENSORS_LIMIT(((val + (scale_in[nr] / 2)) / scale_in[nr]), 0, | 412 | return SENSORS_LIMIT(DIV_ROUND_CLOSEST(val * 100, scale_in[nr]), 0, |
403 | 255); | 413 | 255); |
404 | } | 414 | } |
405 | 415 | ||
@@ -430,6 +440,7 @@ struct w83627ehf_data { | |||
430 | const u16 *REG_FAN_STOP_TIME; | 440 | const u16 *REG_FAN_STOP_TIME; |
431 | const u16 *REG_FAN_MAX_OUTPUT; | 441 | const u16 *REG_FAN_MAX_OUTPUT; |
432 | const u16 *REG_FAN_STEP_OUTPUT; | 442 | const u16 *REG_FAN_STEP_OUTPUT; |
443 | const u16 *scale_in; | ||
433 | 444 | ||
434 | unsigned int (*fan_from_reg)(u16 reg, unsigned int divreg); | 445 | unsigned int (*fan_from_reg)(u16 reg, unsigned int divreg); |
435 | unsigned int (*fan_from_reg_min)(u16 reg, unsigned int divreg); | 446 | unsigned int (*fan_from_reg_min)(u16 reg, unsigned int divreg); |
@@ -481,7 +492,8 @@ struct w83627ehf_data { | |||
481 | u8 vrm; | 492 | u8 vrm; |
482 | 493 | ||
483 | u16 have_temp; | 494 | u16 have_temp; |
484 | u8 in6_skip; | 495 | u8 in6_skip:1; |
496 | u8 temp3_val_only:1; | ||
485 | }; | 497 | }; |
486 | 498 | ||
487 | struct w83627ehf_sio_data { | 499 | struct w83627ehf_sio_data { |
@@ -907,7 +919,8 @@ show_##reg(struct device *dev, struct device_attribute *attr, \ | |||
907 | struct sensor_device_attribute *sensor_attr = \ | 919 | struct sensor_device_attribute *sensor_attr = \ |
908 | to_sensor_dev_attr(attr); \ | 920 | to_sensor_dev_attr(attr); \ |
909 | int nr = sensor_attr->index; \ | 921 | int nr = sensor_attr->index; \ |
910 | return sprintf(buf, "%ld\n", in_from_reg(data->reg[nr], nr)); \ | 922 | return sprintf(buf, "%ld\n", in_from_reg(data->reg[nr], nr, \ |
923 | data->scale_in)); \ | ||
911 | } | 924 | } |
912 | show_in_reg(in) | 925 | show_in_reg(in) |
913 | show_in_reg(in_min) | 926 | show_in_reg(in_min) |
@@ -928,7 +941,7 @@ store_in_##reg(struct device *dev, struct device_attribute *attr, \ | |||
928 | if (err < 0) \ | 941 | if (err < 0) \ |
929 | return err; \ | 942 | return err; \ |
930 | mutex_lock(&data->update_lock); \ | 943 | mutex_lock(&data->update_lock); \ |
931 | data->in_##reg[nr] = in_to_reg(val, nr); \ | 944 | data->in_##reg[nr] = in_to_reg(val, nr, data->scale_in); \ |
932 | w83627ehf_write_value(data, W83627EHF_REG_IN_##REG(nr), \ | 945 | w83627ehf_write_value(data, W83627EHF_REG_IN_##REG(nr), \ |
933 | data->in_##reg[nr]); \ | 946 | data->in_##reg[nr]); \ |
934 | mutex_unlock(&data->update_lock); \ | 947 | mutex_unlock(&data->update_lock); \ |
@@ -1617,25 +1630,28 @@ static struct sensor_device_attribute sda_sf3_arrays_fan4[] = { | |||
1617 | store_fan_step_output, 3), | 1630 | store_fan_step_output, 3), |
1618 | }; | 1631 | }; |
1619 | 1632 | ||
1633 | static struct sensor_device_attribute sda_sf3_arrays_fan3[] = { | ||
1634 | SENSOR_ATTR(pwm3_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, | ||
1635 | store_fan_stop_time, 2), | ||
1636 | SENSOR_ATTR(pwm3_start_output, S_IWUSR | S_IRUGO, show_fan_start_output, | ||
1637 | store_fan_start_output, 2), | ||
1638 | SENSOR_ATTR(pwm3_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output, | ||
1639 | store_fan_stop_output, 2), | ||
1640 | }; | ||
1641 | |||
1620 | static struct sensor_device_attribute sda_sf3_arrays[] = { | 1642 | static struct sensor_device_attribute sda_sf3_arrays[] = { |
1621 | SENSOR_ATTR(pwm1_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, | 1643 | SENSOR_ATTR(pwm1_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, |
1622 | store_fan_stop_time, 0), | 1644 | store_fan_stop_time, 0), |
1623 | SENSOR_ATTR(pwm2_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, | 1645 | SENSOR_ATTR(pwm2_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, |
1624 | store_fan_stop_time, 1), | 1646 | store_fan_stop_time, 1), |
1625 | SENSOR_ATTR(pwm3_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, | ||
1626 | store_fan_stop_time, 2), | ||
1627 | SENSOR_ATTR(pwm1_start_output, S_IWUSR | S_IRUGO, show_fan_start_output, | 1647 | SENSOR_ATTR(pwm1_start_output, S_IWUSR | S_IRUGO, show_fan_start_output, |
1628 | store_fan_start_output, 0), | 1648 | store_fan_start_output, 0), |
1629 | SENSOR_ATTR(pwm2_start_output, S_IWUSR | S_IRUGO, show_fan_start_output, | 1649 | SENSOR_ATTR(pwm2_start_output, S_IWUSR | S_IRUGO, show_fan_start_output, |
1630 | store_fan_start_output, 1), | 1650 | store_fan_start_output, 1), |
1631 | SENSOR_ATTR(pwm3_start_output, S_IWUSR | S_IRUGO, show_fan_start_output, | ||
1632 | store_fan_start_output, 2), | ||
1633 | SENSOR_ATTR(pwm1_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output, | 1651 | SENSOR_ATTR(pwm1_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output, |
1634 | store_fan_stop_output, 0), | 1652 | store_fan_stop_output, 0), |
1635 | SENSOR_ATTR(pwm2_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output, | 1653 | SENSOR_ATTR(pwm2_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output, |
1636 | store_fan_stop_output, 1), | 1654 | store_fan_stop_output, 1), |
1637 | SENSOR_ATTR(pwm3_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output, | ||
1638 | store_fan_stop_output, 2), | ||
1639 | }; | 1655 | }; |
1640 | 1656 | ||
1641 | 1657 | ||
@@ -1728,6 +1744,8 @@ static void w83627ehf_device_remove_files(struct device *dev) | |||
1728 | data->REG_FAN_STEP_OUTPUT[attr->index] != 0xff) | 1744 | data->REG_FAN_STEP_OUTPUT[attr->index] != 0xff) |
1729 | device_remove_file(dev, &attr->dev_attr); | 1745 | device_remove_file(dev, &attr->dev_attr); |
1730 | } | 1746 | } |
1747 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan3); i++) | ||
1748 | device_remove_file(dev, &sda_sf3_arrays_fan3[i].dev_attr); | ||
1731 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) | 1749 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) |
1732 | device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr); | 1750 | device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr); |
1733 | for (i = 0; i < data->in_num; i++) { | 1751 | for (i = 0; i < data->in_num; i++) { |
@@ -1756,6 +1774,8 @@ static void w83627ehf_device_remove_files(struct device *dev) | |||
1756 | continue; | 1774 | continue; |
1757 | device_remove_file(dev, &sda_temp_input[i].dev_attr); | 1775 | device_remove_file(dev, &sda_temp_input[i].dev_attr); |
1758 | device_remove_file(dev, &sda_temp_label[i].dev_attr); | 1776 | device_remove_file(dev, &sda_temp_label[i].dev_attr); |
1777 | if (i == 2 && data->temp3_val_only) | ||
1778 | continue; | ||
1759 | device_remove_file(dev, &sda_temp_max[i].dev_attr); | 1779 | device_remove_file(dev, &sda_temp_max[i].dev_attr); |
1760 | device_remove_file(dev, &sda_temp_max_hyst[i].dev_attr); | 1780 | device_remove_file(dev, &sda_temp_max_hyst[i].dev_attr); |
1761 | if (i > 2) | 1781 | if (i > 2) |
@@ -1808,6 +1828,9 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data, | |||
1808 | case w83627ehf: | 1828 | case w83627ehf: |
1809 | diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); | 1829 | diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); |
1810 | break; | 1830 | break; |
1831 | case w83627uhg: | ||
1832 | diode = 0x00; | ||
1833 | break; | ||
1811 | default: | 1834 | default: |
1812 | diode = 0x70; | 1835 | diode = 0x70; |
1813 | } | 1836 | } |
@@ -1871,6 +1894,13 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, | |||
1871 | { | 1894 | { |
1872 | int fan3pin, fan4pin, fan4min, fan5pin, regval; | 1895 | int fan3pin, fan4pin, fan4min, fan5pin, regval; |
1873 | 1896 | ||
1897 | /* The W83627UHG is simple, only two fan inputs, no config */ | ||
1898 | if (sio_data->kind == w83627uhg) { | ||
1899 | data->has_fan = 0x03; /* fan1 and fan2 */ | ||
1900 | data->has_fan_min = 0x03; | ||
1901 | return; | ||
1902 | } | ||
1903 | |||
1874 | superio_enter(sio_data->sioreg); | 1904 | superio_enter(sio_data->sioreg); |
1875 | 1905 | ||
1876 | /* fan4 and fan5 share some pins with the GPIO and serial flash */ | 1906 | /* fan4 and fan5 share some pins with the GPIO and serial flash */ |
@@ -1962,11 +1992,21 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1962 | 1992 | ||
1963 | /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */ | 1993 | /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */ |
1964 | data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9; | 1994 | data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9; |
1965 | /* 667HG, NCT6775F, and NCT6776F have 3 pwms */ | 1995 | /* 667HG, NCT6775F, and NCT6776F have 3 pwms, and 627UHG has only 2 */ |
1966 | data->pwm_num = (sio_data->kind == w83667hg | 1996 | switch (sio_data->kind) { |
1967 | || sio_data->kind == w83667hg_b | 1997 | default: |
1968 | || sio_data->kind == nct6775 | 1998 | data->pwm_num = 4; |
1969 | || sio_data->kind == nct6776) ? 3 : 4; | 1999 | break; |
2000 | case w83667hg: | ||
2001 | case w83667hg_b: | ||
2002 | case nct6775: | ||
2003 | case nct6776: | ||
2004 | data->pwm_num = 3; | ||
2005 | break; | ||
2006 | case w83627uhg: | ||
2007 | data->pwm_num = 2; | ||
2008 | break; | ||
2009 | } | ||
1970 | 2010 | ||
1971 | /* Default to 3 temperature inputs, code below will adjust as needed */ | 2011 | /* Default to 3 temperature inputs, code below will adjust as needed */ |
1972 | data->have_temp = 0x07; | 2012 | data->have_temp = 0x07; |
@@ -2085,6 +2125,42 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2085 | data->in6_skip = 1; | 2125 | data->in6_skip = 1; |
2086 | 2126 | ||
2087 | data->temp_label = w83667hg_b_temp_label; | 2127 | data->temp_label = w83667hg_b_temp_label; |
2128 | } else if (sio_data->kind == w83627uhg) { | ||
2129 | u8 reg; | ||
2130 | |||
2131 | w83627ehf_set_temp_reg_ehf(data, 3); | ||
2132 | |||
2133 | /* | ||
2134 | * Temperature sources for temp1 and temp2 are selected with | ||
2135 | * bank 0, registers 0x49 and 0x4a. | ||
2136 | */ | ||
2137 | data->temp_src[0] = 0; /* SYSTIN */ | ||
2138 | reg = w83627ehf_read_value(data, 0x49) & 0x07; | ||
2139 | /* Adjust to have the same mapping as other source registers */ | ||
2140 | if (reg == 0) | ||
2141 | data->temp_src[1]++; | ||
2142 | else if (reg >= 2 && reg <= 5) | ||
2143 | data->temp_src[1] += 2; | ||
2144 | else /* should never happen */ | ||
2145 | data->have_temp &= ~(1 << 1); | ||
2146 | reg = w83627ehf_read_value(data, 0x4a); | ||
2147 | data->temp_src[2] = reg >> 5; | ||
2148 | |||
2149 | /* | ||
2150 | * Skip temp3 if source is invalid or the same as temp1 | ||
2151 | * or temp2. | ||
2152 | */ | ||
2153 | if (data->temp_src[2] == 2 || data->temp_src[2] == 3 || | ||
2154 | data->temp_src[2] == data->temp_src[0] || | ||
2155 | ((data->have_temp & (1 << 1)) && | ||
2156 | data->temp_src[2] == data->temp_src[1])) | ||
2157 | data->have_temp &= ~(1 << 2); | ||
2158 | else | ||
2159 | data->temp3_val_only = 1; /* No limit regs */ | ||
2160 | |||
2161 | data->in6_skip = 1; /* No VIN3 */ | ||
2162 | |||
2163 | data->temp_label = w83667hg_b_temp_label; | ||
2088 | } else { | 2164 | } else { |
2089 | w83627ehf_set_temp_reg_ehf(data, 3); | 2165 | w83627ehf_set_temp_reg_ehf(data, 3); |
2090 | 2166 | ||
@@ -2162,6 +2238,12 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2162 | W83627EHF_REG_FAN_STEP_OUTPUT_COMMON; | 2238 | W83627EHF_REG_FAN_STEP_OUTPUT_COMMON; |
2163 | } | 2239 | } |
2164 | 2240 | ||
2241 | /* Setup input voltage scaling factors */ | ||
2242 | if (sio_data->kind == w83627uhg) | ||
2243 | data->scale_in = scale_in_w83627uhg; | ||
2244 | else | ||
2245 | data->scale_in = scale_in_common; | ||
2246 | |||
2165 | /* Initialize the chip */ | 2247 | /* Initialize the chip */ |
2166 | w83627ehf_init_device(data, sio_data->kind); | 2248 | w83627ehf_init_device(data, sio_data->kind); |
2167 | 2249 | ||
@@ -2178,7 +2260,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2178 | err = device_create_file(dev, &dev_attr_cpu0_vid); | 2260 | err = device_create_file(dev, &dev_attr_cpu0_vid); |
2179 | if (err) | 2261 | if (err) |
2180 | goto exit_release; | 2262 | goto exit_release; |
2181 | } else { | 2263 | } else if (sio_data->kind != w83627uhg) { |
2182 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); | 2264 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); |
2183 | if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) { | 2265 | if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) { |
2184 | /* Set VID input sensibility if needed. In theory the | 2266 | /* Set VID input sensibility if needed. In theory the |
@@ -2268,7 +2350,14 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2268 | goto exit_remove; | 2350 | goto exit_remove; |
2269 | } | 2351 | } |
2270 | } | 2352 | } |
2271 | /* if fan4 is enabled create the sf3 files for it */ | 2353 | /* if fan3 and fan4 are enabled create the sf3 files for them */ |
2354 | if ((data->has_fan & (1 << 2)) && data->pwm_num >= 3) | ||
2355 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan3); i++) { | ||
2356 | err = device_create_file(dev, | ||
2357 | &sda_sf3_arrays_fan3[i].dev_attr); | ||
2358 | if (err) | ||
2359 | goto exit_remove; | ||
2360 | } | ||
2272 | if ((data->has_fan & (1 << 3)) && data->pwm_num >= 4) | 2361 | if ((data->has_fan & (1 << 3)) && data->pwm_num >= 4) |
2273 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) { | 2362 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) { |
2274 | err = device_create_file(dev, | 2363 | err = device_create_file(dev, |
@@ -2336,6 +2425,8 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2336 | if (err) | 2425 | if (err) |
2337 | goto exit_remove; | 2426 | goto exit_remove; |
2338 | } | 2427 | } |
2428 | if (i == 2 && data->temp3_val_only) | ||
2429 | continue; | ||
2339 | if (data->reg_temp_over[i]) { | 2430 | if (data->reg_temp_over[i]) { |
2340 | err = device_create_file(dev, | 2431 | err = device_create_file(dev, |
2341 | &sda_temp_max[i].dev_attr); | 2432 | &sda_temp_max[i].dev_attr); |
@@ -2419,6 +2510,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | |||
2419 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; | 2510 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; |
2420 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; | 2511 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; |
2421 | static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P"; | 2512 | static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P"; |
2513 | static const char __initdata sio_name_W83627UHG[] = "W83627UHG"; | ||
2422 | static const char __initdata sio_name_W83667HG[] = "W83667HG"; | 2514 | static const char __initdata sio_name_W83667HG[] = "W83667HG"; |
2423 | static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B"; | 2515 | static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B"; |
2424 | static const char __initdata sio_name_NCT6775[] = "NCT6775F"; | 2516 | static const char __initdata sio_name_NCT6775[] = "NCT6775F"; |
@@ -2451,6 +2543,10 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | |||
2451 | sio_data->kind = w83627dhg_p; | 2543 | sio_data->kind = w83627dhg_p; |
2452 | sio_name = sio_name_W83627DHG_P; | 2544 | sio_name = sio_name_W83627DHG_P; |
2453 | break; | 2545 | break; |
2546 | case SIO_W83627UHG_ID: | ||
2547 | sio_data->kind = w83627uhg; | ||
2548 | sio_name = sio_name_W83627UHG; | ||
2549 | break; | ||
2454 | case SIO_W83667HG_ID: | 2550 | case SIO_W83667HG_ID: |
2455 | sio_data->kind = w83667hg; | 2551 | sio_data->kind = w83667hg; |
2456 | sio_name = sio_name_W83667HG; | 2552 | sio_name = sio_name_W83667HG; |