Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelva…
Browse files Browse the repository at this point in the history
…re-2.6

* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  hwmon/applesmc: Handle name file creation error and deletion
  hwmon/applesmc: Simplify dependencies
  hwmon-vid: Don't spam the logs when VRM version is missing
  hwmon/w83627hf: Be quiet when no chip is found
  hwmon/coretemp: Add more safety checks
  hwmon/ds1621: Fix swapped temperature limits
  • Loading branch information
Linus Torvalds committed May 29, 2007
2 parents 5566321 + 6996abf commit 358a9af
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 11 deletions.
2 changes: 1 addition & 1 deletion drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ config SENSORS_HDAPS

config SENSORS_APPLESMC
tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)"
depends on HWMON && INPUT && X86
depends on INPUT && X86
select NEW_LEDS
select LEDS_CLASS
default n
Expand Down
7 changes: 6 additions & 1 deletion drivers/hwmon/applesmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,11 +1206,13 @@ static int __init applesmc_init(void)
}

ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr);
if (ret)
goto out_device;

/* Create key enumeration sysfs files */
ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group);
if (ret)
goto out_device;
goto out_name;

/* create fan files */
count = applesmc_get_fan_count();
Expand Down Expand Up @@ -1310,6 +1312,8 @@ static int __init applesmc_init(void)
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
out_key_enumeration:
sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
out_name:
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
out_device:
platform_device_unregister(pdev);
out_driver:
Expand All @@ -1335,6 +1339,7 @@ static void __exit applesmc_exit(void)
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]);
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
platform_device_unregister(pdev);
platform_driver_unregister(&applesmc_driver);
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
Expand Down
32 changes: 29 additions & 3 deletions drivers/hwmon/coretemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
goto exit_free;
}

/* Check if we have problem with errata AE18 of Core processors:
Readings might stop update when processor visited too deep sleep,
fixed for stepping D0 (6EC).
*/

if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) {
/* check for microcode update */
rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx);
if (edx < 0x39) {
dev_err(&pdev->dev,
"Errata AE18 not fixed, update BIOS or "
"microcode of the CPU!\n");
goto exit_free;
}
}

/* Some processors have Tjmax 85 following magic should detect it
Intel won't disclose the information without signed NDA, but
individuals cannot sign it. Catch(ed) 22.
Expand All @@ -193,6 +209,19 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
}
}

/* Intel says that above should not work for desktop Core2 processors,
but it seems to work. There is no other way how get the absolute
readings. Warn the user about this. First check if are desktop,
bit 50 of MSR_IA32_PLATFORM_ID should be 0.
*/

rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx);

if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) {
dev_warn(&pdev->dev, "Using undocumented features, absolute "
"temperature might be wrong!\n");
}

platform_set_drvdata(pdev, data);

if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
Expand Down Expand Up @@ -330,9 +359,6 @@ static int __init coretemp_init(void)
int i, err = -ENODEV;
struct pdev_entry *p, *n;

printk(KERN_NOTICE DRVNAME ": This driver uses undocumented features "
"of Core CPU. Temperature might be wrong!\n");

/* quick check if we run Intel */
if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL)
goto exit;
Expand Down
8 changes: 4 additions & 4 deletions drivers/hwmon/ds1621.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ MODULE_PARM_DESC(polarity, "Output's polarity: 0 = active high, 1 = active low")

/* The DS1621 registers */
#define DS1621_REG_TEMP 0xAA /* word, RO */
#define DS1621_REG_TEMP_MIN 0xA1 /* word, RW */
#define DS1621_REG_TEMP_MAX 0xA2 /* word, RW */
#define DS1621_REG_TEMP_MIN 0xA2 /* word, RW */
#define DS1621_REG_TEMP_MAX 0xA1 /* word, RW */
#define DS1621_REG_CONF 0xAC /* byte, RW */
#define DS1621_COM_START 0xEE /* no data */
#define DS1621_COM_STOP 0x22 /* no data */
Expand Down Expand Up @@ -328,9 +328,9 @@ static struct ds1621_data *ds1621_update_client(struct device *dev)

/* reset alarms if necessary */
new_conf = data->conf;
if (data->temp < data->temp_min)
if (data->temp > data->temp_min)
new_conf &= ~DS1621_ALARM_TEMP_LOW;
if (data->temp > data->temp_max)
if (data->temp < data->temp_max)
new_conf &= ~DS1621_ALARM_TEMP_HIGH;
if (data->conf != new_conf)
ds1621_write_value(client, DS1621_REG_CONF,
Expand Down
4 changes: 3 additions & 1 deletion drivers/hwmon/hwmon-vid.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ int vid_from_reg(int val, u8 vrm)
val &= 0x7f;
return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000);
default: /* report 0 for unknown */
printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n");
if (vrm)
printk(KERN_WARNING "hwmon-vid: Requested unsupported "
"VRM version (%u)\n", (unsigned int)vrm);
return 0;
}
}
Expand Down
4 changes: 3 additions & 1 deletion drivers/hwmon/w83627hf.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,10 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr,
case W687THF_DEVID:
sio_data->type = w83687thf;
break;
case 0xff: /* No device at all */
goto exit;
default:
pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%x)\n", val);
pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%02x)\n", val);
goto exit;
}

Expand Down

0 comments on commit 358a9af

Please sign in to comment.