aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2010-08-14 15:08:55 -0400
committerJean Delvare <khali@linux-fr.org>2010-08-14 15:08:55 -0400
commitc39aedafb242601729bef48db052ebc055ce3ab4 (patch)
tree518a88dca7fa8b4904a21ad88df761b02c466c04
parentda2e025590cf7038440132d4bbc967a579b11112 (diff)
hwmon: (w83627ehf) Add support for W83667HG-B
Add support for W83667HG-B (very similar to the W83667HG). Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--Documentation/hwmon/w83627ehf15
-rw-r--r--drivers/hwmon/w83627ehf.c42
2 files changed, 43 insertions, 14 deletions
diff --git a/Documentation/hwmon/w83627ehf b/Documentation/hwmon/w83627ehf
index b7e42ec4b26b..13d556112fc0 100644
--- a/Documentation/hwmon/w83627ehf
+++ b/Documentation/hwmon/w83627ehf
@@ -20,6 +20,10 @@ Supported chips:
20 Prefix: 'w83667hg' 20 Prefix: 'w83667hg'
21 Addresses scanned: ISA address retrieved from Super I/O registers 21 Addresses scanned: ISA address retrieved from Super I/O registers
22 Datasheet: not available 22 Datasheet: not available
23 * Winbond W83667HG-B
24 Prefix: 'w83667hg'
25 Addresses scanned: ISA address retrieved from Super I/O registers
26 Datasheet: Available from Nuvoton upon request
23 27
24Authors: 28Authors:
25 Jean Delvare <khali@linux-fr.org> 29 Jean Delvare <khali@linux-fr.org>
@@ -32,8 +36,8 @@ Description
32----------- 36-----------
33 37
34This driver implements support for the Winbond W83627EHF, W83627EHG, 38This driver implements support for the Winbond W83627EHF, W83627EHG,
35W83627DHG, W83627DHG-P and W83667HG super I/O chips. We will refer to them 39W83627DHG, W83627DHG-P, W83667HG and W83667HG-B super I/O chips.
36collectively as Winbond chips. 40We will refer to them collectively as Winbond chips.
37 41
38The chips implement three temperature sensors, five fan rotation 42The chips implement three temperature sensors, five fan rotation
39speed sensors, ten analog voltage sensors (only nine for the 627DHG), one 43speed sensors, ten analog voltage sensors (only nine for the 627DHG), one
@@ -68,14 +72,15 @@ follows:
68temp1 -> pwm1 72temp1 -> pwm1
69temp2 -> pwm2 73temp2 -> pwm2
70temp3 -> pwm3 74temp3 -> pwm3
71prog -> pwm4 (not on 667HG; the programmable setting is not supported by 75prog -> pwm4 (not on 667HG and 667HG-B; the programmable setting is not
72 the driver) 76 supported by the driver)
73 77
74/sys files 78/sys files
75---------- 79----------
76 80
77name - this is a standard hwmon device entry. For the W83627EHF and W83627EHG, 81name - this is a standard hwmon device entry. For the W83627EHF and W83627EHG,
78 it is set to "w83627ehf" and for the W83627DHG it is set to "w83627dhg" 82 it is set to "w83627ehf", for the W83627DHG it is set to "w83627dhg",
83 and for the W83667HG it is set to "w83667hg".
79 84
80pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range: 85pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range:
81 0 (stop) to 255 (full) 86 0 (stop) to 255 (full)
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index e01a3e97aa17..e96e69dd36fb 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -39,6 +39,7 @@
39 w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3 39 w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3
40 w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3 40 w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3
41 w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3 41 w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3
42 w83667hg-b 9 5 3 3 0xb350 0xc1 0x5ca3
42*/ 43*/
43 44
44#include <linux/module.h> 45#include <linux/module.h>
@@ -55,7 +56,7 @@
55#include <linux/io.h> 56#include <linux/io.h>
56#include "lm75.h" 57#include "lm75.h"
57 58
58enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg }; 59enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg, w83667hg_b };
59 60
60/* used to set data->name = w83627ehf_device_names[data->sio_kind] */ 61/* used to set data->name = w83627ehf_device_names[data->sio_kind] */
61static const char * w83627ehf_device_names[] = { 62static const char * w83627ehf_device_names[] = {
@@ -63,6 +64,7 @@ static const char * w83627ehf_device_names[] = {
63 "w83627dhg", 64 "w83627dhg",
64 "w83627dhg", 65 "w83627dhg",
65 "w83667hg", 66 "w83667hg",
67 "w83667hg",
66}; 68};
67 69
68static unsigned short force_id; 70static unsigned short force_id;
@@ -91,6 +93,7 @@ MODULE_PARM_DESC(force_id, "Override the detected device ID");
91#define SIO_W83627DHG_ID 0xa020 93#define SIO_W83627DHG_ID 0xa020
92#define SIO_W83627DHG_P_ID 0xb070 94#define SIO_W83627DHG_P_ID 0xb070
93#define SIO_W83667HG_ID 0xa510 95#define SIO_W83667HG_ID 0xa510
96#define SIO_W83667HG_B_ID 0xb350
94#define SIO_ID_MASK 0xFFF0 97#define SIO_ID_MASK 0xFFF0
95 98
96static inline void 99static inline void
@@ -201,8 +204,14 @@ static const u8 W83627EHF_REG_TOLERANCE[] = { 0x07, 0x07, 0x14, 0x62 };
201static const u8 W83627EHF_REG_FAN_START_OUTPUT[] = { 0x0a, 0x0b, 0x16, 0x65 }; 204static const u8 W83627EHF_REG_FAN_START_OUTPUT[] = { 0x0a, 0x0b, 0x16, 0x65 };
202static const u8 W83627EHF_REG_FAN_STOP_OUTPUT[] = { 0x08, 0x09, 0x15, 0x64 }; 205static const u8 W83627EHF_REG_FAN_STOP_OUTPUT[] = { 0x08, 0x09, 0x15, 0x64 };
203static const u8 W83627EHF_REG_FAN_STOP_TIME[] = { 0x0c, 0x0d, 0x17, 0x66 }; 206static const u8 W83627EHF_REG_FAN_STOP_TIME[] = { 0x0c, 0x0d, 0x17, 0x66 };
204static const u8 W83627EHF_REG_FAN_MAX_OUTPUT[] = { 0xff, 0x67, 0xff, 0x69 }; 207
205static const u8 W83627EHF_REG_FAN_STEP_OUTPUT[] = { 0xff, 0x68, 0xff, 0x6a }; 208static const u8 W83627EHF_REG_FAN_MAX_OUTPUT_COMMON[]
209 = { 0xff, 0x67, 0xff, 0x69 };
210static const u8 W83627EHF_REG_FAN_STEP_OUTPUT_COMMON[]
211 = { 0xff, 0x68, 0xff, 0x6a };
212
213static const u8 W83627EHF_REG_FAN_MAX_OUTPUT_W83667_B[] = { 0x67, 0x69, 0x6b };
214static const u8 W83627EHF_REG_FAN_STEP_OUTPUT_W83667_B[] = { 0x68, 0x6a, 0x6c };
206 215
207/* 216/*
208 * Conversions 217 * Conversions
@@ -1382,10 +1391,11 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1382 /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */ 1391 /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
1383 data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9; 1392 data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9;
1384 /* 667HG has 3 pwms */ 1393 /* 667HG has 3 pwms */
1385 data->pwm_num = (sio_data->kind == w83667hg) ? 3 : 4; 1394 data->pwm_num = (sio_data->kind == w83667hg
1395 || sio_data->kind == w83667hg_b) ? 3 : 4;
1386 1396
1387 /* Check temp3 configuration bit for 667HG */ 1397 /* Check temp3 configuration bit for 667HG */
1388 if (sio_data->kind == w83667hg) { 1398 if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
1389 data->temp3_disable = w83627ehf_read_value(data, 1399 data->temp3_disable = w83627ehf_read_value(data,
1390 W83627EHF_REG_TEMP_CONFIG[1]) & 0x01; 1400 W83627EHF_REG_TEMP_CONFIG[1]) & 0x01;
1391 data->in6_skip = !data->temp3_disable; 1401 data->in6_skip = !data->temp3_disable;
@@ -1393,8 +1403,17 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1393 1403
1394 data->REG_FAN_START_OUTPUT = W83627EHF_REG_FAN_START_OUTPUT; 1404 data->REG_FAN_START_OUTPUT = W83627EHF_REG_FAN_START_OUTPUT;
1395 data->REG_FAN_STOP_OUTPUT = W83627EHF_REG_FAN_STOP_OUTPUT; 1405 data->REG_FAN_STOP_OUTPUT = W83627EHF_REG_FAN_STOP_OUTPUT;
1396 data->REG_FAN_MAX_OUTPUT = W83627EHF_REG_FAN_MAX_OUTPUT; 1406 if (sio_data->kind == w83667hg_b) {
1397 data->REG_FAN_STEP_OUTPUT = W83627EHF_REG_FAN_STEP_OUTPUT; 1407 data->REG_FAN_MAX_OUTPUT =
1408 W83627EHF_REG_FAN_MAX_OUTPUT_W83667_B;
1409 data->REG_FAN_STEP_OUTPUT =
1410 W83627EHF_REG_FAN_STEP_OUTPUT_W83667_B;
1411 } else {
1412 data->REG_FAN_MAX_OUTPUT =
1413 W83627EHF_REG_FAN_MAX_OUTPUT_COMMON;
1414 data->REG_FAN_STEP_OUTPUT =
1415 W83627EHF_REG_FAN_STEP_OUTPUT_COMMON;
1416 }
1398 1417
1399 /* Initialize the chip */ 1418 /* Initialize the chip */
1400 w83627ehf_init_device(data); 1419 w83627ehf_init_device(data);
@@ -1402,7 +1421,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1402 data->vrm = vid_which_vrm(); 1421 data->vrm = vid_which_vrm();
1403 superio_enter(sio_data->sioreg); 1422 superio_enter(sio_data->sioreg);
1404 /* Read VID value */ 1423 /* Read VID value */
1405 if (sio_data->kind == w83667hg) { 1424 if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
1406 /* W83667HG has different pins for VID input and output, so 1425 /* W83667HG has different pins for VID input and output, so
1407 we can get the VID input values directly at logical device D 1426 we can get the VID input values directly at logical device D
1408 0xe3. */ 1427 0xe3. */
@@ -1453,7 +1472,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1453 } 1472 }
1454 1473
1455 /* fan4 and fan5 share some pins with the GPIO and serial flash */ 1474 /* fan4 and fan5 share some pins with the GPIO and serial flash */
1456 if (sio_data->kind == w83667hg) { 1475 if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
1457 fan5pin = superio_inb(sio_data->sioreg, 0x27) & 0x20; 1476 fan5pin = superio_inb(sio_data->sioreg, 0x27) & 0x20;
1458 fan4pin = superio_inb(sio_data->sioreg, 0x27) & 0x40; 1477 fan4pin = superio_inb(sio_data->sioreg, 0x27) & 0x40;
1459 } else { 1478 } else {
@@ -1609,6 +1628,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
1609 static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; 1628 static const char __initdata sio_name_W83627DHG[] = "W83627DHG";
1610 static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P"; 1629 static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P";
1611 static const char __initdata sio_name_W83667HG[] = "W83667HG"; 1630 static const char __initdata sio_name_W83667HG[] = "W83667HG";
1631 static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B";
1612 1632
1613 u16 val; 1633 u16 val;
1614 const char *sio_name; 1634 const char *sio_name;
@@ -1641,6 +1661,10 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
1641 sio_data->kind = w83667hg; 1661 sio_data->kind = w83667hg;
1642 sio_name = sio_name_W83667HG; 1662 sio_name = sio_name_W83667HG;
1643 break; 1663 break;
1664 case SIO_W83667HG_B_ID:
1665 sio_data->kind = w83667hg_b;
1666 sio_name = sio_name_W83667HG_B;
1667 break;
1644 default: 1668 default:
1645 if (val != 0xffff) 1669 if (val != 0xffff)
1646 pr_debug(DRVNAME ": unsupported chip ID: 0x%04x\n", 1670 pr_debug(DRVNAME ": unsupported chip ID: 0x%04x\n",