aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/k8temp.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/hwmon/k8temp.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/hwmon/k8temp.c')
-rw-r--r--drivers/hwmon/k8temp.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index 39ead2a4d3c5..b923bc2307ad 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -191,38 +191,31 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
191 model = boot_cpu_data.x86_model; 191 model = boot_cpu_data.x86_model;
192 stepping = boot_cpu_data.x86_mask; 192 stepping = boot_cpu_data.x86_mask;
193 193
194 switch (boot_cpu_data.x86) { 194 /* feature available since SH-C0, exclude older revisions */
195 case 0xf: 195 if (((model == 4) && (stepping == 0)) ||
196 /* feature available since SH-C0, exclude older revisions */ 196 ((model == 5) && (stepping <= 1))) {
197 if (((model == 4) && (stepping == 0)) || 197 err = -ENODEV;
198 ((model == 5) && (stepping <= 1))) { 198 goto exit_free;
199 err = -ENODEV; 199 }
200 goto exit_free;
201 }
202
203 /*
204 * AMD NPT family 0fh, i.e. RevF and RevG:
205 * meaning of SEL_CORE bit is inverted
206 */
207 if (model >= 0x40) {
208 data->swap_core_select = 1;
209 dev_warn(&pdev->dev, "Temperature readouts might be "
210 "wrong - check erratum #141\n");
211 }
212
213 if (is_rev_g_desktop(model)) {
214 /*
215 * RevG desktop CPUs (i.e. no socket S1G1 or
216 * ASB1 parts) need additional offset,
217 * otherwise reported temperature is below
218 * ambient temperature
219 */
220 data->temp_offset = 21000;
221 }
222 200
223 break; 201 /*
202 * AMD NPT family 0fh, i.e. RevF and RevG:
203 * meaning of SEL_CORE bit is inverted
204 */
205 if (model >= 0x40) {
206 data->swap_core_select = 1;
207 dev_warn(&pdev->dev, "Temperature readouts might be wrong - "
208 "check erratum #141\n");
224 } 209 }
225 210
211 /*
212 * RevG desktop CPUs (i.e. no socket S1G1 or ASB1 parts) need
213 * additional offset, otherwise reported temperature is below
214 * ambient temperature
215 */
216 if (is_rev_g_desktop(model))
217 data->temp_offset = 21000;
218
226 pci_read_config_byte(pdev, REG_TEMP, &scfg); 219 pci_read_config_byte(pdev, REG_TEMP, &scfg);
227 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ 220 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
228 pci_write_config_byte(pdev, REG_TEMP, scfg); 221 pci_write_config_byte(pdev, REG_TEMP, scfg);
@@ -259,7 +252,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
259 252
260 data->name = "k8temp"; 253 data->name = "k8temp";
261 mutex_init(&data->update_lock); 254 mutex_init(&data->update_lock);
262 dev_set_drvdata(&pdev->dev, data); 255 pci_set_drvdata(pdev, data);
263 256
264 /* Register sysfs hooks */ 257 /* Register sysfs hooks */
265 err = device_create_file(&pdev->dev, 258 err = device_create_file(&pdev->dev,
@@ -314,7 +307,7 @@ exit_remove:
314 &sensor_dev_attr_temp4_input.dev_attr); 307 &sensor_dev_attr_temp4_input.dev_attr);
315 device_remove_file(&pdev->dev, &dev_attr_name); 308 device_remove_file(&pdev->dev, &dev_attr_name);
316exit_free: 309exit_free:
317 dev_set_drvdata(&pdev->dev, NULL); 310 pci_set_drvdata(pdev, NULL);
318 kfree(data); 311 kfree(data);
319exit: 312exit:
320 return err; 313 return err;
@@ -322,7 +315,7 @@ exit:
322 315
323static void __devexit k8temp_remove(struct pci_dev *pdev) 316static void __devexit k8temp_remove(struct pci_dev *pdev)
324{ 317{
325 struct k8temp_data *data = dev_get_drvdata(&pdev->dev); 318 struct k8temp_data *data = pci_get_drvdata(pdev);
326 319
327 hwmon_device_unregister(data->hwmon_dev); 320 hwmon_device_unregister(data->hwmon_dev);
328 device_remove_file(&pdev->dev, 321 device_remove_file(&pdev->dev,
@@ -334,7 +327,7 @@ static void __devexit k8temp_remove(struct pci_dev *pdev)
334 device_remove_file(&pdev->dev, 327 device_remove_file(&pdev->dev,
335 &sensor_dev_attr_temp4_input.dev_attr); 328 &sensor_dev_attr_temp4_input.dev_attr);
336 device_remove_file(&pdev->dev, &dev_attr_name); 329 device_remove_file(&pdev->dev, &dev_attr_name);
337 dev_set_drvdata(&pdev->dev, NULL); 330 pci_set_drvdata(pdev, NULL);
338 kfree(data); 331 kfree(data);
339} 332}
340 333