diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-11 12:45:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-11 12:45:55 -0500 |
commit | 6102c315d896fb020550fb2481613485872978f6 (patch) | |
tree | d0afc2dca7492c65be45af869b5988053bd92f2d | |
parent | a29815a333c6c6e677294bbe5958e771d0aad3fd (diff) | |
parent | 3dd3a156355e7e6bec0dc9a0bbb6eeecbd965d50 (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: Make PCI device ids constant
hwmon: (coretemp) Fix TjMax for Atom N450/D410/D510 CPUs
hwmon: (k10temp) Blacklist more family 10h processors
hwmon: (asus_atk0110) Add debugfs interface
hwmon: (asus_atk0110) Refactor interface probe code
hwmon: (adt7462) Fix pin 28 monitoring
-rw-r--r-- | Documentation/hwmon/k10temp | 17 | ||||
-rw-r--r-- | drivers/hwmon/Kconfig | 2 | ||||
-rw-r--r-- | drivers/hwmon/adt7462.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/asus_atk0110.c | 289 | ||||
-rw-r--r-- | drivers/hwmon/coretemp.c | 16 | ||||
-rw-r--r-- | drivers/hwmon/k10temp.c | 40 | ||||
-rw-r--r-- | drivers/hwmon/k8temp.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/sis5595.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/via686a.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/vt8231.c | 2 |
10 files changed, 299 insertions, 75 deletions
diff --git a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp index a7a18d453a51..6526eee525a6 100644 --- a/Documentation/hwmon/k10temp +++ b/Documentation/hwmon/k10temp | |||
@@ -3,8 +3,8 @@ Kernel driver k10temp | |||
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * AMD Family 10h processors: | 5 | * AMD Family 10h processors: |
6 | Socket F: Quad-Core/Six-Core/Embedded Opteron | 6 | Socket F: Quad-Core/Six-Core/Embedded Opteron (but see below) |
7 | Socket AM2+: Opteron, Phenom (II) X3/X4 | 7 | Socket AM2+: Quad-Core Opteron, Phenom (II) X3/X4, Athlon X2 (but see below) |
8 | Socket AM3: Quad-Core Opteron, Athlon/Phenom II X2/X3/X4, Sempron II | 8 | Socket AM3: Quad-Core Opteron, Athlon/Phenom II X2/X3/X4, Sempron II |
9 | Socket S1G3: Athlon II, Sempron, Turion II | 9 | Socket S1G3: Athlon II, Sempron, Turion II |
10 | * AMD Family 11h processors: | 10 | * AMD Family 11h processors: |
@@ -36,10 +36,15 @@ Description | |||
36 | This driver permits reading of the internal temperature sensor of AMD | 36 | This driver permits reading of the internal temperature sensor of AMD |
37 | Family 10h and 11h processors. | 37 | Family 10h and 11h processors. |
38 | 38 | ||
39 | All these processors have a sensor, but on older revisions of Family 10h | 39 | All these processors have a sensor, but on those for Socket F or AM2+, |
40 | processors, the sensor may return inconsistent values (erratum 319). The | 40 | the sensor may return inconsistent values (erratum 319). The driver |
41 | driver will refuse to load on these revisions unless you specify the | 41 | will refuse to load on these revisions unless you specify the "force=1" |
42 | "force=1" module parameter. | 42 | module parameter. |
43 | |||
44 | Due to technical reasons, the driver can detect only the mainboard's | ||
45 | socket type, not the processor's actual capabilities. Therefore, if you | ||
46 | are using an AM3 processor on an AM2+ mainboard, you can safely use the | ||
47 | "force=1" parameter. | ||
43 | 48 | ||
44 | There is one temperature measurement value, available as temp1_input in | 49 | There is one temperature measurement value, available as temp1_input in |
45 | sysfs. It is measured in degrees Celsius with a resolution of 1/8th degree. | 50 | sysfs. It is measured in degrees Celsius with a resolution of 1/8th degree. |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 07a0f030a3ec..68cf87749a42 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -392,7 +392,7 @@ config SENSORS_GL520SM | |||
392 | 392 | ||
393 | config SENSORS_CORETEMP | 393 | config SENSORS_CORETEMP |
394 | tristate "Intel Core/Core2/Atom temperature sensor" | 394 | tristate "Intel Core/Core2/Atom temperature sensor" |
395 | depends on X86 && EXPERIMENTAL | 395 | depends on X86 && PCI && EXPERIMENTAL |
396 | help | 396 | help |
397 | If you say yes here you get support for the temperature | 397 | If you say yes here you get support for the temperature |
398 | sensor inside your CPU. Most of the family 6 CPUs | 398 | sensor inside your CPU. Most of the family 6 CPUs |
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c index a1a7ef14b519..a31e77c776ae 100644 --- a/drivers/hwmon/adt7462.c +++ b/drivers/hwmon/adt7462.c | |||
@@ -94,7 +94,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END }; | |||
94 | #define ADT7462_PIN24_SHIFT 6 | 94 | #define ADT7462_PIN24_SHIFT 6 |
95 | #define ADT7462_PIN26_VOLT_INPUT 0x08 | 95 | #define ADT7462_PIN26_VOLT_INPUT 0x08 |
96 | #define ADT7462_PIN25_VOLT_INPUT 0x20 | 96 | #define ADT7462_PIN25_VOLT_INPUT 0x20 |
97 | #define ADT7462_PIN28_SHIFT 6 /* cfg3 */ | 97 | #define ADT7462_PIN28_SHIFT 4 /* cfg3 */ |
98 | #define ADT7462_PIN28_VOLT 0x5 | 98 | #define ADT7462_PIN28_VOLT 0x5 |
99 | 99 | ||
100 | #define ADT7462_REG_ALARM1 0xB8 | 100 | #define ADT7462_REG_ALARM1 0xB8 |
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index 5a3ee00c0e7d..6811346c1c62 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * See COPYING in the top level directory of the kernel tree. | 5 | * See COPYING in the top level directory of the kernel tree. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/debugfs.h> | ||
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
9 | #include <linux/hwmon.h> | 10 | #include <linux/hwmon.h> |
10 | #include <linux/list.h> | 11 | #include <linux/list.h> |
@@ -101,6 +102,11 @@ struct atk_data { | |||
101 | int temperature_count; | 102 | int temperature_count; |
102 | int fan_count; | 103 | int fan_count; |
103 | struct list_head sensor_list; | 104 | struct list_head sensor_list; |
105 | |||
106 | struct { | ||
107 | struct dentry *root; | ||
108 | u32 id; | ||
109 | } debugfs; | ||
104 | }; | 110 | }; |
105 | 111 | ||
106 | 112 | ||
@@ -624,6 +630,187 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) | |||
624 | return err; | 630 | return err; |
625 | } | 631 | } |
626 | 632 | ||
633 | #ifdef CONFIG_DEBUG_FS | ||
634 | static int atk_debugfs_gitm_get(void *p, u64 *val) | ||
635 | { | ||
636 | struct atk_data *data = p; | ||
637 | union acpi_object *ret; | ||
638 | struct atk_acpi_ret_buffer *buf; | ||
639 | int err = 0; | ||
640 | |||
641 | if (!data->read_handle) | ||
642 | return -ENODEV; | ||
643 | |||
644 | if (!data->debugfs.id) | ||
645 | return -EINVAL; | ||
646 | |||
647 | ret = atk_gitm(data, data->debugfs.id); | ||
648 | if (IS_ERR(ret)) | ||
649 | return PTR_ERR(ret); | ||
650 | |||
651 | buf = (struct atk_acpi_ret_buffer *)ret->buffer.pointer; | ||
652 | if (buf->flags) | ||
653 | *val = buf->value; | ||
654 | else | ||
655 | err = -EIO; | ||
656 | |||
657 | return err; | ||
658 | } | ||
659 | |||
660 | DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm, | ||
661 | atk_debugfs_gitm_get, | ||
662 | NULL, | ||
663 | "0x%08llx\n") | ||
664 | |||
665 | static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj) | ||
666 | { | ||
667 | int ret = 0; | ||
668 | |||
669 | switch (obj->type) { | ||
670 | case ACPI_TYPE_INTEGER: | ||
671 | ret = snprintf(buf, sz, "0x%08llx\n", obj->integer.value); | ||
672 | break; | ||
673 | case ACPI_TYPE_STRING: | ||
674 | ret = snprintf(buf, sz, "%s\n", obj->string.pointer); | ||
675 | break; | ||
676 | } | ||
677 | |||
678 | return ret; | ||
679 | } | ||
680 | |||
681 | static void atk_pack_print(char *buf, size_t sz, union acpi_object *pack) | ||
682 | { | ||
683 | int ret; | ||
684 | int i; | ||
685 | |||
686 | for (i = 0; i < pack->package.count; i++) { | ||
687 | union acpi_object *obj = &pack->package.elements[i]; | ||
688 | |||
689 | ret = atk_acpi_print(buf, sz, obj); | ||
690 | if (ret >= sz) | ||
691 | break; | ||
692 | buf += ret; | ||
693 | sz -= ret; | ||
694 | } | ||
695 | } | ||
696 | |||
697 | static int atk_debugfs_ggrp_open(struct inode *inode, struct file *file) | ||
698 | { | ||
699 | struct atk_data *data = inode->i_private; | ||
700 | char *buf = NULL; | ||
701 | union acpi_object *ret; | ||
702 | u8 cls; | ||
703 | int i; | ||
704 | |||
705 | if (!data->enumerate_handle) | ||
706 | return -ENODEV; | ||
707 | if (!data->debugfs.id) | ||
708 | return -EINVAL; | ||
709 | |||
710 | cls = (data->debugfs.id & 0xff000000) >> 24; | ||
711 | ret = atk_ggrp(data, cls); | ||
712 | if (IS_ERR(ret)) | ||
713 | return PTR_ERR(ret); | ||
714 | |||
715 | for (i = 0; i < ret->package.count; i++) { | ||
716 | union acpi_object *pack = &ret->package.elements[i]; | ||
717 | union acpi_object *id; | ||
718 | |||
719 | if (pack->type != ACPI_TYPE_PACKAGE) | ||
720 | continue; | ||
721 | if (!pack->package.count) | ||
722 | continue; | ||
723 | id = &pack->package.elements[0]; | ||
724 | if (id->integer.value == data->debugfs.id) { | ||
725 | /* Print the package */ | ||
726 | buf = kzalloc(512, GFP_KERNEL); | ||
727 | if (!buf) { | ||
728 | ACPI_FREE(ret); | ||
729 | return -ENOMEM; | ||
730 | } | ||
731 | atk_pack_print(buf, 512, pack); | ||
732 | break; | ||
733 | } | ||
734 | } | ||
735 | ACPI_FREE(ret); | ||
736 | |||
737 | if (!buf) | ||
738 | return -EINVAL; | ||
739 | |||
740 | file->private_data = buf; | ||
741 | |||
742 | return nonseekable_open(inode, file); | ||
743 | } | ||
744 | |||
745 | static ssize_t atk_debugfs_ggrp_read(struct file *file, char __user *buf, | ||
746 | size_t count, loff_t *pos) | ||
747 | { | ||
748 | char *str = file->private_data; | ||
749 | size_t len = strlen(str); | ||
750 | |||
751 | return simple_read_from_buffer(buf, count, pos, str, len); | ||
752 | } | ||
753 | |||
754 | static int atk_debugfs_ggrp_release(struct inode *inode, struct file *file) | ||
755 | { | ||
756 | kfree(file->private_data); | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | static const struct file_operations atk_debugfs_ggrp_fops = { | ||
761 | .read = atk_debugfs_ggrp_read, | ||
762 | .open = atk_debugfs_ggrp_open, | ||
763 | .release = atk_debugfs_ggrp_release, | ||
764 | }; | ||
765 | |||
766 | static void atk_debugfs_init(struct atk_data *data) | ||
767 | { | ||
768 | struct dentry *d; | ||
769 | struct dentry *f; | ||
770 | |||
771 | data->debugfs.id = 0; | ||
772 | |||
773 | d = debugfs_create_dir("asus_atk0110", NULL); | ||
774 | if (!d || IS_ERR(d)) | ||
775 | return; | ||
776 | |||
777 | f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id); | ||
778 | if (!f || IS_ERR(f)) | ||
779 | goto cleanup; | ||
780 | |||
781 | f = debugfs_create_file("gitm", S_IRUSR, d, data, | ||
782 | &atk_debugfs_gitm); | ||
783 | if (!f || IS_ERR(f)) | ||
784 | goto cleanup; | ||
785 | |||
786 | f = debugfs_create_file("ggrp", S_IRUSR, d, data, | ||
787 | &atk_debugfs_ggrp_fops); | ||
788 | if (!f || IS_ERR(f)) | ||
789 | goto cleanup; | ||
790 | |||
791 | data->debugfs.root = d; | ||
792 | |||
793 | return; | ||
794 | cleanup: | ||
795 | debugfs_remove_recursive(d); | ||
796 | } | ||
797 | |||
798 | static void atk_debugfs_cleanup(struct atk_data *data) | ||
799 | { | ||
800 | debugfs_remove_recursive(data->debugfs.root); | ||
801 | } | ||
802 | |||
803 | #else /* CONFIG_DEBUG_FS */ | ||
804 | |||
805 | static void atk_debugfs_init(struct atk_data *data) | ||
806 | { | ||
807 | } | ||
808 | |||
809 | static void atk_debugfs_cleanup(struct atk_data *data) | ||
810 | { | ||
811 | } | ||
812 | #endif | ||
813 | |||
627 | static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) | 814 | static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) |
628 | { | 815 | { |
629 | struct device *dev = &data->acpi_dev->dev; | 816 | struct device *dev = &data->acpi_dev->dev; |
@@ -1047,76 +1234,75 @@ remove: | |||
1047 | return err; | 1234 | return err; |
1048 | } | 1235 | } |
1049 | 1236 | ||
1050 | static int atk_check_old_if(struct atk_data *data) | 1237 | static int atk_probe_if(struct atk_data *data) |
1051 | { | 1238 | { |
1052 | struct device *dev = &data->acpi_dev->dev; | 1239 | struct device *dev = &data->acpi_dev->dev; |
1053 | acpi_handle ret; | 1240 | acpi_handle ret; |
1054 | acpi_status status; | 1241 | acpi_status status; |
1242 | int err = 0; | ||
1055 | 1243 | ||
1056 | /* RTMP: read temperature */ | 1244 | /* RTMP: read temperature */ |
1057 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret); | 1245 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret); |
1058 | if (status != AE_OK) { | 1246 | if (ACPI_SUCCESS(status)) |
1247 | data->rtmp_handle = ret; | ||
1248 | else | ||
1059 | dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n", | 1249 | dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n", |
1060 | acpi_format_exception(status)); | 1250 | acpi_format_exception(status)); |
1061 | return -ENODEV; | ||
1062 | } | ||
1063 | data->rtmp_handle = ret; | ||
1064 | 1251 | ||
1065 | /* RVLT: read voltage */ | 1252 | /* RVLT: read voltage */ |
1066 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret); | 1253 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret); |
1067 | if (status != AE_OK) { | 1254 | if (ACPI_SUCCESS(status)) |
1255 | data->rvlt_handle = ret; | ||
1256 | else | ||
1068 | dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n", | 1257 | dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n", |
1069 | acpi_format_exception(status)); | 1258 | acpi_format_exception(status)); |
1070 | return -ENODEV; | ||
1071 | } | ||
1072 | data->rvlt_handle = ret; | ||
1073 | 1259 | ||
1074 | /* RFAN: read fan status */ | 1260 | /* RFAN: read fan status */ |
1075 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret); | 1261 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret); |
1076 | if (status != AE_OK) { | 1262 | if (ACPI_SUCCESS(status)) |
1263 | data->rfan_handle = ret; | ||
1264 | else | ||
1077 | dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n", | 1265 | dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n", |
1078 | acpi_format_exception(status)); | 1266 | acpi_format_exception(status)); |
1079 | return -ENODEV; | ||
1080 | } | ||
1081 | data->rfan_handle = ret; | ||
1082 | |||
1083 | return 0; | ||
1084 | } | ||
1085 | |||
1086 | static int atk_check_new_if(struct atk_data *data) | ||
1087 | { | ||
1088 | struct device *dev = &data->acpi_dev->dev; | ||
1089 | acpi_handle ret; | ||
1090 | acpi_status status; | ||
1091 | 1267 | ||
1092 | /* Enumeration */ | 1268 | /* Enumeration */ |
1093 | status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret); | 1269 | status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret); |
1094 | if (status != AE_OK) { | 1270 | if (ACPI_SUCCESS(status)) |
1271 | data->enumerate_handle = ret; | ||
1272 | else | ||
1095 | dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n", | 1273 | dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n", |
1096 | acpi_format_exception(status)); | 1274 | acpi_format_exception(status)); |
1097 | return -ENODEV; | ||
1098 | } | ||
1099 | data->enumerate_handle = ret; | ||
1100 | 1275 | ||
1101 | /* De-multiplexer (read) */ | 1276 | /* De-multiplexer (read) */ |
1102 | status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret); | 1277 | status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret); |
1103 | if (status != AE_OK) { | 1278 | if (ACPI_SUCCESS(status)) |
1279 | data->read_handle = ret; | ||
1280 | else | ||
1104 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", | 1281 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", |
1105 | acpi_format_exception(status)); | 1282 | acpi_format_exception(status)); |
1106 | return -ENODEV; | ||
1107 | } | ||
1108 | data->read_handle = ret; | ||
1109 | 1283 | ||
1110 | /* De-multiplexer (write) */ | 1284 | /* De-multiplexer (write) */ |
1111 | status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret); | 1285 | status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret); |
1112 | if (status != AE_OK) { | 1286 | if (ACPI_SUCCESS(status)) |
1113 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", | 1287 | data->write_handle = ret; |
1288 | else | ||
1289 | dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n", | ||
1114 | acpi_format_exception(status)); | 1290 | acpi_format_exception(status)); |
1115 | return -ENODEV; | ||
1116 | } | ||
1117 | data->write_handle = ret; | ||
1118 | 1291 | ||
1119 | return 0; | 1292 | /* Check for hwmon methods: first check "old" style methods; note that |
1293 | * both may be present: in this case we stick to the old interface; | ||
1294 | * analysis of multiple DSDTs indicates that when both interfaces | ||
1295 | * are present the new one (GGRP/GITM) is not functional. | ||
1296 | */ | ||
1297 | if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle) | ||
1298 | data->old_interface = true; | ||
1299 | else if (data->enumerate_handle && data->read_handle && | ||
1300 | data->write_handle) | ||
1301 | data->old_interface = false; | ||
1302 | else | ||
1303 | err = -ENODEV; | ||
1304 | |||
1305 | return err; | ||
1120 | } | 1306 | } |
1121 | 1307 | ||
1122 | static int atk_add(struct acpi_device *device) | 1308 | static int atk_add(struct acpi_device *device) |
@@ -1155,28 +1341,19 @@ static int atk_add(struct acpi_device *device) | |||
1155 | } | 1341 | } |
1156 | ACPI_FREE(buf.pointer); | 1342 | ACPI_FREE(buf.pointer); |
1157 | 1343 | ||
1158 | /* Check for hwmon methods: first check "old" style methods; note that | 1344 | err = atk_probe_if(data); |
1159 | * both may be present: in this case we stick to the old interface; | 1345 | if (err) { |
1160 | * analysis of multiple DSDTs indicates that when both interfaces | 1346 | dev_err(&device->dev, "No usable hwmon interface detected\n"); |
1161 | * are present the new one (GGRP/GITM) is not functional. | 1347 | goto out; |
1162 | */ | ||
1163 | err = atk_check_old_if(data); | ||
1164 | if (!err) { | ||
1165 | dev_dbg(&device->dev, "Using old hwmon interface\n"); | ||
1166 | data->old_interface = true; | ||
1167 | } else { | ||
1168 | err = atk_check_new_if(data); | ||
1169 | if (err) | ||
1170 | goto out; | ||
1171 | |||
1172 | dev_dbg(&device->dev, "Using new hwmon interface\n"); | ||
1173 | data->old_interface = false; | ||
1174 | } | 1348 | } |
1175 | 1349 | ||
1176 | if (data->old_interface) | 1350 | if (data->old_interface) { |
1351 | dev_dbg(&device->dev, "Using old hwmon interface\n"); | ||
1177 | err = atk_enumerate_old_hwmon(data); | 1352 | err = atk_enumerate_old_hwmon(data); |
1178 | else | 1353 | } else { |
1354 | dev_dbg(&device->dev, "Using new hwmon interface\n"); | ||
1179 | err = atk_enumerate_new_hwmon(data); | 1355 | err = atk_enumerate_new_hwmon(data); |
1356 | } | ||
1180 | if (err < 0) | 1357 | if (err < 0) |
1181 | goto out; | 1358 | goto out; |
1182 | if (err == 0) { | 1359 | if (err == 0) { |
@@ -1190,6 +1367,8 @@ static int atk_add(struct acpi_device *device) | |||
1190 | if (err) | 1367 | if (err) |
1191 | goto cleanup; | 1368 | goto cleanup; |
1192 | 1369 | ||
1370 | atk_debugfs_init(data); | ||
1371 | |||
1193 | device->driver_data = data; | 1372 | device->driver_data = data; |
1194 | return 0; | 1373 | return 0; |
1195 | cleanup: | 1374 | cleanup: |
@@ -1208,6 +1387,8 @@ static int atk_remove(struct acpi_device *device, int type) | |||
1208 | 1387 | ||
1209 | device->driver_data = NULL; | 1388 | device->driver_data = NULL; |
1210 | 1389 | ||
1390 | atk_debugfs_cleanup(data); | ||
1391 | |||
1211 | atk_remove_files(data); | 1392 | atk_remove_files(data); |
1212 | atk_free_sensors(data); | 1393 | atk_free_sensors(data); |
1213 | hwmon_device_unregister(data->hwmon_dev); | 1394 | hwmon_device_unregister(data->hwmon_dev); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index caef39cda8c8..2d7bceeed0bc 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/cpu.h> | 35 | #include <linux/cpu.h> |
36 | #include <linux/pci.h> | ||
36 | #include <asm/msr.h> | 37 | #include <asm/msr.h> |
37 | #include <asm/processor.h> | 38 | #include <asm/processor.h> |
38 | 39 | ||
@@ -161,6 +162,7 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device * | |||
161 | int usemsr_ee = 1; | 162 | int usemsr_ee = 1; |
162 | int err; | 163 | int err; |
163 | u32 eax, edx; | 164 | u32 eax, edx; |
165 | struct pci_dev *host_bridge; | ||
164 | 166 | ||
165 | /* Early chips have no MSR for TjMax */ | 167 | /* Early chips have no MSR for TjMax */ |
166 | 168 | ||
@@ -168,11 +170,21 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device * | |||
168 | usemsr_ee = 0; | 170 | usemsr_ee = 0; |
169 | } | 171 | } |
170 | 172 | ||
171 | /* Atoms seems to have TjMax at 90C */ | 173 | /* Atom CPUs */ |
172 | 174 | ||
173 | if (c->x86_model == 0x1c) { | 175 | if (c->x86_model == 0x1c) { |
174 | usemsr_ee = 0; | 176 | usemsr_ee = 0; |
175 | tjmax = 90000; | 177 | |
178 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); | ||
179 | |||
180 | if (host_bridge && host_bridge->vendor == PCI_VENDOR_ID_INTEL | ||
181 | && (host_bridge->device == 0xa000 /* NM10 based nettop */ | ||
182 | || host_bridge->device == 0xa010)) /* NM10 based netbook */ | ||
183 | tjmax = 100000; | ||
184 | else | ||
185 | tjmax = 90000; | ||
186 | |||
187 | pci_dev_put(host_bridge); | ||
176 | } | 188 | } |
177 | 189 | ||
178 | if ((c->x86_model > 0xe) && (usemsr_ee)) { | 190 | if ((c->x86_model > 0xe) && (usemsr_ee)) { |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index d8a26d16d948..099a2138cdf6 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -33,6 +33,16 @@ static bool force; | |||
33 | module_param(force, bool, 0444); | 33 | module_param(force, bool, 0444); |
34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); | 34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); |
35 | 35 | ||
36 | /* CPUID function 0x80000001, ebx */ | ||
37 | #define CPUID_PKGTYPE_MASK 0xf0000000 | ||
38 | #define CPUID_PKGTYPE_F 0x00000000 | ||
39 | #define CPUID_PKGTYPE_AM2R2_AM3 0x10000000 | ||
40 | |||
41 | /* DRAM controller (PCI function 2) */ | ||
42 | #define REG_DCT0_CONFIG_HIGH 0x094 | ||
43 | #define DDR3_MODE 0x00000100 | ||
44 | |||
45 | /* miscellaneous (PCI function 3) */ | ||
36 | #define REG_HARDWARE_THERMAL_CONTROL 0x64 | 46 | #define REG_HARDWARE_THERMAL_CONTROL 0x64 |
37 | #define HTC_ENABLE 0x00000001 | 47 | #define HTC_ENABLE 0x00000001 |
38 | 48 | ||
@@ -85,13 +95,28 @@ static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); | |||
85 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1); | 95 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1); |
86 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 96 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
87 | 97 | ||
88 | static bool __devinit has_erratum_319(void) | 98 | static bool __devinit has_erratum_319(struct pci_dev *pdev) |
89 | { | 99 | { |
100 | u32 pkg_type, reg_dram_cfg; | ||
101 | |||
102 | if (boot_cpu_data.x86 != 0x10) | ||
103 | return false; | ||
104 | |||
90 | /* | 105 | /* |
91 | * Erratum 319: The thermal sensor of older Family 10h processors | 106 | * Erratum 319: The thermal sensor of Socket F/AM2+ processors |
92 | * (B steppings) may be unreliable. | 107 | * may be unreliable. |
93 | */ | 108 | */ |
94 | return boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model <= 2; | 109 | pkg_type = cpuid_ebx(0x80000001) & CPUID_PKGTYPE_MASK; |
110 | if (pkg_type == CPUID_PKGTYPE_F) | ||
111 | return true; | ||
112 | if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) | ||
113 | return false; | ||
114 | |||
115 | /* Differentiate between AM2+ (bad) and AM3 (good) */ | ||
116 | pci_bus_read_config_dword(pdev->bus, | ||
117 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), | ||
118 | REG_DCT0_CONFIG_HIGH, ®_dram_cfg); | ||
119 | return !(reg_dram_cfg & DDR3_MODE); | ||
95 | } | 120 | } |
96 | 121 | ||
97 | static int __devinit k10temp_probe(struct pci_dev *pdev, | 122 | static int __devinit k10temp_probe(struct pci_dev *pdev, |
@@ -99,9 +124,10 @@ static int __devinit k10temp_probe(struct pci_dev *pdev, | |||
99 | { | 124 | { |
100 | struct device *hwmon_dev; | 125 | struct device *hwmon_dev; |
101 | u32 reg_caps, reg_htc; | 126 | u32 reg_caps, reg_htc; |
127 | int unreliable = has_erratum_319(pdev); | ||
102 | int err; | 128 | int err; |
103 | 129 | ||
104 | if (has_erratum_319() && !force) { | 130 | if (unreliable && !force) { |
105 | dev_err(&pdev->dev, | 131 | dev_err(&pdev->dev, |
106 | "unreliable CPU thermal sensor; monitoring disabled\n"); | 132 | "unreliable CPU thermal sensor; monitoring disabled\n"); |
107 | err = -ENODEV; | 133 | err = -ENODEV; |
@@ -139,7 +165,7 @@ static int __devinit k10temp_probe(struct pci_dev *pdev, | |||
139 | } | 165 | } |
140 | dev_set_drvdata(&pdev->dev, hwmon_dev); | 166 | dev_set_drvdata(&pdev->dev, hwmon_dev); |
141 | 167 | ||
142 | if (has_erratum_319() && force) | 168 | if (unreliable && force) |
143 | dev_warn(&pdev->dev, | 169 | dev_warn(&pdev->dev, |
144 | "unreliable CPU thermal sensor; check erratum 319\n"); | 170 | "unreliable CPU thermal sensor; check erratum 319\n"); |
145 | return 0; | 171 | return 0; |
@@ -169,7 +195,7 @@ static void __devexit k10temp_remove(struct pci_dev *pdev) | |||
169 | dev_set_drvdata(&pdev->dev, NULL); | 195 | dev_set_drvdata(&pdev->dev, NULL); |
170 | } | 196 | } |
171 | 197 | ||
172 | static struct pci_device_id k10temp_id_table[] = { | 198 | static const struct pci_device_id k10temp_id_table[] = { |
173 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, | 199 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, |
174 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 200 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
175 | {} | 201 | {} |
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index 1fe995111841..0ceb6d6200a3 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -136,7 +136,7 @@ static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 1, 0); | |||
136 | static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); | 136 | static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); |
137 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 137 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
138 | 138 | ||
139 | static struct pci_device_id k8temp_ids[] = { | 139 | static const struct pci_device_id k8temp_ids[] = { |
140 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, | 140 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, |
141 | { 0 }, | 141 | { 0 }, |
142 | }; | 142 | }; |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 12f2e7086560..79c2931e3008 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -697,7 +697,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev) | |||
697 | return data; | 697 | return data; |
698 | } | 698 | } |
699 | 699 | ||
700 | static struct pci_device_id sis5595_pci_ids[] = { | 700 | static const struct pci_device_id sis5595_pci_ids[] = { |
701 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, | 701 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, |
702 | { 0, } | 702 | { 0, } |
703 | }; | 703 | }; |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 39e82a492f26..f397ce7ad598 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -767,7 +767,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) | |||
767 | return data; | 767 | return data; |
768 | } | 768 | } |
769 | 769 | ||
770 | static struct pci_device_id via686a_pci_ids[] = { | 770 | static const struct pci_device_id via686a_pci_ids[] = { |
771 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) }, | 771 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) }, |
772 | { 0, } | 772 | { 0, } |
773 | }; | 773 | }; |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 470a1226ba2b..d47b4c9949c2 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -697,7 +697,7 @@ static struct platform_driver vt8231_driver = { | |||
697 | .remove = __devexit_p(vt8231_remove), | 697 | .remove = __devexit_p(vt8231_remove), |
698 | }; | 698 | }; |
699 | 699 | ||
700 | static struct pci_device_id vt8231_pci_ids[] = { | 700 | static const struct pci_device_id vt8231_pci_ids[] = { |
701 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, | 701 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, |
702 | { 0, } | 702 | { 0, } |
703 | }; | 703 | }; |