diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/coretemp.c | 32 | ||||
-rw-r--r-- | drivers/hwmon/i5k_amb.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/it87.c | 22 | ||||
-rw-r--r-- | drivers/hwmon/k10temp.c | 14 | ||||
-rw-r--r-- | drivers/hwmon/k8temp.c | 12 |
5 files changed, 77 insertions, 9 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 2988da150ed6..05344af50734 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -53,6 +53,7 @@ struct coretemp_data { | |||
53 | struct mutex update_lock; | 53 | struct mutex update_lock; |
54 | const char *name; | 54 | const char *name; |
55 | u32 id; | 55 | u32 id; |
56 | u16 core_id; | ||
56 | char valid; /* zero until following fields are valid */ | 57 | char valid; /* zero until following fields are valid */ |
57 | unsigned long last_updated; /* in jiffies */ | 58 | unsigned long last_updated; /* in jiffies */ |
58 | int temp; | 59 | int temp; |
@@ -75,7 +76,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute | |||
75 | if (attr->index == SHOW_NAME) | 76 | if (attr->index == SHOW_NAME) |
76 | ret = sprintf(buf, "%s\n", data->name); | 77 | ret = sprintf(buf, "%s\n", data->name); |
77 | else /* show label */ | 78 | else /* show label */ |
78 | ret = sprintf(buf, "Core %d\n", data->id); | 79 | ret = sprintf(buf, "Core %d\n", data->core_id); |
79 | return ret; | 80 | return ret; |
80 | } | 81 | } |
81 | 82 | ||
@@ -304,6 +305,9 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
304 | } | 305 | } |
305 | 306 | ||
306 | data->id = pdev->id; | 307 | data->id = pdev->id; |
308 | #ifdef CONFIG_SMP | ||
309 | data->core_id = c->cpu_core_id; | ||
310 | #endif | ||
307 | data->name = "coretemp"; | 311 | data->name = "coretemp"; |
308 | mutex_init(&data->update_lock); | 312 | mutex_init(&data->update_lock); |
309 | 313 | ||
@@ -405,6 +409,10 @@ struct pdev_entry { | |||
405 | struct list_head list; | 409 | struct list_head list; |
406 | struct platform_device *pdev; | 410 | struct platform_device *pdev; |
407 | unsigned int cpu; | 411 | unsigned int cpu; |
412 | #ifdef CONFIG_SMP | ||
413 | u16 phys_proc_id; | ||
414 | u16 cpu_core_id; | ||
415 | #endif | ||
408 | }; | 416 | }; |
409 | 417 | ||
410 | static LIST_HEAD(pdev_list); | 418 | static LIST_HEAD(pdev_list); |
@@ -415,6 +423,22 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
415 | int err; | 423 | int err; |
416 | struct platform_device *pdev; | 424 | struct platform_device *pdev; |
417 | struct pdev_entry *pdev_entry; | 425 | struct pdev_entry *pdev_entry; |
426 | #ifdef CONFIG_SMP | ||
427 | struct cpuinfo_x86 *c = &cpu_data(cpu); | ||
428 | #endif | ||
429 | |||
430 | mutex_lock(&pdev_list_mutex); | ||
431 | |||
432 | #ifdef CONFIG_SMP | ||
433 | /* Skip second HT entry of each core */ | ||
434 | list_for_each_entry(pdev_entry, &pdev_list, list) { | ||
435 | if (c->phys_proc_id == pdev_entry->phys_proc_id && | ||
436 | c->cpu_core_id == pdev_entry->cpu_core_id) { | ||
437 | err = 0; /* Not an error */ | ||
438 | goto exit; | ||
439 | } | ||
440 | } | ||
441 | #endif | ||
418 | 442 | ||
419 | pdev = platform_device_alloc(DRVNAME, cpu); | 443 | pdev = platform_device_alloc(DRVNAME, cpu); |
420 | if (!pdev) { | 444 | if (!pdev) { |
@@ -438,7 +462,10 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
438 | 462 | ||
439 | pdev_entry->pdev = pdev; | 463 | pdev_entry->pdev = pdev; |
440 | pdev_entry->cpu = cpu; | 464 | pdev_entry->cpu = cpu; |
441 | mutex_lock(&pdev_list_mutex); | 465 | #ifdef CONFIG_SMP |
466 | pdev_entry->phys_proc_id = c->phys_proc_id; | ||
467 | pdev_entry->cpu_core_id = c->cpu_core_id; | ||
468 | #endif | ||
442 | list_add_tail(&pdev_entry->list, &pdev_list); | 469 | list_add_tail(&pdev_entry->list, &pdev_list); |
443 | mutex_unlock(&pdev_list_mutex); | 470 | mutex_unlock(&pdev_list_mutex); |
444 | 471 | ||
@@ -449,6 +476,7 @@ exit_device_free: | |||
449 | exit_device_put: | 476 | exit_device_put: |
450 | platform_device_put(pdev); | 477 | platform_device_put(pdev); |
451 | exit: | 478 | exit: |
479 | mutex_unlock(&pdev_list_mutex); | ||
452 | return err; | 480 | return err; |
453 | } | 481 | } |
454 | 482 | ||
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index e880e2c3871d..937983407e2a 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -289,6 +289,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
289 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | 289 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; |
290 | iattr->s_attr.dev_attr.show = show_label; | 290 | iattr->s_attr.dev_attr.show = show_label; |
291 | iattr->s_attr.index = k; | 291 | iattr->s_attr.index = k; |
292 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
292 | res = device_create_file(&pdev->dev, | 293 | res = device_create_file(&pdev->dev, |
293 | &iattr->s_attr.dev_attr); | 294 | &iattr->s_attr.dev_attr); |
294 | if (res) | 295 | if (res) |
@@ -303,6 +304,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
303 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | 304 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; |
304 | iattr->s_attr.dev_attr.show = show_amb_temp; | 305 | iattr->s_attr.dev_attr.show = show_amb_temp; |
305 | iattr->s_attr.index = k; | 306 | iattr->s_attr.index = k; |
307 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
306 | res = device_create_file(&pdev->dev, | 308 | res = device_create_file(&pdev->dev, |
307 | &iattr->s_attr.dev_attr); | 309 | &iattr->s_attr.dev_attr); |
308 | if (res) | 310 | if (res) |
@@ -318,6 +320,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
318 | iattr->s_attr.dev_attr.show = show_amb_min; | 320 | iattr->s_attr.dev_attr.show = show_amb_min; |
319 | iattr->s_attr.dev_attr.store = store_amb_min; | 321 | iattr->s_attr.dev_attr.store = store_amb_min; |
320 | iattr->s_attr.index = k; | 322 | iattr->s_attr.index = k; |
323 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
321 | res = device_create_file(&pdev->dev, | 324 | res = device_create_file(&pdev->dev, |
322 | &iattr->s_attr.dev_attr); | 325 | &iattr->s_attr.dev_attr); |
323 | if (res) | 326 | if (res) |
@@ -333,6 +336,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
333 | iattr->s_attr.dev_attr.show = show_amb_mid; | 336 | iattr->s_attr.dev_attr.show = show_amb_mid; |
334 | iattr->s_attr.dev_attr.store = store_amb_mid; | 337 | iattr->s_attr.dev_attr.store = store_amb_mid; |
335 | iattr->s_attr.index = k; | 338 | iattr->s_attr.index = k; |
339 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
336 | res = device_create_file(&pdev->dev, | 340 | res = device_create_file(&pdev->dev, |
337 | &iattr->s_attr.dev_attr); | 341 | &iattr->s_attr.dev_attr); |
338 | if (res) | 342 | if (res) |
@@ -348,6 +352,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
348 | iattr->s_attr.dev_attr.show = show_amb_max; | 352 | iattr->s_attr.dev_attr.show = show_amb_max; |
349 | iattr->s_attr.dev_attr.store = store_amb_max; | 353 | iattr->s_attr.dev_attr.store = store_amb_max; |
350 | iattr->s_attr.index = k; | 354 | iattr->s_attr.index = k; |
355 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
351 | res = device_create_file(&pdev->dev, | 356 | res = device_create_file(&pdev->dev, |
352 | &iattr->s_attr.dev_attr); | 357 | &iattr->s_attr.dev_attr); |
353 | if (res) | 358 | if (res) |
@@ -362,6 +367,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
362 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | 367 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; |
363 | iattr->s_attr.dev_attr.show = show_amb_alarm; | 368 | iattr->s_attr.dev_attr.show = show_amb_alarm; |
364 | iattr->s_attr.index = k; | 369 | iattr->s_attr.index = k; |
370 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
365 | res = device_create_file(&pdev->dev, | 371 | res = device_create_file(&pdev->dev, |
366 | &iattr->s_attr.dev_attr); | 372 | &iattr->s_attr.dev_attr); |
367 | if (res) | 373 | if (res) |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 5be09c048c5f..25763d2223b6 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -80,6 +80,13 @@ superio_inb(int reg) | |||
80 | return inb(VAL); | 80 | return inb(VAL); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline void | ||
84 | superio_outb(int reg, int val) | ||
85 | { | ||
86 | outb(reg, REG); | ||
87 | outb(val, VAL); | ||
88 | } | ||
89 | |||
83 | static int superio_inw(int reg) | 90 | static int superio_inw(int reg) |
84 | { | 91 | { |
85 | int val; | 92 | int val; |
@@ -1517,6 +1524,21 @@ static int __init it87_find(unsigned short *address, | |||
1517 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); | 1524 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); |
1518 | 1525 | ||
1519 | reg = superio_inb(IT87_SIO_PINX2_REG); | 1526 | reg = superio_inb(IT87_SIO_PINX2_REG); |
1527 | /* | ||
1528 | * The IT8720F has no VIN7 pin, so VCCH should always be | ||
1529 | * routed internally to VIN7 with an internal divider. | ||
1530 | * Curiously, there still is a configuration bit to control | ||
1531 | * this, which means it can be set incorrectly. And even | ||
1532 | * more curiously, many boards out there are improperly | ||
1533 | * configured, even though the IT8720F datasheet claims | ||
1534 | * that the internal routing of VCCH to VIN7 is the default | ||
1535 | * setting. So we force the internal routing in this case. | ||
1536 | */ | ||
1537 | if (sio_data->type == it8720 && !(reg & (1 << 1))) { | ||
1538 | reg |= (1 << 1); | ||
1539 | superio_outb(IT87_SIO_PINX2_REG, reg); | ||
1540 | pr_notice("it87: Routing internal VCCH to in7\n"); | ||
1541 | } | ||
1520 | if (reg & (1 << 0)) | 1542 | if (reg & (1 << 0)) |
1521 | pr_info("it87: in3 is VCC (+5V)\n"); | 1543 | pr_info("it87: in3 is VCC (+5V)\n"); |
1522 | if (reg & (1 << 1)) | 1544 | if (reg & (1 << 1)) |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 099a2138cdf6..da5a2404cd3e 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -112,11 +112,21 @@ static bool __devinit has_erratum_319(struct pci_dev *pdev) | |||
112 | if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) | 112 | if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) |
113 | return false; | 113 | return false; |
114 | 114 | ||
115 | /* Differentiate between AM2+ (bad) and AM3 (good) */ | 115 | /* DDR3 memory implies socket AM3, which is good */ |
116 | pci_bus_read_config_dword(pdev->bus, | 116 | pci_bus_read_config_dword(pdev->bus, |
117 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), | 117 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), |
118 | REG_DCT0_CONFIG_HIGH, ®_dram_cfg); | 118 | REG_DCT0_CONFIG_HIGH, ®_dram_cfg); |
119 | return !(reg_dram_cfg & DDR3_MODE); | 119 | if (reg_dram_cfg & DDR3_MODE) |
120 | return false; | ||
121 | |||
122 | /* | ||
123 | * Unfortunately it is possible to run a socket AM3 CPU with DDR2 | ||
124 | * memory. We blacklist all the cores which do exist in socket AM2+ | ||
125 | * format. It still isn't perfect, as RB-C2 cores exist in both AM2+ | ||
126 | * and AM3 formats, but that's the best we can do. | ||
127 | */ | ||
128 | return boot_cpu_data.x86_model < 4 || | ||
129 | (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask <= 2); | ||
120 | } | 130 | } |
121 | 131 | ||
122 | static int __devinit k10temp_probe(struct pci_dev *pdev, | 132 | static int __devinit k10temp_probe(struct pci_dev *pdev, |
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index 0ceb6d6200a3..8bdf80d91598 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *dev, | |||
120 | int temp; | 120 | int temp; |
121 | struct k8temp_data *data = k8temp_update_device(dev); | 121 | struct k8temp_data *data = k8temp_update_device(dev); |
122 | 122 | ||
123 | if (data->swap_core_select) | 123 | if (data->swap_core_select && (data->sensorsp & SEL_CORE)) |
124 | core = core ? 0 : 1; | 124 | core = core ? 0 : 1; |
125 | 125 | ||
126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; | 126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; |
@@ -180,11 +180,13 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, | |||
180 | } | 180 | } |
181 | 181 | ||
182 | if ((model >= 0x69) && | 182 | if ((model >= 0x69) && |
183 | !(model == 0xc1 || model == 0x6c || model == 0x7c)) { | 183 | !(model == 0xc1 || model == 0x6c || model == 0x7c || |
184 | model == 0x6b || model == 0x6f || model == 0x7f)) { | ||
184 | /* | 185 | /* |
185 | * RevG desktop CPUs (i.e. no socket S1G1 parts) | 186 | * RevG desktop CPUs (i.e. no socket S1G1 or |
186 | * need additional offset, otherwise reported | 187 | * ASB1 parts) need additional offset, |
187 | * temperature is below ambient temperature | 188 | * otherwise reported temperature is below |
189 | * ambient temperature | ||
188 | */ | 190 | */ |
189 | data->temp_offset = 21000; | 191 | data->temp_offset = 21000; |
190 | } | 192 | } |