diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-17 12:47:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-17 12:47:35 -0400 |
commit | 96c015b75feaaa67c8744229937bd9c35919d16b (patch) | |
tree | c7021e4245d9a02fa78d9775027b9ac1dc9ec8a6 | |
parent | 3aee0605a41399063c0ad396f1f4267108f210d3 (diff) | |
parent | 5cfaf338134605ce8d9272b9c16605bc920d25be (diff) |
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
hwmon: (lm85) Don't bind to Winbond/Nuvoton WPCD377I
hwmon: (pcf8591) Documentation clean-ups
hwmon: Clearly mark ACPI drivers as such
hwmon: Use resource_size
hwmon: Include <linux/io.h> instead of <asm/io.h>
hwmon: (tmp421) Add documentation
hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips
hwmon-vid: Ignore 6th VID pin of AMD family 0Fh processors
hwmon: (asus_atk0110) Add maintainer information
hwmon: (abituguru3) Support multiple DMI strings per chip ID
-rw-r--r-- | Documentation/hwmon/pcf8591 | 28 | ||||
-rw-r--r-- | Documentation/hwmon/tmp421 | 36 | ||||
-rw-r--r-- | MAINTAINERS | 6 | ||||
-rw-r--r-- | drivers/hwmon/Kconfig | 110 | ||||
-rw-r--r-- | drivers/hwmon/Makefile | 7 | ||||
-rw-r--r-- | drivers/hwmon/abituguru.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/abituguru3.c | 79 | ||||
-rw-r--r-- | drivers/hwmon/applesmc.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/dme1737.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/f71805f.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/hdaps.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/hwmon-vid.c | 10 | ||||
-rw-r--r-- | drivers/hwmon/it87.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/lm78.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/lm85.c | 32 | ||||
-rw-r--r-- | drivers/hwmon/pc87360.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/pc87427.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/sis5595.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/smsc47b397.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/tmp421.c | 347 | ||||
-rw-r--r-- | drivers/hwmon/via686a.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/vt1211.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/vt8231.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/w83627hf.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/w83781d.c | 2 |
27 files changed, 579 insertions, 125 deletions
diff --git a/Documentation/hwmon/pcf8591 b/Documentation/hwmon/pcf8591 index 5628fcf4207f..e76a7892f68e 100644 --- a/Documentation/hwmon/pcf8591 +++ b/Documentation/hwmon/pcf8591 | |||
@@ -2,11 +2,11 @@ Kernel driver pcf8591 | |||
2 | ===================== | 2 | ===================== |
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * Philips PCF8591 | 5 | * Philips/NXP PCF8591 |
6 | Prefix: 'pcf8591' | 6 | Prefix: 'pcf8591' |
7 | Addresses scanned: I2C 0x48 - 0x4f | 7 | Addresses scanned: I2C 0x48 - 0x4f |
8 | Datasheet: Publicly available at the Philips Semiconductor website | 8 | Datasheet: Publicly available at the NXP website |
9 | http://www.semiconductors.philips.com/pip/PCF8591P.html | 9 | http://www.nxp.com/pip/PCF8591_6.html |
10 | 10 | ||
11 | Authors: | 11 | Authors: |
12 | Aurelien Jarno <aurelien@aurel32.net> | 12 | Aurelien Jarno <aurelien@aurel32.net> |
@@ -16,9 +16,10 @@ Authors: | |||
16 | 16 | ||
17 | Description | 17 | Description |
18 | ----------- | 18 | ----------- |
19 | |||
19 | The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one | 20 | The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one |
20 | analog output) for the I2C bus produced by Philips Semiconductors. It | 21 | analog output) for the I2C bus produced by Philips Semiconductors (now NXP). |
21 | is designed to provide a byte I2C interface to up to 4 separate devices. | 22 | It is designed to provide a byte I2C interface to up to 4 separate devices. |
22 | 23 | ||
23 | The PCF8591 has 4 analog inputs programmable as single-ended or | 24 | The PCF8591 has 4 analog inputs programmable as single-ended or |
24 | differential inputs : | 25 | differential inputs : |
@@ -58,8 +59,8 @@ Accessing PCF8591 via /sys interface | |||
58 | ------------------------------------- | 59 | ------------------------------------- |
59 | 60 | ||
60 | ! Be careful ! | 61 | ! Be careful ! |
61 | The PCF8591 is plainly impossible to detect ! Stupid chip. | 62 | The PCF8591 is plainly impossible to detect! Stupid chip. |
62 | So every chip with address in the interval [48..4f] is | 63 | So every chip with address in the interval [0x48..0x4f] is |
63 | detected as PCF8591. If you have other chips in this address | 64 | detected as PCF8591. If you have other chips in this address |
64 | range, the workaround is to load this module after the one | 65 | range, the workaround is to load this module after the one |
65 | for your others chips. | 66 | for your others chips. |
@@ -67,19 +68,20 @@ for your others chips. | |||
67 | On detection (i.e. insmod, modprobe et al.), directories are being | 68 | On detection (i.e. insmod, modprobe et al.), directories are being |
68 | created for each detected PCF8591: | 69 | created for each detected PCF8591: |
69 | 70 | ||
70 | /sys/bus/devices/<0>-<1>/ | 71 | /sys/bus/i2c/devices/<0>-<1>/ |
71 | where <0> is the bus the chip was detected on (e. g. i2c-0) | 72 | where <0> is the bus the chip was detected on (e. g. i2c-0) |
72 | and <1> the chip address ([48..4f]) | 73 | and <1> the chip address ([48..4f]) |
73 | 74 | ||
74 | Inside these directories, there are such files: | 75 | Inside these directories, there are such files: |
75 | in0, in1, in2, in3, out0_enable, out0_output, name | 76 | in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name |
76 | 77 | ||
77 | Name contains chip name. | 78 | Name contains chip name. |
78 | 79 | ||
79 | The in0, in1, in2 and in3 files are RO. Reading gives the value of the | 80 | The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives |
80 | corresponding channel. Depending on the current analog inputs configuration, | 81 | the value of the corresponding channel. Depending on the current analog inputs |
81 | files in2 and/or in3 do not exist. Values range are from 0 to 255 for single | 82 | configuration, files in2_input and in3_input may not exist. Values range |
82 | ended inputs and -128 to +127 for differential inputs (8-bit ADC). | 83 | from 0 to 255 for single ended inputs and -128 to +127 for differential inputs |
84 | (8-bit ADC). | ||
83 | 85 | ||
84 | The out0_enable file is RW. Reading gives "1" for analog output enabled and | 86 | The out0_enable file is RW. Reading gives "1" for analog output enabled and |
85 | "0" for analog output disabled. Writing accepts "0" and "1" accordingly. | 87 | "0" for analog output disabled. Writing accepts "0" and "1" accordingly. |
diff --git a/Documentation/hwmon/tmp421 b/Documentation/hwmon/tmp421 new file mode 100644 index 000000000000..0cf07f824741 --- /dev/null +++ b/Documentation/hwmon/tmp421 | |||
@@ -0,0 +1,36 @@ | |||
1 | Kernel driver tmp421 | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Texas Instruments TMP421 | ||
6 | Prefix: 'tmp421' | ||
7 | Addresses scanned: I2C 0x2a, 0x4c, 0x4d, 0x4e and 0x4f | ||
8 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp421.html | ||
9 | * Texas Instruments TMP422 | ||
10 | Prefix: 'tmp422' | ||
11 | Addresses scanned: I2C 0x2a, 0x4c, 0x4d, 0x4e and 0x4f | ||
12 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp421.html | ||
13 | * Texas Instruments TMP423 | ||
14 | Prefix: 'tmp423' | ||
15 | Addresses scanned: I2C 0x2a, 0x4c, 0x4d, 0x4e and 0x4f | ||
16 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp421.html | ||
17 | |||
18 | Authors: | ||
19 | Andre Prendel <andre.prendel@gmx.de> | ||
20 | |||
21 | Description | ||
22 | ----------- | ||
23 | |||
24 | This driver implements support for Texas Instruments TMP421, TMP422 | ||
25 | and TMP423 temperature sensor chips. These chips implement one local | ||
26 | and up to one (TMP421), up to two (TMP422) or up to three (TMP423) | ||
27 | remote sensors. Temperature is measured in degrees Celsius. The chips | ||
28 | are wired over I2C/SMBus and specified over a temperature range of -40 | ||
29 | to +125 degrees Celsius. Resolution for both the local and remote | ||
30 | channels is 0.0625 degree C. | ||
31 | |||
32 | The chips support only temperature measurement. The driver exports | ||
33 | the temperature values via the following sysfs files: | ||
34 | |||
35 | temp[1-4]_input | ||
36 | temp[2-4]_fault | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 9117b65f4ae3..c5f312bac7b4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -931,6 +931,12 @@ W: http://wireless.kernel.org/en/users/Drivers/ar9170 | |||
931 | S: Maintained | 931 | S: Maintained |
932 | F: drivers/net/wireless/ath/ar9170/ | 932 | F: drivers/net/wireless/ath/ar9170/ |
933 | 933 | ||
934 | ATK0110 HWMON DRIVER | ||
935 | M: Luca Tettamanti <kronos.it@gmail.com> | ||
936 | L: lm-sensors@lm-sensors.org | ||
937 | S: Maintained | ||
938 | F: drivers/hwmon/asus_atk0110.c | ||
939 | |||
934 | ATI_REMOTE2 DRIVER | 940 | ATI_REMOTE2 DRIVER |
935 | M: Ville Syrjala <syrjala@sci.fi> | 941 | M: Ville Syrjala <syrjala@sci.fi> |
936 | S: Maintained | 942 | S: Maintained |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 2e25b7a827d3..461abb1e273a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -28,6 +28,17 @@ config HWMON_VID | |||
28 | tristate | 28 | tristate |
29 | default n | 29 | default n |
30 | 30 | ||
31 | config HWMON_DEBUG_CHIP | ||
32 | bool "Hardware Monitoring Chip debugging messages" | ||
33 | default n | ||
34 | help | ||
35 | Say Y here if you want the I2C chip drivers to produce a bunch of | ||
36 | debug messages to the system log. Select this if you are having | ||
37 | a problem with I2C support and want to see more of what is going | ||
38 | on. | ||
39 | |||
40 | comment "Native drivers" | ||
41 | |||
31 | config SENSORS_ABITUGURU | 42 | config SENSORS_ABITUGURU |
32 | tristate "Abit uGuru (rev 1 & 2)" | 43 | tristate "Abit uGuru (rev 1 & 2)" |
33 | depends on X86 && EXPERIMENTAL | 44 | depends on X86 && EXPERIMENTAL |
@@ -248,18 +259,6 @@ config SENSORS_ASB100 | |||
248 | This driver can also be built as a module. If so, the module | 259 | This driver can also be built as a module. If so, the module |
249 | will be called asb100. | 260 | will be called asb100. |
250 | 261 | ||
251 | config SENSORS_ATK0110 | ||
252 | tristate "ASUS ATK0110 ACPI hwmon" | ||
253 | depends on X86 && ACPI && EXPERIMENTAL | ||
254 | help | ||
255 | If you say yes here you get support for the ACPI hardware | ||
256 | monitoring interface found in many ASUS motherboards. This | ||
257 | driver will provide readings of fans, voltages and temperatures | ||
258 | through the system firmware. | ||
259 | |||
260 | This driver can also be built as a module. If so, the module | ||
261 | will be called asus_atk0110. | ||
262 | |||
263 | config SENSORS_ATXP1 | 262 | config SENSORS_ATXP1 |
264 | tristate "Attansic ATXP1 VID controller" | 263 | tristate "Attansic ATXP1 VID controller" |
265 | depends on I2C && EXPERIMENTAL | 264 | depends on I2C && EXPERIMENTAL |
@@ -814,6 +813,16 @@ config SENSORS_TMP401 | |||
814 | This driver can also be built as a module. If so, the module | 813 | This driver can also be built as a module. If so, the module |
815 | will be called tmp401. | 814 | will be called tmp401. |
816 | 815 | ||
816 | config SENSORS_TMP421 | ||
817 | tristate "Texas Instruments TMP421 and compatible" | ||
818 | depends on I2C && EXPERIMENTAL | ||
819 | help | ||
820 | If you say yes here you get support for Texas Instruments TMP421, | ||
821 | TMP422 and TMP423 temperature sensor chips. | ||
822 | |||
823 | This driver can also be built as a module. If so, the module | ||
824 | will be called tmp421. | ||
825 | |||
817 | config SENSORS_VIA686A | 826 | config SENSORS_VIA686A |
818 | tristate "VIA686A" | 827 | tristate "VIA686A" |
819 | depends on PCI | 828 | depends on PCI |
@@ -964,34 +973,6 @@ config SENSORS_HDAPS | |||
964 | Say Y here if you have an applicable laptop and want to experience | 973 | Say Y here if you have an applicable laptop and want to experience |
965 | the awesome power of hdaps. | 974 | the awesome power of hdaps. |
966 | 975 | ||
967 | config SENSORS_LIS3LV02D | ||
968 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" | ||
969 | depends on ACPI && INPUT | ||
970 | select INPUT_POLLDEV | ||
971 | select NEW_LEDS | ||
972 | select LEDS_CLASS | ||
973 | default n | ||
974 | help | ||
975 | This driver provides support for the LIS3LV02Dx accelerometer. In | ||
976 | particular, it can be found in a number of HP laptops, which have the | ||
977 | "Mobile Data Protection System 3D" or "3D DriveGuard" feature. On such | ||
978 | systems the driver should load automatically (via ACPI). The | ||
979 | accelerometer might also be found in other systems, connected via SPI | ||
980 | or I2C. The accelerometer data is readable via | ||
981 | /sys/devices/platform/lis3lv02d. | ||
982 | |||
983 | This driver also provides an absolute input class device, allowing | ||
984 | the laptop to act as a pinball machine-esque joystick. On HP laptops, | ||
985 | if the led infrastructure is activated, support for a led indicating | ||
986 | disk protection will be provided as hp:red:hddprotection. | ||
987 | |||
988 | This driver can also be built as modules. If so, the core module | ||
989 | will be called lis3lv02d and a specific module for HP laptops will be | ||
990 | called hp_accel. | ||
991 | |||
992 | Say Y here if you have an applicable laptop and want to experience | ||
993 | the awesome power of lis3lv02d. | ||
994 | |||
995 | config SENSORS_LIS3_SPI | 976 | config SENSORS_LIS3_SPI |
996 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI)" | 977 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI)" |
997 | depends on !ACPI && SPI_MASTER && INPUT | 978 | depends on !ACPI && SPI_MASTER && INPUT |
@@ -1034,13 +1015,50 @@ config SENSORS_APPLESMC | |||
1034 | Say Y here if you have an applicable laptop and want to experience | 1015 | Say Y here if you have an applicable laptop and want to experience |
1035 | the awesome power of applesmc. | 1016 | the awesome power of applesmc. |
1036 | 1017 | ||
1037 | config HWMON_DEBUG_CHIP | 1018 | if ACPI |
1038 | bool "Hardware Monitoring Chip debugging messages" | 1019 | |
1020 | comment "ACPI drivers" | ||
1021 | |||
1022 | config SENSORS_ATK0110 | ||
1023 | tristate "ASUS ATK0110" | ||
1024 | depends on X86 && EXPERIMENTAL | ||
1025 | help | ||
1026 | If you say yes here you get support for the ACPI hardware | ||
1027 | monitoring interface found in many ASUS motherboards. This | ||
1028 | driver will provide readings of fans, voltages and temperatures | ||
1029 | through the system firmware. | ||
1030 | |||
1031 | This driver can also be built as a module. If so, the module | ||
1032 | will be called asus_atk0110. | ||
1033 | |||
1034 | config SENSORS_LIS3LV02D | ||
1035 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" | ||
1036 | depends on INPUT | ||
1037 | select INPUT_POLLDEV | ||
1038 | select NEW_LEDS | ||
1039 | select LEDS_CLASS | ||
1039 | default n | 1040 | default n |
1040 | help | 1041 | help |
1041 | Say Y here if you want the I2C chip drivers to produce a bunch of | 1042 | This driver provides support for the LIS3LV02Dx accelerometer. In |
1042 | debug messages to the system log. Select this if you are having | 1043 | particular, it can be found in a number of HP laptops, which have the |
1043 | a problem with I2C support and want to see more of what is going | 1044 | "Mobile Data Protection System 3D" or "3D DriveGuard" feature. On such |
1044 | on. | 1045 | systems the driver should load automatically (via ACPI). The |
1046 | accelerometer might also be found in other systems, connected via SPI | ||
1047 | or I2C. The accelerometer data is readable via | ||
1048 | /sys/devices/platform/lis3lv02d. | ||
1049 | |||
1050 | This driver also provides an absolute input class device, allowing | ||
1051 | the laptop to act as a pinball machine-esque joystick. On HP laptops, | ||
1052 | if the led infrastructure is activated, support for a led indicating | ||
1053 | disk protection will be provided as hp:red:hddprotection. | ||
1054 | |||
1055 | This driver can also be built as modules. If so, the core module | ||
1056 | will be called lis3lv02d and a specific module for HP laptops will be | ||
1057 | called hp_accel. | ||
1058 | |||
1059 | Say Y here if you have an applicable laptop and want to experience | ||
1060 | the awesome power of lis3lv02d. | ||
1061 | |||
1062 | endif # ACPI | ||
1045 | 1063 | ||
1046 | endif # HWMON | 1064 | endif # HWMON |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 7f239a247c33..2e547881bc0a 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -5,6 +5,10 @@ | |||
5 | obj-$(CONFIG_HWMON) += hwmon.o | 5 | obj-$(CONFIG_HWMON) += hwmon.o |
6 | obj-$(CONFIG_HWMON_VID) += hwmon-vid.o | 6 | obj-$(CONFIG_HWMON_VID) += hwmon-vid.o |
7 | 7 | ||
8 | # APCI drivers | ||
9 | obj-$(CONFIG_SENSORS_ATK0110) += asus_atk0110.o | ||
10 | |||
11 | # Native drivers | ||
8 | # asb100, then w83781d go first, as they can override other drivers' addresses. | 12 | # asb100, then w83781d go first, as they can override other drivers' addresses. |
9 | obj-$(CONFIG_SENSORS_ASB100) += asb100.o | 13 | obj-$(CONFIG_SENSORS_ASB100) += asb100.o |
10 | obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o | 14 | obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o |
@@ -29,10 +33,8 @@ obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o | |||
29 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o | 33 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o |
30 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o | 34 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o |
31 | obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o | 35 | obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o |
32 | |||
33 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o | 36 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o |
34 | obj-$(CONFIG_SENSORS_AMS) += ams/ | 37 | obj-$(CONFIG_SENSORS_AMS) += ams/ |
35 | obj-$(CONFIG_SENSORS_ATK0110) += asus_atk0110.o | ||
36 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o | 38 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o |
37 | obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o | 39 | obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o |
38 | obj-$(CONFIG_SENSORS_DME1737) += dme1737.o | 40 | obj-$(CONFIG_SENSORS_DME1737) += dme1737.o |
@@ -84,6 +86,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o | |||
84 | obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o | 86 | obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o |
85 | obj-$(CONFIG_SENSORS_THMC50) += thmc50.o | 87 | obj-$(CONFIG_SENSORS_THMC50) += thmc50.o |
86 | obj-$(CONFIG_SENSORS_TMP401) += tmp401.o | 88 | obj-$(CONFIG_SENSORS_TMP401) += tmp401.o |
89 | obj-$(CONFIG_SENSORS_TMP421) += tmp421.o | ||
87 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o | 90 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o |
88 | obj-$(CONFIG_SENSORS_VT1211) += vt1211.o | 91 | obj-$(CONFIG_SENSORS_VT1211) += vt1211.o |
89 | obj-$(CONFIG_SENSORS_VT8231) += vt8231.o | 92 | obj-$(CONFIG_SENSORS_VT8231) += vt8231.o |
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index 4dbdb81ea3b1..03694cc17a32 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/hwmon.h> | 32 | #include <linux/hwmon.h> |
33 | #include <linux/hwmon-sysfs.h> | 33 | #include <linux/hwmon-sysfs.h> |
34 | #include <linux/dmi.h> | 34 | #include <linux/dmi.h> |
35 | #include <asm/io.h> | 35 | #include <linux/io.h> |
36 | 36 | ||
37 | /* Banks */ | 37 | /* Banks */ |
38 | #define ABIT_UGURU_ALARM_BANK 0x20 /* 1x 3 bytes */ | 38 | #define ABIT_UGURU_ALARM_BANK 0x20 /* 1x 3 bytes */ |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index 7d3f15d32fdf..3cf28af614b5 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/hwmon.h> | 34 | #include <linux/hwmon.h> |
35 | #include <linux/hwmon-sysfs.h> | 35 | #include <linux/hwmon-sysfs.h> |
36 | #include <linux/dmi.h> | 36 | #include <linux/dmi.h> |
37 | #include <asm/io.h> | 37 | #include <linux/io.h> |
38 | 38 | ||
39 | /* uGuru3 bank addresses */ | 39 | /* uGuru3 bank addresses */ |
40 | #define ABIT_UGURU3_SETTINGS_BANK 0x01 | 40 | #define ABIT_UGURU3_SETTINGS_BANK 0x01 |
@@ -117,9 +117,12 @@ struct abituguru3_sensor_info { | |||
117 | int offset; | 117 | int offset; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* Avoid use of flexible array members */ | ||
121 | #define ABIT_UGURU3_MAX_DMI_NAMES 2 | ||
122 | |||
120 | struct abituguru3_motherboard_info { | 123 | struct abituguru3_motherboard_info { |
121 | u16 id; | 124 | u16 id; |
122 | const char *dmi_name; | 125 | const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES + 1]; |
123 | /* + 1 -> end of sensors indicated by a sensor with name == NULL */ | 126 | /* + 1 -> end of sensors indicated by a sensor with name == NULL */ |
124 | struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1]; | 127 | struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1]; |
125 | }; | 128 | }; |
@@ -164,7 +167,7 @@ struct abituguru3_data { | |||
164 | 167 | ||
165 | /* Constants */ | 168 | /* Constants */ |
166 | static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | 169 | static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { |
167 | { 0x000C, NULL /* Unknown, need DMI string */, { | 170 | { 0x000C, { NULL } /* Unknown, need DMI string */, { |
168 | { "CPU Core", 0, 0, 10, 1, 0 }, | 171 | { "CPU Core", 0, 0, 10, 1, 0 }, |
169 | { "DDR", 1, 0, 10, 1, 0 }, | 172 | { "DDR", 1, 0, 10, 1, 0 }, |
170 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 173 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
186 | { "AUX1 Fan", 35, 2, 60, 1, 0 }, | 189 | { "AUX1 Fan", 35, 2, 60, 1, 0 }, |
187 | { NULL, 0, 0, 0, 0, 0 } } | 190 | { NULL, 0, 0, 0, 0, 0 } } |
188 | }, | 191 | }, |
189 | { 0x000D, NULL /* Abit AW8, need DMI string */, { | 192 | { 0x000D, { NULL } /* Abit AW8, need DMI string */, { |
190 | { "CPU Core", 0, 0, 10, 1, 0 }, | 193 | { "CPU Core", 0, 0, 10, 1, 0 }, |
191 | { "DDR", 1, 0, 10, 1, 0 }, | 194 | { "DDR", 1, 0, 10, 1, 0 }, |
192 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 195 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
215 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | 218 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, |
216 | { NULL, 0, 0, 0, 0, 0 } } | 219 | { NULL, 0, 0, 0, 0, 0 } } |
217 | }, | 220 | }, |
218 | { 0x000E, NULL /* AL-8, need DMI string */, { | 221 | { 0x000E, { NULL } /* AL-8, need DMI string */, { |
219 | { "CPU Core", 0, 0, 10, 1, 0 }, | 222 | { "CPU Core", 0, 0, 10, 1, 0 }, |
220 | { "DDR", 1, 0, 10, 1, 0 }, | 223 | { "DDR", 1, 0, 10, 1, 0 }, |
221 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 224 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
236 | { "SYS Fan", 34, 2, 60, 1, 0 }, | 239 | { "SYS Fan", 34, 2, 60, 1, 0 }, |
237 | { NULL, 0, 0, 0, 0, 0 } } | 240 | { NULL, 0, 0, 0, 0, 0 } } |
238 | }, | 241 | }, |
239 | { 0x000F, NULL /* Unknown, need DMI string */, { | 242 | { 0x000F, { NULL } /* Unknown, need DMI string */, { |
243 | |||
240 | { "CPU Core", 0, 0, 10, 1, 0 }, | 244 | { "CPU Core", 0, 0, 10, 1, 0 }, |
241 | { "DDR", 1, 0, 10, 1, 0 }, | 245 | { "DDR", 1, 0, 10, 1, 0 }, |
242 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 246 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
257 | { "SYS Fan", 34, 2, 60, 1, 0 }, | 261 | { "SYS Fan", 34, 2, 60, 1, 0 }, |
258 | { NULL, 0, 0, 0, 0, 0 } } | 262 | { NULL, 0, 0, 0, 0, 0 } } |
259 | }, | 263 | }, |
260 | { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { | 264 | { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, { |
261 | { "CPU Core", 0, 0, 10, 1, 0 }, | 265 | { "CPU Core", 0, 0, 10, 1, 0 }, |
262 | { "DDR", 1, 0, 10, 1, 0 }, | 266 | { "DDR", 1, 0, 10, 1, 0 }, |
263 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 267 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
279 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, | 283 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, |
280 | { NULL, 0, 0, 0, 0, 0 } } | 284 | { NULL, 0, 0, 0, 0, 0 } } |
281 | }, | 285 | }, |
282 | { 0x0011, "AT8 32X", { | 286 | { 0x0011, { "AT8 32X", NULL }, { |
283 | { "CPU Core", 0, 0, 10, 1, 0 }, | 287 | { "CPU Core", 0, 0, 10, 1, 0 }, |
284 | { "DDR", 1, 0, 20, 1, 0 }, | 288 | { "DDR", 1, 0, 20, 1, 0 }, |
285 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 289 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
306 | { "AUX3 Fan", 37, 2, 60, 1, 0 }, | 310 | { "AUX3 Fan", 37, 2, 60, 1, 0 }, |
307 | { NULL, 0, 0, 0, 0, 0 } } | 311 | { NULL, 0, 0, 0, 0, 0 } } |
308 | }, | 312 | }, |
309 | { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { | 313 | { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, { |
310 | { "CPU Core", 0, 0, 10, 1, 0 }, | 314 | { "CPU Core", 0, 0, 10, 1, 0 }, |
311 | { "DDR", 1, 0, 20, 1, 0 }, | 315 | { "DDR", 1, 0, 20, 1, 0 }, |
312 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 316 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
328 | { "AUX1 Fan", 36, 2, 60, 1, 0 }, | 332 | { "AUX1 Fan", 36, 2, 60, 1, 0 }, |
329 | { NULL, 0, 0, 0, 0, 0 } } | 333 | { NULL, 0, 0, 0, 0, 0 } } |
330 | }, | 334 | }, |
331 | { 0x0013, NULL /* Abit AW8D, need DMI string */, { | 335 | { 0x0013, { NULL } /* Abit AW8D, need DMI string */, { |
332 | { "CPU Core", 0, 0, 10, 1, 0 }, | 336 | { "CPU Core", 0, 0, 10, 1, 0 }, |
333 | { "DDR", 1, 0, 10, 1, 0 }, | 337 | { "DDR", 1, 0, 10, 1, 0 }, |
334 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 338 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
357 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | 361 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, |
358 | { NULL, 0, 0, 0, 0, 0 } } | 362 | { NULL, 0, 0, 0, 0, 0 } } |
359 | }, | 363 | }, |
360 | { 0x0014, "AB9", /* + AB9 Pro */ { | 364 | { 0x0014, { "AB9", "AB9 Pro", NULL }, { |
361 | { "CPU Core", 0, 0, 10, 1, 0 }, | 365 | { "CPU Core", 0, 0, 10, 1, 0 }, |
362 | { "DDR", 1, 0, 10, 1, 0 }, | 366 | { "DDR", 1, 0, 10, 1, 0 }, |
363 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 367 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
378 | { "SYS Fan", 34, 2, 60, 1, 0 }, | 382 | { "SYS Fan", 34, 2, 60, 1, 0 }, |
379 | { NULL, 0, 0, 0, 0, 0 } } | 383 | { NULL, 0, 0, 0, 0, 0 } } |
380 | }, | 384 | }, |
381 | { 0x0015, NULL /* Unknown, need DMI string */, { | 385 | { 0x0015, { NULL } /* Unknown, need DMI string */, { |
382 | { "CPU Core", 0, 0, 10, 1, 0 }, | 386 | { "CPU Core", 0, 0, 10, 1, 0 }, |
383 | { "DDR", 1, 0, 20, 1, 0 }, | 387 | { "DDR", 1, 0, 20, 1, 0 }, |
384 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 388 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
402 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 406 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
403 | { NULL, 0, 0, 0, 0, 0 } } | 407 | { NULL, 0, 0, 0, 0, 0 } } |
404 | }, | 408 | }, |
405 | { 0x0016, "AW9D-MAX", { | 409 | { 0x0016, { "AW9D-MAX", NULL }, { |
406 | { "CPU Core", 0, 0, 10, 1, 0 }, | 410 | { "CPU Core", 0, 0, 10, 1, 0 }, |
407 | { "DDR2", 1, 0, 20, 1, 0 }, | 411 | { "DDR2", 1, 0, 20, 1, 0 }, |
408 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 412 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
430 | { "OTES1 Fan", 38, 2, 60, 1, 0 }, | 434 | { "OTES1 Fan", 38, 2, 60, 1, 0 }, |
431 | { NULL, 0, 0, 0, 0, 0 } } | 435 | { NULL, 0, 0, 0, 0, 0 } } |
432 | }, | 436 | }, |
433 | { 0x0017, NULL /* Unknown, need DMI string */, { | 437 | { 0x0017, { NULL } /* Unknown, need DMI string */, { |
434 | { "CPU Core", 0, 0, 10, 1, 0 }, | 438 | { "CPU Core", 0, 0, 10, 1, 0 }, |
435 | { "DDR2", 1, 0, 20, 1, 0 }, | 439 | { "DDR2", 1, 0, 20, 1, 0 }, |
436 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 440 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
455 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, | 459 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, |
456 | { NULL, 0, 0, 0, 0, 0 } } | 460 | { NULL, 0, 0, 0, 0, 0 } } |
457 | }, | 461 | }, |
458 | { 0x0018, "AB9 QuadGT", { | 462 | { 0x0018, { "AB9 QuadGT", NULL }, { |
459 | { "CPU Core", 0, 0, 10, 1, 0 }, | 463 | { "CPU Core", 0, 0, 10, 1, 0 }, |
460 | { "DDR2", 1, 0, 20, 1, 0 }, | 464 | { "DDR2", 1, 0, 20, 1, 0 }, |
461 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 465 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
482 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 486 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
483 | { NULL, 0, 0, 0, 0, 0 } } | 487 | { NULL, 0, 0, 0, 0, 0 } } |
484 | }, | 488 | }, |
485 | { 0x0019, "IN9 32X MAX", { | 489 | { 0x0019, { "IN9 32X MAX", NULL }, { |
486 | { "CPU Core", 7, 0, 10, 1, 0 }, | 490 | { "CPU Core", 7, 0, 10, 1, 0 }, |
487 | { "DDR2", 13, 0, 20, 1, 0 }, | 491 | { "DDR2", 13, 0, 20, 1, 0 }, |
488 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, | 492 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, |
@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
509 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, | 513 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, |
510 | { NULL, 0, 0, 0, 0, 0 } } | 514 | { NULL, 0, 0, 0, 0, 0 } } |
511 | }, | 515 | }, |
512 | { 0x001A, "IP35 Pro", { | 516 | { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, { |
513 | { "CPU Core", 0, 0, 10, 1, 0 }, | 517 | { "CPU Core", 0, 0, 10, 1, 0 }, |
514 | { "DDR2", 1, 0, 20, 1, 0 }, | 518 | { "DDR2", 1, 0, 20, 1, 0 }, |
515 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 519 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
537 | { "AUX4 Fan", 37, 2, 60, 1, 0 }, | 541 | { "AUX4 Fan", 37, 2, 60, 1, 0 }, |
538 | { NULL, 0, 0, 0, 0, 0 } } | 542 | { NULL, 0, 0, 0, 0, 0 } } |
539 | }, | 543 | }, |
540 | { 0x001B, NULL /* Unknown, need DMI string */, { | 544 | { 0x001B, { NULL } /* Unknown, need DMI string */, { |
541 | { "CPU Core", 0, 0, 10, 1, 0 }, | 545 | { "CPU Core", 0, 0, 10, 1, 0 }, |
542 | { "DDR3", 1, 0, 20, 1, 0 }, | 546 | { "DDR3", 1, 0, 20, 1, 0 }, |
543 | { "DDR3 VTT", 2, 0, 10, 1, 0 }, | 547 | { "DDR3 VTT", 2, 0, 10, 1, 0 }, |
@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
564 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 568 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
565 | { NULL, 0, 0, 0, 0, 0 } } | 569 | { NULL, 0, 0, 0, 0, 0 } } |
566 | }, | 570 | }, |
567 | { 0x001C, "IX38 QuadGT", { | 571 | { 0x001C, { "IX38 QuadGT", NULL }, { |
568 | { "CPU Core", 0, 0, 10, 1, 0 }, | 572 | { "CPU Core", 0, 0, 10, 1, 0 }, |
569 | { "DDR2", 1, 0, 20, 1, 0 }, | 573 | { "DDR2", 1, 0, 20, 1, 0 }, |
570 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 574 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
591 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 595 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
592 | { NULL, 0, 0, 0, 0, 0 } } | 596 | { NULL, 0, 0, 0, 0, 0 } } |
593 | }, | 597 | }, |
594 | { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } | 598 | { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } } |
595 | }; | 599 | }; |
596 | 600 | ||
597 | 601 | ||
@@ -946,15 +950,6 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) | |||
946 | printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " | 950 | printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " |
947 | "ID: %04X\n", (unsigned int)id); | 951 | "ID: %04X\n", (unsigned int)id); |
948 | 952 | ||
949 | #ifdef CONFIG_DMI | ||
950 | if (!abituguru3_motherboards[i].dmi_name) { | ||
951 | printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " | ||
952 | "not detected using DMI. Please send the output of " | ||
953 | "\"dmidecode\" to the abituguru3 maintainer " | ||
954 | "(see MAINTAINERS)\n"); | ||
955 | } | ||
956 | #endif | ||
957 | |||
958 | /* Fill the sysfs attr array */ | 953 | /* Fill the sysfs attr array */ |
959 | sysfs_attr_i = 0; | 954 | sysfs_attr_i = 0; |
960 | sysfs_filename = data->sysfs_names; | 955 | sysfs_filename = data->sysfs_names; |
@@ -1131,6 +1126,7 @@ static int __init abituguru3_dmi_detect(void) | |||
1131 | { | 1126 | { |
1132 | const char *board_vendor, *board_name; | 1127 | const char *board_vendor, *board_name; |
1133 | int i, err = (force) ? 1 : -ENODEV; | 1128 | int i, err = (force) ? 1 : -ENODEV; |
1129 | const char *const *dmi_name; | ||
1134 | size_t sublen; | 1130 | size_t sublen; |
1135 | 1131 | ||
1136 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1132 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
@@ -1151,17 +1147,17 @@ static int __init abituguru3_dmi_detect(void) | |||
1151 | sublen--; | 1147 | sublen--; |
1152 | 1148 | ||
1153 | for (i = 0; abituguru3_motherboards[i].id; i++) { | 1149 | for (i = 0; abituguru3_motherboards[i].id; i++) { |
1154 | const char *dmi_name = abituguru3_motherboards[i].dmi_name; | 1150 | dmi_name = abituguru3_motherboards[i].dmi_name; |
1155 | if (!dmi_name || strlen(dmi_name) != sublen) | 1151 | for ( ; *dmi_name; dmi_name++) { |
1156 | continue; | 1152 | if (strlen(*dmi_name) != sublen) |
1157 | if (!strncasecmp(board_name, dmi_name, sublen)) | 1153 | continue; |
1158 | break; | 1154 | if (!strncasecmp(board_name, *dmi_name, sublen)) |
1155 | return 0; | ||
1156 | } | ||
1159 | } | 1157 | } |
1160 | 1158 | ||
1161 | if (!abituguru3_motherboards[i].id) | 1159 | /* No match found */ |
1162 | return 1; | 1160 | return 1; |
1163 | |||
1164 | return 0; | ||
1165 | } | 1161 | } |
1166 | 1162 | ||
1167 | #else /* !CONFIG_DMI */ | 1163 | #else /* !CONFIG_DMI */ |
@@ -1221,6 +1217,13 @@ static int __init abituguru3_init(void) | |||
1221 | err = abituguru3_detect(); | 1217 | err = abituguru3_detect(); |
1222 | if (err) | 1218 | if (err) |
1223 | return err; | 1219 | return err; |
1220 | |||
1221 | #ifdef CONFIG_DMI | ||
1222 | printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " | ||
1223 | "not detected using DMI. Please send the output of " | ||
1224 | "\"dmidecode\" to the abituguru3 maintainer " | ||
1225 | "(see MAINTAINERS)\n"); | ||
1226 | #endif | ||
1224 | } | 1227 | } |
1225 | 1228 | ||
1226 | err = platform_driver_register(&abituguru3_driver); | 1229 | err = platform_driver_register(&abituguru3_driver); |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 678e34b01e52..753b34885f9d 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/dmi.h> | 35 | #include <linux/dmi.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/hwmon-sysfs.h> | 37 | #include <linux/hwmon-sysfs.h> |
38 | #include <asm/io.h> | 38 | #include <linux/io.h> |
39 | #include <linux/leds.h> | 39 | #include <linux/leds.h> |
40 | #include <linux/hwmon.h> | 40 | #include <linux/hwmon.h> |
41 | #include <linux/workqueue.h> | 41 | #include <linux/workqueue.h> |
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 3df202a9ad72..9814d51b3af4 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
38 | #include <asm/io.h> | 38 | #include <linux/io.h> |
39 | 39 | ||
40 | /* ISA device, if found */ | 40 | /* ISA device, if found */ |
41 | static struct platform_device *pdev; | 41 | static struct platform_device *pdev; |
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 899876579253..525a00bd70b1 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/sysfs.h> | 40 | #include <linux/sysfs.h> |
41 | #include <linux/ioport.h> | 41 | #include <linux/ioport.h> |
42 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
43 | #include <asm/io.h> | 43 | #include <linux/io.h> |
44 | 44 | ||
45 | static unsigned short force_id; | 45 | static unsigned short force_id; |
46 | module_param(force_id, ushort, 0); | 46 | module_param(force_id, ushort, 0); |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index d3612a1f1981..be2d131e405c 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -35,8 +35,7 @@ | |||
35 | #include <linux/timer.h> | 35 | #include <linux/timer.h> |
36 | #include <linux/dmi.h> | 36 | #include <linux/dmi.h> |
37 | #include <linux/jiffies.h> | 37 | #include <linux/jiffies.h> |
38 | 38 | #include <linux/io.h> | |
39 | #include <asm/io.h> | ||
40 | 39 | ||
41 | #define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */ | 40 | #define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */ |
42 | #define HDAPS_NR_PORTS 0x30 /* number of ports: 0x1600 - 0x162f */ | 41 | #define HDAPS_NR_PORTS 0x30 /* number of ports: 0x1600 - 0x162f */ |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index bfc296145bba..bf0862a803c0 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
@@ -179,8 +179,14 @@ struct vrm_model { | |||
179 | static struct vrm_model vrm_models[] = { | 179 | static struct vrm_model vrm_models[] = { |
180 | {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ | 180 | {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ |
181 | {X86_VENDOR_AMD, 0xF, 0x3F, ANY, 24}, /* Athlon 64, Opteron */ | 181 | {X86_VENDOR_AMD, 0xF, 0x3F, ANY, 24}, /* Athlon 64, Opteron */ |
182 | {X86_VENDOR_AMD, 0xF, ANY, ANY, 25}, /* NPT family 0Fh */ | 182 | /* In theory, all NPT family 0Fh processors have 6 VID pins and should |
183 | thus use vrm 25, however in practice not all mainboards route the | ||
184 | 6th VID pin because it is never needed. So we use the 5 VID pin | ||
185 | variant (vrm 24) for the models which exist today. */ | ||
186 | {X86_VENDOR_AMD, 0xF, 0x7F, ANY, 24}, /* NPT family 0Fh */ | ||
187 | {X86_VENDOR_AMD, 0xF, ANY, ANY, 25}, /* future fam. 0Fh */ | ||
183 | {X86_VENDOR_AMD, 0x10, ANY, ANY, 25}, /* NPT family 10h */ | 188 | {X86_VENDOR_AMD, 0x10, ANY, ANY, 25}, /* NPT family 10h */ |
189 | |||
184 | {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 13}, /* Pentium M (130 nm) */ | 190 | {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 13}, /* Pentium M (130 nm) */ |
185 | {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ | 191 | {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ |
186 | {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */ | 192 | {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */ |
@@ -191,12 +197,14 @@ static struct vrm_model vrm_models[] = { | |||
191 | {X86_VENDOR_INTEL, 0xF, 0x1, ANY, 90}, /* P4 Willamette */ | 197 | {X86_VENDOR_INTEL, 0xF, 0x1, ANY, 90}, /* P4 Willamette */ |
192 | {X86_VENDOR_INTEL, 0xF, 0x2, ANY, 90}, /* P4 Northwood */ | 198 | {X86_VENDOR_INTEL, 0xF, 0x2, ANY, 90}, /* P4 Northwood */ |
193 | {X86_VENDOR_INTEL, 0xF, ANY, ANY, 100}, /* Prescott and above assume VRD 10 */ | 199 | {X86_VENDOR_INTEL, 0xF, ANY, ANY, 100}, /* Prescott and above assume VRD 10 */ |
200 | |||
194 | {X86_VENDOR_CENTAUR, 0x6, 0x7, ANY, 85}, /* Eden ESP/Ezra */ | 201 | {X86_VENDOR_CENTAUR, 0x6, 0x7, ANY, 85}, /* Eden ESP/Ezra */ |
195 | {X86_VENDOR_CENTAUR, 0x6, 0x8, 0x7, 85}, /* Ezra T */ | 202 | {X86_VENDOR_CENTAUR, 0x6, 0x8, 0x7, 85}, /* Ezra T */ |
196 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nemiah */ | 203 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nemiah */ |
197 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ | 204 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ |
198 | {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ | 205 | {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ |
199 | {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */ | 206 | {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */ |
207 | |||
200 | {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ | 208 | {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ |
201 | }; | 209 | }; |
202 | 210 | ||
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 9157247fed8e..ffeb2a10e1a7 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include <linux/string.h> | 50 | #include <linux/string.h> |
51 | #include <linux/dmi.h> | 51 | #include <linux/dmi.h> |
52 | #include <linux/acpi.h> | 52 | #include <linux/acpi.h> |
53 | #include <asm/io.h> | 53 | #include <linux/io.h> |
54 | 54 | ||
55 | #define DRVNAME "it87" | 55 | #define DRVNAME "it87" |
56 | 56 | ||
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index a1787fdf5b9f..f7e70163e016 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/hwmon-sysfs.h> | 31 | #include <linux/hwmon-sysfs.h> |
32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <asm/io.h> | 34 | #include <linux/io.h> |
35 | 35 | ||
36 | /* ISA device, if found */ | 36 | /* ISA device, if found */ |
37 | static struct platform_device *pdev; | 37 | static struct platform_device *pdev; |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index b251d8674b41..6c53d987de10 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -75,6 +75,8 @@ I2C_CLIENT_INSMOD_7(lm85b, lm85c, adm1027, adt7463, adt7468, emc6d100, | |||
75 | #define LM85_VERSTEP_GENERIC2 0x70 | 75 | #define LM85_VERSTEP_GENERIC2 0x70 |
76 | #define LM85_VERSTEP_LM85C 0x60 | 76 | #define LM85_VERSTEP_LM85C 0x60 |
77 | #define LM85_VERSTEP_LM85B 0x62 | 77 | #define LM85_VERSTEP_LM85B 0x62 |
78 | #define LM85_VERSTEP_LM96000_1 0x68 | ||
79 | #define LM85_VERSTEP_LM96000_2 0x69 | ||
78 | #define LM85_VERSTEP_ADM1027 0x60 | 80 | #define LM85_VERSTEP_ADM1027 0x60 |
79 | #define LM85_VERSTEP_ADT7463 0x62 | 81 | #define LM85_VERSTEP_ADT7463 0x62 |
80 | #define LM85_VERSTEP_ADT7463C 0x6A | 82 | #define LM85_VERSTEP_ADT7463C 0x6A |
@@ -1133,6 +1135,26 @@ static void lm85_init_client(struct i2c_client *client) | |||
1133 | dev_warn(&client->dev, "Device is not ready\n"); | 1135 | dev_warn(&client->dev, "Device is not ready\n"); |
1134 | } | 1136 | } |
1135 | 1137 | ||
1138 | static int lm85_is_fake(struct i2c_client *client) | ||
1139 | { | ||
1140 | /* | ||
1141 | * Differenciate between real LM96000 and Winbond WPCD377I. The latter | ||
1142 | * emulate the former except that it has no hardware monitoring function | ||
1143 | * so the readings are always 0. | ||
1144 | */ | ||
1145 | int i; | ||
1146 | u8 in_temp, fan; | ||
1147 | |||
1148 | for (i = 0; i < 8; i++) { | ||
1149 | in_temp = i2c_smbus_read_byte_data(client, 0x20 + i); | ||
1150 | fan = i2c_smbus_read_byte_data(client, 0x28 + i); | ||
1151 | if (in_temp != 0x00 || fan != 0xff) | ||
1152 | return 0; | ||
1153 | } | ||
1154 | |||
1155 | return 1; | ||
1156 | } | ||
1157 | |||
1136 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 1158 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
1137 | static int lm85_detect(struct i2c_client *client, int kind, | 1159 | static int lm85_detect(struct i2c_client *client, int kind, |
1138 | struct i2c_board_info *info) | 1160 | struct i2c_board_info *info) |
@@ -1173,6 +1195,16 @@ static int lm85_detect(struct i2c_client *client, int kind, | |||
1173 | case LM85_VERSTEP_LM85B: | 1195 | case LM85_VERSTEP_LM85B: |
1174 | kind = lm85b; | 1196 | kind = lm85b; |
1175 | break; | 1197 | break; |
1198 | case LM85_VERSTEP_LM96000_1: | ||
1199 | case LM85_VERSTEP_LM96000_2: | ||
1200 | /* Check for Winbond WPCD377I */ | ||
1201 | if (lm85_is_fake(client)) { | ||
1202 | dev_dbg(&adapter->dev, | ||
1203 | "Found Winbond WPCD377I, " | ||
1204 | "ignoring\n"); | ||
1205 | return -ENODEV; | ||
1206 | } | ||
1207 | break; | ||
1176 | } | 1208 | } |
1177 | } else if (company == LM85_COMPANY_ANALOG_DEV) { | 1209 | } else if (company == LM85_COMPANY_ANALOG_DEV) { |
1178 | switch (verstep) { | 1210 | switch (verstep) { |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index fb052fea3744..4a64b85d4ec9 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/err.h> | 44 | #include <linux/err.h> |
45 | #include <linux/mutex.h> | 45 | #include <linux/mutex.h> |
46 | #include <linux/acpi.h> | 46 | #include <linux/acpi.h> |
47 | #include <asm/io.h> | 47 | #include <linux/io.h> |
48 | 48 | ||
49 | static u8 devid; | 49 | static u8 devid; |
50 | static struct platform_device *pdev; | 50 | static struct platform_device *pdev; |
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c index 3a8a0f7a7736..3170b26d2443 100644 --- a/drivers/hwmon/pc87427.c +++ b/drivers/hwmon/pc87427.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/sysfs.h> | 33 | #include <linux/sysfs.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
36 | #include <asm/io.h> | 36 | #include <linux/io.h> |
37 | 37 | ||
38 | static unsigned short force_id; | 38 | static unsigned short force_id; |
39 | module_param(force_id, ushort, 0); | 39 | module_param(force_id, ushort, 0); |
@@ -435,7 +435,7 @@ static int __devinit pc87427_probe(struct platform_device *pdev) | |||
435 | /* This will need to be revisited when we add support for | 435 | /* This will need to be revisited when we add support for |
436 | temperature and voltage monitoring. */ | 436 | temperature and voltage monitoring. */ |
437 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 437 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
438 | if (!request_region(res->start, res->end - res->start + 1, DRVNAME)) { | 438 | if (!request_region(res->start, resource_size(res), DRVNAME)) { |
439 | err = -EBUSY; | 439 | err = -EBUSY; |
440 | dev_err(&pdev->dev, "Failed to request region 0x%lx-0x%lx\n", | 440 | dev_err(&pdev->dev, "Failed to request region 0x%lx-0x%lx\n", |
441 | (unsigned long)res->start, (unsigned long)res->end); | 441 | (unsigned long)res->start, (unsigned long)res->end); |
@@ -475,7 +475,7 @@ exit_remove_files: | |||
475 | sysfs_remove_group(&pdev->dev.kobj, &pc87427_group_fan[i]); | 475 | sysfs_remove_group(&pdev->dev.kobj, &pc87427_group_fan[i]); |
476 | } | 476 | } |
477 | exit_release_region: | 477 | exit_release_region: |
478 | release_region(res->start, res->end - res->start + 1); | 478 | release_region(res->start, resource_size(res)); |
479 | exit_kfree: | 479 | exit_kfree: |
480 | platform_set_drvdata(pdev, NULL); | 480 | platform_set_drvdata(pdev, NULL); |
481 | kfree(data); | 481 | kfree(data); |
@@ -500,7 +500,7 @@ static int __devexit pc87427_remove(struct platform_device *pdev) | |||
500 | kfree(data); | 500 | kfree(data); |
501 | 501 | ||
502 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 502 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
503 | release_region(res->start, res->end - res->start + 1); | 503 | release_region(res->start, resource_size(res)); |
504 | 504 | ||
505 | return 0; | 505 | return 0; |
506 | } | 506 | } |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index aa2e8318f167..12f2e7086560 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -63,7 +63,7 @@ | |||
63 | #include <linux/mutex.h> | 63 | #include <linux/mutex.h> |
64 | #include <linux/sysfs.h> | 64 | #include <linux/sysfs.h> |
65 | #include <linux/acpi.h> | 65 | #include <linux/acpi.h> |
66 | #include <asm/io.h> | 66 | #include <linux/io.h> |
67 | 67 | ||
68 | 68 | ||
69 | /* If force_addr is set to anything different from 0, we forcibly enable | 69 | /* If force_addr is set to anything different from 0, we forcibly enable |
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 6f6d52b4fb64..f46d936c12da 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
40 | #include <asm/io.h> | 40 | #include <linux/io.h> |
41 | 41 | ||
42 | static unsigned short force_id; | 42 | static unsigned short force_id; |
43 | module_param(force_id, ushort, 0); | 43 | module_param(force_id, ushort, 0); |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index ba75bfcf14ce..8ad50fdba00d 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | #include <linux/sysfs.h> | 39 | #include <linux/sysfs.h> |
40 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
41 | #include <asm/io.h> | 41 | #include <linux/io.h> |
42 | 42 | ||
43 | static unsigned short force_id; | 43 | static unsigned short force_id; |
44 | module_param(force_id, ushort, 0); | 44 | module_param(force_id, ushort, 0); |
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c new file mode 100644 index 000000000000..20924343431b --- /dev/null +++ b/drivers/hwmon/tmp421.c | |||
@@ -0,0 +1,347 @@ | |||
1 | /* tmp421.c | ||
2 | * | ||
3 | * Copyright (C) 2009 Andre Prendel <andre.prendel@gmx.de> | ||
4 | * Preliminary support by: | ||
5 | * Melvin Rook, Raymond Ng | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * Driver for the Texas Instruments TMP421 SMBus temperature sensor IC. | ||
24 | * Supported models: TMP421, TMP422, TMP423 | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/jiffies.h> | ||
31 | #include <linux/i2c.h> | ||
32 | #include <linux/hwmon.h> | ||
33 | #include <linux/hwmon-sysfs.h> | ||
34 | #include <linux/err.h> | ||
35 | #include <linux/mutex.h> | ||
36 | #include <linux/sysfs.h> | ||
37 | |||
38 | /* Addresses to scan */ | ||
39 | static unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f, | ||
40 | I2C_CLIENT_END }; | ||
41 | |||
42 | /* Insmod parameters */ | ||
43 | I2C_CLIENT_INSMOD_3(tmp421, tmp422, tmp423); | ||
44 | |||
45 | /* The TMP421 registers */ | ||
46 | #define TMP421_CONFIG_REG_1 0x09 | ||
47 | #define TMP421_CONVERSION_RATE_REG 0x0B | ||
48 | #define TMP421_MANUFACTURER_ID_REG 0xFE | ||
49 | #define TMP421_DEVICE_ID_REG 0xFF | ||
50 | |||
51 | static const u8 TMP421_TEMP_MSB[4] = { 0x00, 0x01, 0x02, 0x03 }; | ||
52 | static const u8 TMP421_TEMP_LSB[4] = { 0x10, 0x11, 0x12, 0x13 }; | ||
53 | |||
54 | /* Flags */ | ||
55 | #define TMP421_CONFIG_SHUTDOWN 0x40 | ||
56 | #define TMP421_CONFIG_RANGE 0x04 | ||
57 | |||
58 | /* Manufacturer / Device ID's */ | ||
59 | #define TMP421_MANUFACTURER_ID 0x55 | ||
60 | #define TMP421_DEVICE_ID 0x21 | ||
61 | #define TMP422_DEVICE_ID 0x22 | ||
62 | #define TMP423_DEVICE_ID 0x23 | ||
63 | |||
64 | static const struct i2c_device_id tmp421_id[] = { | ||
65 | { "tmp421", tmp421 }, | ||
66 | { "tmp422", tmp422 }, | ||
67 | { "tmp423", tmp423 }, | ||
68 | { } | ||
69 | }; | ||
70 | MODULE_DEVICE_TABLE(i2c, tmp421_id); | ||
71 | |||
72 | struct tmp421_data { | ||
73 | struct device *hwmon_dev; | ||
74 | struct mutex update_lock; | ||
75 | char valid; | ||
76 | unsigned long last_updated; | ||
77 | int kind; | ||
78 | u8 config; | ||
79 | s16 temp[4]; | ||
80 | }; | ||
81 | |||
82 | static int temp_from_s16(s16 reg) | ||
83 | { | ||
84 | int temp = reg; | ||
85 | |||
86 | return (temp * 1000 + 128) / 256; | ||
87 | } | ||
88 | |||
89 | static int temp_from_u16(u16 reg) | ||
90 | { | ||
91 | int temp = reg; | ||
92 | |||
93 | /* Add offset for extended temperature range. */ | ||
94 | temp -= 64 * 256; | ||
95 | |||
96 | return (temp * 1000 + 128) / 256; | ||
97 | } | ||
98 | |||
99 | static struct tmp421_data *tmp421_update_device(struct device *dev) | ||
100 | { | ||
101 | struct i2c_client *client = to_i2c_client(dev); | ||
102 | struct tmp421_data *data = i2c_get_clientdata(client); | ||
103 | int i; | ||
104 | |||
105 | mutex_lock(&data->update_lock); | ||
106 | |||
107 | if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { | ||
108 | data->config = i2c_smbus_read_byte_data(client, | ||
109 | TMP421_CONFIG_REG_1); | ||
110 | |||
111 | for (i = 0; i <= data->kind; i++) { | ||
112 | data->temp[i] = i2c_smbus_read_byte_data(client, | ||
113 | TMP421_TEMP_MSB[i]) << 8; | ||
114 | data->temp[i] |= i2c_smbus_read_byte_data(client, | ||
115 | TMP421_TEMP_LSB[i]); | ||
116 | } | ||
117 | data->last_updated = jiffies; | ||
118 | data->valid = 1; | ||
119 | } | ||
120 | |||
121 | mutex_unlock(&data->update_lock); | ||
122 | |||
123 | return data; | ||
124 | } | ||
125 | |||
126 | static ssize_t show_temp_value(struct device *dev, | ||
127 | struct device_attribute *devattr, char *buf) | ||
128 | { | ||
129 | int index = to_sensor_dev_attr(devattr)->index; | ||
130 | struct tmp421_data *data = tmp421_update_device(dev); | ||
131 | int temp; | ||
132 | |||
133 | mutex_lock(&data->update_lock); | ||
134 | if (data->config & TMP421_CONFIG_RANGE) | ||
135 | temp = temp_from_u16(data->temp[index]); | ||
136 | else | ||
137 | temp = temp_from_s16(data->temp[index]); | ||
138 | mutex_unlock(&data->update_lock); | ||
139 | |||
140 | return sprintf(buf, "%d\n", temp); | ||
141 | } | ||
142 | |||
143 | static ssize_t show_fault(struct device *dev, | ||
144 | struct device_attribute *devattr, char *buf) | ||
145 | { | ||
146 | int index = to_sensor_dev_attr(devattr)->index; | ||
147 | struct tmp421_data *data = tmp421_update_device(dev); | ||
148 | |||
149 | /* | ||
150 | * The OPEN bit signals a fault. This is bit 0 of the temperature | ||
151 | * register (low byte). | ||
152 | */ | ||
153 | if (data->temp[index] & 0x01) | ||
154 | return sprintf(buf, "1\n"); | ||
155 | else | ||
156 | return sprintf(buf, "0\n"); | ||
157 | } | ||
158 | |||
159 | static mode_t tmp421_is_visible(struct kobject *kobj, struct attribute *a, | ||
160 | int n) | ||
161 | { | ||
162 | struct device *dev = container_of(kobj, struct device, kobj); | ||
163 | struct tmp421_data *data = dev_get_drvdata(dev); | ||
164 | struct device_attribute *devattr; | ||
165 | unsigned int index; | ||
166 | |||
167 | devattr = container_of(a, struct device_attribute, attr); | ||
168 | index = to_sensor_dev_attr(devattr)->index; | ||
169 | |||
170 | if (data->kind > index) | ||
171 | return a->mode; | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_value, NULL, 0); | ||
177 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_value, NULL, 1); | ||
178 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_fault, NULL, 1); | ||
179 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_value, NULL, 2); | ||
180 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_fault, NULL, 2); | ||
181 | static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_value, NULL, 3); | ||
182 | static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_fault, NULL, 3); | ||
183 | |||
184 | static struct attribute *tmp421_attr[] = { | ||
185 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
186 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
187 | &sensor_dev_attr_temp2_fault.dev_attr.attr, | ||
188 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
189 | &sensor_dev_attr_temp3_fault.dev_attr.attr, | ||
190 | &sensor_dev_attr_temp4_input.dev_attr.attr, | ||
191 | &sensor_dev_attr_temp4_fault.dev_attr.attr, | ||
192 | NULL | ||
193 | }; | ||
194 | |||
195 | static const struct attribute_group tmp421_group = { | ||
196 | .attrs = tmp421_attr, | ||
197 | .is_visible = tmp421_is_visible, | ||
198 | }; | ||
199 | |||
200 | static int tmp421_init_client(struct i2c_client *client) | ||
201 | { | ||
202 | int config, config_orig; | ||
203 | |||
204 | /* Set the conversion rate to 2 Hz */ | ||
205 | i2c_smbus_write_byte_data(client, TMP421_CONVERSION_RATE_REG, 0x05); | ||
206 | |||
207 | /* Start conversions (disable shutdown if necessary) */ | ||
208 | config = i2c_smbus_read_byte_data(client, TMP421_CONFIG_REG_1); | ||
209 | if (config < 0) { | ||
210 | dev_err(&client->dev, "Could not read configuration" | ||
211 | " register (%d)\n", config); | ||
212 | return -ENODEV; | ||
213 | } | ||
214 | |||
215 | config_orig = config; | ||
216 | config &= ~TMP421_CONFIG_SHUTDOWN; | ||
217 | |||
218 | if (config != config_orig) { | ||
219 | dev_info(&client->dev, "Enable monitoring chip\n"); | ||
220 | i2c_smbus_write_byte_data(client, TMP421_CONFIG_REG_1, config); | ||
221 | } | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | static int tmp421_detect(struct i2c_client *client, int kind, | ||
227 | struct i2c_board_info *info) | ||
228 | { | ||
229 | struct i2c_adapter *adapter = client->adapter; | ||
230 | const char *names[] = { "TMP421", "TMP422", "TMP423" }; | ||
231 | |||
232 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
233 | return -ENODEV; | ||
234 | |||
235 | if (kind <= 0) { | ||
236 | u8 reg; | ||
237 | |||
238 | reg = i2c_smbus_read_byte_data(client, | ||
239 | TMP421_MANUFACTURER_ID_REG); | ||
240 | if (reg != TMP421_MANUFACTURER_ID) | ||
241 | return -ENODEV; | ||
242 | |||
243 | reg = i2c_smbus_read_byte_data(client, | ||
244 | TMP421_DEVICE_ID_REG); | ||
245 | switch (reg) { | ||
246 | case TMP421_DEVICE_ID: | ||
247 | kind = tmp421; | ||
248 | break; | ||
249 | case TMP422_DEVICE_ID: | ||
250 | kind = tmp422; | ||
251 | break; | ||
252 | case TMP423_DEVICE_ID: | ||
253 | kind = tmp423; | ||
254 | break; | ||
255 | default: | ||
256 | return -ENODEV; | ||
257 | } | ||
258 | } | ||
259 | strlcpy(info->type, tmp421_id[kind - 1].name, I2C_NAME_SIZE); | ||
260 | dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n", | ||
261 | names[kind - 1], client->addr); | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int tmp421_probe(struct i2c_client *client, | ||
267 | const struct i2c_device_id *id) | ||
268 | { | ||
269 | struct tmp421_data *data; | ||
270 | int err; | ||
271 | |||
272 | data = kzalloc(sizeof(struct tmp421_data), GFP_KERNEL); | ||
273 | if (!data) | ||
274 | return -ENOMEM; | ||
275 | |||
276 | i2c_set_clientdata(client, data); | ||
277 | mutex_init(&data->update_lock); | ||
278 | data->kind = id->driver_data; | ||
279 | |||
280 | err = tmp421_init_client(client); | ||
281 | if (err) | ||
282 | goto exit_free; | ||
283 | |||
284 | err = sysfs_create_group(&client->dev.kobj, &tmp421_group); | ||
285 | if (err) | ||
286 | goto exit_free; | ||
287 | |||
288 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
289 | if (IS_ERR(data->hwmon_dev)) { | ||
290 | err = PTR_ERR(data->hwmon_dev); | ||
291 | data->hwmon_dev = NULL; | ||
292 | goto exit_remove; | ||
293 | } | ||
294 | return 0; | ||
295 | |||
296 | exit_remove: | ||
297 | sysfs_remove_group(&client->dev.kobj, &tmp421_group); | ||
298 | |||
299 | exit_free: | ||
300 | i2c_set_clientdata(client, NULL); | ||
301 | kfree(data); | ||
302 | |||
303 | return err; | ||
304 | } | ||
305 | |||
306 | static int tmp421_remove(struct i2c_client *client) | ||
307 | { | ||
308 | struct tmp421_data *data = i2c_get_clientdata(client); | ||
309 | |||
310 | hwmon_device_unregister(data->hwmon_dev); | ||
311 | sysfs_remove_group(&client->dev.kobj, &tmp421_group); | ||
312 | |||
313 | i2c_set_clientdata(client, NULL); | ||
314 | kfree(data); | ||
315 | |||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | static struct i2c_driver tmp421_driver = { | ||
320 | .class = I2C_CLASS_HWMON, | ||
321 | .driver = { | ||
322 | .name = "tmp421", | ||
323 | }, | ||
324 | .probe = tmp421_probe, | ||
325 | .remove = tmp421_remove, | ||
326 | .id_table = tmp421_id, | ||
327 | .detect = tmp421_detect, | ||
328 | .address_data = &addr_data, | ||
329 | }; | ||
330 | |||
331 | static int __init tmp421_init(void) | ||
332 | { | ||
333 | return i2c_add_driver(&tmp421_driver); | ||
334 | } | ||
335 | |||
336 | static void __exit tmp421_exit(void) | ||
337 | { | ||
338 | i2c_del_driver(&tmp421_driver); | ||
339 | } | ||
340 | |||
341 | MODULE_AUTHOR("Andre Prendel <andre.prendel@gmx.de>"); | ||
342 | MODULE_DESCRIPTION("Texas Instruments TMP421/422/423 temperature sensor" | ||
343 | " driver"); | ||
344 | MODULE_LICENSE("GPL"); | ||
345 | |||
346 | module_init(tmp421_init); | ||
347 | module_exit(tmp421_exit); | ||
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index a022aedcaacb..39e82a492f26 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
44 | #include <linux/acpi.h> | 44 | #include <linux/acpi.h> |
45 | #include <asm/io.h> | 45 | #include <linux/io.h> |
46 | 46 | ||
47 | 47 | ||
48 | /* If force_addr is set to anything different from 0, we forcibly enable | 48 | /* If force_addr is set to anything different from 0, we forcibly enable |
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index 73f77a9b8b18..ae33bbb577c7 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
36 | #include <asm/io.h> | 36 | #include <linux/io.h> |
37 | 37 | ||
38 | static int uch_config = -1; | 38 | static int uch_config = -1; |
39 | module_param(uch_config, int, 0); | 39 | module_param(uch_config, int, 0); |
@@ -1136,7 +1136,7 @@ static int __devinit vt1211_probe(struct platform_device *pdev) | |||
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1138 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
1139 | if (!request_region(res->start, res->end - res->start + 1, DRVNAME)) { | 1139 | if (!request_region(res->start, resource_size(res), DRVNAME)) { |
1140 | err = -EBUSY; | 1140 | err = -EBUSY; |
1141 | dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", | 1141 | dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", |
1142 | (unsigned long)res->start, (unsigned long)res->end); | 1142 | (unsigned long)res->start, (unsigned long)res->end); |
@@ -1209,7 +1209,7 @@ EXIT_DEV_REMOVE: | |||
1209 | dev_err(dev, "Sysfs interface creation failed (%d)\n", err); | 1209 | dev_err(dev, "Sysfs interface creation failed (%d)\n", err); |
1210 | EXIT_DEV_REMOVE_SILENT: | 1210 | EXIT_DEV_REMOVE_SILENT: |
1211 | vt1211_remove_sysfs(pdev); | 1211 | vt1211_remove_sysfs(pdev); |
1212 | release_region(res->start, res->end - res->start + 1); | 1212 | release_region(res->start, resource_size(res)); |
1213 | EXIT_KFREE: | 1213 | EXIT_KFREE: |
1214 | platform_set_drvdata(pdev, NULL); | 1214 | platform_set_drvdata(pdev, NULL); |
1215 | kfree(data); | 1215 | kfree(data); |
@@ -1228,7 +1228,7 @@ static int __devexit vt1211_remove(struct platform_device *pdev) | |||
1228 | kfree(data); | 1228 | kfree(data); |
1229 | 1229 | ||
1230 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1230 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
1231 | release_region(res->start, res->end - res->start + 1); | 1231 | release_region(res->start, resource_size(res)); |
1232 | 1232 | ||
1233 | return 0; | 1233 | return 0; |
1234 | } | 1234 | } |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 9982b45fbb14..470a1226ba2b 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/err.h> | 36 | #include <linux/err.h> |
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | #include <linux/acpi.h> | 38 | #include <linux/acpi.h> |
39 | #include <asm/io.h> | 39 | #include <linux/io.h> |
40 | 40 | ||
41 | static int force_addr; | 41 | static int force_addr; |
42 | module_param(force_addr, int, 0); | 42 | module_param(force_addr, int, 0); |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 0e9746913d2b..bb5e78748783 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include <linux/err.h> | 51 | #include <linux/err.h> |
52 | #include <linux/mutex.h> | 52 | #include <linux/mutex.h> |
53 | #include <linux/acpi.h> | 53 | #include <linux/acpi.h> |
54 | #include <asm/io.h> | 54 | #include <linux/io.h> |
55 | #include "lm75.h" | 55 | #include "lm75.h" |
56 | 56 | ||
57 | enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg }; | 57 | enum kinds { w83627ehf, w83627dhg, w83627dhg_p, w83667hg }; |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 389150ba30d3..2be28ac4ede0 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include <linux/mutex.h> | 51 | #include <linux/mutex.h> |
52 | #include <linux/ioport.h> | 52 | #include <linux/ioport.h> |
53 | #include <linux/acpi.h> | 53 | #include <linux/acpi.h> |
54 | #include <asm/io.h> | 54 | #include <linux/io.h> |
55 | #include "lm75.h" | 55 | #include "lm75.h" |
56 | 56 | ||
57 | static struct platform_device *pdev; | 57 | static struct platform_device *pdev; |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index 0bdab959b736..d27ed1bac002 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #ifdef CONFIG_ISA | 48 | #ifdef CONFIG_ISA |
49 | #include <linux/platform_device.h> | 49 | #include <linux/platform_device.h> |
50 | #include <linux/ioport.h> | 50 | #include <linux/ioport.h> |
51 | #include <asm/io.h> | 51 | #include <linux/io.h> |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #include "lm75.h" | 54 | #include "lm75.h" |