diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-21 19:37:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-21 19:37:42 -0500 |
commit | bfe38ccf8d0b541f387f65267f6f3794be59233a (patch) | |
tree | c1f5cece3247431b3d2c484da831d2eb0fd6c9e0 | |
parent | 20f8d2a49360980f1dc0afe2ea227e3ba887e575 (diff) | |
parent | 25e9c86d5a6d82ea45eb680fc66bf73ac5e50dff (diff) |
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6:
hwmon: normal_i2c arrays should be const
hwmon: New driver for Analog Devices ADT7473 sensor chip
hwmon: (coretemp) Add Penryn CPU to coretemp
hwmon: (coretemp) Add TjMax detection for mobile CPUs
hwmon: (applesmc) sensors set for MacBook2
hwmon: (thmc50) Storage class should be before const qualifier
hwmon: (coretemp) fix section mismatch warning
hwmon: (coretemp) Add maximum cooling temperature readout
hwmon: (adm1026) Properly terminate sysfs groups
hwmon: (vt8231) Update maintainer email address
hwmon: (vt8231) Add individual alarm files
hwmon: (via686a) Add individual alarm files
hwmon: (smsc47m1) Add individual alarm files
hwmon: (max1619) Add individual alarm and fault files
hwmon: (lm92) Add individual alarm files
51 files changed, 1534 insertions, 120 deletions
diff --git a/Documentation/hwmon/adt7473 b/Documentation/hwmon/adt7473 new file mode 100644 index 000000000000..22d8b19046ab --- /dev/null +++ b/Documentation/hwmon/adt7473 | |||
@@ -0,0 +1,79 @@ | |||
1 | Kernel driver adt7473 | ||
2 | ====================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Analog Devices ADT7473 | ||
6 | Prefix: 'adt7473' | ||
7 | Addresses scanned: I2C 0x2C, 0x2D, 0x2E | ||
8 | Datasheet: Publicly available at the Analog Devices website | ||
9 | |||
10 | Author: Darrick J. Wong | ||
11 | |||
12 | Description | ||
13 | ----------- | ||
14 | |||
15 | This driver implements support for the Analog Devices ADT7473 chip family. | ||
16 | |||
17 | The LM85 uses the 2-wire interface compatible with the SMBUS 2.0 | ||
18 | specification. Using an analog to digital converter it measures three (3) | ||
19 | temperatures and two (2) voltages. It has three (3) 16-bit counters for | ||
20 | measuring fan speed. There are three (3) PWM outputs that can be used | ||
21 | to control fan speed. | ||
22 | |||
23 | A sophisticated control system for the PWM outputs is designed into the | ||
24 | LM85 that allows fan speed to be adjusted automatically based on any of the | ||
25 | three temperature sensors. Each PWM output is individually adjustable and | ||
26 | programmable. Once configured, the ADT7473 will adjust the PWM outputs in | ||
27 | response to the measured temperatures without further host intervention. | ||
28 | This feature can also be disabled for manual control of the PWM's. | ||
29 | |||
30 | Each of the measured inputs (voltage, temperature, fan speed) has | ||
31 | corresponding high/low limit values. The ADT7473 will signal an ALARM if | ||
32 | any measured value exceeds either limit. | ||
33 | |||
34 | The ADT7473 samples all inputs continuously. The driver will not read | ||
35 | the registers more often than once every other second. Further, | ||
36 | configuration data is only read once per minute. | ||
37 | |||
38 | Special Features | ||
39 | ---------------- | ||
40 | |||
41 | The ADT7473 have a 10-bit ADC and can therefore measure temperatures | ||
42 | with 0.25 degC resolution. Temperature readings can be configured either | ||
43 | for twos complement format or "Offset 64" format, wherein 63 is subtracted | ||
44 | from the raw value to get the temperature value. | ||
45 | |||
46 | The Analog Devices datasheet is very detailed and describes a procedure for | ||
47 | determining an optimal configuration for the automatic PWM control. | ||
48 | |||
49 | Hardware Configurations | ||
50 | ----------------------- | ||
51 | |||
52 | The ADT7473 chips have an optional SMBALERT output that can be used to | ||
53 | signal the chipset in case a limit is exceeded or the temperature sensors | ||
54 | fail. Individual sensor interrupts can be masked so they won't trigger | ||
55 | SMBALERT. The SMBALERT output if configured replaces the PWM2 function. | ||
56 | |||
57 | Configuration Notes | ||
58 | ------------------- | ||
59 | |||
60 | Besides standard interfaces driver adds the following: | ||
61 | |||
62 | * PWM Control | ||
63 | |||
64 | * pwm#_auto_point1_pwm and pwm#_auto_point1_temp and | ||
65 | * pwm#_auto_point2_pwm and pwm#_auto_point2_temp - | ||
66 | |||
67 | point1: Set the pwm speed at a lower temperature bound. | ||
68 | point2: Set the pwm speed at a higher temperature bound. | ||
69 | |||
70 | The ADT7473 will scale the pwm between the lower and higher pwm speed when | ||
71 | the temperature is between the two temperature boundaries. PWM values range | ||
72 | from 0 (off) to 255 (full speed). | ||
73 | |||
74 | Notes | ||
75 | ----- | ||
76 | |||
77 | The NVIDIA binary driver presents an ADT7473 chip via an on-card i2c bus. | ||
78 | Unfortunately, they fail to set the i2c adapter class, so this driver may | ||
79 | fail to find the chip until the nvidia driver is patched. | ||
diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp index 170bf862437b..dbbe6c7025b0 100644 --- a/Documentation/hwmon/coretemp +++ b/Documentation/hwmon/coretemp | |||
@@ -4,9 +4,10 @@ Kernel driver coretemp | |||
4 | Supported chips: | 4 | Supported chips: |
5 | * All Intel Core family | 5 | * All Intel Core family |
6 | Prefix: 'coretemp' | 6 | Prefix: 'coretemp' |
7 | CPUID: family 0x6, models 0xe, 0xf, 0x16 | 7 | CPUID: family 0x6, models 0xe, 0xf, 0x16, 0x17 |
8 | Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual | 8 | Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual |
9 | Volume 3A: System Programming Guide | 9 | Volume 3A: System Programming Guide |
10 | http://softwarecommunity.intel.com/Wiki/Mobility/720.htm | ||
10 | 11 | ||
11 | Author: Rudolf Marek | 12 | Author: Rudolf Marek |
12 | 13 | ||
@@ -25,7 +26,8 @@ may be raised, if the temperature grows enough (more than TjMax) to trigger | |||
25 | the Out-Of-Spec bit. Following table summarizes the exported sysfs files: | 26 | the Out-Of-Spec bit. Following table summarizes the exported sysfs files: |
26 | 27 | ||
27 | temp1_input - Core temperature (in millidegrees Celsius). | 28 | temp1_input - Core temperature (in millidegrees Celsius). |
28 | temp1_crit - Maximum junction temperature (in millidegrees Celsius). | 29 | temp1_max - All cooling devices should be turned on (on Core2). |
30 | temp1_crit - Maximum junction temperature (in millidegrees Celsius). | ||
29 | temp1_crit_alarm - Set when Out-of-spec bit is set, never clears. | 31 | temp1_crit_alarm - Set when Out-of-spec bit is set, never clears. |
30 | Correct CPU operation is no longer guaranteed. | 32 | Correct CPU operation is no longer guaranteed. |
31 | temp1_label - Contains string "Core X", where X is processor | 33 | temp1_label - Contains string "Core X", where X is processor |
diff --git a/MAINTAINERS b/MAINTAINERS index fd81e0672c0d..962babe226c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -4261,7 +4261,7 @@ S: Maintained | |||
4261 | 4261 | ||
4262 | VT8231 HARDWARE MONITOR DRIVER | 4262 | VT8231 HARDWARE MONITOR DRIVER |
4263 | P: Roger Lucas | 4263 | P: Roger Lucas |
4264 | M: roger@planbit.co.uk | 4264 | M: vt8231@hiddenengine.co.uk |
4265 | L: lm-sensors@lm-sensors.org | 4265 | L: lm-sensors@lm-sensors.org |
4266 | S: Maintained | 4266 | S: Maintained |
4267 | 4267 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 410ffe4e9d80..368879ff5d8c 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -143,6 +143,16 @@ config SENSORS_ADT7470 | |||
143 | This driver can also be built as a module. If so, the module | 143 | This driver can also be built as a module. If so, the module |
144 | will be called adt7470. | 144 | will be called adt7470. |
145 | 145 | ||
146 | config SENSORS_ADT7473 | ||
147 | tristate "Analog Devices ADT7473" | ||
148 | depends on I2C && EXPERIMENTAL | ||
149 | help | ||
150 | If you say yes here you get support for the Analog Devices | ||
151 | ADT7473 temperature monitoring chips. | ||
152 | |||
153 | This driver can also be built as a module. If so, the module | ||
154 | will be called adt7473. | ||
155 | |||
146 | config SENSORS_K8TEMP | 156 | config SENSORS_K8TEMP |
147 | tristate "AMD Athlon64/FX or Opteron temperature sensor" | 157 | tristate "AMD Athlon64/FX or Opteron temperature sensor" |
148 | depends on X86 && PCI && EXPERIMENTAL | 158 | depends on X86 && PCI && EXPERIMENTAL |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 824161337f1c..3bdb05a5cbd7 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -24,6 +24,7 @@ obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o | |||
24 | obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o | 24 | obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o |
25 | obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o | 25 | obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o |
26 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o | 26 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o |
27 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o | ||
27 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o | 28 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o |
28 | obj-$(CONFIG_SENSORS_AMS) += ams/ | 29 | obj-$(CONFIG_SENSORS_AMS) += ams/ |
29 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o | 30 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o |
diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c index fcd7fe78f3f9..466b9ee92797 100644 --- a/drivers/hwmon/ad7418.c +++ b/drivers/hwmon/ad7418.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #define DRV_VERSION "0.3" | 26 | #define DRV_VERSION "0.3" |
27 | 27 | ||
28 | /* Addresses to scan */ | 28 | /* Addresses to scan */ |
29 | static unsigned short normal_i2c[] = { 0x28, I2C_CLIENT_END }; | 29 | static const unsigned short normal_i2c[] = { 0x28, I2C_CLIENT_END }; |
30 | /* Insmod parameters */ | 30 | /* Insmod parameters */ |
31 | I2C_CLIENT_INSMOD_3(ad7416, ad7417, ad7418); | 31 | I2C_CLIENT_INSMOD_3(ad7416, ad7417, ad7418); |
32 | 32 | ||
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index b96be772e498..ecbf69484bf5 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
@@ -31,10 +31,8 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | /* Addresses to scan */ | 33 | /* Addresses to scan */ |
34 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | 34 | static const unsigned short normal_i2c[] = { |
35 | 0x29, 0x2a, 0x2b, | 35 | 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; |
36 | 0x4c, 0x4d, 0x4e, | ||
37 | I2C_CLIENT_END }; | ||
38 | 36 | ||
39 | /* Insmod parameters */ | 37 | /* Insmod parameters */ |
40 | I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, | 38 | I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, |
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index e96c3725203d..1d76de7d75c7 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c | |||
@@ -62,7 +62,7 @@ | |||
62 | * NE1619 has two possible addresses: 0x2c and 0x2d. | 62 | * NE1619 has two possible addresses: 0x2c and 0x2d. |
63 | */ | 63 | */ |
64 | 64 | ||
65 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 65 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Insmod parameters | 68 | * Insmod parameters |
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 8002f68240c4..904c6ce9d83f 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
36 | 36 | ||
37 | /* Addresses to scan */ | 37 | /* Addresses to scan */ |
38 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 38 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
39 | 39 | ||
40 | /* Insmod parameters */ | 40 | /* Insmod parameters */ |
41 | I2C_CLIENT_INSMOD_1(adm1026); | 41 | I2C_CLIENT_INSMOD_1(adm1026); |
@@ -1624,6 +1624,7 @@ static struct attribute *adm1026_attributes_temp3[] = { | |||
1624 | &dev_attr_temp3_crit_enable.attr, | 1624 | &dev_attr_temp3_crit_enable.attr, |
1625 | &dev_attr_temp3_auto_point1_pwm.attr, | 1625 | &dev_attr_temp3_auto_point1_pwm.attr, |
1626 | &dev_attr_temp3_auto_point2_pwm.attr, | 1626 | &dev_attr_temp3_auto_point2_pwm.attr, |
1627 | NULL | ||
1627 | }; | 1628 | }; |
1628 | 1629 | ||
1629 | static const struct attribute_group adm1026_group_temp3 = { | 1630 | static const struct attribute_group adm1026_group_temp3 = { |
@@ -1639,6 +1640,7 @@ static struct attribute *adm1026_attributes_in8_9[] = { | |||
1639 | &sensor_dev_attr_in9_max.dev_attr.attr, | 1640 | &sensor_dev_attr_in9_max.dev_attr.attr, |
1640 | &sensor_dev_attr_in9_min.dev_attr.attr, | 1641 | &sensor_dev_attr_in9_min.dev_attr.attr, |
1641 | &sensor_dev_attr_in9_alarm.dev_attr.attr, | 1642 | &sensor_dev_attr_in9_alarm.dev_attr.attr, |
1643 | NULL | ||
1642 | }; | 1644 | }; |
1643 | 1645 | ||
1644 | static const struct attribute_group adm1026_group_in8_9 = { | 1646 | static const struct attribute_group adm1026_group_in8_9 = { |
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 0bc897dffa27..2c6608d453c2 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c | |||
@@ -39,10 +39,8 @@ | |||
39 | * Addresses to scan | 39 | * Addresses to scan |
40 | */ | 40 | */ |
41 | 41 | ||
42 | static unsigned short normal_i2c[] = { | 42 | static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, |
43 | 0x28, 0x29, 0x2a, | 43 | 0x2e, 0x2f, I2C_CLIENT_END |
44 | 0x2b, 0x2c, 0x2d, | ||
45 | 0x2e, 0x2f, I2C_CLIENT_END | ||
46 | }; | 44 | }; |
47 | 45 | ||
48 | /* | 46 | /* |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 5aaad3636c98..2bffcab7dc9f 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan)) | 61 | #define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan)) |
62 | 62 | ||
63 | /* Addresses to scan */ | 63 | /* Addresses to scan */ |
64 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 64 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
65 | 65 | ||
66 | /* Insmod parameters */ | 66 | /* Insmod parameters */ |
67 | I2C_CLIENT_INSMOD_2(adm1030, adm1031); | 67 | I2C_CLIENT_INSMOD_2(adm1030, adm1031); |
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index 7671d2bf7800..149ef25252e7 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include <linux/mutex.h> | 52 | #include <linux/mutex.h> |
53 | 53 | ||
54 | /* Addresses to scan */ | 54 | /* Addresses to scan */ |
55 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, | 55 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, |
56 | I2C_CLIENT_END }; | 56 | I2C_CLIENT_END }; |
57 | 57 | ||
58 | /* Insmod parameters */ | 58 | /* Insmod parameters */ |
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index 6b8a73ef404c..ed71a8bc70dc 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */ | 44 | #define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */ |
45 | 45 | ||
46 | /* Addresses to scan */ | 46 | /* Addresses to scan */ |
47 | static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, | 47 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, |
48 | I2C_CLIENT_END }; | 48 | I2C_CLIENT_END }; |
49 | 49 | ||
50 | /* Insmod parameters */ | 50 | /* Insmod parameters */ |
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 747693ab2ff1..6b5325f33a2c 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/log2.h> | 30 | #include <linux/log2.h> |
31 | 31 | ||
32 | /* Addresses to scan */ | 32 | /* Addresses to scan */ |
33 | static unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; | 33 | static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; |
34 | 34 | ||
35 | /* Insmod parameters */ | 35 | /* Insmod parameters */ |
36 | I2C_CLIENT_INSMOD_1(adt7470); | 36 | I2C_CLIENT_INSMOD_1(adt7470); |
diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c new file mode 100644 index 000000000000..9587869bdba0 --- /dev/null +++ b/drivers/hwmon/adt7473.c | |||
@@ -0,0 +1,1157 @@ | |||
1 | /* | ||
2 | * A hwmon driver for the Analog Devices ADT7473 | ||
3 | * Copyright (C) 2007 IBM | ||
4 | * | ||
5 | * Author: Darrick J. Wong <djwong@us.ibm.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/jiffies.h> | ||
24 | #include <linux/i2c.h> | ||
25 | #include <linux/hwmon.h> | ||
26 | #include <linux/hwmon-sysfs.h> | ||
27 | #include <linux/err.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/log2.h> | ||
31 | |||
32 | /* Addresses to scan */ | ||
33 | static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, I2C_CLIENT_END }; | ||
34 | |||
35 | /* Insmod parameters */ | ||
36 | I2C_CLIENT_INSMOD_1(adt7473); | ||
37 | |||
38 | /* ADT7473 registers */ | ||
39 | #define ADT7473_REG_BASE_ADDR 0x20 | ||
40 | |||
41 | #define ADT7473_REG_VOLT_BASE_ADDR 0x21 | ||
42 | #define ADT7473_REG_VOLT_MAX_ADDR 0x22 | ||
43 | #define ADT7473_REG_VOLT_MIN_BASE_ADDR 0x46 | ||
44 | #define ADT7473_REG_VOLT_MIN_MAX_ADDR 0x49 | ||
45 | |||
46 | #define ADT7473_REG_TEMP_BASE_ADDR 0x25 | ||
47 | #define ADT7473_REG_TEMP_MAX_ADDR 0x27 | ||
48 | #define ADT7473_REG_TEMP_LIMITS_BASE_ADDR 0x4E | ||
49 | #define ADT7473_REG_TEMP_LIMITS_MAX_ADDR 0x53 | ||
50 | #define ADT7473_REG_TEMP_TMIN_BASE_ADDR 0x67 | ||
51 | #define ADT7473_REG_TEMP_TMIN_MAX_ADDR 0x69 | ||
52 | #define ADT7473_REG_TEMP_TMAX_BASE_ADDR 0x6A | ||
53 | #define ADT7473_REG_TEMP_TMAX_MAX_ADDR 0x6C | ||
54 | |||
55 | #define ADT7473_REG_FAN_BASE_ADDR 0x28 | ||
56 | #define ADT7473_REG_FAN_MAX_ADDR 0x2F | ||
57 | #define ADT7473_REG_FAN_MIN_BASE_ADDR 0x54 | ||
58 | #define ADT7473_REG_FAN_MIN_MAX_ADDR 0x5B | ||
59 | |||
60 | #define ADT7473_REG_PWM_BASE_ADDR 0x30 | ||
61 | #define ADT7473_REG_PWM_MAX_ADDR 0x32 | ||
62 | #define ADT7473_REG_PWM_MIN_BASE_ADDR 0x64 | ||
63 | #define ADT7473_REG_PWM_MIN_MAX_ADDR 0x66 | ||
64 | #define ADT7473_REG_PWM_MAX_BASE_ADDR 0x38 | ||
65 | #define ADT7473_REG_PWM_MAX_MAX_ADDR 0x3A | ||
66 | #define ADT7473_REG_PWM_BHVR_BASE_ADDR 0x5C | ||
67 | #define ADT7473_REG_PWM_BHVR_MAX_ADDR 0x5E | ||
68 | #define ADT7473_PWM_BHVR_MASK 0xE0 | ||
69 | #define ADT7473_PWM_BHVR_SHIFT 5 | ||
70 | |||
71 | #define ADT7473_REG_CFG1 0x40 | ||
72 | #define ADT7473_CFG1_START 0x01 | ||
73 | #define ADT7473_CFG1_READY 0x04 | ||
74 | #define ADT7473_REG_CFG2 0x73 | ||
75 | #define ADT7473_REG_CFG3 0x78 | ||
76 | #define ADT7473_REG_CFG4 0x7D | ||
77 | #define ADT7473_CFG4_MAX_DUTY_AT_OVT 0x08 | ||
78 | #define ADT7473_REG_CFG5 0x7C | ||
79 | #define ADT7473_CFG5_TEMP_TWOS 0x01 | ||
80 | #define ADT7473_CFG5_TEMP_OFFSET 0x02 | ||
81 | |||
82 | #define ADT7473_REG_DEVICE 0x3D | ||
83 | #define ADT7473_VENDOR 0x41 | ||
84 | #define ADT7473_REG_VENDOR 0x3E | ||
85 | #define ADT7473_DEVICE 0x73 | ||
86 | #define ADT7473_REG_REVISION 0x3F | ||
87 | #define ADT7473_REV_68 0x68 | ||
88 | #define ADT7473_REV_69 0x69 | ||
89 | |||
90 | #define ADT7473_REG_ALARM1 0x41 | ||
91 | #define ADT7473_VCCP_ALARM 0x02 | ||
92 | #define ADT7473_VCC_ALARM 0x04 | ||
93 | #define ADT7473_R1T_ALARM 0x10 | ||
94 | #define ADT7473_LT_ALARM 0x20 | ||
95 | #define ADT7473_R2T_ALARM 0x40 | ||
96 | #define ADT7473_OOL 0x80 | ||
97 | #define ADT7473_REG_ALARM2 0x42 | ||
98 | #define ADT7473_OVT_ALARM 0x02 | ||
99 | #define ADT7473_FAN1_ALARM 0x04 | ||
100 | #define ADT7473_FAN2_ALARM 0x08 | ||
101 | #define ADT7473_FAN3_ALARM 0x10 | ||
102 | #define ADT7473_FAN4_ALARM 0x20 | ||
103 | #define ADT7473_R1T_SHORT 0x40 | ||
104 | #define ADT7473_R2T_SHORT 0x80 | ||
105 | #define ADT7473_REG_MAX_ADDR 0x80 | ||
106 | |||
107 | #define ALARM2(x) ((x) << 8) | ||
108 | |||
109 | #define ADT7473_VOLT_COUNT 2 | ||
110 | #define ADT7473_REG_VOLT(x) (ADT7473_REG_VOLT_BASE_ADDR + (x)) | ||
111 | #define ADT7473_REG_VOLT_MIN(x) (ADT7473_REG_VOLT_MIN_BASE_ADDR + ((x) * 2)) | ||
112 | #define ADT7473_REG_VOLT_MAX(x) (ADT7473_REG_VOLT_MIN_BASE_ADDR + \ | ||
113 | ((x) * 2) + 1) | ||
114 | |||
115 | #define ADT7473_TEMP_COUNT 3 | ||
116 | #define ADT7473_REG_TEMP(x) (ADT7473_REG_TEMP_BASE_ADDR + (x)) | ||
117 | #define ADT7473_REG_TEMP_MIN(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + ((x) * 2)) | ||
118 | #define ADT7473_REG_TEMP_MAX(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + \ | ||
119 | ((x) * 2) + 1) | ||
120 | #define ADT7473_REG_TEMP_TMIN(x) (ADT7473_REG_TEMP_TMIN_BASE_ADDR + (x)) | ||
121 | #define ADT7473_REG_TEMP_TMAX(x) (ADT7473_REG_TEMP_TMAX_BASE_ADDR + (x)) | ||
122 | |||
123 | #define ADT7473_FAN_COUNT 4 | ||
124 | #define ADT7473_REG_FAN(x) (ADT7473_REG_FAN_BASE_ADDR + ((x) * 2)) | ||
125 | #define ADT7473_REG_FAN_MIN(x) (ADT7473_REG_FAN_MIN_BASE_ADDR + ((x) * 2)) | ||
126 | |||
127 | #define ADT7473_PWM_COUNT 3 | ||
128 | #define ADT7473_REG_PWM(x) (ADT7473_REG_PWM_BASE_ADDR + (x)) | ||
129 | #define ADT7473_REG_PWM_MAX(x) (ADT7473_REG_PWM_MAX_BASE_ADDR + (x)) | ||
130 | #define ADT7473_REG_PWM_MIN(x) (ADT7473_REG_PWM_MIN_BASE_ADDR + (x)) | ||
131 | #define ADT7473_REG_PWM_BHVR(x) (ADT7473_REG_PWM_BHVR_BASE_ADDR + (x)) | ||
132 | |||
133 | /* How often do we reread sensors values? (In jiffies) */ | ||
134 | #define SENSOR_REFRESH_INTERVAL (2 * HZ) | ||
135 | |||
136 | /* How often do we reread sensor limit values? (In jiffies) */ | ||
137 | #define LIMIT_REFRESH_INTERVAL (60 * HZ) | ||
138 | |||
139 | /* datasheet says to divide this number by the fan reading to get fan rpm */ | ||
140 | #define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x)) | ||
141 | #define FAN_RPM_TO_PERIOD FAN_PERIOD_TO_RPM | ||
142 | #define FAN_PERIOD_INVALID 65535 | ||
143 | #define FAN_DATA_VALID(x) ((x) && (x) != FAN_PERIOD_INVALID) | ||
144 | |||
145 | struct adt7473_data { | ||
146 | struct i2c_client client; | ||
147 | struct device *hwmon_dev; | ||
148 | struct attribute_group attrs; | ||
149 | struct mutex lock; | ||
150 | char sensors_valid; | ||
151 | char limits_valid; | ||
152 | unsigned long sensors_last_updated; /* In jiffies */ | ||
153 | unsigned long limits_last_updated; /* In jiffies */ | ||
154 | |||
155 | u8 volt[ADT7473_VOLT_COUNT]; | ||
156 | s8 volt_min[ADT7473_VOLT_COUNT]; | ||
157 | s8 volt_max[ADT7473_VOLT_COUNT]; | ||
158 | |||
159 | s8 temp[ADT7473_TEMP_COUNT]; | ||
160 | s8 temp_min[ADT7473_TEMP_COUNT]; | ||
161 | s8 temp_max[ADT7473_TEMP_COUNT]; | ||
162 | s8 temp_tmin[ADT7473_TEMP_COUNT]; | ||
163 | /* This is called the !THERM limit in the datasheet */ | ||
164 | s8 temp_tmax[ADT7473_TEMP_COUNT]; | ||
165 | |||
166 | u16 fan[ADT7473_FAN_COUNT]; | ||
167 | u16 fan_min[ADT7473_FAN_COUNT]; | ||
168 | |||
169 | u8 pwm[ADT7473_PWM_COUNT]; | ||
170 | u8 pwm_max[ADT7473_PWM_COUNT]; | ||
171 | u8 pwm_min[ADT7473_PWM_COUNT]; | ||
172 | u8 pwm_behavior[ADT7473_PWM_COUNT]; | ||
173 | |||
174 | u8 temp_twos_complement; | ||
175 | u8 temp_offset; | ||
176 | |||
177 | u16 alarm; | ||
178 | u8 max_duty_at_overheat; | ||
179 | }; | ||
180 | |||
181 | static int adt7473_attach_adapter(struct i2c_adapter *adapter); | ||
182 | static int adt7473_detect(struct i2c_adapter *adapter, int address, int kind); | ||
183 | static int adt7473_detach_client(struct i2c_client *client); | ||
184 | |||
185 | static struct i2c_driver adt7473_driver = { | ||
186 | .driver = { | ||
187 | .name = "adt7473", | ||
188 | }, | ||
189 | .attach_adapter = adt7473_attach_adapter, | ||
190 | .detach_client = adt7473_detach_client, | ||
191 | }; | ||
192 | |||
193 | /* | ||
194 | * 16-bit registers on the ADT7473 are low-byte first. The data sheet says | ||
195 | * that the low byte must be read before the high byte. | ||
196 | */ | ||
197 | static inline int adt7473_read_word_data(struct i2c_client *client, u8 reg) | ||
198 | { | ||
199 | u16 foo; | ||
200 | foo = i2c_smbus_read_byte_data(client, reg); | ||
201 | foo |= ((u16)i2c_smbus_read_byte_data(client, reg + 1) << 8); | ||
202 | return foo; | ||
203 | } | ||
204 | |||
205 | static inline int adt7473_write_word_data(struct i2c_client *client, u8 reg, | ||
206 | u16 value) | ||
207 | { | ||
208 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) | ||
209 | && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); | ||
210 | } | ||
211 | |||
212 | static void adt7473_init_client(struct i2c_client *client) | ||
213 | { | ||
214 | int reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG1); | ||
215 | |||
216 | if (!(reg & ADT7473_CFG1_READY)) { | ||
217 | dev_err(&client->dev, "Chip not ready.\n"); | ||
218 | } else { | ||
219 | /* start monitoring */ | ||
220 | i2c_smbus_write_byte_data(client, ADT7473_REG_CFG1, | ||
221 | reg | ADT7473_CFG1_START); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | static struct adt7473_data *adt7473_update_device(struct device *dev) | ||
226 | { | ||
227 | struct i2c_client *client = to_i2c_client(dev); | ||
228 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
229 | unsigned long local_jiffies = jiffies; | ||
230 | u8 cfg; | ||
231 | int i; | ||
232 | |||
233 | mutex_lock(&data->lock); | ||
234 | if (time_before(local_jiffies, data->sensors_last_updated + | ||
235 | SENSOR_REFRESH_INTERVAL) | ||
236 | && data->sensors_valid) | ||
237 | goto no_sensor_update; | ||
238 | |||
239 | for (i = 0; i < ADT7473_VOLT_COUNT; i++) | ||
240 | data->volt[i] = i2c_smbus_read_byte_data(client, | ||
241 | ADT7473_REG_VOLT(i)); | ||
242 | |||
243 | /* Determine temperature encoding */ | ||
244 | cfg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG5); | ||
245 | data->temp_twos_complement = (cfg & ADT7473_CFG5_TEMP_TWOS); | ||
246 | |||
247 | /* | ||
248 | * What does this do? it implies a variable temperature sensor | ||
249 | * offset, but the datasheet doesn't say anything about this bit | ||
250 | * and other parts of the datasheet imply that "offset64" mode | ||
251 | * means that you shift temp values by -64 if the above bit was set. | ||
252 | */ | ||
253 | data->temp_offset = (cfg & ADT7473_CFG5_TEMP_OFFSET); | ||
254 | |||
255 | for (i = 0; i < ADT7473_TEMP_COUNT; i++) | ||
256 | data->temp[i] = i2c_smbus_read_byte_data(client, | ||
257 | ADT7473_REG_TEMP(i)); | ||
258 | |||
259 | for (i = 0; i < ADT7473_FAN_COUNT; i++) | ||
260 | data->fan[i] = adt7473_read_word_data(client, | ||
261 | ADT7473_REG_FAN(i)); | ||
262 | |||
263 | for (i = 0; i < ADT7473_PWM_COUNT; i++) | ||
264 | data->pwm[i] = i2c_smbus_read_byte_data(client, | ||
265 | ADT7473_REG_PWM(i)); | ||
266 | |||
267 | data->alarm = i2c_smbus_read_byte_data(client, ADT7473_REG_ALARM1); | ||
268 | if (data->alarm & ADT7473_OOL) | ||
269 | data->alarm |= ALARM2(i2c_smbus_read_byte_data(client, | ||
270 | ADT7473_REG_ALARM2)); | ||
271 | |||
272 | data->sensors_last_updated = local_jiffies; | ||
273 | data->sensors_valid = 1; | ||
274 | |||
275 | no_sensor_update: | ||
276 | if (time_before(local_jiffies, data->limits_last_updated + | ||
277 | LIMIT_REFRESH_INTERVAL) | ||
278 | && data->limits_valid) | ||
279 | goto out; | ||
280 | |||
281 | for (i = 0; i < ADT7473_VOLT_COUNT; i++) { | ||
282 | data->volt_min[i] = i2c_smbus_read_byte_data(client, | ||
283 | ADT7473_REG_VOLT_MIN(i)); | ||
284 | data->volt_max[i] = i2c_smbus_read_byte_data(client, | ||
285 | ADT7473_REG_VOLT_MAX(i)); | ||
286 | } | ||
287 | |||
288 | for (i = 0; i < ADT7473_TEMP_COUNT; i++) { | ||
289 | data->temp_min[i] = i2c_smbus_read_byte_data(client, | ||
290 | ADT7473_REG_TEMP_MIN(i)); | ||
291 | data->temp_max[i] = i2c_smbus_read_byte_data(client, | ||
292 | ADT7473_REG_TEMP_MAX(i)); | ||
293 | data->temp_tmin[i] = i2c_smbus_read_byte_data(client, | ||
294 | ADT7473_REG_TEMP_TMIN(i)); | ||
295 | data->temp_tmax[i] = i2c_smbus_read_byte_data(client, | ||
296 | ADT7473_REG_TEMP_TMAX(i)); | ||
297 | } | ||
298 | |||
299 | for (i = 0; i < ADT7473_FAN_COUNT; i++) | ||
300 | data->fan_min[i] = adt7473_read_word_data(client, | ||
301 | ADT7473_REG_FAN_MIN(i)); | ||
302 | |||
303 | for (i = 0; i < ADT7473_PWM_COUNT; i++) { | ||
304 | data->pwm_max[i] = i2c_smbus_read_byte_data(client, | ||
305 | ADT7473_REG_PWM_MAX(i)); | ||
306 | data->pwm_min[i] = i2c_smbus_read_byte_data(client, | ||
307 | ADT7473_REG_PWM_MIN(i)); | ||
308 | data->pwm_behavior[i] = i2c_smbus_read_byte_data(client, | ||
309 | ADT7473_REG_PWM_BHVR(i)); | ||
310 | } | ||
311 | |||
312 | data->limits_last_updated = local_jiffies; | ||
313 | data->limits_valid = 1; | ||
314 | |||
315 | out: | ||
316 | mutex_unlock(&data->lock); | ||
317 | return data; | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | * On this chip, voltages are given as a count of steps between a minimum | ||
322 | * and maximum voltage, not a direct voltage. | ||
323 | */ | ||
324 | static const int volt_convert_table[][2] = { | ||
325 | {2997, 3}, | ||
326 | {4395, 4}, | ||
327 | }; | ||
328 | |||
329 | static int decode_volt(int volt_index, u8 raw) | ||
330 | { | ||
331 | int cmax = volt_convert_table[volt_index][0]; | ||
332 | int cmin = volt_convert_table[volt_index][1]; | ||
333 | return ((raw * (cmax - cmin)) / 255) + cmin; | ||
334 | } | ||
335 | |||
336 | static u8 encode_volt(int volt_index, int cooked) | ||
337 | { | ||
338 | int cmax = volt_convert_table[volt_index][0]; | ||
339 | int cmin = volt_convert_table[volt_index][1]; | ||
340 | u8 x; | ||
341 | |||
342 | if (cooked > cmax) | ||
343 | cooked = cmax; | ||
344 | else if (cooked < cmin) | ||
345 | cooked = cmin; | ||
346 | |||
347 | x = ((cooked - cmin) * 255) / (cmax - cmin); | ||
348 | |||
349 | return x; | ||
350 | } | ||
351 | |||
352 | static ssize_t show_volt_min(struct device *dev, | ||
353 | struct device_attribute *devattr, | ||
354 | char *buf) | ||
355 | { | ||
356 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
357 | struct adt7473_data *data = adt7473_update_device(dev); | ||
358 | return sprintf(buf, "%d\n", | ||
359 | decode_volt(attr->index, data->volt_min[attr->index])); | ||
360 | } | ||
361 | |||
362 | static ssize_t set_volt_min(struct device *dev, | ||
363 | struct device_attribute *devattr, | ||
364 | const char *buf, | ||
365 | size_t count) | ||
366 | { | ||
367 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
368 | struct i2c_client *client = to_i2c_client(dev); | ||
369 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
370 | int volt = encode_volt(attr->index, simple_strtol(buf, NULL, 10)); | ||
371 | |||
372 | mutex_lock(&data->lock); | ||
373 | data->volt_min[attr->index] = volt; | ||
374 | i2c_smbus_write_byte_data(client, ADT7473_REG_VOLT_MIN(attr->index), | ||
375 | volt); | ||
376 | mutex_unlock(&data->lock); | ||
377 | |||
378 | return count; | ||
379 | } | ||
380 | |||
381 | static ssize_t show_volt_max(struct device *dev, | ||
382 | struct device_attribute *devattr, | ||
383 | char *buf) | ||
384 | { | ||
385 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
386 | struct adt7473_data *data = adt7473_update_device(dev); | ||
387 | return sprintf(buf, "%d\n", | ||
388 | decode_volt(attr->index, data->volt_max[attr->index])); | ||
389 | } | ||
390 | |||
391 | static ssize_t set_volt_max(struct device *dev, | ||
392 | struct device_attribute *devattr, | ||
393 | const char *buf, | ||
394 | size_t count) | ||
395 | { | ||
396 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
397 | struct i2c_client *client = to_i2c_client(dev); | ||
398 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
399 | int volt = encode_volt(attr->index, simple_strtol(buf, NULL, 10)); | ||
400 | |||
401 | mutex_lock(&data->lock); | ||
402 | data->volt_max[attr->index] = volt; | ||
403 | i2c_smbus_write_byte_data(client, ADT7473_REG_VOLT_MAX(attr->index), | ||
404 | volt); | ||
405 | mutex_unlock(&data->lock); | ||
406 | |||
407 | return count; | ||
408 | } | ||
409 | |||
410 | static ssize_t show_volt(struct device *dev, struct device_attribute *devattr, | ||
411 | char *buf) | ||
412 | { | ||
413 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
414 | struct adt7473_data *data = adt7473_update_device(dev); | ||
415 | |||
416 | return sprintf(buf, "%d\n", | ||
417 | decode_volt(attr->index, data->volt[attr->index])); | ||
418 | } | ||
419 | |||
420 | /* | ||
421 | * This chip can report temperature data either as a two's complement | ||
422 | * number in the range -128 to 127, or as an unsigned number that must | ||
423 | * be offset by 64. | ||
424 | */ | ||
425 | static int decode_temp(struct adt7473_data *data, u8 raw) | ||
426 | { | ||
427 | if (data->temp_twos_complement) | ||
428 | return (s8)raw; | ||
429 | return raw - 64; | ||
430 | } | ||
431 | |||
432 | static u8 encode_temp(struct adt7473_data *data, int cooked) | ||
433 | { | ||
434 | if (data->temp_twos_complement) | ||
435 | return (cooked & 0xFF); | ||
436 | return cooked + 64; | ||
437 | } | ||
438 | |||
439 | static ssize_t show_temp_min(struct device *dev, | ||
440 | struct device_attribute *devattr, | ||
441 | char *buf) | ||
442 | { | ||
443 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
444 | struct adt7473_data *data = adt7473_update_device(dev); | ||
445 | return sprintf(buf, "%d\n", | ||
446 | 1000 * decode_temp(data, data->temp_min[attr->index])); | ||
447 | } | ||
448 | |||
449 | static ssize_t set_temp_min(struct device *dev, | ||
450 | struct device_attribute *devattr, | ||
451 | const char *buf, | ||
452 | size_t count) | ||
453 | { | ||
454 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
455 | struct i2c_client *client = to_i2c_client(dev); | ||
456 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
457 | int temp = simple_strtol(buf, NULL, 10) / 1000; | ||
458 | temp = encode_temp(data, temp); | ||
459 | |||
460 | mutex_lock(&data->lock); | ||
461 | data->temp_min[attr->index] = temp; | ||
462 | i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_MIN(attr->index), | ||
463 | temp); | ||
464 | mutex_unlock(&data->lock); | ||
465 | |||
466 | return count; | ||
467 | } | ||
468 | |||
469 | static ssize_t show_temp_max(struct device *dev, | ||
470 | struct device_attribute *devattr, | ||
471 | char *buf) | ||
472 | { | ||
473 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
474 | struct adt7473_data *data = adt7473_update_device(dev); | ||
475 | return sprintf(buf, "%d\n", | ||
476 | 1000 * decode_temp(data, data->temp_max[attr->index])); | ||
477 | } | ||
478 | |||
479 | static ssize_t set_temp_max(struct device *dev, | ||
480 | struct device_attribute *devattr, | ||
481 | const char *buf, | ||
482 | size_t count) | ||
483 | { | ||
484 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
485 | struct i2c_client *client = to_i2c_client(dev); | ||
486 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
487 | int temp = simple_strtol(buf, NULL, 10) / 1000; | ||
488 | temp = encode_temp(data, temp); | ||
489 | |||
490 | mutex_lock(&data->lock); | ||
491 | data->temp_max[attr->index] = temp; | ||
492 | i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_MAX(attr->index), | ||
493 | temp); | ||
494 | mutex_unlock(&data->lock); | ||
495 | |||
496 | return count; | ||
497 | } | ||
498 | |||
499 | static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, | ||
500 | char *buf) | ||
501 | { | ||
502 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
503 | struct adt7473_data *data = adt7473_update_device(dev); | ||
504 | return sprintf(buf, "%d\n", | ||
505 | 1000 * decode_temp(data, data->temp[attr->index])); | ||
506 | } | ||
507 | |||
508 | static ssize_t show_fan_min(struct device *dev, | ||
509 | struct device_attribute *devattr, | ||
510 | char *buf) | ||
511 | { | ||
512 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
513 | struct adt7473_data *data = adt7473_update_device(dev); | ||
514 | |||
515 | if (FAN_DATA_VALID(data->fan_min[attr->index])) | ||
516 | return sprintf(buf, "%d\n", | ||
517 | FAN_PERIOD_TO_RPM(data->fan_min[attr->index])); | ||
518 | else | ||
519 | return sprintf(buf, "0\n"); | ||
520 | } | ||
521 | |||
522 | static ssize_t set_fan_min(struct device *dev, | ||
523 | struct device_attribute *devattr, | ||
524 | const char *buf, size_t count) | ||
525 | { | ||
526 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
527 | struct i2c_client *client = to_i2c_client(dev); | ||
528 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
529 | int temp = simple_strtol(buf, NULL, 10); | ||
530 | |||
531 | if (!temp) | ||
532 | return -EINVAL; | ||
533 | temp = FAN_RPM_TO_PERIOD(temp); | ||
534 | |||
535 | mutex_lock(&data->lock); | ||
536 | data->fan_min[attr->index] = temp; | ||
537 | adt7473_write_word_data(client, ADT7473_REG_FAN_MIN(attr->index), temp); | ||
538 | mutex_unlock(&data->lock); | ||
539 | |||
540 | return count; | ||
541 | } | ||
542 | |||
543 | static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, | ||
544 | char *buf) | ||
545 | { | ||
546 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
547 | struct adt7473_data *data = adt7473_update_device(dev); | ||
548 | |||
549 | if (FAN_DATA_VALID(data->fan[attr->index])) | ||
550 | return sprintf(buf, "%d\n", | ||
551 | FAN_PERIOD_TO_RPM(data->fan[attr->index])); | ||
552 | else | ||
553 | return sprintf(buf, "0\n"); | ||
554 | } | ||
555 | |||
556 | static ssize_t show_max_duty_at_crit(struct device *dev, | ||
557 | struct device_attribute *devattr, | ||
558 | char *buf) | ||
559 | { | ||
560 | struct adt7473_data *data = adt7473_update_device(dev); | ||
561 | return sprintf(buf, "%d\n", data->max_duty_at_overheat); | ||
562 | } | ||
563 | |||
564 | static ssize_t set_max_duty_at_crit(struct device *dev, | ||
565 | struct device_attribute *devattr, | ||
566 | const char *buf, | ||
567 | size_t count) | ||
568 | { | ||
569 | u8 reg; | ||
570 | struct i2c_client *client = to_i2c_client(dev); | ||
571 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
572 | int temp = simple_strtol(buf, NULL, 10); | ||
573 | temp = temp && 0xFF; | ||
574 | |||
575 | mutex_lock(&data->lock); | ||
576 | data->max_duty_at_overheat = temp; | ||
577 | reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4); | ||
578 | if (temp) | ||
579 | reg |= ADT7473_CFG4_MAX_DUTY_AT_OVT; | ||
580 | else | ||
581 | reg &= ~ADT7473_CFG4_MAX_DUTY_AT_OVT; | ||
582 | i2c_smbus_write_byte_data(client, ADT7473_REG_CFG4, reg); | ||
583 | mutex_unlock(&data->lock); | ||
584 | |||
585 | return count; | ||
586 | } | ||
587 | |||
588 | static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, | ||
589 | char *buf) | ||
590 | { | ||
591 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
592 | struct adt7473_data *data = adt7473_update_device(dev); | ||
593 | return sprintf(buf, "%d\n", data->pwm[attr->index]); | ||
594 | } | ||
595 | |||
596 | static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, | ||
597 | const char *buf, size_t count) | ||
598 | { | ||
599 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
600 | struct i2c_client *client = to_i2c_client(dev); | ||
601 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
602 | int temp = simple_strtol(buf, NULL, 10); | ||
603 | |||
604 | mutex_lock(&data->lock); | ||
605 | data->pwm[attr->index] = temp; | ||
606 | i2c_smbus_write_byte_data(client, ADT7473_REG_PWM(attr->index), temp); | ||
607 | mutex_unlock(&data->lock); | ||
608 | |||
609 | return count; | ||
610 | } | ||
611 | |||
612 | static ssize_t show_pwm_max(struct device *dev, | ||
613 | struct device_attribute *devattr, | ||
614 | char *buf) | ||
615 | { | ||
616 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
617 | struct adt7473_data *data = adt7473_update_device(dev); | ||
618 | return sprintf(buf, "%d\n", data->pwm_max[attr->index]); | ||
619 | } | ||
620 | |||
621 | static ssize_t set_pwm_max(struct device *dev, | ||
622 | struct device_attribute *devattr, | ||
623 | const char *buf, | ||
624 | size_t count) | ||
625 | { | ||
626 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
627 | struct i2c_client *client = to_i2c_client(dev); | ||
628 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
629 | int temp = simple_strtol(buf, NULL, 10); | ||
630 | |||
631 | mutex_lock(&data->lock); | ||
632 | data->pwm_max[attr->index] = temp; | ||
633 | i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_MAX(attr->index), | ||
634 | temp); | ||
635 | mutex_unlock(&data->lock); | ||
636 | |||
637 | return count; | ||
638 | } | ||
639 | |||
640 | static ssize_t show_pwm_min(struct device *dev, | ||
641 | struct device_attribute *devattr, | ||
642 | char *buf) | ||
643 | { | ||
644 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
645 | struct adt7473_data *data = adt7473_update_device(dev); | ||
646 | return sprintf(buf, "%d\n", data->pwm_min[attr->index]); | ||
647 | } | ||
648 | |||
649 | static ssize_t set_pwm_min(struct device *dev, | ||
650 | struct device_attribute *devattr, | ||
651 | const char *buf, | ||
652 | size_t count) | ||
653 | { | ||
654 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
655 | struct i2c_client *client = to_i2c_client(dev); | ||
656 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
657 | int temp = simple_strtol(buf, NULL, 10); | ||
658 | |||
659 | mutex_lock(&data->lock); | ||
660 | data->pwm_min[attr->index] = temp; | ||
661 | i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_MIN(attr->index), | ||
662 | temp); | ||
663 | mutex_unlock(&data->lock); | ||
664 | |||
665 | return count; | ||
666 | } | ||
667 | |||
668 | static ssize_t show_temp_tmax(struct device *dev, | ||
669 | struct device_attribute *devattr, | ||
670 | char *buf) | ||
671 | { | ||
672 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
673 | struct adt7473_data *data = adt7473_update_device(dev); | ||
674 | return sprintf(buf, "%d\n", | ||
675 | 1000 * decode_temp(data, data->temp_tmax[attr->index])); | ||
676 | } | ||
677 | |||
678 | static ssize_t set_temp_tmax(struct device *dev, | ||
679 | struct device_attribute *devattr, | ||
680 | const char *buf, | ||
681 | size_t count) | ||
682 | { | ||
683 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
684 | struct i2c_client *client = to_i2c_client(dev); | ||
685 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
686 | int temp = simple_strtol(buf, NULL, 10) / 1000; | ||
687 | temp = encode_temp(data, temp); | ||
688 | |||
689 | mutex_lock(&data->lock); | ||
690 | data->temp_tmax[attr->index] = temp; | ||
691 | i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_TMAX(attr->index), | ||
692 | temp); | ||
693 | mutex_unlock(&data->lock); | ||
694 | |||
695 | return count; | ||
696 | } | ||
697 | |||
698 | static ssize_t show_temp_tmin(struct device *dev, | ||
699 | struct device_attribute *devattr, | ||
700 | char *buf) | ||
701 | { | ||
702 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
703 | struct adt7473_data *data = adt7473_update_device(dev); | ||
704 | return sprintf(buf, "%d\n", | ||
705 | 1000 * decode_temp(data, data->temp_tmin[attr->index])); | ||
706 | } | ||
707 | |||
708 | static ssize_t set_temp_tmin(struct device *dev, | ||
709 | struct device_attribute *devattr, | ||
710 | const char *buf, | ||
711 | size_t count) | ||
712 | { | ||
713 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
714 | struct i2c_client *client = to_i2c_client(dev); | ||
715 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
716 | int temp = simple_strtol(buf, NULL, 10) / 1000; | ||
717 | temp = encode_temp(data, temp); | ||
718 | |||
719 | mutex_lock(&data->lock); | ||
720 | data->temp_tmin[attr->index] = temp; | ||
721 | i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_TMIN(attr->index), | ||
722 | temp); | ||
723 | mutex_unlock(&data->lock); | ||
724 | |||
725 | return count; | ||
726 | } | ||
727 | |||
728 | static ssize_t show_pwm_enable(struct device *dev, | ||
729 | struct device_attribute *devattr, | ||
730 | char *buf) | ||
731 | { | ||
732 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
733 | struct adt7473_data *data = adt7473_update_device(dev); | ||
734 | |||
735 | switch (data->pwm_behavior[attr->index] >> ADT7473_PWM_BHVR_SHIFT) { | ||
736 | case 3: | ||
737 | return sprintf(buf, "0\n"); | ||
738 | case 7: | ||
739 | return sprintf(buf, "1\n"); | ||
740 | default: | ||
741 | return sprintf(buf, "2\n"); | ||
742 | } | ||
743 | } | ||
744 | |||
745 | static ssize_t set_pwm_enable(struct device *dev, | ||
746 | struct device_attribute *devattr, | ||
747 | const char *buf, | ||
748 | size_t count) | ||
749 | { | ||
750 | u8 reg; | ||
751 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
752 | struct i2c_client *client = to_i2c_client(dev); | ||
753 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
754 | int temp = simple_strtol(buf, NULL, 10); | ||
755 | |||
756 | switch (temp) { | ||
757 | case 0: | ||
758 | temp = 3; | ||
759 | break; | ||
760 | case 1: | ||
761 | temp = 7; | ||
762 | break; | ||
763 | case 2: | ||
764 | /* Enter automatic mode with fans off */ | ||
765 | temp = 4; | ||
766 | break; | ||
767 | default: | ||
768 | return -EINVAL; | ||
769 | } | ||
770 | |||
771 | mutex_lock(&data->lock); | ||
772 | reg = i2c_smbus_read_byte_data(client, | ||
773 | ADT7473_REG_PWM_BHVR(attr->index)); | ||
774 | reg = (temp << ADT7473_PWM_BHVR_SHIFT) | | ||
775 | (reg & ~ADT7473_PWM_BHVR_MASK); | ||
776 | i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_BHVR(attr->index), | ||
777 | reg); | ||
778 | data->pwm_behavior[attr->index] = reg; | ||
779 | mutex_unlock(&data->lock); | ||
780 | |||
781 | return count; | ||
782 | } | ||
783 | |||
784 | static ssize_t show_pwm_auto_temp(struct device *dev, | ||
785 | struct device_attribute *devattr, | ||
786 | char *buf) | ||
787 | { | ||
788 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
789 | struct adt7473_data *data = adt7473_update_device(dev); | ||
790 | int bhvr = data->pwm_behavior[attr->index] >> ADT7473_PWM_BHVR_SHIFT; | ||
791 | |||
792 | switch (bhvr) { | ||
793 | case 3: | ||
794 | case 4: | ||
795 | case 7: | ||
796 | return sprintf(buf, "0\n"); | ||
797 | case 0: | ||
798 | case 1: | ||
799 | case 5: | ||
800 | case 6: | ||
801 | return sprintf(buf, "%d\n", bhvr + 1); | ||
802 | case 2: | ||
803 | return sprintf(buf, "4\n"); | ||
804 | } | ||
805 | /* shouldn't ever get here */ | ||
806 | BUG(); | ||
807 | } | ||
808 | |||
809 | static ssize_t set_pwm_auto_temp(struct device *dev, | ||
810 | struct device_attribute *devattr, | ||
811 | const char *buf, | ||
812 | size_t count) | ||
813 | { | ||
814 | u8 reg; | ||
815 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
816 | struct i2c_client *client = to_i2c_client(dev); | ||
817 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
818 | int temp = simple_strtol(buf, NULL, 10); | ||
819 | |||
820 | switch (temp) { | ||
821 | case 1: | ||
822 | case 2: | ||
823 | case 6: | ||
824 | case 7: | ||
825 | temp--; | ||
826 | break; | ||
827 | case 0: | ||
828 | temp = 4; | ||
829 | break; | ||
830 | default: | ||
831 | return -EINVAL; | ||
832 | } | ||
833 | |||
834 | mutex_lock(&data->lock); | ||
835 | reg = i2c_smbus_read_byte_data(client, | ||
836 | ADT7473_REG_PWM_BHVR(attr->index)); | ||
837 | reg = (temp << ADT7473_PWM_BHVR_SHIFT) | | ||
838 | (reg & ~ADT7473_PWM_BHVR_MASK); | ||
839 | i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_BHVR(attr->index), | ||
840 | reg); | ||
841 | data->pwm_behavior[attr->index] = reg; | ||
842 | mutex_unlock(&data->lock); | ||
843 | |||
844 | return count; | ||
845 | } | ||
846 | |||
847 | static ssize_t show_alarm(struct device *dev, | ||
848 | struct device_attribute *devattr, | ||
849 | char *buf) | ||
850 | { | ||
851 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
852 | struct adt7473_data *data = adt7473_update_device(dev); | ||
853 | |||
854 | if (data->alarm & attr->index) | ||
855 | return sprintf(buf, "1\n"); | ||
856 | else | ||
857 | return sprintf(buf, "0\n"); | ||
858 | } | ||
859 | |||
860 | |||
861 | static SENSOR_DEVICE_ATTR(in1_max, S_IWUSR | S_IRUGO, show_volt_max, | ||
862 | set_volt_max, 0); | ||
863 | static SENSOR_DEVICE_ATTR(in2_max, S_IWUSR | S_IRUGO, show_volt_max, | ||
864 | set_volt_max, 1); | ||
865 | |||
866 | static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, show_volt_min, | ||
867 | set_volt_min, 0); | ||
868 | static SENSOR_DEVICE_ATTR(in2_min, S_IWUSR | S_IRUGO, show_volt_min, | ||
869 | set_volt_min, 1); | ||
870 | |||
871 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_volt, NULL, 0); | ||
872 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_volt, NULL, 1); | ||
873 | |||
874 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, | ||
875 | ADT7473_VCCP_ALARM); | ||
876 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, | ||
877 | ADT7473_VCC_ALARM); | ||
878 | |||
879 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, | ||
880 | set_temp_max, 0); | ||
881 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, | ||
882 | set_temp_max, 1); | ||
883 | static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_temp_max, | ||
884 | set_temp_max, 2); | ||
885 | |||
886 | static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp_min, | ||
887 | set_temp_min, 0); | ||
888 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_min, | ||
889 | set_temp_min, 1); | ||
890 | static SENSOR_DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_temp_min, | ||
891 | set_temp_min, 2); | ||
892 | |||
893 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); | ||
894 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); | ||
895 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); | ||
896 | |||
897 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, | ||
898 | ADT7473_R1T_ALARM | ALARM2(ADT7473_R1T_SHORT)); | ||
899 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, | ||
900 | ADT7473_LT_ALARM); | ||
901 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, | ||
902 | ADT7473_R2T_ALARM | ALARM2(ADT7473_R2T_SHORT)); | ||
903 | |||
904 | static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, | ||
905 | set_fan_min, 0); | ||
906 | static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min, | ||
907 | set_fan_min, 1); | ||
908 | static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min, | ||
909 | set_fan_min, 2); | ||
910 | static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, show_fan_min, | ||
911 | set_fan_min, 3); | ||
912 | |||
913 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); | ||
914 | static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); | ||
915 | static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); | ||
916 | static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); | ||
917 | |||
918 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, | ||
919 | ALARM2(ADT7473_FAN1_ALARM)); | ||
920 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, | ||
921 | ALARM2(ADT7473_FAN2_ALARM)); | ||
922 | static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, | ||
923 | ALARM2(ADT7473_FAN3_ALARM)); | ||
924 | static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, | ||
925 | ALARM2(ADT7473_FAN4_ALARM)); | ||
926 | |||
927 | static SENSOR_DEVICE_ATTR(pwm_use_point2_pwm_at_crit, S_IWUSR | S_IRUGO, | ||
928 | show_max_duty_at_crit, set_max_duty_at_crit, 0); | ||
929 | |||
930 | static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); | ||
931 | static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); | ||
932 | static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); | ||
933 | |||
934 | static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IWUSR | S_IRUGO, | ||
935 | show_pwm_min, set_pwm_min, 0); | ||
936 | static SENSOR_DEVICE_ATTR(pwm2_auto_point1_pwm, S_IWUSR | S_IRUGO, | ||
937 | show_pwm_min, set_pwm_min, 1); | ||
938 | static SENSOR_DEVICE_ATTR(pwm3_auto_point1_pwm, S_IWUSR | S_IRUGO, | ||
939 | show_pwm_min, set_pwm_min, 2); | ||
940 | |||
941 | static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IWUSR | S_IRUGO, | ||
942 | show_pwm_max, set_pwm_max, 0); | ||
943 | static SENSOR_DEVICE_ATTR(pwm2_auto_point2_pwm, S_IWUSR | S_IRUGO, | ||
944 | show_pwm_max, set_pwm_max, 1); | ||
945 | static SENSOR_DEVICE_ATTR(pwm3_auto_point2_pwm, S_IWUSR | S_IRUGO, | ||
946 | show_pwm_max, set_pwm_max, 2); | ||
947 | |||
948 | static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, S_IWUSR | S_IRUGO, | ||
949 | show_temp_tmin, set_temp_tmin, 0); | ||
950 | static SENSOR_DEVICE_ATTR(temp2_auto_point1_temp, S_IWUSR | S_IRUGO, | ||
951 | show_temp_tmin, set_temp_tmin, 1); | ||
952 | static SENSOR_DEVICE_ATTR(temp3_auto_point1_temp, S_IWUSR | S_IRUGO, | ||
953 | show_temp_tmin, set_temp_tmin, 2); | ||
954 | |||
955 | static SENSOR_DEVICE_ATTR(temp1_auto_point2_temp, S_IWUSR | S_IRUGO, | ||
956 | show_temp_tmax, set_temp_tmax, 0); | ||
957 | static SENSOR_DEVICE_ATTR(temp2_auto_point2_temp, S_IWUSR | S_IRUGO, | ||
958 | show_temp_tmax, set_temp_tmax, 1); | ||
959 | static SENSOR_DEVICE_ATTR(temp3_auto_point2_temp, S_IWUSR | S_IRUGO, | ||
960 | show_temp_tmax, set_temp_tmax, 2); | ||
961 | |||
962 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, show_pwm_enable, | ||
963 | set_pwm_enable, 0); | ||
964 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, show_pwm_enable, | ||
965 | set_pwm_enable, 1); | ||
966 | static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, show_pwm_enable, | ||
967 | set_pwm_enable, 2); | ||
968 | |||
969 | static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IWUSR | S_IRUGO, | ||
970 | show_pwm_auto_temp, set_pwm_auto_temp, 0); | ||
971 | static SENSOR_DEVICE_ATTR(pwm2_auto_channels_temp, S_IWUSR | S_IRUGO, | ||
972 | show_pwm_auto_temp, set_pwm_auto_temp, 1); | ||
973 | static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO, | ||
974 | show_pwm_auto_temp, set_pwm_auto_temp, 2); | ||
975 | |||
976 | static struct attribute *adt7473_attr[] = | ||
977 | { | ||
978 | &sensor_dev_attr_in1_max.dev_attr.attr, | ||
979 | &sensor_dev_attr_in2_max.dev_attr.attr, | ||
980 | &sensor_dev_attr_in1_min.dev_attr.attr, | ||
981 | &sensor_dev_attr_in2_min.dev_attr.attr, | ||
982 | &sensor_dev_attr_in1_input.dev_attr.attr, | ||
983 | &sensor_dev_attr_in2_input.dev_attr.attr, | ||
984 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
985 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
986 | |||
987 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
988 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
989 | &sensor_dev_attr_temp3_max.dev_attr.attr, | ||
990 | &sensor_dev_attr_temp1_min.dev_attr.attr, | ||
991 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
992 | &sensor_dev_attr_temp3_min.dev_attr.attr, | ||
993 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
994 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
995 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
996 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
997 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
998 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
999 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | ||
1000 | &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr, | ||
1001 | &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr, | ||
1002 | &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr, | ||
1003 | &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr, | ||
1004 | &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr, | ||
1005 | |||
1006 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
1007 | &sensor_dev_attr_fan2_min.dev_attr.attr, | ||
1008 | &sensor_dev_attr_fan3_min.dev_attr.attr, | ||
1009 | &sensor_dev_attr_fan4_min.dev_attr.attr, | ||
1010 | &sensor_dev_attr_fan1_input.dev_attr.attr, | ||
1011 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
1012 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
1013 | &sensor_dev_attr_fan4_input.dev_attr.attr, | ||
1014 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
1015 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
1016 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
1017 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | ||
1018 | |||
1019 | &sensor_dev_attr_pwm_use_point2_pwm_at_crit.dev_attr.attr, | ||
1020 | |||
1021 | &sensor_dev_attr_pwm1.dev_attr.attr, | ||
1022 | &sensor_dev_attr_pwm2.dev_attr.attr, | ||
1023 | &sensor_dev_attr_pwm3.dev_attr.attr, | ||
1024 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | ||
1025 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | ||
1026 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | ||
1027 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | ||
1028 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, | ||
1029 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, | ||
1030 | |||
1031 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | ||
1032 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | ||
1033 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | ||
1034 | &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr, | ||
1035 | &sensor_dev_attr_pwm2_auto_channels_temp.dev_attr.attr, | ||
1036 | &sensor_dev_attr_pwm3_auto_channels_temp.dev_attr.attr, | ||
1037 | |||
1038 | NULL | ||
1039 | }; | ||
1040 | |||
1041 | static int adt7473_attach_adapter(struct i2c_adapter *adapter) | ||
1042 | { | ||
1043 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
1044 | return 0; | ||
1045 | return i2c_probe(adapter, &addr_data, adt7473_detect); | ||
1046 | } | ||
1047 | |||
1048 | static int adt7473_detect(struct i2c_adapter *adapter, int address, int kind) | ||
1049 | { | ||
1050 | struct i2c_client *client; | ||
1051 | struct adt7473_data *data; | ||
1052 | int err = 0; | ||
1053 | |||
1054 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
1055 | goto exit; | ||
1056 | |||
1057 | data = kzalloc(sizeof(struct adt7473_data), GFP_KERNEL); | ||
1058 | if (!data) { | ||
1059 | err = -ENOMEM; | ||
1060 | goto exit; | ||
1061 | } | ||
1062 | |||
1063 | client = &data->client; | ||
1064 | client->addr = address; | ||
1065 | client->adapter = adapter; | ||
1066 | client->driver = &adt7473_driver; | ||
1067 | |||
1068 | i2c_set_clientdata(client, data); | ||
1069 | |||
1070 | mutex_init(&data->lock); | ||
1071 | |||
1072 | if (kind <= 0) { | ||
1073 | int vendor, device, revision; | ||
1074 | |||
1075 | vendor = i2c_smbus_read_byte_data(client, ADT7473_REG_VENDOR); | ||
1076 | if (vendor != ADT7473_VENDOR) { | ||
1077 | err = -ENODEV; | ||
1078 | goto exit_free; | ||
1079 | } | ||
1080 | |||
1081 | device = i2c_smbus_read_byte_data(client, ADT7473_REG_DEVICE); | ||
1082 | if (device != ADT7473_DEVICE) { | ||
1083 | err = -ENODEV; | ||
1084 | goto exit_free; | ||
1085 | } | ||
1086 | |||
1087 | revision = i2c_smbus_read_byte_data(client, | ||
1088 | ADT7473_REG_REVISION); | ||
1089 | if (revision != ADT7473_REV_68 && revision != ADT7473_REV_69) { | ||
1090 | err = -ENODEV; | ||
1091 | goto exit_free; | ||
1092 | } | ||
1093 | } else | ||
1094 | dev_dbg(&adapter->dev, "detection forced\n"); | ||
1095 | |||
1096 | strlcpy(client->name, "adt7473", I2C_NAME_SIZE); | ||
1097 | |||
1098 | err = i2c_attach_client(client); | ||
1099 | if (err) | ||
1100 | goto exit_free; | ||
1101 | |||
1102 | dev_info(&client->dev, "%s chip found\n", client->name); | ||
1103 | |||
1104 | /* Initialize the ADT7473 chip */ | ||
1105 | adt7473_init_client(client); | ||
1106 | |||
1107 | /* Register sysfs hooks */ | ||
1108 | data->attrs.attrs = adt7473_attr; | ||
1109 | err = sysfs_create_group(&client->dev.kobj, &data->attrs); | ||
1110 | if (err) | ||
1111 | goto exit_detach; | ||
1112 | |||
1113 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
1114 | if (IS_ERR(data->hwmon_dev)) { | ||
1115 | err = PTR_ERR(data->hwmon_dev); | ||
1116 | goto exit_remove; | ||
1117 | } | ||
1118 | |||
1119 | return 0; | ||
1120 | |||
1121 | exit_remove: | ||
1122 | sysfs_remove_group(&client->dev.kobj, &data->attrs); | ||
1123 | exit_detach: | ||
1124 | i2c_detach_client(client); | ||
1125 | exit_free: | ||
1126 | kfree(data); | ||
1127 | exit: | ||
1128 | return err; | ||
1129 | } | ||
1130 | |||
1131 | static int adt7473_detach_client(struct i2c_client *client) | ||
1132 | { | ||
1133 | struct adt7473_data *data = i2c_get_clientdata(client); | ||
1134 | |||
1135 | hwmon_device_unregister(data->hwmon_dev); | ||
1136 | sysfs_remove_group(&client->dev.kobj, &data->attrs); | ||
1137 | i2c_detach_client(client); | ||
1138 | kfree(data); | ||
1139 | return 0; | ||
1140 | } | ||
1141 | |||
1142 | static int __init adt7473_init(void) | ||
1143 | { | ||
1144 | return i2c_add_driver(&adt7473_driver); | ||
1145 | } | ||
1146 | |||
1147 | static void __exit adt7473_exit(void) | ||
1148 | { | ||
1149 | i2c_del_driver(&adt7473_driver); | ||
1150 | } | ||
1151 | |||
1152 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); | ||
1153 | MODULE_DESCRIPTION("ADT7473 driver"); | ||
1154 | MODULE_LICENSE("GPL"); | ||
1155 | |||
1156 | module_init(adt7473_init); | ||
1157 | module_exit(adt7473_exit); | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 0c94770b7f83..aacc0c4b809c 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -84,12 +84,15 @@ static const char* temperature_sensors_sets[][36] = { | |||
84 | /* Set 0: Macbook Pro */ | 84 | /* Set 0: Macbook Pro */ |
85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", | 85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", |
86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, | 86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, |
87 | /* Set 1: Macbook set */ | 87 | /* Set 1: Macbook2 set */ |
88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "TTF0", "Th0H", | ||
89 | "Th0S", "Th1H", NULL }, | ||
90 | /* Set 2: Macbook set */ | ||
88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", | 91 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", |
89 | "Th1H", "Ts0P", NULL }, | 92 | "Th1H", "Ts0P", NULL }, |
90 | /* Set 2: Macmini set */ | 93 | /* Set 3: Macmini set */ |
91 | { "TC0D", "TC0P", NULL }, | 94 | { "TC0D", "TC0P", NULL }, |
92 | /* Set 3: Mac Pro (2 x Quad-Core) */ | 95 | /* Set 4: Mac Pro (2 x Quad-Core) */ |
93 | { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", | 96 | { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", |
94 | "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", | 97 | "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", |
95 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", | 98 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", |
@@ -1212,12 +1215,14 @@ static void applesmc_release_accelerometer(void) | |||
1212 | static __initdata struct dmi_match_data applesmc_dmi_data[] = { | 1215 | static __initdata struct dmi_match_data applesmc_dmi_data[] = { |
1213 | /* MacBook Pro: accelerometer, backlight and temperature set 0 */ | 1216 | /* MacBook Pro: accelerometer, backlight and temperature set 0 */ |
1214 | { .accelerometer = 1, .light = 1, .temperature_set = 0 }, | 1217 | { .accelerometer = 1, .light = 1, .temperature_set = 0 }, |
1215 | /* MacBook: accelerometer and temperature set 1 */ | 1218 | /* MacBook2: accelerometer and temperature set 1 */ |
1216 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, | 1219 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, |
1217 | /* MacMini: temperature set 2 */ | 1220 | /* MacBook: accelerometer and temperature set 2 */ |
1218 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, | 1221 | { .accelerometer = 1, .light = 0, .temperature_set = 2 }, |
1219 | /* MacPro: temperature set 3 */ | 1222 | /* MacMini: temperature set 3 */ |
1220 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, | 1223 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, |
1224 | /* MacPro: temperature set 4 */ | ||
1225 | { .accelerometer = 0, .light = 0, .temperature_set = 4 }, | ||
1221 | }; | 1226 | }; |
1222 | 1227 | ||
1223 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1228 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
@@ -1229,16 +1234,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1229 | (void*)&applesmc_dmi_data[0]}, | 1234 | (void*)&applesmc_dmi_data[0]}, |
1230 | { applesmc_dmi_match, "Apple MacBook", { | 1235 | { applesmc_dmi_match, "Apple MacBook", { |
1231 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1236 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1232 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, | 1237 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") }, |
1233 | (void*)&applesmc_dmi_data[1]}, | 1238 | (void*)&applesmc_dmi_data[1]}, |
1239 | { applesmc_dmi_match, "Apple MacBook", { | ||
1240 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | ||
1241 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, | ||
1242 | (void*)&applesmc_dmi_data[2]}, | ||
1234 | { applesmc_dmi_match, "Apple Macmini", { | 1243 | { applesmc_dmi_match, "Apple Macmini", { |
1235 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1244 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1236 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, | 1245 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, |
1237 | (void*)&applesmc_dmi_data[2]}, | 1246 | (void*)&applesmc_dmi_data[3]}, |
1238 | { applesmc_dmi_match, "Apple MacPro2", { | 1247 | { applesmc_dmi_match, "Apple MacPro2", { |
1239 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1248 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1240 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, | 1249 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, |
1241 | (void*)&applesmc_dmi_data[3]}, | 1250 | (void*)&applesmc_dmi_data[4]}, |
1242 | { .ident = NULL } | 1251 | { .ident = NULL } |
1243 | }; | 1252 | }; |
1244 | 1253 | ||
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 950cea8d1d65..84712a22acea 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include "lm75.h" | 49 | #include "lm75.h" |
50 | 50 | ||
51 | /* I2C addresses to scan */ | 51 | /* I2C addresses to scan */ |
52 | static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; | 52 | static const unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; |
53 | 53 | ||
54 | /* Insmod parameters */ | 54 | /* Insmod parameters */ |
55 | I2C_CLIENT_INSMOD_1(asb100); | 55 | I2C_CLIENT_INSMOD_1(asb100); |
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index cce3350e539e..01c17e387f03 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
@@ -42,7 +42,7 @@ MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); | |||
42 | #define ATXP1_VIDMASK 0x1f | 42 | #define ATXP1_VIDMASK 0x1f |
43 | #define ATXP1_GPIO1MASK 0x0f | 43 | #define ATXP1_GPIO1MASK 0x0f |
44 | 44 | ||
45 | static unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END }; | 45 | static const unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END }; |
46 | 46 | ||
47 | I2C_CLIENT_INSMOD_1(atxp1); | 47 | I2C_CLIENT_INSMOD_1(atxp1); |
48 | 48 | ||
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 3ee60d26e3a2..70239acecc8e 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -38,7 +38,8 @@ | |||
38 | 38 | ||
39 | #define DRVNAME "coretemp" | 39 | #define DRVNAME "coretemp" |
40 | 40 | ||
41 | typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_LABEL, SHOW_NAME } SHOW; | 41 | typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_TTARGET, SHOW_LABEL, |
42 | SHOW_NAME } SHOW; | ||
42 | 43 | ||
43 | /* | 44 | /* |
44 | * Functions declaration | 45 | * Functions declaration |
@@ -55,6 +56,7 @@ struct coretemp_data { | |||
55 | unsigned long last_updated; /* in jiffies */ | 56 | unsigned long last_updated; /* in jiffies */ |
56 | int temp; | 57 | int temp; |
57 | int tjmax; | 58 | int tjmax; |
59 | int ttarget; | ||
58 | u8 alarm; | 60 | u8 alarm; |
59 | }; | 61 | }; |
60 | 62 | ||
@@ -93,9 +95,10 @@ static ssize_t show_temp(struct device *dev, | |||
93 | 95 | ||
94 | if (attr->index == SHOW_TEMP) | 96 | if (attr->index == SHOW_TEMP) |
95 | err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN; | 97 | err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN; |
96 | else | 98 | else if (attr->index == SHOW_TJMAX) |
97 | err = sprintf(buf, "%d\n", data->tjmax); | 99 | err = sprintf(buf, "%d\n", data->tjmax); |
98 | 100 | else | |
101 | err = sprintf(buf, "%d\n", data->ttarget); | ||
99 | return err; | 102 | return err; |
100 | } | 103 | } |
101 | 104 | ||
@@ -103,6 +106,8 @@ static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, | |||
103 | SHOW_TEMP); | 106 | SHOW_TEMP); |
104 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL, | 107 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL, |
105 | SHOW_TJMAX); | 108 | SHOW_TJMAX); |
109 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL, | ||
110 | SHOW_TTARGET); | ||
106 | static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL); | 111 | static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL); |
107 | static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL); | 112 | static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL); |
108 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME); | 113 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME); |
@@ -147,6 +152,56 @@ static struct coretemp_data *coretemp_update_device(struct device *dev) | |||
147 | return data; | 152 | return data; |
148 | } | 153 | } |
149 | 154 | ||
155 | static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | ||
156 | { | ||
157 | /* The 100C is default for both mobile and non mobile CPUs */ | ||
158 | |||
159 | int tjmax = 100000; | ||
160 | int ismobile = 1; | ||
161 | int err; | ||
162 | u32 eax, edx; | ||
163 | |||
164 | /* Early chips have no MSR for TjMax */ | ||
165 | |||
166 | if ((c->x86_model == 0xf) && (c->x86_mask < 4)) { | ||
167 | ismobile = 0; | ||
168 | } | ||
169 | |||
170 | if ((c->x86_model > 0xe) && (ismobile)) { | ||
171 | |||
172 | /* Now we can detect the mobile CPU using Intel provided table | ||
173 | http://softwarecommunity.intel.com/Wiki/Mobility/720.htm | ||
174 | For Core2 cores, check MSR 0x17, bit 28 1 = Mobile CPU | ||
175 | */ | ||
176 | |||
177 | err = rdmsr_safe_on_cpu(id, 0x17, &eax, &edx); | ||
178 | if (err) { | ||
179 | dev_warn(dev, | ||
180 | "Unable to access MSR 0x17, assuming desktop" | ||
181 | " CPU\n"); | ||
182 | ismobile = 0; | ||
183 | } else if (!(eax & 0x10000000)) { | ||
184 | ismobile = 0; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | if (ismobile) { | ||
189 | |||
190 | err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx); | ||
191 | if (err) { | ||
192 | dev_warn(dev, | ||
193 | "Unable to access MSR 0xEE, for Tjmax, left" | ||
194 | " at default"); | ||
195 | } else if (eax & 0x40000000) { | ||
196 | tjmax = 85000; | ||
197 | } | ||
198 | } else { | ||
199 | dev_warn(dev, "Using relative temperature scale!\n"); | ||
200 | } | ||
201 | |||
202 | return tjmax; | ||
203 | } | ||
204 | |||
150 | static int __devinit coretemp_probe(struct platform_device *pdev) | 205 | static int __devinit coretemp_probe(struct platform_device *pdev) |
151 | { | 206 | { |
152 | struct coretemp_data *data; | 207 | struct coretemp_data *data; |
@@ -163,8 +218,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
163 | data->id = pdev->id; | 218 | data->id = pdev->id; |
164 | data->name = "coretemp"; | 219 | data->name = "coretemp"; |
165 | mutex_init(&data->update_lock); | 220 | mutex_init(&data->update_lock); |
166 | /* Tjmax default is 100 degrees C */ | ||
167 | data->tjmax = 100000; | ||
168 | 221 | ||
169 | /* test if we can access the THERM_STATUS MSR */ | 222 | /* test if we can access the THERM_STATUS MSR */ |
170 | err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx); | 223 | err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx); |
@@ -191,40 +244,29 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
191 | } | 244 | } |
192 | } | 245 | } |
193 | 246 | ||
194 | /* Some processors have Tjmax 85 following magic should detect it | 247 | data->tjmax = adjust_tjmax(c, data->id, &pdev->dev); |
195 | Intel won't disclose the information without signed NDA, but | 248 | platform_set_drvdata(pdev, data); |
196 | individuals cannot sign it. Catch(ed) 22. | ||
197 | */ | ||
198 | 249 | ||
199 | if (((c->x86_model == 0xf) && (c->x86_mask > 3)) || | 250 | /* read the still undocumented IA32_TEMPERATURE_TARGET it exists |
200 | (c->x86_model == 0xe)) { | 251 | on older CPUs but not in this register */ |
201 | err = rdmsr_safe_on_cpu(data->id, 0xee, &eax, &edx); | 252 | |
253 | if (c->x86_model > 0xe) { | ||
254 | err = rdmsr_safe_on_cpu(data->id, 0x1a2, &eax, &edx); | ||
202 | if (err) { | 255 | if (err) { |
203 | dev_warn(&pdev->dev, | 256 | dev_warn(&pdev->dev, "Unable to read" |
204 | "Unable to access MSR 0xEE, Tjmax left at %d " | 257 | " IA32_TEMPERATURE_TARGET MSR\n"); |
205 | "degrees C\n", data->tjmax/1000); | 258 | } else { |
206 | } else if (eax & 0x40000000) { | 259 | data->ttarget = data->tjmax - |
207 | data->tjmax = 85000; | 260 | (((eax >> 8) & 0xff) * 1000); |
261 | err = device_create_file(&pdev->dev, | ||
262 | &sensor_dev_attr_temp1_max.dev_attr); | ||
263 | if (err) | ||
264 | goto exit_free; | ||
208 | } | 265 | } |
209 | } | 266 | } |
210 | 267 | ||
211 | /* Intel says that above should not work for desktop Core2 processors, | ||
212 | but it seems to work. There is no other way how get the absolute | ||
213 | readings. Warn the user about this. First check if are desktop, | ||
214 | bit 50 of MSR_IA32_PLATFORM_ID should be 0. | ||
215 | */ | ||
216 | |||
217 | rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx); | ||
218 | |||
219 | if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) { | ||
220 | dev_warn(&pdev->dev, "Using undocumented features, absolute " | ||
221 | "temperature might be wrong!\n"); | ||
222 | } | ||
223 | |||
224 | platform_set_drvdata(pdev, data); | ||
225 | |||
226 | if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) | 268 | if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) |
227 | goto exit_free; | 269 | goto exit_dev; |
228 | 270 | ||
229 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 271 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
230 | if (IS_ERR(data->hwmon_dev)) { | 272 | if (IS_ERR(data->hwmon_dev)) { |
@@ -238,6 +280,8 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
238 | 280 | ||
239 | exit_class: | 281 | exit_class: |
240 | sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); | 282 | sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); |
283 | exit_dev: | ||
284 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
241 | exit_free: | 285 | exit_free: |
242 | kfree(data); | 286 | kfree(data); |
243 | exit: | 287 | exit: |
@@ -250,6 +294,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev) | |||
250 | 294 | ||
251 | hwmon_device_unregister(data->hwmon_dev); | 295 | hwmon_device_unregister(data->hwmon_dev); |
252 | sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); | 296 | sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); |
297 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
253 | platform_set_drvdata(pdev, NULL); | 298 | platform_set_drvdata(pdev, NULL); |
254 | kfree(data); | 299 | kfree(data); |
255 | return 0; | 300 | return 0; |
@@ -330,7 +375,7 @@ static void coretemp_device_remove(unsigned int cpu) | |||
330 | mutex_unlock(&pdev_list_mutex); | 375 | mutex_unlock(&pdev_list_mutex); |
331 | } | 376 | } |
332 | 377 | ||
333 | static int coretemp_cpu_callback(struct notifier_block *nfb, | 378 | static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb, |
334 | unsigned long action, void *hcpu) | 379 | unsigned long action, void *hcpu) |
335 | { | 380 | { |
336 | unsigned int cpu = (unsigned long) hcpu; | 381 | unsigned int cpu = (unsigned long) hcpu; |
@@ -347,7 +392,7 @@ static int coretemp_cpu_callback(struct notifier_block *nfb, | |||
347 | return NOTIFY_OK; | 392 | return NOTIFY_OK; |
348 | } | 393 | } |
349 | 394 | ||
350 | static struct notifier_block coretemp_cpu_notifier = { | 395 | static struct notifier_block coretemp_cpu_notifier __refdata = { |
351 | .notifier_call = coretemp_cpu_callback, | 396 | .notifier_call = coretemp_cpu_callback, |
352 | }; | 397 | }; |
353 | #endif /* !CONFIG_HOTPLUG_CPU */ | 398 | #endif /* !CONFIG_HOTPLUG_CPU */ |
@@ -368,10 +413,10 @@ static int __init coretemp_init(void) | |||
368 | for_each_online_cpu(i) { | 413 | for_each_online_cpu(i) { |
369 | struct cpuinfo_x86 *c = &cpu_data(i); | 414 | struct cpuinfo_x86 *c = &cpu_data(i); |
370 | 415 | ||
371 | /* check if family 6, models e, f, 16 */ | 416 | /* check if family 6, models 0xe, 0xf, 0x16, 0x17 */ |
372 | if ((c->cpuid_level < 0) || (c->x86 != 0x6) || | 417 | if ((c->cpuid_level < 0) || (c->x86 != 0x6) || |
373 | !((c->x86_model == 0xe) || (c->x86_model == 0xf) || | 418 | !((c->x86_model == 0xe) || (c->x86_model == 0xf) || |
374 | (c->x86_model == 0x16))) { | 419 | (c->x86_model == 0x16) || (c->x86_model == 0x17))) { |
375 | 420 | ||
376 | /* supported CPU not found, but report the unknown | 421 | /* supported CPU not found, but report the unknown |
377 | family 6 CPU */ | 422 | family 6 CPU */ |
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index ddddd9f34c19..7673f65877e1 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -49,7 +49,7 @@ module_param(force_id, ushort, 0); | |||
49 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 49 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
50 | 50 | ||
51 | /* Addresses to scan */ | 51 | /* Addresses to scan */ |
52 | static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; | 52 | static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; |
53 | 53 | ||
54 | /* Insmod parameters */ | 54 | /* Insmod parameters */ |
55 | I2C_CLIENT_INSMOD_1(dme1737); | 55 | I2C_CLIENT_INSMOD_1(dme1737); |
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 3f5163de13c1..5f300ffed657 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "lm75.h" | 34 | #include "lm75.h" |
35 | 35 | ||
36 | /* Addresses to scan */ | 36 | /* Addresses to scan */ |
37 | static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, | 37 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, |
38 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; | 38 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; |
39 | 39 | ||
40 | /* Insmod parameters */ | 40 | /* Insmod parameters */ |
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 6892f76fc18a..1464338e4e11 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/f75375s.h> | 37 | #include <linux/f75375s.h> |
38 | 38 | ||
39 | /* Addresses to scan */ | 39 | /* Addresses to scan */ |
40 | static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; | 40 | static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; |
41 | 41 | ||
42 | /* Insmod parameters */ | 42 | /* Insmod parameters */ |
43 | I2C_CLIENT_INSMOD_2(f75373, f75375); | 43 | I2C_CLIENT_INSMOD_2(f75373, f75375); |
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index 721c70177b17..ed26b66e0831 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * Addresses to scan | 40 | * Addresses to scan |
41 | */ | 41 | */ |
42 | 42 | ||
43 | static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | 43 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Insmod parameters | 46 | * Insmod parameters |
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index b7c9eef0f928..bd89d270a5ed 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/dmi.h> | 44 | #include <linux/dmi.h> |
45 | 45 | ||
46 | /* Addresses to scan */ | 46 | /* Addresses to scan */ |
47 | static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | 47 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; |
48 | 48 | ||
49 | /* Insmod parameters */ | 49 | /* Insmod parameters */ |
50 | I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); | 50 | I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); |
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 2f1075323a1e..00f48484e54b 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c | |||
@@ -43,7 +43,7 @@ | |||
43 | /* | 43 | /* |
44 | * Addresses to scan | 44 | * Addresses to scan |
45 | */ | 45 | */ |
46 | static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | 46 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Insmod parameters | 49 | * Insmod parameters |
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 3b1ac48fce23..33e9e8a8d1ce 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/sysfs.h> | 44 | #include <linux/sysfs.h> |
45 | 45 | ||
46 | /* Addresses to scan */ | 46 | /* Addresses to scan */ |
47 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; | 47 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; |
48 | 48 | ||
49 | /* Insmod parameters */ | 49 | /* Insmod parameters */ |
50 | I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80); | 50 | I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80); |
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index 03ecdc334764..8984ef141627 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c | |||
@@ -39,7 +39,7 @@ module_param(extra_sensor_type, ushort, 0); | |||
39 | MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)"); | 39 | MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)"); |
40 | 40 | ||
41 | /* Addresses to scan */ | 41 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; | 42 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; |
43 | 43 | ||
44 | /* Insmod parameters */ | 44 | /* Insmod parameters */ |
45 | I2C_CLIENT_INSMOD_1(gl520sm); | 45 | I2C_CLIENT_INSMOD_1(gl520sm); |
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 650b07d5b902..116287008083 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -53,7 +53,7 @@ | |||
53 | * Address is fully defined internally and cannot be changed. | 53 | * Address is fully defined internally and cannot be changed. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | static unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; | 56 | static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Insmod parameters | 59 | * Insmod parameters |
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index e5c35a355a57..115f4090b98e 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | /* Addresses to scan */ | 33 | /* Addresses to scan */ |
34 | static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, | 34 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, |
35 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; | 35 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; |
36 | 36 | ||
37 | /* Insmod parameters */ | 37 | /* Insmod parameters */ |
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 459b70ad6bee..36d5a8c3ad8c 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c | |||
@@ -36,7 +36,8 @@ | |||
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | 37 | ||
38 | /* Addresses to scan */ | 38 | /* Addresses to scan */ |
39 | static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, I2C_CLIENT_END }; | 39 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, |
40 | I2C_CLIENT_END }; | ||
40 | 41 | ||
41 | /* Insmod parameters */ | 42 | /* Insmod parameters */ |
42 | I2C_CLIENT_INSMOD_1(lm77); | 43 | I2C_CLIENT_INSMOD_1(lm77); |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 0a9eb1f6f4e4..ed7859f0e16a 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -37,8 +37,8 @@ | |||
37 | static struct platform_device *pdev; | 37 | static struct platform_device *pdev; |
38 | 38 | ||
39 | /* Addresses to scan */ | 39 | /* Addresses to scan */ |
40 | static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, | 40 | static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, |
41 | 0x2e, 0x2f, I2C_CLIENT_END }; | 41 | 0x2e, 0x2f, I2C_CLIENT_END }; |
42 | static unsigned short isa_address = 0x290; | 42 | static unsigned short isa_address = 0x290; |
43 | 43 | ||
44 | /* Insmod parameters */ | 44 | /* Insmod parameters */ |
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index a2ca055f3922..26c91c9d4769 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c | |||
@@ -32,8 +32,8 @@ | |||
32 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
33 | 33 | ||
34 | /* Addresses to scan */ | 34 | /* Addresses to scan */ |
35 | static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, | 35 | static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, |
36 | 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; | 36 | 0x2e, 0x2f, I2C_CLIENT_END }; |
37 | 37 | ||
38 | /* Insmod parameters */ | 38 | /* Insmod parameters */ |
39 | I2C_CLIENT_INSMOD_1(lm80); | 39 | I2C_CLIENT_INSMOD_1(lm80); |
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 6e8903a6e902..6a8642fa25fb 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c | |||
@@ -48,10 +48,8 @@ | |||
48 | * addresses. | 48 | * addresses. |
49 | */ | 49 | */ |
50 | 50 | ||
51 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | 51 | static const unsigned short normal_i2c[] = { |
52 | 0x29, 0x2a, 0x2b, | 52 | 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; |
53 | 0x4c, 0x4d, 0x4e, | ||
54 | I2C_CLIENT_END }; | ||
55 | 53 | ||
56 | /* | 54 | /* |
57 | * Insmod parameters | 55 | * Insmod parameters |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 4bb0f291a6b8..182fe6a5605f 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
36 | 36 | ||
37 | /* Addresses to scan */ | 37 | /* Addresses to scan */ |
38 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 38 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
39 | 39 | ||
40 | /* Insmod parameters */ | 40 | /* Insmod parameters */ |
41 | I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102); | 41 | I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102); |
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index 8ee07c5c97a1..e1c183f0aae0 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c | |||
@@ -73,7 +73,7 @@ | |||
73 | * LM87 has three possible addresses: 0x2c, 0x2d and 0x2e. | 73 | * LM87 has three possible addresses: 0x2c, 0x2d and 0x2e. |
74 | */ | 74 | */ |
75 | 75 | ||
76 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 76 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
77 | 77 | ||
78 | /* | 78 | /* |
79 | * Insmod parameters | 79 | * Insmod parameters |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index f7ec95bedbf6..d1a3da3dd8e0 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -101,10 +101,8 @@ | |||
101 | * 0x4c, 0x4d or 0x4e. | 101 | * 0x4c, 0x4d or 0x4e. |
102 | */ | 102 | */ |
103 | 103 | ||
104 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | 104 | static const unsigned short normal_i2c[] = { |
105 | 0x29, 0x2a, 0x2b, | 105 | 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; |
106 | 0x4c, 0x4d, 0x4e, | ||
107 | I2C_CLIENT_END }; | ||
108 | 106 | ||
109 | /* | 107 | /* |
110 | * Insmod parameters | 108 | * Insmod parameters |
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index af5c77d568fe..c31942e08246 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c | |||
@@ -45,13 +45,14 @@ | |||
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/i2c.h> | 46 | #include <linux/i2c.h> |
47 | #include <linux/hwmon.h> | 47 | #include <linux/hwmon.h> |
48 | #include <linux/hwmon-sysfs.h> | ||
48 | #include <linux/err.h> | 49 | #include <linux/err.h> |
49 | #include <linux/mutex.h> | 50 | #include <linux/mutex.h> |
50 | 51 | ||
51 | /* The LM92 and MAX6635 have 2 two-state pins for address selection, | 52 | /* The LM92 and MAX6635 have 2 two-state pins for address selection, |
52 | resulting in 4 possible addresses. */ | 53 | resulting in 4 possible addresses. */ |
53 | static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, | 54 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, |
54 | I2C_CLIENT_END }; | 55 | I2C_CLIENT_END }; |
55 | 56 | ||
56 | /* Insmod parameters */ | 57 | /* Insmod parameters */ |
57 | I2C_CLIENT_INSMOD_1(lm92); | 58 | I2C_CLIENT_INSMOD_1(lm92); |
@@ -209,6 +210,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
209 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); | 210 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); |
210 | } | 211 | } |
211 | 212 | ||
213 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
214 | char *buf) | ||
215 | { | ||
216 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
217 | struct lm92_data *data = lm92_update_device(dev); | ||
218 | return sprintf(buf, "%d\n", (data->temp1_input >> bitnr) & 1); | ||
219 | } | ||
220 | |||
212 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL); | 221 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL); |
213 | static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit, | 222 | static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit, |
214 | set_temp1_crit); | 223 | set_temp1_crit); |
@@ -221,6 +230,9 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp1_max, | |||
221 | set_temp1_max); | 230 | set_temp1_max); |
222 | static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL); | 231 | static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL); |
223 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 232 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
233 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
234 | static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
235 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
224 | 236 | ||
225 | 237 | ||
226 | /* | 238 | /* |
@@ -297,7 +309,9 @@ static struct attribute *lm92_attributes[] = { | |||
297 | &dev_attr_temp1_max.attr, | 309 | &dev_attr_temp1_max.attr, |
298 | &dev_attr_temp1_max_hyst.attr, | 310 | &dev_attr_temp1_max_hyst.attr, |
299 | &dev_attr_alarms.attr, | 311 | &dev_attr_alarms.attr, |
300 | 312 | &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, | |
313 | &sensor_dev_attr_temp1_min_alarm.dev_attr.attr, | ||
314 | &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, | ||
301 | NULL | 315 | NULL |
302 | }; | 316 | }; |
303 | 317 | ||
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c index ea61946a4bf7..5e678f5c883d 100644 --- a/drivers/hwmon/lm93.c +++ b/drivers/hwmon/lm93.c | |||
@@ -142,7 +142,7 @@ | |||
142 | I2C_FUNC_SMBUS_WORD_DATA) | 142 | I2C_FUNC_SMBUS_WORD_DATA) |
143 | 143 | ||
144 | /* Addresses to scan */ | 144 | /* Addresses to scan */ |
145 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 145 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
146 | 146 | ||
147 | /* Insmod parameters */ | 147 | /* Insmod parameters */ |
148 | I2C_CLIENT_INSMOD_1(lm93); | 148 | I2C_CLIENT_INSMOD_1(lm93); |
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 38a44c3d6cee..7e7267a04544 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -32,14 +32,13 @@ | |||
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/hwmon.h> | 34 | #include <linux/hwmon.h> |
35 | #include <linux/hwmon-sysfs.h> | ||
35 | #include <linux/err.h> | 36 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
37 | #include <linux/sysfs.h> | 38 | #include <linux/sysfs.h> |
38 | 39 | ||
39 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | 40 | static const unsigned short normal_i2c[] = { |
40 | 0x29, 0x2a, 0x2b, | 41 | 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; |
41 | 0x4c, 0x4d, 0x4e, | ||
42 | I2C_CLIENT_END }; | ||
43 | 42 | ||
44 | /* | 43 | /* |
45 | * Insmod parameters | 44 | * Insmod parameters |
@@ -161,6 +160,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
161 | return sprintf(buf, "%d\n", data->alarms); | 160 | return sprintf(buf, "%d\n", data->alarms); |
162 | } | 161 | } |
163 | 162 | ||
163 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
164 | char *buf) | ||
165 | { | ||
166 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
167 | struct max1619_data *data = max1619_update_device(dev); | ||
168 | return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1); | ||
169 | } | ||
170 | |||
164 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); | 171 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); |
165 | static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); | 172 | static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); |
166 | static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, | 173 | static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, |
@@ -172,6 +179,10 @@ static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2, | |||
172 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, | 179 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, |
173 | set_temp_hyst2); | 180 | set_temp_hyst2); |
174 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 181 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
182 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
183 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); | ||
184 | static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
185 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
175 | 186 | ||
176 | static struct attribute *max1619_attributes[] = { | 187 | static struct attribute *max1619_attributes[] = { |
177 | &dev_attr_temp1_input.attr, | 188 | &dev_attr_temp1_input.attr, |
@@ -182,6 +193,10 @@ static struct attribute *max1619_attributes[] = { | |||
182 | &dev_attr_temp2_crit_hyst.attr, | 193 | &dev_attr_temp2_crit_hyst.attr, |
183 | 194 | ||
184 | &dev_attr_alarms.attr, | 195 | &dev_attr_alarms.attr, |
196 | &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, | ||
197 | &sensor_dev_attr_temp2_fault.dev_attr.attr, | ||
198 | &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, | ||
199 | &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, | ||
185 | NULL | 200 | NULL |
186 | }; | 201 | }; |
187 | 202 | ||
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 755570c1f4eb..52d528b76cc3 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c | |||
@@ -44,7 +44,8 @@ | |||
44 | * Addresses to scan. There are four disjoint possibilities, by pin config. | 44 | * Addresses to scan. There are four disjoint possibilities, by pin config. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | static unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, I2C_CLIENT_END}; | 47 | static const unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, |
48 | I2C_CLIENT_END}; | ||
48 | 49 | ||
49 | /* | 50 | /* |
50 | * Insmod parameters | 51 | * Insmod parameters |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 0d7f0c4d06bb..d1b498548736 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -198,6 +198,14 @@ static ssize_t get_fan_div(struct device *dev, struct device_attribute | |||
198 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); | 198 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); |
199 | } | 199 | } |
200 | 200 | ||
201 | static ssize_t get_fan_alarm(struct device *dev, struct device_attribute | ||
202 | *devattr, char *buf) | ||
203 | { | ||
204 | int bitnr = to_sensor_dev_attr(devattr)->index; | ||
205 | struct smsc47m1_data *data = smsc47m1_update_device(dev, 0); | ||
206 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
207 | } | ||
208 | |||
201 | static ssize_t get_pwm(struct device *dev, struct device_attribute | 209 | static ssize_t get_pwm(struct device *dev, struct device_attribute |
202 | *devattr, char *buf) | 210 | *devattr, char *buf) |
203 | { | 211 | { |
@@ -347,6 +355,8 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | |||
347 | get_fan_min, set_fan_min, offset - 1); \ | 355 | get_fan_min, set_fan_min, offset - 1); \ |
348 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | 356 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ |
349 | get_fan_div, set_fan_div, offset - 1); \ | 357 | get_fan_div, set_fan_div, offset - 1); \ |
358 | static SENSOR_DEVICE_ATTR(fan##offset##_alarm, S_IRUGO, get_fan_alarm, \ | ||
359 | NULL, offset - 1); \ | ||
350 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ | 360 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ |
351 | get_pwm, set_pwm, offset - 1); \ | 361 | get_pwm, set_pwm, offset - 1); \ |
352 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ | 362 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ |
@@ -374,12 +384,15 @@ static struct attribute *smsc47m1_attributes[] = { | |||
374 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 384 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
375 | &sensor_dev_attr_fan1_min.dev_attr.attr, | 385 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
376 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 386 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
387 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
377 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 388 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
378 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 389 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
379 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 390 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
391 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
380 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 392 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
381 | &sensor_dev_attr_fan3_min.dev_attr.attr, | 393 | &sensor_dev_attr_fan3_min.dev_attr.attr, |
382 | &sensor_dev_attr_fan3_div.dev_attr.attr, | 394 | &sensor_dev_attr_fan3_div.dev_attr.attr, |
395 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
383 | 396 | ||
384 | &sensor_dev_attr_pwm1.dev_attr.attr, | 397 | &sensor_dev_attr_pwm1.dev_attr.attr, |
385 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | 398 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, |
@@ -533,7 +546,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
533 | || (err = device_create_file(dev, | 546 | || (err = device_create_file(dev, |
534 | &sensor_dev_attr_fan1_min.dev_attr)) | 547 | &sensor_dev_attr_fan1_min.dev_attr)) |
535 | || (err = device_create_file(dev, | 548 | || (err = device_create_file(dev, |
536 | &sensor_dev_attr_fan1_div.dev_attr))) | 549 | &sensor_dev_attr_fan1_div.dev_attr)) |
550 | || (err = device_create_file(dev, | ||
551 | &sensor_dev_attr_fan1_alarm.dev_attr))) | ||
537 | goto error_remove_files; | 552 | goto error_remove_files; |
538 | } else | 553 | } else |
539 | dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n"); | 554 | dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n"); |
@@ -544,7 +559,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
544 | || (err = device_create_file(dev, | 559 | || (err = device_create_file(dev, |
545 | &sensor_dev_attr_fan2_min.dev_attr)) | 560 | &sensor_dev_attr_fan2_min.dev_attr)) |
546 | || (err = device_create_file(dev, | 561 | || (err = device_create_file(dev, |
547 | &sensor_dev_attr_fan2_div.dev_attr))) | 562 | &sensor_dev_attr_fan2_div.dev_attr)) |
563 | || (err = device_create_file(dev, | ||
564 | &sensor_dev_attr_fan2_alarm.dev_attr))) | ||
548 | goto error_remove_files; | 565 | goto error_remove_files; |
549 | } else | 566 | } else |
550 | dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n"); | 567 | dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n"); |
@@ -555,7 +572,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
555 | || (err = device_create_file(dev, | 572 | || (err = device_create_file(dev, |
556 | &sensor_dev_attr_fan3_min.dev_attr)) | 573 | &sensor_dev_attr_fan3_min.dev_attr)) |
557 | || (err = device_create_file(dev, | 574 | || (err = device_create_file(dev, |
558 | &sensor_dev_attr_fan3_div.dev_attr))) | 575 | &sensor_dev_attr_fan3_div.dev_attr)) |
576 | || (err = device_create_file(dev, | ||
577 | &sensor_dev_attr_fan3_alarm.dev_attr))) | ||
559 | goto error_remove_files; | 578 | goto error_remove_files; |
560 | } else if (data->type == smsc47m2) | 579 | } else if (data->type == smsc47m2) |
561 | dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n"); | 580 | dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n"); |
diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c index 8b0c188e60f6..3c9db6598ba7 100644 --- a/drivers/hwmon/smsc47m192.c +++ b/drivers/hwmon/smsc47m192.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | 35 | ||
36 | /* Addresses to scan */ | 36 | /* Addresses to scan */ |
37 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; | 37 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; |
38 | 38 | ||
39 | /* Insmod parameters */ | 39 | /* Insmod parameters */ |
40 | I2C_CLIENT_INSMOD_1(smsc47m192); | 40 | I2C_CLIENT_INSMOD_1(smsc47m192); |
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c index 04dd7699b3ac..76a3859c3fbe 100644 --- a/drivers/hwmon/thmc50.c +++ b/drivers/hwmon/thmc50.c | |||
@@ -32,7 +32,7 @@ | |||
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
34 | /* Addresses to scan */ | 34 | /* Addresses to scan */ |
35 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 35 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
36 | 36 | ||
37 | /* Insmod parameters */ | 37 | /* Insmod parameters */ |
38 | I2C_CLIENT_INSMOD_2(thmc50, adm1022); | 38 | I2C_CLIENT_INSMOD_2(thmc50, adm1022); |
@@ -52,9 +52,9 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs " | |||
52 | */ | 52 | */ |
53 | #define THMC50_REG_INTR 0x41 | 53 | #define THMC50_REG_INTR 0x41 |
54 | 54 | ||
55 | const static u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 }; | 55 | static const u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 }; |
56 | const static u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C }; | 56 | static const u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C }; |
57 | const static u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B }; | 57 | static const u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B }; |
58 | 58 | ||
59 | #define THMC50_REG_CONF_nFANOFF 0x20 | 59 | #define THMC50_REG_CONF_nFANOFF 0x20 |
60 | 60 | ||
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 2635bba1e3fc..f1ee5e731968 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -533,6 +533,24 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
533 | } | 533 | } |
534 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 534 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
535 | 535 | ||
536 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
537 | char *buf) | ||
538 | { | ||
539 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
540 | struct via686a_data *data = via686a_update_device(dev); | ||
541 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
542 | } | ||
543 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
544 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
545 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
546 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
547 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
548 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
549 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
550 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 15); | ||
551 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
552 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); | ||
553 | |||
536 | static ssize_t show_name(struct device *dev, struct device_attribute | 554 | static ssize_t show_name(struct device *dev, struct device_attribute |
537 | *devattr, char *buf) | 555 | *devattr, char *buf) |
538 | { | 556 | { |
@@ -557,6 +575,11 @@ static struct attribute *via686a_attributes[] = { | |||
557 | &sensor_dev_attr_in2_max.dev_attr.attr, | 575 | &sensor_dev_attr_in2_max.dev_attr.attr, |
558 | &sensor_dev_attr_in3_max.dev_attr.attr, | 576 | &sensor_dev_attr_in3_max.dev_attr.attr, |
559 | &sensor_dev_attr_in4_max.dev_attr.attr, | 577 | &sensor_dev_attr_in4_max.dev_attr.attr, |
578 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
579 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
580 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
581 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
582 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
560 | 583 | ||
561 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 584 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
562 | &sensor_dev_attr_temp2_input.dev_attr.attr, | 585 | &sensor_dev_attr_temp2_input.dev_attr.attr, |
@@ -567,6 +590,9 @@ static struct attribute *via686a_attributes[] = { | |||
567 | &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, | 590 | &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, |
568 | &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, | 591 | &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, |
569 | &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, | 592 | &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, |
593 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
594 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
595 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
570 | 596 | ||
571 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 597 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
572 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 598 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
@@ -574,6 +600,8 @@ static struct attribute *via686a_attributes[] = { | |||
574 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 600 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
575 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 601 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
576 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 602 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
603 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
604 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
577 | 605 | ||
578 | &dev_attr_alarms.attr, | 606 | &dev_attr_alarms.attr, |
579 | &dev_attr_name.attr, | 607 | &dev_attr_name.attr, |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index f87661775fe0..5bc57275cae8 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -2,7 +2,7 @@ | |||
2 | vt8231.c - Part of lm_sensors, Linux kernel modules | 2 | vt8231.c - Part of lm_sensors, Linux kernel modules |
3 | for hardware monitoring | 3 | for hardware monitoring |
4 | 4 | ||
5 | Copyright (c) 2005 Roger Lucas <roger@planbit.co.uk> | 5 | Copyright (c) 2005 Roger Lucas <vt8231@hiddenengine.co.uk> |
6 | Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> | 6 | Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> |
7 | Aaron M. Marsh <amarsh@sdf.lonestar.org> | 7 | Aaron M. Marsh <amarsh@sdf.lonestar.org> |
8 | 8 | ||
@@ -541,6 +541,28 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, | |||
541 | } | 541 | } |
542 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 542 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
543 | 543 | ||
544 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
545 | char *buf) | ||
546 | { | ||
547 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
548 | struct vt8231_data *data = vt8231_update_device(dev); | ||
549 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
550 | } | ||
551 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
552 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
553 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
554 | static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
555 | static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
556 | static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
557 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
558 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
559 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
560 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
561 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
562 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
563 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
564 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); | ||
565 | |||
544 | static ssize_t show_name(struct device *dev, struct device_attribute | 566 | static ssize_t show_name(struct device *dev, struct device_attribute |
545 | *devattr, char *buf) | 567 | *devattr, char *buf) |
546 | { | 568 | { |
@@ -549,36 +571,42 @@ static ssize_t show_name(struct device *dev, struct device_attribute | |||
549 | } | 571 | } |
550 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 572 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
551 | 573 | ||
552 | static struct attribute *vt8231_attributes_temps[6][4] = { | 574 | static struct attribute *vt8231_attributes_temps[6][5] = { |
553 | { | 575 | { |
554 | &dev_attr_temp1_input.attr, | 576 | &dev_attr_temp1_input.attr, |
555 | &dev_attr_temp1_max_hyst.attr, | 577 | &dev_attr_temp1_max_hyst.attr, |
556 | &dev_attr_temp1_max.attr, | 578 | &dev_attr_temp1_max.attr, |
579 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
557 | NULL | 580 | NULL |
558 | }, { | 581 | }, { |
559 | &sensor_dev_attr_temp2_input.dev_attr.attr, | 582 | &sensor_dev_attr_temp2_input.dev_attr.attr, |
560 | &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, | 583 | &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, |
561 | &sensor_dev_attr_temp2_max.dev_attr.attr, | 584 | &sensor_dev_attr_temp2_max.dev_attr.attr, |
585 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
562 | NULL | 586 | NULL |
563 | }, { | 587 | }, { |
564 | &sensor_dev_attr_temp3_input.dev_attr.attr, | 588 | &sensor_dev_attr_temp3_input.dev_attr.attr, |
565 | &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, | 589 | &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, |
566 | &sensor_dev_attr_temp3_max.dev_attr.attr, | 590 | &sensor_dev_attr_temp3_max.dev_attr.attr, |
591 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
567 | NULL | 592 | NULL |
568 | }, { | 593 | }, { |
569 | &sensor_dev_attr_temp4_input.dev_attr.attr, | 594 | &sensor_dev_attr_temp4_input.dev_attr.attr, |
570 | &sensor_dev_attr_temp4_max_hyst.dev_attr.attr, | 595 | &sensor_dev_attr_temp4_max_hyst.dev_attr.attr, |
571 | &sensor_dev_attr_temp4_max.dev_attr.attr, | 596 | &sensor_dev_attr_temp4_max.dev_attr.attr, |
597 | &sensor_dev_attr_temp4_alarm.dev_attr.attr, | ||
572 | NULL | 598 | NULL |
573 | }, { | 599 | }, { |
574 | &sensor_dev_attr_temp5_input.dev_attr.attr, | 600 | &sensor_dev_attr_temp5_input.dev_attr.attr, |
575 | &sensor_dev_attr_temp5_max_hyst.dev_attr.attr, | 601 | &sensor_dev_attr_temp5_max_hyst.dev_attr.attr, |
576 | &sensor_dev_attr_temp5_max.dev_attr.attr, | 602 | &sensor_dev_attr_temp5_max.dev_attr.attr, |
603 | &sensor_dev_attr_temp5_alarm.dev_attr.attr, | ||
577 | NULL | 604 | NULL |
578 | }, { | 605 | }, { |
579 | &sensor_dev_attr_temp6_input.dev_attr.attr, | 606 | &sensor_dev_attr_temp6_input.dev_attr.attr, |
580 | &sensor_dev_attr_temp6_max_hyst.dev_attr.attr, | 607 | &sensor_dev_attr_temp6_max_hyst.dev_attr.attr, |
581 | &sensor_dev_attr_temp6_max.dev_attr.attr, | 608 | &sensor_dev_attr_temp6_max.dev_attr.attr, |
609 | &sensor_dev_attr_temp6_alarm.dev_attr.attr, | ||
582 | NULL | 610 | NULL |
583 | } | 611 | } |
584 | }; | 612 | }; |
@@ -592,36 +620,42 @@ static const struct attribute_group vt8231_group_temps[6] = { | |||
592 | { .attrs = vt8231_attributes_temps[5] }, | 620 | { .attrs = vt8231_attributes_temps[5] }, |
593 | }; | 621 | }; |
594 | 622 | ||
595 | static struct attribute *vt8231_attributes_volts[6][4] = { | 623 | static struct attribute *vt8231_attributes_volts[6][5] = { |
596 | { | 624 | { |
597 | &sensor_dev_attr_in0_input.dev_attr.attr, | 625 | &sensor_dev_attr_in0_input.dev_attr.attr, |
598 | &sensor_dev_attr_in0_min.dev_attr.attr, | 626 | &sensor_dev_attr_in0_min.dev_attr.attr, |
599 | &sensor_dev_attr_in0_max.dev_attr.attr, | 627 | &sensor_dev_attr_in0_max.dev_attr.attr, |
628 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
600 | NULL | 629 | NULL |
601 | }, { | 630 | }, { |
602 | &sensor_dev_attr_in1_input.dev_attr.attr, | 631 | &sensor_dev_attr_in1_input.dev_attr.attr, |
603 | &sensor_dev_attr_in1_min.dev_attr.attr, | 632 | &sensor_dev_attr_in1_min.dev_attr.attr, |
604 | &sensor_dev_attr_in1_max.dev_attr.attr, | 633 | &sensor_dev_attr_in1_max.dev_attr.attr, |
634 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
605 | NULL | 635 | NULL |
606 | }, { | 636 | }, { |
607 | &sensor_dev_attr_in2_input.dev_attr.attr, | 637 | &sensor_dev_attr_in2_input.dev_attr.attr, |
608 | &sensor_dev_attr_in2_min.dev_attr.attr, | 638 | &sensor_dev_attr_in2_min.dev_attr.attr, |
609 | &sensor_dev_attr_in2_max.dev_attr.attr, | 639 | &sensor_dev_attr_in2_max.dev_attr.attr, |
640 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
610 | NULL | 641 | NULL |
611 | }, { | 642 | }, { |
612 | &sensor_dev_attr_in3_input.dev_attr.attr, | 643 | &sensor_dev_attr_in3_input.dev_attr.attr, |
613 | &sensor_dev_attr_in3_min.dev_attr.attr, | 644 | &sensor_dev_attr_in3_min.dev_attr.attr, |
614 | &sensor_dev_attr_in3_max.dev_attr.attr, | 645 | &sensor_dev_attr_in3_max.dev_attr.attr, |
646 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
615 | NULL | 647 | NULL |
616 | }, { | 648 | }, { |
617 | &sensor_dev_attr_in4_input.dev_attr.attr, | 649 | &sensor_dev_attr_in4_input.dev_attr.attr, |
618 | &sensor_dev_attr_in4_min.dev_attr.attr, | 650 | &sensor_dev_attr_in4_min.dev_attr.attr, |
619 | &sensor_dev_attr_in4_max.dev_attr.attr, | 651 | &sensor_dev_attr_in4_max.dev_attr.attr, |
652 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
620 | NULL | 653 | NULL |
621 | }, { | 654 | }, { |
622 | &dev_attr_in5_input.attr, | 655 | &dev_attr_in5_input.attr, |
623 | &dev_attr_in5_min.attr, | 656 | &dev_attr_in5_min.attr, |
624 | &dev_attr_in5_max.attr, | 657 | &dev_attr_in5_max.attr, |
658 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
625 | NULL | 659 | NULL |
626 | } | 660 | } |
627 | }; | 661 | }; |
@@ -642,6 +676,8 @@ static struct attribute *vt8231_attributes[] = { | |||
642 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 676 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
643 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 677 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
644 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 678 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
679 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
680 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
645 | &dev_attr_alarms.attr, | 681 | &dev_attr_alarms.attr, |
646 | &dev_attr_name.attr, | 682 | &dev_attr_name.attr, |
647 | NULL | 683 | NULL |
@@ -963,7 +999,7 @@ static void __exit sm_vt8231_exit(void) | |||
963 | } | 999 | } |
964 | } | 1000 | } |
965 | 1001 | ||
966 | MODULE_AUTHOR("Roger Lucas <roger@planbit.co.uk>"); | 1002 | MODULE_AUTHOR("Roger Lucas <vt8231@hiddenengine.co.uk>"); |
967 | MODULE_DESCRIPTION("VT8231 sensors"); | 1003 | MODULE_DESCRIPTION("VT8231 sensors"); |
968 | MODULE_LICENSE("GPL"); | 1004 | MODULE_LICENSE("GPL"); |
969 | 1005 | ||
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index 7421f6ea53e1..5c85670e2d16 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -53,8 +53,8 @@ | |||
53 | static struct platform_device *pdev; | 53 | static struct platform_device *pdev; |
54 | 54 | ||
55 | /* Addresses to scan */ | 55 | /* Addresses to scan */ |
56 | static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, | 56 | static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, |
57 | 0x2e, 0x2f, I2C_CLIENT_END }; | 57 | 0x2e, 0x2f, I2C_CLIENT_END }; |
58 | static unsigned short isa_address = 0x290; | 58 | static unsigned short isa_address = 0x290; |
59 | 59 | ||
60 | /* Insmod parameters */ | 60 | /* Insmod parameters */ |
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index 85bd21ee3298..85077c4c8039 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c | |||
@@ -47,7 +47,8 @@ | |||
47 | #define NUMBER_OF_TEMPIN 3 | 47 | #define NUMBER_OF_TEMPIN 3 |
48 | 48 | ||
49 | /* Addresses to scan */ | 49 | /* Addresses to scan */ |
50 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; | 50 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, |
51 | I2C_CLIENT_END }; | ||
51 | 52 | ||
52 | /* Insmod parameters */ | 53 | /* Insmod parameters */ |
53 | I2C_CLIENT_INSMOD_1(w83791d); | 54 | I2C_CLIENT_INSMOD_1(w83791d); |
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 007449d3e16e..299629d47ed6 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
@@ -46,7 +46,8 @@ | |||
46 | #include <linux/sysfs.h> | 46 | #include <linux/sysfs.h> |
47 | 47 | ||
48 | /* Addresses to scan */ | 48 | /* Addresses to scan */ |
49 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; | 49 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, |
50 | I2C_CLIENT_END }; | ||
50 | 51 | ||
51 | /* Insmod parameters */ | 52 | /* Insmod parameters */ |
52 | I2C_CLIENT_INSMOD_1(w83792d); | 53 | I2C_CLIENT_INSMOD_1(w83792d); |
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 3ba1d6b33473..ee35af93b574 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c | |||
@@ -37,7 +37,8 @@ | |||
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | 38 | ||
39 | /* Addresses to scan */ | 39 | /* Addresses to scan */ |
40 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; | 40 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, |
41 | I2C_CLIENT_END }; | ||
41 | 42 | ||
42 | /* Insmod parameters */ | 43 | /* Insmod parameters */ |
43 | I2C_CLIENT_INSMOD_1(w83793); | 44 | I2C_CLIENT_INSMOD_1(w83793); |
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 1d6259d29e74..77f2d482888b 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
@@ -49,7 +49,7 @@ | |||
49 | * Address is fully defined internally and cannot be changed. | 49 | * Address is fully defined internally and cannot be changed. |
50 | */ | 50 | */ |
51 | 51 | ||
52 | static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; | 52 | static const unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * Insmod parameters | 55 | * Insmod parameters |
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 1dbee4fa23ad..41e22ddb568a 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
36 | 36 | ||
37 | /* Addresses to scan */ | 37 | /* Addresses to scan */ |
38 | static unsigned short normal_i2c[] = { 0x2e, 0x2f, I2C_CLIENT_END }; | 38 | static const unsigned short normal_i2c[] = { 0x2e, 0x2f, I2C_CLIENT_END }; |
39 | 39 | ||
40 | /* Insmod parameters */ | 40 | /* Insmod parameters */ |
41 | I2C_CLIENT_INSMOD_1(w83l786ng); | 41 | I2C_CLIENT_INSMOD_1(w83l786ng); |