diff options
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/hwmon/adm1031.c | 43 | ||||
| -rw-r--r-- | drivers/hwmon/coretemp.c | 57 | ||||
| -rw-r--r-- | drivers/hwmon/emc1403.c | 1 | ||||
| -rw-r--r-- | drivers/hwmon/f71882fg.c | 32 | ||||
| -rw-r--r-- | drivers/hwmon/f75375s.c | 6 | ||||
| -rw-r--r-- | drivers/hwmon/hp_accel.c | 2 | ||||
| -rw-r--r-- | drivers/hwmon/lis3lv02d.c | 4 | ||||
| -rw-r--r-- | drivers/hwmon/lis3lv02d_i2c.c | 4 | ||||
| -rw-r--r-- | drivers/hwmon/lis3lv02d_spi.c | 4 | ||||
| -rw-r--r-- | drivers/hwmon/lm95241.c | 21 | ||||
| -rw-r--r-- | drivers/hwmon/pkgtemp.c | 23 | ||||
| -rw-r--r-- | drivers/hwmon/w83627ehf.c | 1 |
13 files changed, 111 insertions, 89 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4d4d09bdec0a..97499d00615a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -409,7 +409,7 @@ config SENSORS_CORETEMP | |||
| 409 | 409 | ||
| 410 | config SENSORS_PKGTEMP | 410 | config SENSORS_PKGTEMP |
| 411 | tristate "Intel processor package temperature sensor" | 411 | tristate "Intel processor package temperature sensor" |
| 412 | depends on X86 && PCI && EXPERIMENTAL | 412 | depends on X86 && EXPERIMENTAL |
| 413 | help | 413 | help |
| 414 | If you say yes here you get support for the package level temperature | 414 | If you say yes here you get support for the package level temperature |
| 415 | sensor inside your CPU. Check documentation/driver for details. | 415 | sensor inside your CPU. Check documentation/driver for details. |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 15c1a9616af3..0683e6be662c 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
| @@ -79,7 +79,7 @@ struct adm1031_data { | |||
| 79 | int chip_type; | 79 | int chip_type; |
| 80 | char valid; /* !=0 if following fields are valid */ | 80 | char valid; /* !=0 if following fields are valid */ |
| 81 | unsigned long last_updated; /* In jiffies */ | 81 | unsigned long last_updated; /* In jiffies */ |
| 82 | unsigned int update_rate; /* In milliseconds */ | 82 | unsigned int update_interval; /* In milliseconds */ |
| 83 | /* The chan_select_table contains the possible configurations for | 83 | /* The chan_select_table contains the possible configurations for |
| 84 | * auto fan control. | 84 | * auto fan control. |
| 85 | */ | 85 | */ |
| @@ -743,23 +743,23 @@ static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, 12); | |||
| 743 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 13); | 743 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 13); |
| 744 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 14); | 744 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 14); |
| 745 | 745 | ||
| 746 | /* Update Rate */ | 746 | /* Update Interval */ |
| 747 | static const unsigned int update_rates[] = { | 747 | static const unsigned int update_intervals[] = { |
| 748 | 16000, 8000, 4000, 2000, 1000, 500, 250, 125, | 748 | 16000, 8000, 4000, 2000, 1000, 500, 250, 125, |
| 749 | }; | 749 | }; |
| 750 | 750 | ||
| 751 | static ssize_t show_update_rate(struct device *dev, | 751 | static ssize_t show_update_interval(struct device *dev, |
| 752 | struct device_attribute *attr, char *buf) | 752 | struct device_attribute *attr, char *buf) |
| 753 | { | 753 | { |
| 754 | struct i2c_client *client = to_i2c_client(dev); | 754 | struct i2c_client *client = to_i2c_client(dev); |
| 755 | struct adm1031_data *data = i2c_get_clientdata(client); | 755 | struct adm1031_data *data = i2c_get_clientdata(client); |
| 756 | 756 | ||
| 757 | return sprintf(buf, "%u\n", data->update_rate); | 757 | return sprintf(buf, "%u\n", data->update_interval); |
| 758 | } | 758 | } |
| 759 | 759 | ||
| 760 | static ssize_t set_update_rate(struct device *dev, | 760 | static ssize_t set_update_interval(struct device *dev, |
| 761 | struct device_attribute *attr, | 761 | struct device_attribute *attr, |
| 762 | const char *buf, size_t count) | 762 | const char *buf, size_t count) |
| 763 | { | 763 | { |
| 764 | struct i2c_client *client = to_i2c_client(dev); | 764 | struct i2c_client *client = to_i2c_client(dev); |
| 765 | struct adm1031_data *data = i2c_get_clientdata(client); | 765 | struct adm1031_data *data = i2c_get_clientdata(client); |
| @@ -771,12 +771,15 @@ static ssize_t set_update_rate(struct device *dev, | |||
| 771 | if (err) | 771 | if (err) |
| 772 | return err; | 772 | return err; |
| 773 | 773 | ||
| 774 | /* find the nearest update rate from the table */ | 774 | /* |
| 775 | for (i = 0; i < ARRAY_SIZE(update_rates) - 1; i++) { | 775 | * Find the nearest update interval from the table. |
| 776 | if (val >= update_rates[i]) | 776 | * Use it to determine the matching update rate. |
| 777 | */ | ||
| 778 | for (i = 0; i < ARRAY_SIZE(update_intervals) - 1; i++) { | ||
| 779 | if (val >= update_intervals[i]) | ||
| 777 | break; | 780 | break; |
| 778 | } | 781 | } |
| 779 | /* if not found, we point to the last entry (lowest update rate) */ | 782 | /* if not found, we point to the last entry (lowest update interval) */ |
| 780 | 783 | ||
| 781 | /* set the new update rate while preserving other settings */ | 784 | /* set the new update rate while preserving other settings */ |
| 782 | reg = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); | 785 | reg = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); |
| @@ -785,14 +788,14 @@ static ssize_t set_update_rate(struct device *dev, | |||
| 785 | adm1031_write_value(client, ADM1031_REG_FAN_FILTER, reg); | 788 | adm1031_write_value(client, ADM1031_REG_FAN_FILTER, reg); |
| 786 | 789 | ||
| 787 | mutex_lock(&data->update_lock); | 790 | mutex_lock(&data->update_lock); |
| 788 | data->update_rate = update_rates[i]; | 791 | data->update_interval = update_intervals[i]; |
| 789 | mutex_unlock(&data->update_lock); | 792 | mutex_unlock(&data->update_lock); |
| 790 | 793 | ||
| 791 | return count; | 794 | return count; |
| 792 | } | 795 | } |
| 793 | 796 | ||
| 794 | static DEVICE_ATTR(update_rate, S_IRUGO | S_IWUSR, show_update_rate, | 797 | static DEVICE_ATTR(update_interval, S_IRUGO | S_IWUSR, show_update_interval, |
| 795 | set_update_rate); | 798 | set_update_interval); |
| 796 | 799 | ||
| 797 | static struct attribute *adm1031_attributes[] = { | 800 | static struct attribute *adm1031_attributes[] = { |
| 798 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 801 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
| @@ -830,7 +833,7 @@ static struct attribute *adm1031_attributes[] = { | |||
| 830 | 833 | ||
| 831 | &sensor_dev_attr_auto_fan1_min_pwm.dev_attr.attr, | 834 | &sensor_dev_attr_auto_fan1_min_pwm.dev_attr.attr, |
| 832 | 835 | ||
| 833 | &dev_attr_update_rate.attr, | 836 | &dev_attr_update_interval.attr, |
| 834 | &dev_attr_alarms.attr, | 837 | &dev_attr_alarms.attr, |
| 835 | 838 | ||
| 836 | NULL | 839 | NULL |
| @@ -981,7 +984,8 @@ static void adm1031_init_client(struct i2c_client *client) | |||
| 981 | mask = ADM1031_UPDATE_RATE_MASK; | 984 | mask = ADM1031_UPDATE_RATE_MASK; |
| 982 | read_val = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); | 985 | read_val = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); |
| 983 | i = (read_val & mask) >> ADM1031_UPDATE_RATE_SHIFT; | 986 | i = (read_val & mask) >> ADM1031_UPDATE_RATE_SHIFT; |
| 984 | data->update_rate = update_rates[i]; | 987 | /* Save it as update interval */ |
| 988 | data->update_interval = update_intervals[i]; | ||
| 985 | } | 989 | } |
| 986 | 990 | ||
| 987 | static struct adm1031_data *adm1031_update_device(struct device *dev) | 991 | static struct adm1031_data *adm1031_update_device(struct device *dev) |
| @@ -993,7 +997,8 @@ static struct adm1031_data *adm1031_update_device(struct device *dev) | |||
| 993 | 997 | ||
| 994 | mutex_lock(&data->update_lock); | 998 | mutex_lock(&data->update_lock); |
| 995 | 999 | ||
| 996 | next_update = data->last_updated + msecs_to_jiffies(data->update_rate); | 1000 | next_update = data->last_updated |
| 1001 | + msecs_to_jiffies(data->update_interval); | ||
| 997 | if (time_after(jiffies, next_update) || !data->valid) { | 1002 | if (time_after(jiffies, next_update) || !data->valid) { |
| 998 | 1003 | ||
| 999 | dev_dbg(&client->dev, "Starting adm1031 update\n"); | 1004 | dev_dbg(&client->dev, "Starting adm1031 update\n"); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index de8111114f46..a23b17a78ace 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
| 37 | #include <asm/msr.h> | 37 | #include <asm/msr.h> |
| 38 | #include <asm/processor.h> | 38 | #include <asm/processor.h> |
| 39 | #include <asm/smp.h> | ||
| 39 | 40 | ||
| 40 | #define DRVNAME "coretemp" | 41 | #define DRVNAME "coretemp" |
| 41 | 42 | ||
| @@ -423,9 +424,18 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
| 423 | int err; | 424 | int err; |
| 424 | struct platform_device *pdev; | 425 | struct platform_device *pdev; |
| 425 | struct pdev_entry *pdev_entry; | 426 | struct pdev_entry *pdev_entry; |
| 426 | #ifdef CONFIG_SMP | ||
| 427 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 427 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 428 | #endif | 428 | |
| 429 | /* | ||
| 430 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal | ||
| 431 | * sensors. We check this bit only, all the early CPUs | ||
| 432 | * without thermal sensors will be filtered out. | ||
| 433 | */ | ||
| 434 | if (!cpu_has(c, X86_FEATURE_DTS)) { | ||
| 435 | printk(KERN_INFO DRVNAME ": CPU (model=0x%x)" | ||
| 436 | " has no thermal sensor.\n", c->x86_model); | ||
| 437 | return 0; | ||
| 438 | } | ||
| 429 | 439 | ||
| 430 | mutex_lock(&pdev_list_mutex); | 440 | mutex_lock(&pdev_list_mutex); |
| 431 | 441 | ||
| @@ -482,14 +492,22 @@ exit: | |||
| 482 | 492 | ||
| 483 | static void coretemp_device_remove(unsigned int cpu) | 493 | static void coretemp_device_remove(unsigned int cpu) |
| 484 | { | 494 | { |
| 485 | struct pdev_entry *p, *n; | 495 | struct pdev_entry *p; |
| 496 | unsigned int i; | ||
| 497 | |||
| 486 | mutex_lock(&pdev_list_mutex); | 498 | mutex_lock(&pdev_list_mutex); |
| 487 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 499 | list_for_each_entry(p, &pdev_list, list) { |
| 488 | if (p->cpu == cpu) { | 500 | if (p->cpu != cpu) |
| 489 | platform_device_unregister(p->pdev); | 501 | continue; |
| 490 | list_del(&p->list); | 502 | |
| 491 | kfree(p); | 503 | platform_device_unregister(p->pdev); |
| 492 | } | 504 | list_del(&p->list); |
| 505 | mutex_unlock(&pdev_list_mutex); | ||
| 506 | kfree(p); | ||
| 507 | for_each_cpu(i, cpu_sibling_mask(cpu)) | ||
| 508 | if (i != cpu && !coretemp_device_add(i)) | ||
| 509 | break; | ||
| 510 | return; | ||
| 493 | } | 511 | } |
| 494 | mutex_unlock(&pdev_list_mutex); | 512 | mutex_unlock(&pdev_list_mutex); |
| 495 | } | 513 | } |
| @@ -527,30 +545,21 @@ static int __init coretemp_init(void) | |||
| 527 | if (err) | 545 | if (err) |
| 528 | goto exit; | 546 | goto exit; |
| 529 | 547 | ||
| 530 | for_each_online_cpu(i) { | 548 | for_each_online_cpu(i) |
| 531 | struct cpuinfo_x86 *c = &cpu_data(i); | 549 | coretemp_device_add(i); |
| 532 | /* | 550 | |
| 533 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal | 551 | #ifndef CONFIG_HOTPLUG_CPU |
| 534 | * sensors. We check this bit only, all the early CPUs | ||
| 535 | * without thermal sensors will be filtered out. | ||
| 536 | */ | ||
| 537 | if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) | ||
| 538 | coretemp_device_add(i); | ||
| 539 | else { | ||
| 540 | printk(KERN_INFO DRVNAME ": CPU (model=0x%x)" | ||
| 541 | " has no thermal sensor.\n", c->x86_model); | ||
| 542 | } | ||
| 543 | } | ||
| 544 | if (list_empty(&pdev_list)) { | 552 | if (list_empty(&pdev_list)) { |
| 545 | err = -ENODEV; | 553 | err = -ENODEV; |
| 546 | goto exit_driver_unreg; | 554 | goto exit_driver_unreg; |
| 547 | } | 555 | } |
| 556 | #endif | ||
| 548 | 557 | ||
| 549 | register_hotcpu_notifier(&coretemp_cpu_notifier); | 558 | register_hotcpu_notifier(&coretemp_cpu_notifier); |
| 550 | return 0; | 559 | return 0; |
| 551 | 560 | ||
| 552 | exit_driver_unreg: | ||
| 553 | #ifndef CONFIG_HOTPLUG_CPU | 561 | #ifndef CONFIG_HOTPLUG_CPU |
| 562 | exit_driver_unreg: | ||
| 554 | platform_driver_unregister(&coretemp_driver); | 563 | platform_driver_unregister(&coretemp_driver); |
| 555 | #endif | 564 | #endif |
| 556 | exit: | 565 | exit: |
diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c index 5b58b20dead1..8dee3f38fdfb 100644 --- a/drivers/hwmon/emc1403.c +++ b/drivers/hwmon/emc1403.c | |||
| @@ -308,7 +308,6 @@ static int emc1403_probe(struct i2c_client *client, | |||
| 308 | res = sysfs_create_group(&client->dev.kobj, &m_thermal_gr); | 308 | res = sysfs_create_group(&client->dev.kobj, &m_thermal_gr); |
| 309 | if (res) { | 309 | if (res) { |
| 310 | dev_warn(&client->dev, "create group failed\n"); | 310 | dev_warn(&client->dev, "create group failed\n"); |
| 311 | hwmon_device_unregister(data->hwmon_dev); | ||
| 312 | goto thermal_error1; | 311 | goto thermal_error1; |
| 313 | } | 312 | } |
| 314 | data->hwmon_dev = hwmon_device_register(&client->dev); | 313 | data->hwmon_dev = hwmon_device_register(&client->dev); |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 537841ef44b9..75afb3b0e076 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
| @@ -111,7 +111,7 @@ static struct platform_device *f71882fg_pdev; | |||
| 111 | /* Super-I/O Function prototypes */ | 111 | /* Super-I/O Function prototypes */ |
| 112 | static inline int superio_inb(int base, int reg); | 112 | static inline int superio_inb(int base, int reg); |
| 113 | static inline int superio_inw(int base, int reg); | 113 | static inline int superio_inw(int base, int reg); |
| 114 | static inline void superio_enter(int base); | 114 | static inline int superio_enter(int base); |
| 115 | static inline void superio_select(int base, int ld); | 115 | static inline void superio_select(int base, int ld); |
| 116 | static inline void superio_exit(int base); | 116 | static inline void superio_exit(int base); |
| 117 | 117 | ||
| @@ -861,11 +861,20 @@ static int superio_inw(int base, int reg) | |||
| 861 | return val; | 861 | return val; |
| 862 | } | 862 | } |
| 863 | 863 | ||
| 864 | static inline void superio_enter(int base) | 864 | static inline int superio_enter(int base) |
| 865 | { | 865 | { |
| 866 | /* Don't step on other drivers' I/O space by accident */ | ||
| 867 | if (!request_muxed_region(base, 2, DRVNAME)) { | ||
| 868 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | ||
| 869 | base); | ||
| 870 | return -EBUSY; | ||
| 871 | } | ||
| 872 | |||
| 866 | /* according to the datasheet the key must be send twice! */ | 873 | /* according to the datasheet the key must be send twice! */ |
| 867 | outb(SIO_UNLOCK_KEY, base); | 874 | outb(SIO_UNLOCK_KEY, base); |
| 868 | outb(SIO_UNLOCK_KEY, base); | 875 | outb(SIO_UNLOCK_KEY, base); |
| 876 | |||
| 877 | return 0; | ||
| 869 | } | 878 | } |
| 870 | 879 | ||
| 871 | static inline void superio_select(int base, int ld) | 880 | static inline void superio_select(int base, int ld) |
| @@ -877,6 +886,7 @@ static inline void superio_select(int base, int ld) | |||
| 877 | static inline void superio_exit(int base) | 886 | static inline void superio_exit(int base) |
| 878 | { | 887 | { |
| 879 | outb(SIO_LOCK_KEY, base); | 888 | outb(SIO_LOCK_KEY, base); |
| 889 | release_region(base, 2); | ||
| 880 | } | 890 | } |
| 881 | 891 | ||
| 882 | static inline int fan_from_reg(u16 reg) | 892 | static inline int fan_from_reg(u16 reg) |
| @@ -2175,21 +2185,15 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
| 2175 | static int __init f71882fg_find(int sioaddr, unsigned short *address, | 2185 | static int __init f71882fg_find(int sioaddr, unsigned short *address, |
| 2176 | struct f71882fg_sio_data *sio_data) | 2186 | struct f71882fg_sio_data *sio_data) |
| 2177 | { | 2187 | { |
| 2178 | int err = -ENODEV; | ||
| 2179 | u16 devid; | 2188 | u16 devid; |
| 2180 | 2189 | int err = superio_enter(sioaddr); | |
| 2181 | /* Don't step on other drivers' I/O space by accident */ | 2190 | if (err) |
| 2182 | if (!request_region(sioaddr, 2, DRVNAME)) { | 2191 | return err; |
| 2183 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | ||
| 2184 | (int)sioaddr); | ||
| 2185 | return -EBUSY; | ||
| 2186 | } | ||
| 2187 | |||
| 2188 | superio_enter(sioaddr); | ||
| 2189 | 2192 | ||
| 2190 | devid = superio_inw(sioaddr, SIO_REG_MANID); | 2193 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
| 2191 | if (devid != SIO_FINTEK_ID) { | 2194 | if (devid != SIO_FINTEK_ID) { |
| 2192 | pr_debug(DRVNAME ": Not a Fintek device\n"); | 2195 | pr_debug(DRVNAME ": Not a Fintek device\n"); |
| 2196 | err = -ENODEV; | ||
| 2193 | goto exit; | 2197 | goto exit; |
| 2194 | } | 2198 | } |
| 2195 | 2199 | ||
| @@ -2213,6 +2217,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
| 2213 | default: | 2217 | default: |
| 2214 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", | 2218 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", |
| 2215 | (unsigned int)devid); | 2219 | (unsigned int)devid); |
| 2220 | err = -ENODEV; | ||
| 2216 | goto exit; | 2221 | goto exit; |
| 2217 | } | 2222 | } |
| 2218 | 2223 | ||
| @@ -2223,12 +2228,14 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
| 2223 | 2228 | ||
| 2224 | if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { | 2229 | if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { |
| 2225 | printk(KERN_WARNING DRVNAME ": Device not activated\n"); | 2230 | printk(KERN_WARNING DRVNAME ": Device not activated\n"); |
| 2231 | err = -ENODEV; | ||
| 2226 | goto exit; | 2232 | goto exit; |
| 2227 | } | 2233 | } |
| 2228 | 2234 | ||
| 2229 | *address = superio_inw(sioaddr, SIO_REG_ADDR); | 2235 | *address = superio_inw(sioaddr, SIO_REG_ADDR); |
| 2230 | if (*address == 0) { | 2236 | if (*address == 0) { |
| 2231 | printk(KERN_WARNING DRVNAME ": Base address not set\n"); | 2237 | printk(KERN_WARNING DRVNAME ": Base address not set\n"); |
| 2238 | err = -ENODEV; | ||
| 2232 | goto exit; | 2239 | goto exit; |
| 2233 | } | 2240 | } |
| 2234 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ | 2241 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ |
| @@ -2239,7 +2246,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
| 2239 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); | 2246 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); |
| 2240 | exit: | 2247 | exit: |
| 2241 | superio_exit(sioaddr); | 2248 | superio_exit(sioaddr); |
| 2242 | release_region(sioaddr, 2); | ||
| 2243 | return err; | 2249 | return err; |
| 2244 | } | 2250 | } |
| 2245 | 2251 | ||
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 0f58ecc5334d..9638d58f99fd 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
| @@ -79,7 +79,7 @@ enum chips { f75373, f75375 }; | |||
| 79 | #define F75375_REG_PWM2_DROP_DUTY 0x6C | 79 | #define F75375_REG_PWM2_DROP_DUTY 0x6C |
| 80 | 80 | ||
| 81 | #define FAN_CTRL_LINEAR(nr) (4 + nr) | 81 | #define FAN_CTRL_LINEAR(nr) (4 + nr) |
| 82 | #define FAN_CTRL_MODE(nr) (5 + ((nr) * 2)) | 82 | #define FAN_CTRL_MODE(nr) (4 + ((nr) * 2)) |
| 83 | 83 | ||
| 84 | /* | 84 | /* |
| 85 | * Data structures and manipulation thereof | 85 | * Data structures and manipulation thereof |
| @@ -298,7 +298,7 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) | |||
| 298 | return -EINVAL; | 298 | return -EINVAL; |
| 299 | 299 | ||
| 300 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); | 300 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); |
| 301 | fanmode = ~(3 << FAN_CTRL_MODE(nr)); | 301 | fanmode &= ~(3 << FAN_CTRL_MODE(nr)); |
| 302 | 302 | ||
| 303 | switch (val) { | 303 | switch (val) { |
| 304 | case 0: /* Full speed */ | 304 | case 0: /* Full speed */ |
| @@ -350,7 +350,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
| 350 | 350 | ||
| 351 | mutex_lock(&data->update_lock); | 351 | mutex_lock(&data->update_lock); |
| 352 | conf = f75375_read8(client, F75375_REG_CONFIG1); | 352 | conf = f75375_read8(client, F75375_REG_CONFIG1); |
| 353 | conf = ~(1 << FAN_CTRL_LINEAR(nr)); | 353 | conf &= ~(1 << FAN_CTRL_LINEAR(nr)); |
| 354 | 354 | ||
| 355 | if (val == 0) | 355 | if (val == 0) |
| 356 | conf |= (1 << FAN_CTRL_LINEAR(nr)) ; | 356 | conf |= (1 << FAN_CTRL_LINEAR(nr)) ; |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index 7580f55e67e3..36e957532230 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
| @@ -221,6 +221,8 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
| 221 | AXIS_DMI_MATCH("HPB442x", "HP ProBook 442", xy_rotated_left), | 221 | AXIS_DMI_MATCH("HPB442x", "HP ProBook 442", xy_rotated_left), |
| 222 | AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted), | 222 | AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted), |
| 223 | AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap), | 223 | AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap), |
| 224 | AXIS_DMI_MATCH("HPB532x", "HP ProBook 532", y_inverted), | ||
| 225 | AXIS_DMI_MATCH("Mini5102", "HP Mini 5102", xy_rotated_left_usd), | ||
| 224 | { NULL, } | 226 | { NULL, } |
| 225 | /* Laptop models without axis info (yet): | 227 | /* Laptop models without axis info (yet): |
| 226 | * "NC6910" "HP Compaq 6910" | 228 | * "NC6910" "HP Compaq 6910" |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 6138f036b159..fc591ae53107 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
| @@ -277,7 +277,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy) | |||
| 277 | wake_up_interruptible(&lis3_dev.misc_wait); | 277 | wake_up_interruptible(&lis3_dev.misc_wait); |
| 278 | kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); | 278 | kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); |
| 279 | out: | 279 | out: |
| 280 | if (lis3_dev.whoami == WAI_8B && lis3_dev.idev && | 280 | if (lis3_dev.pdata && lis3_dev.whoami == WAI_8B && lis3_dev.idev && |
| 281 | lis3_dev.idev->input->users) | 281 | lis3_dev.idev->input->users) |
| 282 | return IRQ_WAKE_THREAD; | 282 | return IRQ_WAKE_THREAD; |
| 283 | return IRQ_HANDLED; | 283 | return IRQ_HANDLED; |
| @@ -718,7 +718,7 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) | |||
| 718 | * io-apic is not configurable (and generates a warning) but I keep it | 718 | * io-apic is not configurable (and generates a warning) but I keep it |
| 719 | * in case of support for other hardware. | 719 | * in case of support for other hardware. |
| 720 | */ | 720 | */ |
| 721 | if (dev->whoami == WAI_8B) | 721 | if (dev->pdata && dev->whoami == WAI_8B) |
| 722 | thread_fn = lis302dl_interrupt_thread1_8b; | 722 | thread_fn = lis302dl_interrupt_thread1_8b; |
| 723 | else | 723 | else |
| 724 | thread_fn = NULL; | 724 | thread_fn = NULL; |
diff --git a/drivers/hwmon/lis3lv02d_i2c.c b/drivers/hwmon/lis3lv02d_i2c.c index dc1f5402c1d7..8e5933b72d19 100644 --- a/drivers/hwmon/lis3lv02d_i2c.c +++ b/drivers/hwmon/lis3lv02d_i2c.c | |||
| @@ -121,7 +121,7 @@ static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg) | |||
| 121 | { | 121 | { |
| 122 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 122 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
| 123 | 123 | ||
| 124 | if (!lis3->pdata->wakeup_flags) | 124 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
| 125 | lis3lv02d_poweroff(lis3); | 125 | lis3lv02d_poweroff(lis3); |
| 126 | return 0; | 126 | return 0; |
| 127 | } | 127 | } |
| @@ -130,7 +130,7 @@ static int lis3lv02d_i2c_resume(struct i2c_client *client) | |||
| 130 | { | 130 | { |
| 131 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 131 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
| 132 | 132 | ||
| 133 | if (!lis3->pdata->wakeup_flags) | 133 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
| 134 | lis3lv02d_poweron(lis3); | 134 | lis3lv02d_poweron(lis3); |
| 135 | return 0; | 135 | return 0; |
| 136 | } | 136 | } |
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c index 82b16808a274..b9be5e3a22b3 100644 --- a/drivers/hwmon/lis3lv02d_spi.c +++ b/drivers/hwmon/lis3lv02d_spi.c | |||
| @@ -92,7 +92,7 @@ static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg) | |||
| 92 | { | 92 | { |
| 93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | 93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); |
| 94 | 94 | ||
| 95 | if (!lis3->pdata->wakeup_flags) | 95 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
| 96 | lis3lv02d_poweroff(&lis3_dev); | 96 | lis3lv02d_poweroff(&lis3_dev); |
| 97 | 97 | ||
| 98 | return 0; | 98 | return 0; |
| @@ -102,7 +102,7 @@ static int lis3lv02d_spi_resume(struct spi_device *spi) | |||
| 102 | { | 102 | { |
| 103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | 103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); |
| 104 | 104 | ||
| 105 | if (!lis3->pdata->wakeup_flags) | 105 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
| 106 | lis3lv02d_poweron(lis3); | 106 | lis3lv02d_poweron(lis3); |
| 107 | 107 | ||
| 108 | return 0; | 108 | return 0; |
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c index 94741d42112d..464340f25496 100644 --- a/drivers/hwmon/lm95241.c +++ b/drivers/hwmon/lm95241.c | |||
| @@ -91,7 +91,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev); | |||
| 91 | struct lm95241_data { | 91 | struct lm95241_data { |
| 92 | struct device *hwmon_dev; | 92 | struct device *hwmon_dev; |
| 93 | struct mutex update_lock; | 93 | struct mutex update_lock; |
| 94 | unsigned long last_updated, rate; /* in jiffies */ | 94 | unsigned long last_updated, interval; /* in jiffies */ |
| 95 | char valid; /* zero until following fields are valid */ | 95 | char valid; /* zero until following fields are valid */ |
| 96 | /* registers values */ | 96 | /* registers values */ |
| 97 | u8 local_h, local_l; /* local */ | 97 | u8 local_h, local_l; /* local */ |
| @@ -114,23 +114,23 @@ show_temp(local); | |||
| 114 | show_temp(remote1); | 114 | show_temp(remote1); |
| 115 | show_temp(remote2); | 115 | show_temp(remote2); |
| 116 | 116 | ||
| 117 | static ssize_t show_rate(struct device *dev, struct device_attribute *attr, | 117 | static ssize_t show_interval(struct device *dev, struct device_attribute *attr, |
| 118 | char *buf) | 118 | char *buf) |
| 119 | { | 119 | { |
| 120 | struct lm95241_data *data = lm95241_update_device(dev); | 120 | struct lm95241_data *data = lm95241_update_device(dev); |
| 121 | 121 | ||
| 122 | snprintf(buf, PAGE_SIZE - 1, "%lu\n", 1000 * data->rate / HZ); | 122 | snprintf(buf, PAGE_SIZE - 1, "%lu\n", 1000 * data->interval / HZ); |
| 123 | return strlen(buf); | 123 | return strlen(buf); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static ssize_t set_rate(struct device *dev, struct device_attribute *attr, | 126 | static ssize_t set_interval(struct device *dev, struct device_attribute *attr, |
| 127 | const char *buf, size_t count) | 127 | const char *buf, size_t count) |
| 128 | { | 128 | { |
| 129 | struct i2c_client *client = to_i2c_client(dev); | 129 | struct i2c_client *client = to_i2c_client(dev); |
| 130 | struct lm95241_data *data = i2c_get_clientdata(client); | 130 | struct lm95241_data *data = i2c_get_clientdata(client); |
| 131 | 131 | ||
| 132 | strict_strtol(buf, 10, &data->rate); | 132 | strict_strtol(buf, 10, &data->interval); |
| 133 | data->rate = data->rate * HZ / 1000; | 133 | data->interval = data->interval * HZ / 1000; |
| 134 | 134 | ||
| 135 | return count; | 135 | return count; |
| 136 | } | 136 | } |
| @@ -286,7 +286,8 @@ static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_min1, set_min1); | |||
| 286 | static DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_min2, set_min2); | 286 | static DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_min2, set_min2); |
| 287 | static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_max1, set_max1); | 287 | static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_max1, set_max1); |
| 288 | static DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_max2, set_max2); | 288 | static DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_max2, set_max2); |
| 289 | static DEVICE_ATTR(rate, S_IWUSR | S_IRUGO, show_rate, set_rate); | 289 | static DEVICE_ATTR(update_interval, S_IWUSR | S_IRUGO, show_interval, |
| 290 | set_interval); | ||
| 290 | 291 | ||
| 291 | static struct attribute *lm95241_attributes[] = { | 292 | static struct attribute *lm95241_attributes[] = { |
| 292 | &dev_attr_temp1_input.attr, | 293 | &dev_attr_temp1_input.attr, |
| @@ -298,7 +299,7 @@ static struct attribute *lm95241_attributes[] = { | |||
| 298 | &dev_attr_temp3_min.attr, | 299 | &dev_attr_temp3_min.attr, |
| 299 | &dev_attr_temp2_max.attr, | 300 | &dev_attr_temp2_max.attr, |
| 300 | &dev_attr_temp3_max.attr, | 301 | &dev_attr_temp3_max.attr, |
| 301 | &dev_attr_rate.attr, | 302 | &dev_attr_update_interval.attr, |
| 302 | NULL | 303 | NULL |
| 303 | }; | 304 | }; |
| 304 | 305 | ||
| @@ -376,7 +377,7 @@ static void lm95241_init_client(struct i2c_client *client) | |||
| 376 | { | 377 | { |
| 377 | struct lm95241_data *data = i2c_get_clientdata(client); | 378 | struct lm95241_data *data = i2c_get_clientdata(client); |
| 378 | 379 | ||
| 379 | data->rate = HZ; /* 1 sec default */ | 380 | data->interval = HZ; /* 1 sec default */ |
| 380 | data->valid = 0; | 381 | data->valid = 0; |
| 381 | data->config = CFG_CR0076; | 382 | data->config = CFG_CR0076; |
| 382 | data->model = 0; | 383 | data->model = 0; |
| @@ -410,7 +411,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev) | |||
| 410 | 411 | ||
| 411 | mutex_lock(&data->update_lock); | 412 | mutex_lock(&data->update_lock); |
| 412 | 413 | ||
| 413 | if (time_after(jiffies, data->last_updated + data->rate) || | 414 | if (time_after(jiffies, data->last_updated + data->interval) || |
| 414 | !data->valid) { | 415 | !data->valid) { |
| 415 | dev_dbg(&client->dev, "Updating lm95241 data.\n"); | 416 | dev_dbg(&client->dev, "Updating lm95241 data.\n"); |
| 416 | data->local_h = | 417 | data->local_h = |
diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c index 74157fcda6ed..f11903936c8b 100644 --- a/drivers/hwmon/pkgtemp.c +++ b/drivers/hwmon/pkgtemp.c | |||
| @@ -33,7 +33,6 @@ | |||
| 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> | ||
| 37 | #include <asm/msr.h> | 36 | #include <asm/msr.h> |
| 38 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
| 39 | 38 | ||
| @@ -224,7 +223,7 @@ static int __devinit pkgtemp_probe(struct platform_device *pdev) | |||
| 224 | 223 | ||
| 225 | err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); | 224 | err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); |
| 226 | if (err) | 225 | if (err) |
| 227 | goto exit_free; | 226 | goto exit_dev; |
| 228 | 227 | ||
| 229 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 228 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
| 230 | if (IS_ERR(data->hwmon_dev)) { | 229 | if (IS_ERR(data->hwmon_dev)) { |
| @@ -238,6 +237,8 @@ static int __devinit pkgtemp_probe(struct platform_device *pdev) | |||
| 238 | 237 | ||
| 239 | exit_class: | 238 | exit_class: |
| 240 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); | 239 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); |
| 240 | exit_dev: | ||
| 241 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
| 241 | exit_free: | 242 | exit_free: |
| 242 | kfree(data); | 243 | kfree(data); |
| 243 | exit: | 244 | exit: |
| @@ -250,6 +251,7 @@ static int __devexit pkgtemp_remove(struct platform_device *pdev) | |||
| 250 | 251 | ||
| 251 | hwmon_device_unregister(data->hwmon_dev); | 252 | hwmon_device_unregister(data->hwmon_dev); |
| 252 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); | 253 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); |
| 254 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
| 253 | platform_set_drvdata(pdev, NULL); | 255 | platform_set_drvdata(pdev, NULL); |
| 254 | kfree(data); | 256 | kfree(data); |
| 255 | return 0; | 257 | return 0; |
| @@ -281,9 +283,10 @@ static int __cpuinit pkgtemp_device_add(unsigned int cpu) | |||
| 281 | int err; | 283 | int err; |
| 282 | struct platform_device *pdev; | 284 | struct platform_device *pdev; |
| 283 | struct pdev_entry *pdev_entry; | 285 | struct pdev_entry *pdev_entry; |
| 284 | #ifdef CONFIG_SMP | ||
| 285 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 286 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 286 | #endif | 287 | |
| 288 | if (!cpu_has(c, X86_FEATURE_PTS)) | ||
| 289 | return 0; | ||
| 287 | 290 | ||
| 288 | mutex_lock(&pdev_list_mutex); | 291 | mutex_lock(&pdev_list_mutex); |
| 289 | 292 | ||
| @@ -339,17 +342,18 @@ exit: | |||
| 339 | #ifdef CONFIG_HOTPLUG_CPU | 342 | #ifdef CONFIG_HOTPLUG_CPU |
| 340 | static void pkgtemp_device_remove(unsigned int cpu) | 343 | static void pkgtemp_device_remove(unsigned int cpu) |
| 341 | { | 344 | { |
| 342 | struct pdev_entry *p, *n; | 345 | struct pdev_entry *p; |
| 343 | unsigned int i; | 346 | unsigned int i; |
| 344 | int err; | 347 | int err; |
| 345 | 348 | ||
| 346 | mutex_lock(&pdev_list_mutex); | 349 | mutex_lock(&pdev_list_mutex); |
| 347 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 350 | list_for_each_entry(p, &pdev_list, list) { |
| 348 | if (p->cpu != cpu) | 351 | if (p->cpu != cpu) |
| 349 | continue; | 352 | continue; |
| 350 | 353 | ||
| 351 | platform_device_unregister(p->pdev); | 354 | platform_device_unregister(p->pdev); |
| 352 | list_del(&p->list); | 355 | list_del(&p->list); |
| 356 | mutex_unlock(&pdev_list_mutex); | ||
| 353 | kfree(p); | 357 | kfree(p); |
| 354 | for_each_cpu(i, cpu_core_mask(cpu)) { | 358 | for_each_cpu(i, cpu_core_mask(cpu)) { |
| 355 | if (i != cpu) { | 359 | if (i != cpu) { |
| @@ -358,7 +362,7 @@ static void pkgtemp_device_remove(unsigned int cpu) | |||
| 358 | break; | 362 | break; |
| 359 | } | 363 | } |
| 360 | } | 364 | } |
| 361 | break; | 365 | return; |
| 362 | } | 366 | } |
| 363 | mutex_unlock(&pdev_list_mutex); | 367 | mutex_unlock(&pdev_list_mutex); |
| 364 | } | 368 | } |
| @@ -399,11 +403,6 @@ static int __init pkgtemp_init(void) | |||
| 399 | goto exit; | 403 | goto exit; |
| 400 | 404 | ||
| 401 | for_each_online_cpu(i) { | 405 | for_each_online_cpu(i) { |
| 402 | struct cpuinfo_x86 *c = &cpu_data(i); | ||
| 403 | |||
| 404 | if (!cpu_has(c, X86_FEATURE_PTS)) | ||
| 405 | continue; | ||
| 406 | |||
| 407 | err = pkgtemp_device_add(i); | 406 | err = pkgtemp_device_add(i); |
| 408 | if (err) | 407 | if (err) |
| 409 | goto exit_devices_unreg; | 408 | goto exit_devices_unreg; |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index e96e69dd36fb..072c58008a63 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
| @@ -127,6 +127,7 @@ superio_enter(int ioreg) | |||
| 127 | static inline void | 127 | static inline void |
| 128 | superio_exit(int ioreg) | 128 | superio_exit(int ioreg) |
| 129 | { | 129 | { |
| 130 | outb(0xaa, ioreg); | ||
| 130 | outb(0x02, ioreg); | 131 | outb(0x02, ioreg); |
| 131 | outb(0x02, ioreg + 1); | 132 | outb(0x02, ioreg + 1); |
| 132 | } | 133 | } |
