Commit c39aedafb242601729bef48db052ebc055ce3ab4

Authored by Guenter Roeck
Committed by Jean Delvare
1 parent da2e025590

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>

Showing 2 changed files with 43 additions and 14 deletions Side-by-side Diff

Documentation/hwmon/w83627ehf
... ... @@ -20,6 +20,10 @@
20 20 Prefix: 'w83667hg'
21 21 Addresses scanned: ISA address retrieved from Super I/O registers
22 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  
24 28 Authors:
25 29 Jean Delvare <khali@linux-fr.org>
... ... @@ -32,8 +36,8 @@
32 36 -----------
33 37  
34 38 This driver implements support for the Winbond W83627EHF, W83627EHG,
35   -W83627DHG, W83627DHG-P and W83667HG super I/O chips. We will refer to them
36   -collectively as Winbond chips.
  39 +W83627DHG, W83627DHG-P, W83667HG and W83667HG-B super I/O chips.
  40 +We will refer to them collectively as Winbond chips.
37 41  
38 42 The chips implement three temperature sensors, five fan rotation
39 43 speed sensors, ten analog voltage sensors (only nine for the 627DHG), one
40 44  
... ... @@ -68,14 +72,15 @@
68 72 temp1 -> pwm1
69 73 temp2 -> pwm2
70 74 temp3 -> pwm3
71   -prog -> pwm4 (not on 667HG; the programmable setting is not supported by
72   - the driver)
  75 +prog -> pwm4 (not on 667HG and 667HG-B; the programmable setting is not
  76 + supported by the driver)
73 77  
74 78 /sys files
75 79 ----------
76 80  
77 81 name - 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  
80 85 pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range:
81 86 0 (stop) to 255 (full)
drivers/hwmon/w83627ehf.c
... ... @@ -39,6 +39,7 @@
39 39 w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3
40 40 w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3
41 41 w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3
  42 + w83667hg-b 9 5 3 3 0xb350 0xc1 0x5ca3
42 43 */
43 44  
44 45 #include <linux/module.h>
... ... @@ -55,7 +56,7 @@
55 56 #include <linux/io.h>
56 57 #include "lm75.h"
57 58  
58   -enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg };
  59 +enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg, w83667hg_b };
59 60  
60 61 /* used to set data->name = w83627ehf_device_names[data->sio_kind] */
61 62 static const char * w83627ehf_device_names[] = {
... ... @@ -63,6 +64,7 @@
63 64 "w83627dhg",
64 65 "w83627dhg",
65 66 "w83667hg",
  67 + "w83667hg",
66 68 };
67 69  
68 70 static unsigned short force_id;
... ... @@ -91,6 +93,7 @@
91 93 #define SIO_W83627DHG_ID 0xa020
92 94 #define SIO_W83627DHG_P_ID 0xb070
93 95 #define SIO_W83667HG_ID 0xa510
  96 +#define SIO_W83667HG_B_ID 0xb350
94 97 #define SIO_ID_MASK 0xFFF0
95 98  
96 99 static inline void
97 100  
... ... @@ -201,9 +204,15 @@
201 204 static const u8 W83627EHF_REG_FAN_START_OUTPUT[] = { 0x0a, 0x0b, 0x16, 0x65 };
202 205 static const u8 W83627EHF_REG_FAN_STOP_OUTPUT[] = { 0x08, 0x09, 0x15, 0x64 };
203 206 static const u8 W83627EHF_REG_FAN_STOP_TIME[] = { 0x0c, 0x0d, 0x17, 0x66 };
204   -static const u8 W83627EHF_REG_FAN_MAX_OUTPUT[] = { 0xff, 0x67, 0xff, 0x69 };
205   -static const u8 W83627EHF_REG_FAN_STEP_OUTPUT[] = { 0xff, 0x68, 0xff, 0x6a };
206 207  
  208 +static const u8 W83627EHF_REG_FAN_MAX_OUTPUT_COMMON[]
  209 + = { 0xff, 0x67, 0xff, 0x69 };
  210 +static const u8 W83627EHF_REG_FAN_STEP_OUTPUT_COMMON[]
  211 + = { 0xff, 0x68, 0xff, 0x6a };
  212 +
  213 +static const u8 W83627EHF_REG_FAN_MAX_OUTPUT_W83667_B[] = { 0x67, 0x69, 0x6b };
  214 +static const u8 W83627EHF_REG_FAN_STEP_OUTPUT_W83667_B[] = { 0x68, 0x6a, 0x6c };
  215 +
207 216 /*
208 217 * Conversions
209 218 */
210 219  
... ... @@ -1382,10 +1391,11 @@
1382 1391 /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
1383 1392 data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9;
1384 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 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 1399 data->temp3_disable = w83627ehf_read_value(data,
1390 1400 W83627EHF_REG_TEMP_CONFIG[1]) & 0x01;
1391 1401 data->in6_skip = !data->temp3_disable;
... ... @@ -1393,8 +1403,17 @@
1393 1403  
1394 1404 data->REG_FAN_START_OUTPUT = W83627EHF_REG_FAN_START_OUTPUT;
1395 1405 data->REG_FAN_STOP_OUTPUT = W83627EHF_REG_FAN_STOP_OUTPUT;
1396   - data->REG_FAN_MAX_OUTPUT = W83627EHF_REG_FAN_MAX_OUTPUT;
1397   - data->REG_FAN_STEP_OUTPUT = W83627EHF_REG_FAN_STEP_OUTPUT;
  1406 + if (sio_data->kind == w83667hg_b) {
  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 1418 /* Initialize the chip */
1400 1419 w83627ehf_init_device(data);
... ... @@ -1402,7 +1421,7 @@
1402 1421 data->vrm = vid_which_vrm();
1403 1422 superio_enter(sio_data->sioreg);
1404 1423 /* Read VID value */
1405   - if (sio_data->kind == w83667hg) {
  1424 + if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
1406 1425 /* W83667HG has different pins for VID input and output, so
1407 1426 we can get the VID input values directly at logical device D
1408 1427 0xe3. */
... ... @@ -1453,7 +1472,7 @@
1453 1472 }
1454 1473  
1455 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 1476 fan5pin = superio_inb(sio_data->sioreg, 0x27) & 0x20;
1458 1477 fan4pin = superio_inb(sio_data->sioreg, 0x27) & 0x40;
1459 1478 } else {
... ... @@ -1609,6 +1628,7 @@
1609 1628 static const char __initdata sio_name_W83627DHG[] = "W83627DHG";
1610 1629 static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P";
1611 1630 static const char __initdata sio_name_W83667HG[] = "W83667HG";
  1631 + static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B";
1612 1632  
1613 1633 u16 val;
1614 1634 const char *sio_name;
... ... @@ -1640,6 +1660,10 @@
1640 1660 case SIO_W83667HG_ID:
1641 1661 sio_data->kind = w83667hg;
1642 1662 sio_name = sio_name_W83667HG;
  1663 + break;
  1664 + case SIO_W83667HG_B_ID:
  1665 + sio_data->kind = w83667hg_b;
  1666 + sio_name = sio_name_W83667HG_B;
1643 1667 break;
1644 1668 default:
1645 1669 if (val != 0xffff)