aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/feature-removal-schedule.txt10
-rw-r--r--Documentation/hwmon/adm92402
-rw-r--r--Documentation/hwmon/ads78282
-rw-r--r--Documentation/hwmon/dme173712
-rw-r--r--Documentation/hwmon/w83627hf22
-rw-r--r--Documentation/hwmon/w837932
-rw-r--r--drivers/hwmon/Kconfig4
-rw-r--r--drivers/hwmon/adm9240.c32
-rw-r--r--drivers/hwmon/ads7828.c4
-rw-r--r--drivers/hwmon/dme1737.c189
-rw-r--r--drivers/hwmon/emc1403.c16
-rw-r--r--drivers/hwmon/fschmd.c5
-rw-r--r--drivers/hwmon/it87.c30
-rw-r--r--drivers/hwmon/lm78.c14
-rw-r--r--drivers/hwmon/pc87360.c53
-rw-r--r--drivers/hwmon/pc87427.c26
-rw-r--r--drivers/hwmon/via686a.c14
-rw-r--r--drivers/hwmon/w83781d.c29
-rw-r--r--drivers/hwmon/w83792d.c44
-rw-r--r--drivers/hwmon/w83793.c38
-rw-r--r--drivers/hwmon/w83795.c4
21 files changed, 370 insertions, 182 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 07eb3f624998..6cbbd20534cf 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -590,3 +590,13 @@ Why: The functions have been superceded by cancel_delayed_work_sync()
590Who: Tejun Heo <tj@kernel.org> 590Who: Tejun Heo <tj@kernel.org>
591 591
592---------------------------- 592----------------------------
593
594What: Legacy, non-standard chassis intrusion detection interface.
595When: June 2011
596Why: The adm9240, w83792d and w83793 hardware monitoring drivers have
597 legacy interfaces for chassis intrusion detection. A standard
598 interface has been added to each driver, so the legacy interface
599 can be removed.
600Who: Jean Delvare <khali@linux-fr.org>
601
602----------------------------
diff --git a/Documentation/hwmon/adm9240 b/Documentation/hwmon/adm9240
index 2c6f1fed4618..36e8ec6aa868 100644
--- a/Documentation/hwmon/adm9240
+++ b/Documentation/hwmon/adm9240
@@ -155,7 +155,7 @@ connected to a normally open switch.
155The ADM9240 provides an internal open drain on this line, and may output 155The ADM9240 provides an internal open drain on this line, and may output
156a 20 ms active low pulse to reset an external Chassis Intrusion latch. 156a 20 ms active low pulse to reset an external Chassis Intrusion latch.
157 157
158Clear the CI latch by writing value 1 to the sysfs chassis_clear file. 158Clear the CI latch by writing value 0 to the sysfs intrusion0_alarm file.
159 159
160Alarm flags reported as 16-bit word 160Alarm flags reported as 16-bit word
161 161
diff --git a/Documentation/hwmon/ads7828 b/Documentation/hwmon/ads7828
index 75bc4beaf447..2bbebe6f771f 100644
--- a/Documentation/hwmon/ads7828
+++ b/Documentation/hwmon/ads7828
@@ -9,7 +9,7 @@ Supported chips:
9 http://focus.ti.com/lit/ds/symlink/ads7828.pdf 9 http://focus.ti.com/lit/ds/symlink/ads7828.pdf
10 10
11Authors: 11Authors:
12 Steve Hardy <steve@linuxrealtime.co.uk> 12 Steve Hardy <shardy@redhat.com>
13 13
14Module Parameters 14Module Parameters
15----------------- 15-----------------
diff --git a/Documentation/hwmon/dme1737 b/Documentation/hwmon/dme1737
index fc5df7654d63..4d2935145a1c 100644
--- a/Documentation/hwmon/dme1737
+++ b/Documentation/hwmon/dme1737
@@ -42,7 +42,7 @@ Description
42This driver implements support for the hardware monitoring capabilities of the 42This driver implements support for the hardware monitoring capabilities of the
43SMSC DME1737 and Asus A8000 (which are the same), SMSC SCH5027, SCH311x, 43SMSC DME1737 and Asus A8000 (which are the same), SMSC SCH5027, SCH311x,
44and SCH5127 Super-I/O chips. These chips feature monitoring of 3 temp sensors 44and SCH5127 Super-I/O chips. These chips feature monitoring of 3 temp sensors
45temp[1-3] (2 remote diodes and 1 internal), 7 voltages in[0-6] (6 external and 45temp[1-3] (2 remote diodes and 1 internal), 8 voltages in[0-7] (7 external and
461 internal) and up to 6 fan speeds fan[1-6]. Additionally, the chips implement 461 internal) and up to 6 fan speeds fan[1-6]. Additionally, the chips implement
47up to 5 PWM outputs pwm[1-3,5-6] for controlling fan speeds both manually and 47up to 5 PWM outputs pwm[1-3,5-6] for controlling fan speeds both manually and
48automatically. 48automatically.
@@ -105,6 +105,7 @@ SCH5127:
105 in4: V1_IN 0V - 1.5V 105 in4: V1_IN 0V - 1.5V
106 in5: VTR (+3.3V standby) 0V - 4.38V 106 in5: VTR (+3.3V standby) 0V - 4.38V
107 in6: Vbat (+3.0V) 0V - 4.38V 107 in6: Vbat (+3.0V) 0V - 4.38V
108 in7: Vtrip (+1.5V) 0V - 1.99V
108 109
109Each voltage input has associated min and max limits which trigger an alarm 110Each voltage input has associated min and max limits which trigger an alarm
110when crossed. 111when crossed.
@@ -217,10 +218,10 @@ cpu0_vid RO CPU core reference voltage in
217vrm RW Voltage regulator module version 218vrm RW Voltage regulator module version
218 number. 219 number.
219 220
220in[0-6]_input RO Measured voltage in millivolts. 221in[0-7]_input RO Measured voltage in millivolts.
221in[0-6]_min RW Low limit for voltage input. 222in[0-7]_min RW Low limit for voltage input.
222in[0-6]_max RW High limit for voltage input. 223in[0-7]_max RW High limit for voltage input.
223in[0-6]_alarm RO Voltage input alarm. Returns 1 if 224in[0-7]_alarm RO Voltage input alarm. Returns 1 if
224 voltage input is or went outside the 225 voltage input is or went outside the
225 associated min-max range, 0 otherwise. 226 associated min-max range, 0 otherwise.
226 227
@@ -324,3 +325,4 @@ fan5 opt opt
324pwm5 opt opt 325pwm5 opt opt
325fan6 opt opt 326fan6 opt opt
326pwm6 opt opt 327pwm6 opt opt
328in7 yes
diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf
index fb145e5e722a..8432e1118173 100644
--- a/Documentation/hwmon/w83627hf
+++ b/Documentation/hwmon/w83627hf
@@ -91,3 +91,25 @@ isaset -y -f 0x2e 0xaa
91 91
92The above sequence assumes a Super-I/O config space at 0x2e/0x2f, but 92The above sequence assumes a Super-I/O config space at 0x2e/0x2f, but
930x4e/0x4f is also possible. 930x4e/0x4f is also possible.
94
95Voltage pin mapping
96-------------------
97
98Here is a summary of the voltage pin mapping for the W83627THF. This
99can be useful to convert data provided by board manufacturers into
100working libsensors configuration statements.
101
102 W83627THF |
103 Pin | Name | Register | Sysfs attribute
104-----------------------------------------------------
105 100 | CPUVCORE | 20h | in0
106 99 | VIN0 | 21h | in1
107 98 | VIN1 | 22h | in2
108 97 | VIN2 | 24h | in4
109 114 | AVCC | 23h | in3
110 61 | 5VSB | 50h (bank 5) | in7
111 74 | VBAT | 51h (bank 5) | in8
112
113For other supported devices, you'll have to take the hard path and
114look up the information in the datasheet yourself (and then add it
115to this document please.)
diff --git a/Documentation/hwmon/w83793 b/Documentation/hwmon/w83793
index 51171a83165b..6cc5f639b721 100644
--- a/Documentation/hwmon/w83793
+++ b/Documentation/hwmon/w83793
@@ -92,7 +92,7 @@ This driver implements support for Winbond W83793G/W83793R chips.
92 92
93* Chassis 93* Chassis
94 If the case open alarm triggers, it will stay in this state unless cleared 94 If the case open alarm triggers, it will stay in this state unless cleared
95 by any write to the sysfs file "chassis". 95 by writing 0 to the sysfs file "intrusion0_alarm".
96 96
97* VID and VRM 97* VID and VRM
98 The VRM version is detected automatically, don't modify the it unless you 98 The VRM version is detected automatically, don't modify the it unless you
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index bdc13d28b1ea..35f00dae3676 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -809,10 +809,10 @@ config SENSORS_DME1737
809 will be called dme1737. 809 will be called dme1737.
810 810
811config SENSORS_EMC1403 811config SENSORS_EMC1403
812 tristate "SMSC EMC1403 thermal sensor" 812 tristate "SMSC EMC1403/23 thermal sensor"
813 depends on I2C 813 depends on I2C
814 help 814 help
815 If you say yes here you get support for the SMSC EMC1403 815 If you say yes here you get support for the SMSC EMC1403/23
816 temperature monitoring chip. 816 temperature monitoring chip.
817 817
818 Threshold values can be configured using sysfs. 818 Threshold values can be configured using sysfs.
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 0727ad250793..9e234b981b83 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -20,7 +20,7 @@
20 * Alarms 16-bit map of active alarms 20 * Alarms 16-bit map of active alarms
21 * Analog Out 0..1250 mV output 21 * Analog Out 0..1250 mV output
22 * 22 *
23 * Chassis Intrusion: clear CI latch with 'echo 1 > chassis_clear' 23 * Chassis Intrusion: clear CI latch with 'echo 0 > intrusion0_alarm'
24 * 24 *
25 * Test hardware: Intel SE440BX-2 desktop motherboard --Grant 25 * Test hardware: Intel SE440BX-2 desktop motherboard --Grant
26 * 26 *
@@ -476,13 +476,16 @@ static ssize_t set_aout(struct device *dev,
476static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout); 476static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
477 477
478/* chassis_clear */ 478/* chassis_clear */
479static ssize_t chassis_clear(struct device *dev, 479static ssize_t chassis_clear_legacy(struct device *dev,
480 struct device_attribute *attr, 480 struct device_attribute *attr,
481 const char *buf, size_t count) 481 const char *buf, size_t count)
482{ 482{
483 struct i2c_client *client = to_i2c_client(dev); 483 struct i2c_client *client = to_i2c_client(dev);
484 unsigned long val = simple_strtol(buf, NULL, 10); 484 unsigned long val = simple_strtol(buf, NULL, 10);
485 485
486 dev_warn(dev, "Attribute chassis_clear is deprecated, "
487 "use intrusion0_alarm instead\n");
488
486 if (val == 1) { 489 if (val == 1) {
487 i2c_smbus_write_byte_data(client, 490 i2c_smbus_write_byte_data(client,
488 ADM9240_REG_CHASSIS_CLEAR, 0x80); 491 ADM9240_REG_CHASSIS_CLEAR, 0x80);
@@ -490,7 +493,29 @@ static ssize_t chassis_clear(struct device *dev,
490 } 493 }
491 return count; 494 return count;
492} 495}
493static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear); 496static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear_legacy);
497
498static ssize_t chassis_clear(struct device *dev,
499 struct device_attribute *attr,
500 const char *buf, size_t count)
501{
502 struct i2c_client *client = to_i2c_client(dev);
503 struct adm9240_data *data = i2c_get_clientdata(client);
504 unsigned long val;
505
506 if (strict_strtoul(buf, 10, &val) || val != 0)
507 return -EINVAL;
508
509 mutex_lock(&data->update_lock);
510 i2c_smbus_write_byte_data(client, ADM9240_REG_CHASSIS_CLEAR, 0x80);
511 data->valid = 0; /* Force cache refresh */
512 mutex_unlock(&data->update_lock);
513 dev_dbg(&client->dev, "chassis intrusion latch cleared\n");
514
515 return count;
516}
517static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, show_alarm,
518 chassis_clear, 12);
494 519
495static struct attribute *adm9240_attributes[] = { 520static struct attribute *adm9240_attributes[] = {
496 &sensor_dev_attr_in0_input.dev_attr.attr, 521 &sensor_dev_attr_in0_input.dev_attr.attr,
@@ -532,6 +557,7 @@ static struct attribute *adm9240_attributes[] = {
532 &dev_attr_alarms.attr, 557 &dev_attr_alarms.attr,
533 &dev_attr_aout_output.attr, 558 &dev_attr_aout_output.attr,
534 &dev_attr_chassis_clear.attr, 559 &dev_attr_chassis_clear.attr,
560 &sensor_dev_attr_intrusion0_alarm.dev_attr.attr,
535 &dev_attr_cpu0_vid.attr, 561 &dev_attr_cpu0_vid.attr,
536 NULL 562 NULL
537}; 563};
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c
index aac85f3aed50..c42c5a69a664 100644
--- a/drivers/hwmon/ads7828.c
+++ b/drivers/hwmon/ads7828.c
@@ -4,7 +4,7 @@
4 4
5 This driver is based on the lm75 and other lm_sensors/hwmon drivers 5 This driver is based on the lm75 and other lm_sensors/hwmon drivers
6 6
7 Written by Steve Hardy <steve@linuxrealtime.co.uk> 7 Written by Steve Hardy <shardy@redhat.com>
8 8
9 Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads7828.pdf 9 Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads7828.pdf
10 10
@@ -271,7 +271,7 @@ static void __exit sensors_ads7828_exit(void)
271 i2c_del_driver(&ads7828_driver); 271 i2c_del_driver(&ads7828_driver);
272} 272}
273 273
274MODULE_AUTHOR("Steve Hardy <steve@linuxrealtime.co.uk>"); 274MODULE_AUTHOR("Steve Hardy <shardy@redhat.com>");
275MODULE_DESCRIPTION("ADS7828 driver"); 275MODULE_DESCRIPTION("ADS7828 driver");
276MODULE_LICENSE("GPL"); 276MODULE_LICENSE("GPL");
277 277
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index e9a610bfd0cc..d9c592713919 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -77,12 +77,14 @@ enum chips { dme1737, sch5027, sch311x, sch5127 };
77 * in4 +12V 77 * in4 +12V
78 * in5 VTR (+3.3V stby) 78 * in5 VTR (+3.3V stby)
79 * in6 Vbat 79 * in6 Vbat
80 * in7 Vtrip (sch5127 only)
80 * 81 *
81 * --------------------------------------------------------------------- */ 82 * --------------------------------------------------------------------- */
82 83
83/* Voltages (in) numbered 0-6 (ix) */ 84/* Voltages (in) numbered 0-7 (ix) */
84#define DME1737_REG_IN(ix) ((ix) < 5 ? 0x20 + (ix) \ 85#define DME1737_REG_IN(ix) ((ix) < 5 ? 0x20 + (ix) : \
85 : 0x94 + (ix)) 86 (ix) < 7 ? 0x94 + (ix) : \
87 0x1f)
86#define DME1737_REG_IN_MIN(ix) ((ix) < 5 ? 0x44 + (ix) * 2 \ 88#define DME1737_REG_IN_MIN(ix) ((ix) < 5 ? 0x44 + (ix) * 2 \
87 : 0x91 + (ix) * 2) 89 : 0x91 + (ix) * 2)
88#define DME1737_REG_IN_MAX(ix) ((ix) < 5 ? 0x45 + (ix) * 2 \ 90#define DME1737_REG_IN_MAX(ix) ((ix) < 5 ? 0x45 + (ix) * 2 \
@@ -101,10 +103,11 @@ enum chips { dme1737, sch5027, sch311x, sch5127 };
101 * IN_TEMP_LSB(1) = [temp3, temp1] 103 * IN_TEMP_LSB(1) = [temp3, temp1]
102 * IN_TEMP_LSB(2) = [in4, temp2] 104 * IN_TEMP_LSB(2) = [in4, temp2]
103 * IN_TEMP_LSB(3) = [in3, in0] 105 * IN_TEMP_LSB(3) = [in3, in0]
104 * IN_TEMP_LSB(4) = [in2, in1] */ 106 * IN_TEMP_LSB(4) = [in2, in1]
107 * IN_TEMP_LSB(5) = [res, in7] */
105#define DME1737_REG_IN_TEMP_LSB(ix) (0x84 + (ix)) 108#define DME1737_REG_IN_TEMP_LSB(ix) (0x84 + (ix))
106static const u8 DME1737_REG_IN_LSB[] = {3, 4, 4, 3, 2, 0, 0}; 109static const u8 DME1737_REG_IN_LSB[] = {3, 4, 4, 3, 2, 0, 0, 5};
107static const u8 DME1737_REG_IN_LSB_SHL[] = {4, 4, 0, 0, 0, 0, 4}; 110static const u8 DME1737_REG_IN_LSB_SHL[] = {4, 4, 0, 0, 0, 0, 4, 4};
108static const u8 DME1737_REG_TEMP_LSB[] = {1, 2, 1}; 111static const u8 DME1737_REG_TEMP_LSB[] = {1, 2, 1};
109static const u8 DME1737_REG_TEMP_LSB_SHL[] = {4, 4, 0}; 112static const u8 DME1737_REG_TEMP_LSB_SHL[] = {4, 4, 0};
110 113
@@ -145,7 +148,7 @@ static const u8 DME1737_REG_TEMP_LSB_SHL[] = {4, 4, 0};
145#define DME1737_REG_ALARM1 0x41 148#define DME1737_REG_ALARM1 0x41
146#define DME1737_REG_ALARM2 0x42 149#define DME1737_REG_ALARM2 0x42
147#define DME1737_REG_ALARM3 0x83 150#define DME1737_REG_ALARM3 0x83
148static const u8 DME1737_BIT_ALARM_IN[] = {0, 1, 2, 3, 8, 16, 17}; 151static const u8 DME1737_BIT_ALARM_IN[] = {0, 1, 2, 3, 8, 16, 17, 18};
149static const u8 DME1737_BIT_ALARM_TEMP[] = {4, 5, 6}; 152static const u8 DME1737_BIT_ALARM_TEMP[] = {4, 5, 6};
150static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23}; 153static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23};
151 154
@@ -190,6 +193,7 @@ static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23};
190#define HAS_PWM_MIN (1 << 4) /* bit 4 */ 193#define HAS_PWM_MIN (1 << 4) /* bit 4 */
191#define HAS_FAN(ix) (1 << ((ix) + 5)) /* bits 5-10 */ 194#define HAS_FAN(ix) (1 << ((ix) + 5)) /* bits 5-10 */
192#define HAS_PWM(ix) (1 << ((ix) + 11)) /* bits 11-16 */ 195#define HAS_PWM(ix) (1 << ((ix) + 11)) /* bits 11-16 */
196#define HAS_IN7 (1 << 17) /* bit 17 */
193 197
194/* --------------------------------------------------------------------- 198/* ---------------------------------------------------------------------
195 * Data structures and manipulation thereof 199 * Data structures and manipulation thereof
@@ -213,9 +217,9 @@ struct dme1737_data {
213 u32 has_features; 217 u32 has_features;
214 218
215 /* Register values */ 219 /* Register values */
216 u16 in[7]; 220 u16 in[8];
217 u8 in_min[7]; 221 u8 in_min[8];
218 u8 in_max[7]; 222 u8 in_max[8];
219 s16 temp[3]; 223 s16 temp[3];
220 s8 temp_min[3]; 224 s8 temp_min[3];
221 s8 temp_max[3]; 225 s8 temp_max[3];
@@ -247,7 +251,7 @@ static const int IN_NOMINAL_SCH311x[] = {2500, 1500, 3300, 5000, 12000, 3300,
247static const int IN_NOMINAL_SCH5027[] = {5000, 2250, 3300, 1125, 1125, 3300, 251static const int IN_NOMINAL_SCH5027[] = {5000, 2250, 3300, 1125, 1125, 3300,
248 3300}; 252 3300};
249static const int IN_NOMINAL_SCH5127[] = {2500, 2250, 3300, 1125, 1125, 3300, 253static const int IN_NOMINAL_SCH5127[] = {2500, 2250, 3300, 1125, 1125, 3300,
250 3300}; 254 3300, 1500};
251#define IN_NOMINAL(type) ((type) == sch311x ? IN_NOMINAL_SCH311x : \ 255#define IN_NOMINAL(type) ((type) == sch311x ? IN_NOMINAL_SCH311x : \
252 (type) == sch5027 ? IN_NOMINAL_SCH5027 : \ 256 (type) == sch5027 ? IN_NOMINAL_SCH5027 : \
253 (type) == sch5127 ? IN_NOMINAL_SCH5127 : \ 257 (type) == sch5127 ? IN_NOMINAL_SCH5127 : \
@@ -580,7 +584,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
580{ 584{
581 struct dme1737_data *data = dev_get_drvdata(dev); 585 struct dme1737_data *data = dev_get_drvdata(dev);
582 int ix; 586 int ix;
583 u8 lsb[5]; 587 u8 lsb[6];
584 588
585 mutex_lock(&data->update_lock); 589 mutex_lock(&data->update_lock);
586 590
@@ -603,6 +607,9 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
603 /* Voltage inputs are stored as 16 bit values even 607 /* Voltage inputs are stored as 16 bit values even
604 * though they have only 12 bits resolution. This is 608 * though they have only 12 bits resolution. This is
605 * to make it consistent with the temp inputs. */ 609 * to make it consistent with the temp inputs. */
610 if (ix == 7 && !(data->has_features & HAS_IN7)) {
611 continue;
612 }
606 data->in[ix] = dme1737_read(data, 613 data->in[ix] = dme1737_read(data,
607 DME1737_REG_IN(ix)) << 8; 614 DME1737_REG_IN(ix)) << 8;
608 data->in_min[ix] = dme1737_read(data, 615 data->in_min[ix] = dme1737_read(data,
@@ -635,10 +642,16 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
635 * which the registers are read (MSB first, then LSB) is 642 * which the registers are read (MSB first, then LSB) is
636 * important! */ 643 * important! */
637 for (ix = 0; ix < ARRAY_SIZE(lsb); ix++) { 644 for (ix = 0; ix < ARRAY_SIZE(lsb); ix++) {
645 if (ix == 5 && !(data->has_features & HAS_IN7)) {
646 continue;
647 }
638 lsb[ix] = dme1737_read(data, 648 lsb[ix] = dme1737_read(data,
639 DME1737_REG_IN_TEMP_LSB(ix)); 649 DME1737_REG_IN_TEMP_LSB(ix));
640 } 650 }
641 for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) { 651 for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) {
652 if (ix == 7 && !(data->has_features & HAS_IN7)) {
653 continue;
654 }
642 data->in[ix] |= (lsb[DME1737_REG_IN_LSB[ix]] << 655 data->in[ix] |= (lsb[DME1737_REG_IN_LSB[ix]] <<
643 DME1737_REG_IN_LSB_SHL[ix]) & 0xf0; 656 DME1737_REG_IN_LSB_SHL[ix]) & 0xf0;
644 } 657 }
@@ -762,7 +775,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
762 775
763/* --------------------------------------------------------------------- 776/* ---------------------------------------------------------------------
764 * Voltage sysfs attributes 777 * Voltage sysfs attributes
765 * ix = [0-5] 778 * ix = [0-7]
766 * --------------------------------------------------------------------- */ 779 * --------------------------------------------------------------------- */
767 780
768#define SYS_IN_INPUT 0 781#define SYS_IN_INPUT 0
@@ -1439,7 +1452,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr,
1439 * Sysfs device attribute defines and structs 1452 * Sysfs device attribute defines and structs
1440 * --------------------------------------------------------------------- */ 1453 * --------------------------------------------------------------------- */
1441 1454
1442/* Voltages 0-6 */ 1455/* Voltages 0-7 */
1443 1456
1444#define SENSOR_DEVICE_ATTR_IN(ix) \ 1457#define SENSOR_DEVICE_ATTR_IN(ix) \
1445static SENSOR_DEVICE_ATTR_2(in##ix##_input, S_IRUGO, \ 1458static SENSOR_DEVICE_ATTR_2(in##ix##_input, S_IRUGO, \
@@ -1458,6 +1471,7 @@ SENSOR_DEVICE_ATTR_IN(3);
1458SENSOR_DEVICE_ATTR_IN(4); 1471SENSOR_DEVICE_ATTR_IN(4);
1459SENSOR_DEVICE_ATTR_IN(5); 1472SENSOR_DEVICE_ATTR_IN(5);
1460SENSOR_DEVICE_ATTR_IN(6); 1473SENSOR_DEVICE_ATTR_IN(6);
1474SENSOR_DEVICE_ATTR_IN(7);
1461 1475
1462/* Temperatures 1-3 */ 1476/* Temperatures 1-3 */
1463 1477
@@ -1576,7 +1590,7 @@ static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); /* for ISA devices */
1576 * created unconditionally. The attributes that need modification of their 1590 * created unconditionally. The attributes that need modification of their
1577 * permissions are created read-only and write permissions are added or removed 1591 * permissions are created read-only and write permissions are added or removed
1578 * on the fly when required */ 1592 * on the fly when required */
1579static struct attribute *dme1737_attr[] ={ 1593static struct attribute *dme1737_attr[] = {
1580 /* Voltages */ 1594 /* Voltages */
1581 &sensor_dev_attr_in0_input.dev_attr.attr, 1595 &sensor_dev_attr_in0_input.dev_attr.attr,
1582 &sensor_dev_attr_in0_min.dev_attr.attr, 1596 &sensor_dev_attr_in0_min.dev_attr.attr,
@@ -1681,7 +1695,7 @@ static const struct attribute_group dme1737_zone3_group = {
1681}; 1695};
1682 1696
1683 1697
1684/* The following struct holds temp zone hysteresis related attributes, which 1698/* The following struct holds temp zone hysteresis related attributes, which
1685 * are not available in all chips. The following chips support them: 1699 * are not available in all chips. The following chips support them:
1686 * DME1737, SCH311x */ 1700 * DME1737, SCH311x */
1687static struct attribute *dme1737_zone_hyst_attr[] = { 1701static struct attribute *dme1737_zone_hyst_attr[] = {
@@ -1695,6 +1709,21 @@ static const struct attribute_group dme1737_zone_hyst_group = {
1695 .attrs = dme1737_zone_hyst_attr, 1709 .attrs = dme1737_zone_hyst_attr,
1696}; 1710};
1697 1711
1712/* The following struct holds voltage in7 related attributes, which
1713 * are not available in all chips. The following chips support them:
1714 * SCH5127 */
1715static struct attribute *dme1737_in7_attr[] = {
1716 &sensor_dev_attr_in7_input.dev_attr.attr,
1717 &sensor_dev_attr_in7_min.dev_attr.attr,
1718 &sensor_dev_attr_in7_max.dev_attr.attr,
1719 &sensor_dev_attr_in7_alarm.dev_attr.attr,
1720 NULL
1721};
1722
1723static const struct attribute_group dme1737_in7_group = {
1724 .attrs = dme1737_in7_attr,
1725};
1726
1698/* The following structs hold the PWM attributes, some of which are optional. 1727/* The following structs hold the PWM attributes, some of which are optional.
1699 * Their creation depends on the chip configuration which is determined during 1728 * Their creation depends on the chip configuration which is determined during
1700 * module load. */ 1729 * module load. */
@@ -1986,6 +2015,9 @@ static void dme1737_remove_files(struct device *dev)
1986 if (data->has_features & HAS_ZONE_HYST) { 2015 if (data->has_features & HAS_ZONE_HYST) {
1987 sysfs_remove_group(&dev->kobj, &dme1737_zone_hyst_group); 2016 sysfs_remove_group(&dev->kobj, &dme1737_zone_hyst_group);
1988 } 2017 }
2018 if (data->has_features & HAS_IN7) {
2019 sysfs_remove_group(&dev->kobj, &dme1737_in7_group);
2020 }
1989 sysfs_remove_group(&dev->kobj, &dme1737_group); 2021 sysfs_remove_group(&dev->kobj, &dme1737_group);
1990 2022
1991 if (!data->client) { 2023 if (!data->client) {
@@ -1999,43 +2031,58 @@ static int dme1737_create_files(struct device *dev)
1999 int err, ix; 2031 int err, ix;
2000 2032
2001 /* Create a name attribute for ISA devices */ 2033 /* Create a name attribute for ISA devices */
2002 if (!data->client && 2034 if (!data->client) {
2003 (err = sysfs_create_file(&dev->kobj, &dev_attr_name.attr))) { 2035 err = sysfs_create_file(&dev->kobj, &dev_attr_name.attr);
2004 goto exit; 2036 if (err) {
2037 goto exit;
2038 }
2005 } 2039 }
2006 2040
2007 /* Create standard sysfs attributes */ 2041 /* Create standard sysfs attributes */
2008 if ((err = sysfs_create_group(&dev->kobj, &dme1737_group))) { 2042 err = sysfs_create_group(&dev->kobj, &dme1737_group);
2043 if (err) {
2009 goto exit_remove; 2044 goto exit_remove;
2010 } 2045 }
2011 2046
2012 /* Create chip-dependent sysfs attributes */ 2047 /* Create chip-dependent sysfs attributes */
2013 if ((data->has_features & HAS_TEMP_OFFSET) && 2048 if (data->has_features & HAS_TEMP_OFFSET) {
2014 (err = sysfs_create_group(&dev->kobj, 2049 err = sysfs_create_group(&dev->kobj,
2015 &dme1737_temp_offset_group))) { 2050 &dme1737_temp_offset_group);
2016 goto exit_remove; 2051 if (err) {
2052 goto exit_remove;
2053 }
2017 } 2054 }
2018 if ((data->has_features & HAS_VID) && 2055 if (data->has_features & HAS_VID) {
2019 (err = sysfs_create_group(&dev->kobj, 2056 err = sysfs_create_group(&dev->kobj, &dme1737_vid_group);
2020 &dme1737_vid_group))) { 2057 if (err) {
2021 goto exit_remove; 2058 goto exit_remove;
2059 }
2022 } 2060 }
2023 if ((data->has_features & HAS_ZONE3) && 2061 if (data->has_features & HAS_ZONE3) {
2024 (err = sysfs_create_group(&dev->kobj, 2062 err = sysfs_create_group(&dev->kobj, &dme1737_zone3_group);
2025 &dme1737_zone3_group))) { 2063 if (err) {
2026 goto exit_remove; 2064 goto exit_remove;
2065 }
2027 } 2066 }
2028 if ((data->has_features & HAS_ZONE_HYST) && 2067 if (data->has_features & HAS_ZONE_HYST) {
2029 (err = sysfs_create_group(&dev->kobj, 2068 err = sysfs_create_group(&dev->kobj, &dme1737_zone_hyst_group);
2030 &dme1737_zone_hyst_group))) { 2069 if (err) {
2031 goto exit_remove; 2070 goto exit_remove;
2071 }
2072 }
2073 if (data->has_features & HAS_IN7) {
2074 err = sysfs_create_group(&dev->kobj, &dme1737_in7_group);
2075 if (err) {
2076 goto exit_remove;
2077 }
2032 } 2078 }
2033 2079
2034 /* Create fan sysfs attributes */ 2080 /* Create fan sysfs attributes */
2035 for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { 2081 for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
2036 if (data->has_features & HAS_FAN(ix)) { 2082 if (data->has_features & HAS_FAN(ix)) {
2037 if ((err = sysfs_create_group(&dev->kobj, 2083 err = sysfs_create_group(&dev->kobj,
2038 &dme1737_fan_group[ix]))) { 2084 &dme1737_fan_group[ix]);
2085 if (err) {
2039 goto exit_remove; 2086 goto exit_remove;
2040 } 2087 }
2041 } 2088 }
@@ -2044,14 +2091,17 @@ static int dme1737_create_files(struct device *dev)
2044 /* Create PWM sysfs attributes */ 2091 /* Create PWM sysfs attributes */
2045 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_group); ix++) { 2092 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_group); ix++) {
2046 if (data->has_features & HAS_PWM(ix)) { 2093 if (data->has_features & HAS_PWM(ix)) {
2047 if ((err = sysfs_create_group(&dev->kobj, 2094 err = sysfs_create_group(&dev->kobj,
2048 &dme1737_pwm_group[ix]))) { 2095 &dme1737_pwm_group[ix]);
2096 if (err) {
2049 goto exit_remove; 2097 goto exit_remove;
2050 } 2098 }
2051 if ((data->has_features & HAS_PWM_MIN) && ix < 3 && 2099 if ((data->has_features & HAS_PWM_MIN) && (ix < 3)) {
2052 (err = sysfs_create_file(&dev->kobj, 2100 err = sysfs_create_file(&dev->kobj,
2053 dme1737_auto_pwm_min_attr[ix]))) { 2101 dme1737_auto_pwm_min_attr[ix]);
2054 goto exit_remove; 2102 if (err) {
2103 goto exit_remove;
2104 }
2055 } 2105 }
2056 } 2106 }
2057 } 2107 }
@@ -2188,7 +2238,7 @@ static int dme1737_init_device(struct device *dev)
2188 data->has_features |= HAS_ZONE3; 2238 data->has_features |= HAS_ZONE3;
2189 break; 2239 break;
2190 case sch5127: 2240 case sch5127:
2191 data->has_features |= HAS_FAN(2) | HAS_PWM(2); 2241 data->has_features |= HAS_FAN(2) | HAS_PWM(2) | HAS_IN7;
2192 break; 2242 break;
2193 default: 2243 default:
2194 break; 2244 break;
@@ -2281,8 +2331,9 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data)
2281 dme1737_sio_outb(sio_cip, 0x07, 0x0a); 2331 dme1737_sio_outb(sio_cip, 0x07, 0x0a);
2282 2332
2283 /* Get the base address of the runtime registers */ 2333 /* Get the base address of the runtime registers */
2284 if (!(addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) | 2334 addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) |
2285 dme1737_sio_inb(sio_cip, 0x61))) { 2335 dme1737_sio_inb(sio_cip, 0x61);
2336 if (!addr) {
2286 err = -ENODEV; 2337 err = -ENODEV;
2287 goto exit; 2338 goto exit;
2288 } 2339 }
@@ -2363,13 +2414,15 @@ static int dme1737_i2c_probe(struct i2c_client *client,
2363 mutex_init(&data->update_lock); 2414 mutex_init(&data->update_lock);
2364 2415
2365 /* Initialize the DME1737 chip */ 2416 /* Initialize the DME1737 chip */
2366 if ((err = dme1737_init_device(dev))) { 2417 err = dme1737_init_device(dev);
2418 if (err) {
2367 dev_err(dev, "Failed to initialize device.\n"); 2419 dev_err(dev, "Failed to initialize device.\n");
2368 goto exit_kfree; 2420 goto exit_kfree;
2369 } 2421 }
2370 2422
2371 /* Create sysfs files */ 2423 /* Create sysfs files */
2372 if ((err = dme1737_create_files(dev))) { 2424 err = dme1737_create_files(dev);
2425 if (err) {
2373 dev_err(dev, "Failed to create sysfs files.\n"); 2426 dev_err(dev, "Failed to create sysfs files.\n");
2374 goto exit_kfree; 2427 goto exit_kfree;
2375 } 2428 }
@@ -2446,8 +2499,9 @@ static int __init dme1737_isa_detect(int sio_cip, unsigned short *addr)
2446 dme1737_sio_outb(sio_cip, 0x07, 0x0a); 2499 dme1737_sio_outb(sio_cip, 0x07, 0x0a);
2447 2500
2448 /* Get the base address of the runtime registers */ 2501 /* Get the base address of the runtime registers */
2449 if (!(base_addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) | 2502 base_addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) |
2450 dme1737_sio_inb(sio_cip, 0x61))) { 2503 dme1737_sio_inb(sio_cip, 0x61);
2504 if (!base_addr) {
2451 pr_err("Base address not set\n"); 2505 pr_err("Base address not set\n");
2452 err = -ENODEV; 2506 err = -ENODEV;
2453 goto exit; 2507 goto exit;
@@ -2476,18 +2530,21 @@ static int __init dme1737_isa_device_add(unsigned short addr)
2476 if (err) 2530 if (err)
2477 goto exit; 2531 goto exit;
2478 2532
2479 if (!(pdev = platform_device_alloc("dme1737", addr))) { 2533 pdev = platform_device_alloc("dme1737", addr);
2534 if (!pdev) {
2480 pr_err("Failed to allocate device\n"); 2535 pr_err("Failed to allocate device\n");
2481 err = -ENOMEM; 2536 err = -ENOMEM;
2482 goto exit; 2537 goto exit;
2483 } 2538 }
2484 2539
2485 if ((err = platform_device_add_resources(pdev, &res, 1))) { 2540 err = platform_device_add_resources(pdev, &res, 1);
2541 if (err) {
2486 pr_err("Failed to add device resource (err = %d)\n", err); 2542 pr_err("Failed to add device resource (err = %d)\n", err);
2487 goto exit_device_put; 2543 goto exit_device_put;
2488 } 2544 }
2489 2545
2490 if ((err = platform_device_add(pdev))) { 2546 err = platform_device_add(pdev);
2547 if (err) {
2491 pr_err("Failed to add device (err = %d)\n", err); 2548 pr_err("Failed to add device (err = %d)\n", err);
2492 goto exit_device_put; 2549 goto exit_device_put;
2493 } 2550 }
@@ -2514,11 +2571,12 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
2514 dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n", 2571 dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n",
2515 (unsigned short)res->start, 2572 (unsigned short)res->start,
2516 (unsigned short)res->start + DME1737_EXTENT - 1); 2573 (unsigned short)res->start + DME1737_EXTENT - 1);
2517 err = -EBUSY; 2574 err = -EBUSY;
2518 goto exit; 2575 goto exit;
2519 } 2576 }
2520 2577
2521 if (!(data = kzalloc(sizeof(struct dme1737_data), GFP_KERNEL))) { 2578 data = kzalloc(sizeof(struct dme1737_data), GFP_KERNEL);
2579 if (!data) {
2522 err = -ENOMEM; 2580 err = -ENOMEM;
2523 goto exit_release_region; 2581 goto exit_release_region;
2524 } 2582 }
@@ -2565,13 +2623,15 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
2565 data->type == sch5127 ? "SCH5127" : "SCH311x", data->addr); 2623 data->type == sch5127 ? "SCH5127" : "SCH311x", data->addr);
2566 2624
2567 /* Initialize the chip */ 2625 /* Initialize the chip */
2568 if ((err = dme1737_init_device(dev))) { 2626 err = dme1737_init_device(dev);
2627 if (err) {
2569 dev_err(dev, "Failed to initialize device.\n"); 2628 dev_err(dev, "Failed to initialize device.\n");
2570 goto exit_kfree; 2629 goto exit_kfree;
2571 } 2630 }
2572 2631
2573 /* Create sysfs files */ 2632 /* Create sysfs files */
2574 if ((err = dme1737_create_files(dev))) { 2633 err = dme1737_create_files(dev);
2634 if (err) {
2575 dev_err(dev, "Failed to create sysfs files.\n"); 2635 dev_err(dev, "Failed to create sysfs files.\n");
2576 goto exit_kfree; 2636 goto exit_kfree;
2577 } 2637 }
@@ -2628,7 +2688,8 @@ static int __init dme1737_init(void)
2628 int err; 2688 int err;
2629 unsigned short addr; 2689 unsigned short addr;
2630 2690
2631 if ((err = i2c_add_driver(&dme1737_i2c_driver))) { 2691 err = i2c_add_driver(&dme1737_i2c_driver);
2692 if (err) {
2632 goto exit; 2693 goto exit;
2633 } 2694 }
2634 2695
@@ -2641,12 +2702,14 @@ static int __init dme1737_init(void)
2641 return 0; 2702 return 0;
2642 } 2703 }
2643 2704
2644 if ((err = platform_driver_register(&dme1737_isa_driver))) { 2705 err = platform_driver_register(&dme1737_isa_driver);
2706 if (err) {
2645 goto exit_del_i2c_driver; 2707 goto exit_del_i2c_driver;
2646 } 2708 }
2647 2709
2648 /* Sets global pdev as a side effect */ 2710 /* Sets global pdev as a side effect */
2649 if ((err = dme1737_isa_device_add(addr))) { 2711 err = dme1737_isa_device_add(addr);
2712 if (err) {
2650 goto exit_del_isa_driver; 2713 goto exit_del_isa_driver;
2651 } 2714 }
2652 2715
diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
index 8dee3f38fdfb..5dea9faa1656 100644
--- a/drivers/hwmon/emc1403.c
+++ b/drivers/hwmon/emc1403.c
@@ -269,23 +269,30 @@ static int emc1403_detect(struct i2c_client *client,
269 struct i2c_board_info *info) 269 struct i2c_board_info *info)
270{ 270{
271 int id; 271 int id;
272 /* Check if thermal chip is SMSC and EMC1403 */ 272 /* Check if thermal chip is SMSC and EMC1403 or EMC1423 */
273 273
274 id = i2c_smbus_read_byte_data(client, THERMAL_SMSC_ID_REG); 274 id = i2c_smbus_read_byte_data(client, THERMAL_SMSC_ID_REG);
275 if (id != 0x5d) 275 if (id != 0x5d)
276 return -ENODEV; 276 return -ENODEV;
277 277
278 id = i2c_smbus_read_byte_data(client, THERMAL_PID_REG);
279 switch (id) {
280 case 0x21:
281 strlcpy(info->type, "emc1403", I2C_NAME_SIZE);
282 break;
283 case 0x23:
284 strlcpy(info->type, "emc1423", I2C_NAME_SIZE);
285 break;
278 /* Note: 0x25 is the 1404 which is very similar and this 286 /* Note: 0x25 is the 1404 which is very similar and this
279 driver could be extended */ 287 driver could be extended */
280 id = i2c_smbus_read_byte_data(client, THERMAL_PID_REG); 288 default:
281 if (id != 0x21)
282 return -ENODEV; 289 return -ENODEV;
290 }
283 291
284 id = i2c_smbus_read_byte_data(client, THERMAL_REVISION_REG); 292 id = i2c_smbus_read_byte_data(client, THERMAL_REVISION_REG);
285 if (id != 0x01) 293 if (id != 0x01)
286 return -ENODEV; 294 return -ENODEV;
287 295
288 strlcpy(info->type, "emc1403", I2C_NAME_SIZE);
289 return 0; 296 return 0;
290} 297}
291 298
@@ -342,6 +349,7 @@ static const unsigned short emc1403_address_list[] = {
342 349
343static const struct i2c_device_id emc1403_idtable[] = { 350static const struct i2c_device_id emc1403_idtable[] = {
344 { "emc1403", 0 }, 351 { "emc1403", 0 },
352 { "emc1423", 0 },
345 { } 353 { }
346}; 354};
347MODULE_DEVICE_TABLE(i2c, emc1403_idtable); 355MODULE_DEVICE_TABLE(i2c, emc1403_idtable);
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index d4d4ca65d371..aa6d8b686f82 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -49,7 +49,6 @@
49#include <linux/kref.h> 49#include <linux/kref.h>
50 50
51/* Addresses to scan */ 51/* Addresses to scan */
52static DEFINE_MUTEX(watchdog_mutex);
53static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; 52static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
54 53
55/* Insmod parameters */ 54/* Insmod parameters */
@@ -850,7 +849,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
850 849
851static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 850static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
852{ 851{
853 static struct watchdog_info ident = { 852 struct watchdog_info ident = {
854 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 853 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
855 WDIOF_CARDRESET, 854 WDIOF_CARDRESET,
856 .identity = "FSC watchdog" 855 .identity = "FSC watchdog"
@@ -858,7 +857,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long ar
858 int i, ret = 0; 857 int i, ret = 0;
859 struct fschmd_data *data = filp->private_data; 858 struct fschmd_data *data = filp->private_data;
860 859
861 mutex_lock(&watchdog_mutex);
862 switch (cmd) { 860 switch (cmd) {
863 case WDIOC_GETSUPPORT: 861 case WDIOC_GETSUPPORT:
864 ident.firmware_version = data->revision; 862 ident.firmware_version = data->revision;
@@ -915,7 +913,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long ar
915 default: 913 default:
916 ret = -ENOTTY; 914 ret = -ENOTTY;
917 } 915 }
918 mutex_unlock(&watchdog_mutex);
919 return ret; 916 return ret;
920} 917}
921 918
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index a428a9264195..316b64823f7b 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -38,6 +38,8 @@
38 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 38 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
39 */ 39 */
40 40
41#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
42
41#include <linux/module.h> 43#include <linux/module.h>
42#include <linux/init.h> 44#include <linux/init.h>
43#include <linux/slab.h> 45#include <linux/slab.h>
@@ -1570,26 +1572,25 @@ static int __init it87_find(unsigned short *address,
1570 case 0xffff: /* No device at all */ 1572 case 0xffff: /* No device at all */
1571 goto exit; 1573 goto exit;
1572 default: 1574 default:
1573 pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%x)\n", 1575 pr_debug("Unsupported chip (DEVID=0x%x)\n", chip_type);
1574 chip_type);
1575 goto exit; 1576 goto exit;
1576 } 1577 }
1577 1578
1578 superio_select(PME); 1579 superio_select(PME);
1579 if (!(superio_inb(IT87_ACT_REG) & 0x01)) { 1580 if (!(superio_inb(IT87_ACT_REG) & 0x01)) {
1580 pr_info("it87: Device not activated, skipping\n"); 1581 pr_info("Device not activated, skipping\n");
1581 goto exit; 1582 goto exit;
1582 } 1583 }
1583 1584
1584 *address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1); 1585 *address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1);
1585 if (*address == 0) { 1586 if (*address == 0) {
1586 pr_info("it87: Base address not set, skipping\n"); 1587 pr_info("Base address not set, skipping\n");
1587 goto exit; 1588 goto exit;
1588 } 1589 }
1589 1590
1590 err = 0; 1591 err = 0;
1591 sio_data->revision = superio_inb(DEVREV) & 0x0f; 1592 sio_data->revision = superio_inb(DEVREV) & 0x0f;
1592 pr_info("it87: Found IT%04xF chip at 0x%x, revision %d\n", 1593 pr_info("Found IT%04xF chip at 0x%x, revision %d\n",
1593 chip_type, *address, sio_data->revision); 1594 chip_type, *address, sio_data->revision);
1594 1595
1595 /* in8 (Vbat) is always internal */ 1596 /* in8 (Vbat) is always internal */
@@ -1615,7 +1616,7 @@ static int __init it87_find(unsigned short *address,
1615 } else { 1616 } else {
1616 /* We need at least 4 VID pins */ 1617 /* We need at least 4 VID pins */
1617 if (reg & 0x0f) { 1618 if (reg & 0x0f) {
1618 pr_info("it87: VID is disabled (pins used for GPIO)\n"); 1619 pr_info("VID is disabled (pins used for GPIO)\n");
1619 sio_data->skip_vid = 1; 1620 sio_data->skip_vid = 1;
1620 } 1621 }
1621 } 1622 }
@@ -1651,7 +1652,7 @@ static int __init it87_find(unsigned short *address,
1651 if (sio_data->type == it8720 && !(reg & (1 << 1))) { 1652 if (sio_data->type == it8720 && !(reg & (1 << 1))) {
1652 reg |= (1 << 1); 1653 reg |= (1 << 1);
1653 superio_outb(IT87_SIO_PINX2_REG, reg); 1654 superio_outb(IT87_SIO_PINX2_REG, reg);
1654 pr_notice("it87: Routing internal VCCH to in7\n"); 1655 pr_notice("Routing internal VCCH to in7\n");
1655 } 1656 }
1656 if (reg & (1 << 0)) 1657 if (reg & (1 << 0))
1657 sio_data->internal |= (1 << 0); 1658 sio_data->internal |= (1 << 0);
@@ -1661,7 +1662,7 @@ static int __init it87_find(unsigned short *address,
1661 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; 1662 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
1662 } 1663 }
1663 if (sio_data->beep_pin) 1664 if (sio_data->beep_pin)
1664 pr_info("it87: Beeping is supported\n"); 1665 pr_info("Beeping is supported\n");
1665 1666
1666 /* Disable specific features based on DMI strings */ 1667 /* Disable specific features based on DMI strings */
1667 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); 1668 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
@@ -1675,8 +1676,7 @@ static int __init it87_find(unsigned short *address,
1675 the PWM2 duty cycle, so we disable it. 1676 the PWM2 duty cycle, so we disable it.
1676 I use the board name string as the trigger in case 1677 I use the board name string as the trigger in case
1677 the same board is ever used in other systems. */ 1678 the same board is ever used in other systems. */
1678 pr_info("it87: Disabling pwm2 due to " 1679 pr_info("Disabling pwm2 due to hardware constraints\n");
1679 "hardware constraints\n");
1680 sio_data->skip_pwm = (1 << 1); 1680 sio_data->skip_pwm = (1 << 1);
1681 } 1681 }
1682 } 1682 }
@@ -2189,28 +2189,26 @@ static int __init it87_device_add(unsigned short address,
2189 pdev = platform_device_alloc(DRVNAME, address); 2189 pdev = platform_device_alloc(DRVNAME, address);
2190 if (!pdev) { 2190 if (!pdev) {
2191 err = -ENOMEM; 2191 err = -ENOMEM;
2192 printk(KERN_ERR DRVNAME ": Device allocation failed\n"); 2192 pr_err("Device allocation failed\n");
2193 goto exit; 2193 goto exit;
2194 } 2194 }
2195 2195
2196 err = platform_device_add_resources(pdev, &res, 1); 2196 err = platform_device_add_resources(pdev, &res, 1);
2197 if (err) { 2197 if (err) {
2198 printk(KERN_ERR DRVNAME ": Device resource addition failed " 2198 pr_err("Device resource addition failed (%d)\n", err);
2199 "(%d)\n", err);
2200 goto exit_device_put; 2199 goto exit_device_put;
2201 } 2200 }
2202 2201
2203 err = platform_device_add_data(pdev, sio_data, 2202 err = platform_device_add_data(pdev, sio_data,
2204 sizeof(struct it87_sio_data)); 2203 sizeof(struct it87_sio_data));
2205 if (err) { 2204 if (err) {
2206 printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); 2205 pr_err("Platform data allocation failed\n");
2207 goto exit_device_put; 2206 goto exit_device_put;
2208 } 2207 }
2209 2208
2210 err = platform_device_add(pdev); 2209 err = platform_device_add(pdev);
2211 if (err) { 2210 if (err) {
2212 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n", 2211 pr_err("Device addition failed (%d)\n", err);
2213 err);
2214 goto exit_device_put; 2212 goto exit_device_put;
2215 } 2213 }
2216 2214
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 72ff2c4e757d..4cb24eafe318 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -19,6 +19,8 @@
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/ 20*/
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/module.h> 24#include <linux/module.h>
23#include <linux/init.h> 25#include <linux/init.h>
24#include <linux/slab.h> 26#include <linux/slab.h>
@@ -858,7 +860,7 @@ static int __init lm78_isa_found(unsigned short address)
858 * individually for the probing phase. */ 860 * individually for the probing phase. */
859 for (port = address; port < address + LM78_EXTENT; port++) { 861 for (port = address; port < address + LM78_EXTENT; port++) {
860 if (!request_region(port, 1, "lm78")) { 862 if (!request_region(port, 1, "lm78")) {
861 pr_debug("lm78: Failed to request port 0x%x\n", port); 863 pr_debug("Failed to request port 0x%x\n", port);
862 goto release; 864 goto release;
863 } 865 }
864 } 866 }
@@ -920,7 +922,7 @@ static int __init lm78_isa_found(unsigned short address)
920 found = 1; 922 found = 1;
921 923
922 if (found) 924 if (found)
923 pr_info("lm78: Found an %s chip at %#x\n", 925 pr_info("Found an %s chip at %#x\n",
924 val & 0x80 ? "LM79" : "LM78", (int)address); 926 val & 0x80 ? "LM79" : "LM78", (int)address);
925 927
926 release: 928 release:
@@ -942,21 +944,19 @@ static int __init lm78_isa_device_add(unsigned short address)
942 pdev = platform_device_alloc("lm78", address); 944 pdev = platform_device_alloc("lm78", address);
943 if (!pdev) { 945 if (!pdev) {
944 err = -ENOMEM; 946 err = -ENOMEM;
945 printk(KERN_ERR "lm78: Device allocation failed\n"); 947 pr_err("Device allocation failed\n");
946 goto exit; 948 goto exit;
947 } 949 }
948 950
949 err = platform_device_add_resources(pdev, &res, 1); 951 err = platform_device_add_resources(pdev, &res, 1);
950 if (err) { 952 if (err) {
951 printk(KERN_ERR "lm78: Device resource addition failed " 953 pr_err("Device resource addition failed (%d)\n", err);
952 "(%d)\n", err);
953 goto exit_device_put; 954 goto exit_device_put;
954 } 955 }
955 956
956 err = platform_device_add(pdev); 957 err = platform_device_add(pdev);
957 if (err) { 958 if (err) {
958 printk(KERN_ERR "lm78: Device addition failed (%d)\n", 959 pr_err("Device addition failed (%d)\n", err);
959 err);
960 goto exit_device_put; 960 goto exit_device_put;
961 } 961 }
962 962
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 68e69a49633c..3d99b8854d7c 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -33,6 +33,8 @@
33 * the standard Super-I/O addresses is used (0x2E/0x2F or 0x4E/0x4F). 33 * the standard Super-I/O addresses is used (0x2E/0x2F or 0x4E/0x4F).
34 */ 34 */
35 35
36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
37
36#include <linux/module.h> 38#include <linux/module.h>
37#include <linux/init.h> 39#include <linux/init.h>
38#include <linux/slab.h> 40#include <linux/slab.h>
@@ -1031,16 +1033,15 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
1031 1033
1032 val = superio_inb(sioaddr, ACT); 1034 val = superio_inb(sioaddr, ACT);
1033 if (!(val & 0x01)) { 1035 if (!(val & 0x01)) {
1034 printk(KERN_INFO "pc87360: Device 0x%02x not " 1036 pr_info("Device 0x%02x not activated\n", logdev[i]);
1035 "activated\n", logdev[i]);
1036 continue; 1037 continue;
1037 } 1038 }
1038 1039
1039 val = (superio_inb(sioaddr, BASE) << 8) 1040 val = (superio_inb(sioaddr, BASE) << 8)
1040 | superio_inb(sioaddr, BASE + 1); 1041 | superio_inb(sioaddr, BASE + 1);
1041 if (!val) { 1042 if (!val) {
1042 printk(KERN_INFO "pc87360: Base address not set for " 1043 pr_info("Base address not set for device 0x%02x\n",
1043 "device 0x%02x\n", logdev[i]); 1044 logdev[i]);
1044 continue; 1045 continue;
1045 } 1046 }
1046 1047
@@ -1050,17 +1051,15 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
1050 confreg[0] = superio_inb(sioaddr, 0xF0); 1051 confreg[0] = superio_inb(sioaddr, 0xF0);
1051 confreg[1] = superio_inb(sioaddr, 0xF1); 1052 confreg[1] = superio_inb(sioaddr, 0xF1);
1052 1053
1053#ifdef DEBUG 1054 pr_debug("Fan %d: mon=%d ctrl=%d inv=%d\n", 1,
1054 printk(KERN_DEBUG "pc87360: Fan 1: mon=%d " 1055 (confreg[0] >> 2) & 1, (confreg[0] >> 3) & 1,
1055 "ctrl=%d inv=%d\n", (confreg[0]>>2)&1, 1056 (confreg[0] >> 4) & 1);
1056 (confreg[0]>>3)&1, (confreg[0]>>4)&1); 1057 pr_debug("Fan %d: mon=%d ctrl=%d inv=%d\n", 2,
1057 printk(KERN_DEBUG "pc87360: Fan 2: mon=%d " 1058 (confreg[0] >> 5) & 1, (confreg[0] >> 6) & 1,
1058 "ctrl=%d inv=%d\n", (confreg[0]>>5)&1, 1059 (confreg[0] >> 7) & 1);
1059 (confreg[0]>>6)&1, (confreg[0]>>7)&1); 1060 pr_debug("Fan %d: mon=%d ctrl=%d inv=%d\n", 3,
1060 printk(KERN_DEBUG "pc87360: Fan 3: mon=%d " 1061 confreg[1] & 1, (confreg[1] >> 1) & 1,
1061 "ctrl=%d inv=%d\n", confreg[1]&1, 1062 (confreg[1] >> 2) & 1);
1062 (confreg[1]>>1)&1, (confreg[1]>>2)&1);
1063#endif
1064 } else if (i==1) { /* Voltages */ 1063 } else if (i==1) { /* Voltages */
1065 /* Are we using thermistors? */ 1064 /* Are we using thermistors? */
1066 if (*devid == 0xE9) { /* PC87366 */ 1065 if (*devid == 0xE9) { /* PC87366 */
@@ -1071,14 +1070,12 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
1071 confreg[3] = superio_inb(sioaddr, 0x25); 1070 confreg[3] = superio_inb(sioaddr, 0x25);
1072 1071
1073 if (confreg[2] & 0x40) { 1072 if (confreg[2] & 0x40) {
1074 printk(KERN_INFO "pc87360: Using " 1073 pr_info("Using thermistors for "
1075 "thermistors for temperature " 1074 "temperature monitoring\n");
1076 "monitoring\n");
1077 } 1075 }
1078 if (confreg[3] & 0xE0) { 1076 if (confreg[3] & 0xE0) {
1079 printk(KERN_INFO "pc87360: VID " 1077 pr_info("VID inputs routed (mode %u)\n",
1080 "inputs routed (mode %u)\n", 1078 confreg[3] >> 5);
1081 confreg[3] >> 5);
1082 } 1079 }
1083 } 1080 }
1084 } 1081 }
@@ -1616,7 +1613,7 @@ static int __init pc87360_device_add(unsigned short address)
1616 pdev = platform_device_alloc("pc87360", address); 1613 pdev = platform_device_alloc("pc87360", address);
1617 if (!pdev) { 1614 if (!pdev) {
1618 err = -ENOMEM; 1615 err = -ENOMEM;
1619 printk(KERN_ERR "pc87360: Device allocation failed\n"); 1616 pr_err("Device allocation failed\n");
1620 goto exit; 1617 goto exit;
1621 } 1618 }
1622 1619
@@ -1639,15 +1636,13 @@ static int __init pc87360_device_add(unsigned short address)
1639 1636
1640 err = platform_device_add_resources(pdev, res, res_count); 1637 err = platform_device_add_resources(pdev, res, res_count);
1641 if (err) { 1638 if (err) {
1642 printk(KERN_ERR "pc87360: Device resources addition failed " 1639 pr_err("Device resources addition failed (%d)\n", err);
1643 "(%d)\n", err);
1644 goto exit_device_put; 1640 goto exit_device_put;
1645 } 1641 }
1646 1642
1647 err = platform_device_add(pdev); 1643 err = platform_device_add(pdev);
1648 if (err) { 1644 if (err) {
1649 printk(KERN_ERR "pc87360: Device addition failed (%d)\n", 1645 pr_err("Device addition failed (%d)\n", err);
1650 err);
1651 goto exit_device_put; 1646 goto exit_device_put;
1652 } 1647 }
1653 1648
@@ -1666,8 +1661,7 @@ static int __init pc87360_init(void)
1666 1661
1667 if (pc87360_find(0x2e, &devid, extra_isa) 1662 if (pc87360_find(0x2e, &devid, extra_isa)
1668 && pc87360_find(0x4e, &devid, extra_isa)) { 1663 && pc87360_find(0x4e, &devid, extra_isa)) {
1669 printk(KERN_WARNING "pc87360: PC8736x not detected, " 1664 pr_warn("PC8736x not detected, module not inserted\n");
1670 "module not inserted.\n");
1671 return -ENODEV; 1665 return -ENODEV;
1672 } 1666 }
1673 1667
@@ -1680,8 +1674,7 @@ static int __init pc87360_init(void)
1680 } 1674 }
1681 1675
1682 if (address == 0x0000) { 1676 if (address == 0x0000) {
1683 printk(KERN_WARNING "pc87360: No active logical device, " 1677 pr_warn("No active logical device, module not inserted\n");
1684 "module not inserted.\n");
1685 return -ENODEV; 1678 return -ENODEV;
1686 } 1679 }
1687 1680
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c
index 9ec4daaf6ca6..8da2181630b1 100644
--- a/drivers/hwmon/pc87427.c
+++ b/drivers/hwmon/pc87427.c
@@ -22,6 +22,8 @@
22 * mode, and voltages aren't supported at all. 22 * mode, and voltages aren't supported at all.
23 */ 23 */
24 24
25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26
25#include <linux/module.h> 27#include <linux/module.h>
26#include <linux/init.h> 28#include <linux/init.h>
27#include <linux/slab.h> 29#include <linux/slab.h>
@@ -1077,7 +1079,7 @@ static int __devinit pc87427_probe(struct platform_device *pdev)
1077 data = kzalloc(sizeof(struct pc87427_data), GFP_KERNEL); 1079 data = kzalloc(sizeof(struct pc87427_data), GFP_KERNEL);
1078 if (!data) { 1080 if (!data) {
1079 err = -ENOMEM; 1081 err = -ENOMEM;
1080 printk(KERN_ERR DRVNAME ": Out of memory\n"); 1082 pr_err("Out of memory\n");
1081 goto exit; 1083 goto exit;
1082 } 1084 }
1083 1085
@@ -1196,28 +1198,26 @@ static int __init pc87427_device_add(const struct pc87427_sio_data *sio_data)
1196 pdev = platform_device_alloc(DRVNAME, res[0].start); 1198 pdev = platform_device_alloc(DRVNAME, res[0].start);
1197 if (!pdev) { 1199 if (!pdev) {
1198 err = -ENOMEM; 1200 err = -ENOMEM;
1199 printk(KERN_ERR DRVNAME ": Device allocation failed\n"); 1201 pr_err("Device allocation failed\n");
1200 goto exit; 1202 goto exit;
1201 } 1203 }
1202 1204
1203 err = platform_device_add_resources(pdev, res, res_count); 1205 err = platform_device_add_resources(pdev, res, res_count);
1204 if (err) { 1206 if (err) {
1205 printk(KERN_ERR DRVNAME ": Device resource addition failed " 1207 pr_err("Device resource addition failed (%d)\n", err);
1206 "(%d)\n", err);
1207 goto exit_device_put; 1208 goto exit_device_put;
1208 } 1209 }
1209 1210
1210 err = platform_device_add_data(pdev, sio_data, 1211 err = platform_device_add_data(pdev, sio_data,
1211 sizeof(struct pc87427_sio_data)); 1212 sizeof(struct pc87427_sio_data));
1212 if (err) { 1213 if (err) {
1213 printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); 1214 pr_err("Platform data allocation failed\n");
1214 goto exit_device_put; 1215 goto exit_device_put;
1215 } 1216 }
1216 1217
1217 err = platform_device_add(pdev); 1218 err = platform_device_add(pdev);
1218 if (err) { 1219 if (err) {
1219 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n", 1220 pr_err("Device addition failed (%d)\n", err);
1220 err);
1221 goto exit_device_put; 1221 goto exit_device_put;
1222 } 1222 }
1223 1223
@@ -1249,23 +1249,23 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data)
1249 1249
1250 val = superio_inb(sioaddr, SIOREG_ACT); 1250 val = superio_inb(sioaddr, SIOREG_ACT);
1251 if (!(val & 0x01)) { 1251 if (!(val & 0x01)) {
1252 printk(KERN_INFO DRVNAME ": Logical device 0x%02x " 1252 pr_info("Logical device 0x%02x not activated\n",
1253 "not activated\n", logdev[i]); 1253 logdev[i]);
1254 continue; 1254 continue;
1255 } 1255 }
1256 1256
1257 val = superio_inb(sioaddr, SIOREG_MAP); 1257 val = superio_inb(sioaddr, SIOREG_MAP);
1258 if (val & 0x01) { 1258 if (val & 0x01) {
1259 printk(KERN_WARNING DRVNAME ": Logical device 0x%02x " 1259 pr_warn("Logical device 0x%02x is memory-mapped, "
1260 "is memory-mapped, can't use\n", logdev[i]); 1260 "can't use\n", logdev[i]);
1261 continue; 1261 continue;
1262 } 1262 }
1263 1263
1264 val = (superio_inb(sioaddr, SIOREG_IOBASE) << 8) 1264 val = (superio_inb(sioaddr, SIOREG_IOBASE) << 8)
1265 | superio_inb(sioaddr, SIOREG_IOBASE + 1); 1265 | superio_inb(sioaddr, SIOREG_IOBASE + 1);
1266 if (!val) { 1266 if (!val) {
1267 printk(KERN_INFO DRVNAME ": I/O base address not set " 1267 pr_info("I/O base address not set for logical device "
1268 "for logical device 0x%02x\n", logdev[i]); 1268 "0x%02x\n", logdev[i]);
1269 continue; 1269 continue;
1270 } 1270 }
1271 sio_data->address[i] = val; 1271 sio_data->address[i] = val;
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index 13e8d218e495..25e91665a0a2 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -689,6 +689,13 @@ static int __devexit via686a_remove(struct platform_device *pdev)
689 return 0; 689 return 0;
690} 690}
691 691
692static void via686a_update_fan_div(struct via686a_data *data)
693{
694 int reg = via686a_read_value(data, VIA686A_REG_FANDIV);
695 data->fan_div[0] = (reg >> 4) & 0x03;
696 data->fan_div[1] = reg >> 6;
697}
698
692static void __devinit via686a_init_device(struct via686a_data *data) 699static void __devinit via686a_init_device(struct via686a_data *data)
693{ 700{
694 u8 reg; 701 u8 reg;
@@ -702,6 +709,9 @@ static void __devinit via686a_init_device(struct via686a_data *data)
702 via686a_write_value(data, VIA686A_REG_TEMP_MODE, 709 via686a_write_value(data, VIA686A_REG_TEMP_MODE,
703 (reg & ~VIA686A_TEMP_MODE_MASK) 710 (reg & ~VIA686A_TEMP_MODE_MASK)
704 | VIA686A_TEMP_MODE_CONTINUOUS); 711 | VIA686A_TEMP_MODE_CONTINUOUS);
712
713 /* Pre-read fan clock divisor values */
714 via686a_update_fan_div(data);
705} 715}
706 716
707static struct via686a_data *via686a_update_device(struct device *dev) 717static struct via686a_data *via686a_update_device(struct device *dev)
@@ -753,9 +763,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
753 (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) & 763 (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) &
754 0xc0) >> 6; 764 0xc0) >> 6;
755 765
756 i = via686a_read_value(data, VIA686A_REG_FANDIV); 766 via686a_update_fan_div(data);
757 data->fan_div[0] = (i >> 4) & 0x03;
758 data->fan_div[1] = i >> 6;
759 data->alarms = 767 data->alarms =
760 via686a_read_value(data, 768 via686a_read_value(data,
761 VIA686A_REG_ALARM1) | 769 VIA686A_REG_ALARM1) |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index c84b9b4e6960..eed43a008be1 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -33,6 +33,8 @@
33 33
34*/ 34*/
35 35
36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
37
36#include <linux/module.h> 38#include <linux/module.h>
37#include <linux/init.h> 39#include <linux/init.h>
38#include <linux/slab.h> 40#include <linux/slab.h>
@@ -1798,8 +1800,7 @@ w83781d_isa_found(unsigned short address)
1798 * individually for the probing phase. */ 1800 * individually for the probing phase. */
1799 for (port = address; port < address + W83781D_EXTENT; port++) { 1801 for (port = address; port < address + W83781D_EXTENT; port++) {
1800 if (!request_region(port, 1, "w83781d")) { 1802 if (!request_region(port, 1, "w83781d")) {
1801 pr_debug("w83781d: Failed to request port 0x%x\n", 1803 pr_debug("Failed to request port 0x%x\n", port);
1802 port);
1803 goto release; 1804 goto release;
1804 } 1805 }
1805 } 1806 }
@@ -1811,7 +1812,7 @@ w83781d_isa_found(unsigned short address)
1811 if (inb_p(address + 2) != val 1812 if (inb_p(address + 2) != val
1812 || inb_p(address + 3) != val 1813 || inb_p(address + 3) != val
1813 || inb_p(address + 7) != val) { 1814 || inb_p(address + 7) != val) {
1814 pr_debug("w83781d: Detection failed at step 1\n"); 1815 pr_debug("Detection failed at step %d\n", 1);
1815 goto release; 1816 goto release;
1816 } 1817 }
1817#undef REALLY_SLOW_IO 1818#undef REALLY_SLOW_IO
@@ -1820,14 +1821,14 @@ w83781d_isa_found(unsigned short address)
1820 MSB (busy flag) should be clear initially, set after the write. */ 1821 MSB (busy flag) should be clear initially, set after the write. */
1821 save = inb_p(address + W83781D_ADDR_REG_OFFSET); 1822 save = inb_p(address + W83781D_ADDR_REG_OFFSET);
1822 if (save & 0x80) { 1823 if (save & 0x80) {
1823 pr_debug("w83781d: Detection failed at step 2\n"); 1824 pr_debug("Detection failed at step %d\n", 2);
1824 goto release; 1825 goto release;
1825 } 1826 }
1826 val = ~save & 0x7f; 1827 val = ~save & 0x7f;
1827 outb_p(val, address + W83781D_ADDR_REG_OFFSET); 1828 outb_p(val, address + W83781D_ADDR_REG_OFFSET);
1828 if (inb_p(address + W83781D_ADDR_REG_OFFSET) != (val | 0x80)) { 1829 if (inb_p(address + W83781D_ADDR_REG_OFFSET) != (val | 0x80)) {
1829 outb_p(save, address + W83781D_ADDR_REG_OFFSET); 1830 outb_p(save, address + W83781D_ADDR_REG_OFFSET);
1830 pr_debug("w83781d: Detection failed at step 3\n"); 1831 pr_debug("Detection failed at step %d\n", 3);
1831 goto release; 1832 goto release;
1832 } 1833 }
1833 1834
@@ -1835,7 +1836,7 @@ w83781d_isa_found(unsigned short address)
1835 outb_p(W83781D_REG_CONFIG, address + W83781D_ADDR_REG_OFFSET); 1836 outb_p(W83781D_REG_CONFIG, address + W83781D_ADDR_REG_OFFSET);
1836 val = inb_p(address + W83781D_DATA_REG_OFFSET); 1837 val = inb_p(address + W83781D_DATA_REG_OFFSET);
1837 if (val & 0x80) { 1838 if (val & 0x80) {
1838 pr_debug("w83781d: Detection failed at step 4\n"); 1839 pr_debug("Detection failed at step %d\n", 4);
1839 goto release; 1840 goto release;
1840 } 1841 }
1841 outb_p(W83781D_REG_BANK, address + W83781D_ADDR_REG_OFFSET); 1842 outb_p(W83781D_REG_BANK, address + W83781D_ADDR_REG_OFFSET);
@@ -1844,19 +1845,19 @@ w83781d_isa_found(unsigned short address)
1844 val = inb_p(address + W83781D_DATA_REG_OFFSET); 1845 val = inb_p(address + W83781D_DATA_REG_OFFSET);
1845 if ((!(save & 0x80) && (val != 0xa3)) 1846 if ((!(save & 0x80) && (val != 0xa3))
1846 || ((save & 0x80) && (val != 0x5c))) { 1847 || ((save & 0x80) && (val != 0x5c))) {
1847 pr_debug("w83781d: Detection failed at step 5\n"); 1848 pr_debug("Detection failed at step %d\n", 5);
1848 goto release; 1849 goto release;
1849 } 1850 }
1850 outb_p(W83781D_REG_I2C_ADDR, address + W83781D_ADDR_REG_OFFSET); 1851 outb_p(W83781D_REG_I2C_ADDR, address + W83781D_ADDR_REG_OFFSET);
1851 val = inb_p(address + W83781D_DATA_REG_OFFSET); 1852 val = inb_p(address + W83781D_DATA_REG_OFFSET);
1852 if (val < 0x03 || val > 0x77) { /* Not a valid I2C address */ 1853 if (val < 0x03 || val > 0x77) { /* Not a valid I2C address */
1853 pr_debug("w83781d: Detection failed at step 6\n"); 1854 pr_debug("Detection failed at step %d\n", 6);
1854 goto release; 1855 goto release;
1855 } 1856 }
1856 1857
1857 /* The busy flag should be clear again */ 1858 /* The busy flag should be clear again */
1858 if (inb_p(address + W83781D_ADDR_REG_OFFSET) & 0x80) { 1859 if (inb_p(address + W83781D_ADDR_REG_OFFSET) & 0x80) {
1859 pr_debug("w83781d: Detection failed at step 7\n"); 1860 pr_debug("Detection failed at step %d\n", 7);
1860 goto release; 1861 goto release;
1861 } 1862 }
1862 1863
@@ -1871,7 +1872,7 @@ w83781d_isa_found(unsigned short address)
1871 found = 1; 1872 found = 1;
1872 1873
1873 if (found) 1874 if (found)
1874 pr_info("w83781d: Found a %s chip at %#x\n", 1875 pr_info("Found a %s chip at %#x\n",
1875 val == 0x30 ? "W83782D" : "W83781D", (int)address); 1876 val == 0x30 ? "W83782D" : "W83781D", (int)address);
1876 1877
1877 release: 1878 release:
@@ -1894,21 +1895,19 @@ w83781d_isa_device_add(unsigned short address)
1894 pdev = platform_device_alloc("w83781d", address); 1895 pdev = platform_device_alloc("w83781d", address);
1895 if (!pdev) { 1896 if (!pdev) {
1896 err = -ENOMEM; 1897 err = -ENOMEM;
1897 printk(KERN_ERR "w83781d: Device allocation failed\n"); 1898 pr_err("Device allocation failed\n");
1898 goto exit; 1899 goto exit;
1899 } 1900 }
1900 1901
1901 err = platform_device_add_resources(pdev, &res, 1); 1902 err = platform_device_add_resources(pdev, &res, 1);
1902 if (err) { 1903 if (err) {
1903 printk(KERN_ERR "w83781d: Device resource addition failed " 1904 pr_err("Device resource addition failed (%d)\n", err);
1904 "(%d)\n", err);
1905 goto exit_device_put; 1905 goto exit_device_put;
1906 } 1906 }
1907 1907
1908 err = platform_device_add(pdev); 1908 err = platform_device_add(pdev);
1909 if (err) { 1909 if (err) {
1910 printk(KERN_ERR "w83781d: Device addition failed (%d)\n", 1910 pr_err("Device addition failed (%d)\n", err);
1911 err);
1912 goto exit_device_put; 1911 goto exit_device_put;
1913 } 1912 }
1914 1913
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 679718e6b017..63841f8cec07 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -691,7 +691,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
691} 691}
692 692
693static ssize_t 693static ssize_t
694show_regs_chassis(struct device *dev, struct device_attribute *attr, 694show_chassis(struct device *dev, struct device_attribute *attr,
695 char *buf) 695 char *buf)
696{ 696{
697 struct w83792d_data *data = w83792d_update_device(dev); 697 struct w83792d_data *data = w83792d_update_device(dev);
@@ -699,6 +699,16 @@ show_regs_chassis(struct device *dev, struct device_attribute *attr,
699} 699}
700 700
701static ssize_t 701static ssize_t
702show_regs_chassis(struct device *dev, struct device_attribute *attr,
703 char *buf)
704{
705 dev_warn(dev,
706 "Attribute %s is deprecated, use intrusion0_alarm instead\n",
707 "chassis");
708 return show_chassis(dev, attr, buf);
709}
710
711static ssize_t
702show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf) 712show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
703{ 713{
704 struct w83792d_data *data = w83792d_update_device(dev); 714 struct w83792d_data *data = w83792d_update_device(dev);
@@ -706,7 +716,7 @@ show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
706} 716}
707 717
708static ssize_t 718static ssize_t
709store_chassis_clear(struct device *dev, struct device_attribute *attr, 719store_chassis_clear_legacy(struct device *dev, struct device_attribute *attr,
710 const char *buf, size_t count) 720 const char *buf, size_t count)
711{ 721{
712 struct i2c_client *client = to_i2c_client(dev); 722 struct i2c_client *client = to_i2c_client(dev);
@@ -714,6 +724,10 @@ store_chassis_clear(struct device *dev, struct device_attribute *attr,
714 u32 val; 724 u32 val;
715 u8 temp1 = 0, temp2 = 0; 725 u8 temp1 = 0, temp2 = 0;
716 726
727 dev_warn(dev,
728 "Attribute %s is deprecated, use intrusion0_alarm instead\n",
729 "chassis_clear");
730
717 val = simple_strtoul(buf, NULL, 10); 731 val = simple_strtoul(buf, NULL, 10);
718 mutex_lock(&data->update_lock); 732 mutex_lock(&data->update_lock);
719 data->chassis_clear = SENSORS_LIMIT(val, 0 ,1); 733 data->chassis_clear = SENSORS_LIMIT(val, 0 ,1);
@@ -726,6 +740,27 @@ store_chassis_clear(struct device *dev, struct device_attribute *attr,
726 return count; 740 return count;
727} 741}
728 742
743static ssize_t
744store_chassis_clear(struct device *dev, struct device_attribute *attr,
745 const char *buf, size_t count)
746{
747 struct i2c_client *client = to_i2c_client(dev);
748 struct w83792d_data *data = i2c_get_clientdata(client);
749 unsigned long val;
750 u8 reg;
751
752 if (strict_strtoul(buf, 10, &val) || val != 0)
753 return -EINVAL;
754
755 mutex_lock(&data->update_lock);
756 reg = w83792d_read_value(client, W83792D_REG_CHASSIS_CLR);
757 w83792d_write_value(client, W83792D_REG_CHASSIS_CLR, reg | 0x80);
758 data->valid = 0; /* Force cache refresh */
759 mutex_unlock(&data->update_lock);
760
761 return count;
762}
763
729/* For Smart Fan I / Thermal Cruise */ 764/* For Smart Fan I / Thermal Cruise */
730static ssize_t 765static ssize_t
731show_thermal_cruise(struct device *dev, struct device_attribute *attr, 766show_thermal_cruise(struct device *dev, struct device_attribute *attr,
@@ -1012,7 +1047,9 @@ static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 22);
1012static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 23); 1047static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 23);
1013static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL); 1048static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
1014static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR, 1049static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
1015 show_chassis_clear, store_chassis_clear); 1050 show_chassis_clear, store_chassis_clear_legacy);
1051static DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
1052 show_chassis, store_chassis_clear);
1016static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0); 1053static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0);
1017static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1); 1054static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1);
1018static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2); 1055static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2);
@@ -1214,6 +1251,7 @@ static struct attribute *w83792d_attributes[] = {
1214 &dev_attr_alarms.attr, 1251 &dev_attr_alarms.attr,
1215 &dev_attr_chassis.attr, 1252 &dev_attr_chassis.attr,
1216 &dev_attr_chassis_clear.attr, 1253 &dev_attr_chassis_clear.attr,
1254 &dev_attr_intrusion0_alarm.attr,
1217 &sensor_dev_attr_tolerance1.dev_attr.attr, 1255 &sensor_dev_attr_tolerance1.dev_attr.attr,
1218 &sensor_dev_attr_thermal_cruise1.dev_attr.attr, 1256 &sensor_dev_attr_thermal_cruise1.dev_attr.attr,
1219 &sensor_dev_attr_tolerance2.dev_attr.attr, 1257 &sensor_dev_attr_tolerance2.dev_attr.attr,
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 8e540ada47d2..e3bdedfb5347 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -51,7 +51,6 @@
51#define WATCHDOG_TIMEOUT 2 /* 2 minute default timeout */ 51#define WATCHDOG_TIMEOUT 2 /* 2 minute default timeout */
52 52
53/* Addresses to scan */ 53/* Addresses to scan */
54static DEFINE_MUTEX(watchdog_mutex);
55static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, 54static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
56 I2C_CLIENT_END }; 55 I2C_CLIENT_END };
57 56
@@ -421,14 +420,17 @@ store_beep_enable(struct device *dev, struct device_attribute *attr,
421 420
422/* Write any value to clear chassis alarm */ 421/* Write any value to clear chassis alarm */
423static ssize_t 422static ssize_t
424store_chassis_clear(struct device *dev, 423store_chassis_clear_legacy(struct device *dev,
425 struct device_attribute *attr, const char *buf, 424 struct device_attribute *attr, const char *buf,
426 size_t count) 425 size_t count)
427{ 426{
428 struct i2c_client *client = to_i2c_client(dev); 427 struct i2c_client *client = to_i2c_client(dev);
429 struct w83793_data *data = i2c_get_clientdata(client); 428 struct w83793_data *data = i2c_get_clientdata(client);
430 u8 val; 429 u8 val;
431 430
431 dev_warn(dev, "Attribute chassis is deprecated, "
432 "use intrusion0_alarm instead\n");
433
432 mutex_lock(&data->update_lock); 434 mutex_lock(&data->update_lock);
433 val = w83793_read_value(client, W83793_REG_CLR_CHASSIS); 435 val = w83793_read_value(client, W83793_REG_CLR_CHASSIS);
434 val |= 0x80; 436 val |= 0x80;
@@ -437,6 +439,28 @@ store_chassis_clear(struct device *dev,
437 return count; 439 return count;
438} 440}
439 441
442/* Write 0 to clear chassis alarm */
443static ssize_t
444store_chassis_clear(struct device *dev,
445 struct device_attribute *attr, const char *buf,
446 size_t count)
447{
448 struct i2c_client *client = to_i2c_client(dev);
449 struct w83793_data *data = i2c_get_clientdata(client);
450 unsigned long val;
451 u8 reg;
452
453 if (strict_strtoul(buf, 10, &val) || val != 0)
454 return -EINVAL;
455
456 mutex_lock(&data->update_lock);
457 reg = w83793_read_value(client, W83793_REG_CLR_CHASSIS);
458 w83793_write_value(client, W83793_REG_CLR_CHASSIS, reg | 0x80);
459 data->valid = 0; /* Force cache refresh */
460 mutex_unlock(&data->update_lock);
461 return count;
462}
463
440#define FAN_INPUT 0 464#define FAN_INPUT 0
441#define FAN_MIN 1 465#define FAN_MIN 1
442static ssize_t 466static ssize_t
@@ -1102,6 +1126,8 @@ static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm);
1102 1126
1103static struct sensor_device_attribute_2 sda_single_files[] = { 1127static struct sensor_device_attribute_2 sda_single_files[] = {
1104 SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, 1128 SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep,
1129 store_chassis_clear_legacy, ALARM_STATUS, 30),
1130 SENSOR_ATTR_2(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm_beep,
1105 store_chassis_clear, ALARM_STATUS, 30), 1131 store_chassis_clear, ALARM_STATUS, 30),
1106 SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, 1132 SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable,
1107 store_beep_enable, NOT_USED, NOT_USED), 1133 store_beep_enable, NOT_USED, NOT_USED),
@@ -1323,7 +1349,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
1323static long watchdog_ioctl(struct file *filp, unsigned int cmd, 1349static long watchdog_ioctl(struct file *filp, unsigned int cmd,
1324 unsigned long arg) 1350 unsigned long arg)
1325{ 1351{
1326 static struct watchdog_info ident = { 1352 struct watchdog_info ident = {
1327 .options = WDIOF_KEEPALIVEPING | 1353 .options = WDIOF_KEEPALIVEPING |
1328 WDIOF_SETTIMEOUT | 1354 WDIOF_SETTIMEOUT |
1329 WDIOF_CARDRESET, 1355 WDIOF_CARDRESET,
@@ -1333,7 +1359,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd,
1333 int val, ret = 0; 1359 int val, ret = 0;
1334 struct w83793_data *data = filp->private_data; 1360 struct w83793_data *data = filp->private_data;
1335 1361
1336 mutex_lock(&watchdog_mutex);
1337 switch (cmd) { 1362 switch (cmd) {
1338 case WDIOC_GETSUPPORT: 1363 case WDIOC_GETSUPPORT:
1339 if (!nowayout) 1364 if (!nowayout)
@@ -1387,7 +1412,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd,
1387 default: 1412 default:
1388 ret = -ENOTTY; 1413 ret = -ENOTTY;
1389 } 1414 }
1390 mutex_unlock(&watchdog_mutex);
1391 return ret; 1415 return ret;
1392} 1416}
1393 1417
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index cdbc7448491e..845232d7f611 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -458,6 +458,7 @@ static void w83795_update_limits(struct i2c_client *client)
458{ 458{
459 struct w83795_data *data = i2c_get_clientdata(client); 459 struct w83795_data *data = i2c_get_clientdata(client);
460 int i, limit; 460 int i, limit;
461 u8 lsb;
461 462
462 /* Read the voltage limits */ 463 /* Read the voltage limits */
463 for (i = 0; i < ARRAY_SIZE(data->in); i++) { 464 for (i = 0; i < ARRAY_SIZE(data->in); i++) {
@@ -479,9 +480,8 @@ static void w83795_update_limits(struct i2c_client *client)
479 } 480 }
480 481
481 /* Read the fan limits */ 482 /* Read the fan limits */
483 lsb = 0; /* Silent false gcc warning */
482 for (i = 0; i < ARRAY_SIZE(data->fan); i++) { 484 for (i = 0; i < ARRAY_SIZE(data->fan); i++) {
483 u8 lsb;
484
485 /* Each register contains LSB for 2 fans, but we want to 485 /* Each register contains LSB for 2 fans, but we want to
486 * read it only once to save time */ 486 * read it only once to save time */
487 if ((i & 1) == 0 && (data->has_fan & (3 << i))) 487 if ((i & 1) == 0 && (data->has_fan & (3 << i)))