diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-05-21 11:49:57 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-21 11:49:57 -0400 |
commit | ff5f149b6aec8edbfa3698721667acd043009a33 (patch) | |
tree | d052553eb296dfee3f01b1cb2b717cb7ccf3127a /drivers/hwmon | |
parent | f0218b3e9974f06014b61be8987159f4a20e011e (diff) | |
parent | 580d607cd666dfabfc1c7b0fb08c8ac690c7c87f (diff) |
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-7
Conflicts:
include/linux/ftrace_event.h
include/trace/ftrace.h
kernel/trace/trace_event_perf.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_syscalls.c
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/applesmc.c | 61 | ||||
-rw-r--r-- | drivers/hwmon/asc7621.c | 63 | ||||
-rw-r--r-- | drivers/hwmon/hp_accel.c | 2 |
3 files changed, 57 insertions, 69 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 0f28d91f29d8..f085c18d2905 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -195,6 +195,9 @@ static unsigned int applesmc_accelerometer; | |||
195 | /* Indicates whether this computer has light sensors and keyboard backlight. */ | 195 | /* Indicates whether this computer has light sensors and keyboard backlight. */ |
196 | static unsigned int applesmc_light; | 196 | static unsigned int applesmc_light; |
197 | 197 | ||
198 | /* The number of fans handled by the driver */ | ||
199 | static unsigned int fans_handled; | ||
200 | |||
198 | /* Indicates which temperature sensors set to use. */ | 201 | /* Indicates which temperature sensors set to use. */ |
199 | static unsigned int applesmc_temperature_set; | 202 | static unsigned int applesmc_temperature_set; |
200 | 203 | ||
@@ -1492,39 +1495,24 @@ static int __init applesmc_init(void) | |||
1492 | 1495 | ||
1493 | /* create fan files */ | 1496 | /* create fan files */ |
1494 | count = applesmc_get_fan_count(); | 1497 | count = applesmc_get_fan_count(); |
1495 | if (count < 0) { | 1498 | if (count < 0) |
1496 | printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); | 1499 | printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); |
1497 | } else { | 1500 | else |
1498 | printk(KERN_INFO "applesmc: %d fans found.\n", count); | 1501 | printk(KERN_INFO "applesmc: %d fans found.\n", count); |
1499 | 1502 | ||
1500 | switch (count) { | 1503 | if (count > 4) { |
1501 | default: | 1504 | count = 4; |
1502 | printk(KERN_WARNING "applesmc: More than 4 fans found," | 1505 | printk(KERN_WARNING "applesmc: More than 4 fans found," |
1503 | " but at most 4 fans are supported" | 1506 | " but at most 4 fans are supported" |
1504 | " by the driver.\n"); | 1507 | " by the driver.\n"); |
1505 | case 4: | 1508 | } |
1506 | ret = sysfs_create_group(&pdev->dev.kobj, | 1509 | |
1507 | &fan_attribute_groups[3]); | 1510 | while (fans_handled < count) { |
1508 | if (ret) | 1511 | ret = sysfs_create_group(&pdev->dev.kobj, |
1509 | goto out_key_enumeration; | 1512 | &fan_attribute_groups[fans_handled]); |
1510 | case 3: | 1513 | if (ret) |
1511 | ret = sysfs_create_group(&pdev->dev.kobj, | 1514 | goto out_fans; |
1512 | &fan_attribute_groups[2]); | 1515 | fans_handled++; |
1513 | if (ret) | ||
1514 | goto out_key_enumeration; | ||
1515 | case 2: | ||
1516 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1517 | &fan_attribute_groups[1]); | ||
1518 | if (ret) | ||
1519 | goto out_key_enumeration; | ||
1520 | case 1: | ||
1521 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1522 | &fan_attribute_groups[0]); | ||
1523 | if (ret) | ||
1524 | goto out_fan_1; | ||
1525 | case 0: | ||
1526 | ; | ||
1527 | } | ||
1528 | } | 1516 | } |
1529 | 1517 | ||
1530 | for (i = 0; | 1518 | for (i = 0; |
@@ -1593,10 +1581,10 @@ out_accelerometer: | |||
1593 | applesmc_release_accelerometer(); | 1581 | applesmc_release_accelerometer(); |
1594 | out_temperature: | 1582 | out_temperature: |
1595 | sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); | 1583 | sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); |
1596 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); | 1584 | out_fans: |
1597 | out_fan_1: | 1585 | while (fans_handled) |
1598 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); | 1586 | sysfs_remove_group(&pdev->dev.kobj, |
1599 | out_key_enumeration: | 1587 | &fan_attribute_groups[--fans_handled]); |
1600 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); | 1588 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); |
1601 | out_name: | 1589 | out_name: |
1602 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); | 1590 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); |
@@ -1622,8 +1610,9 @@ static void __exit applesmc_exit(void) | |||
1622 | if (applesmc_accelerometer) | 1610 | if (applesmc_accelerometer) |
1623 | applesmc_release_accelerometer(); | 1611 | applesmc_release_accelerometer(); |
1624 | sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); | 1612 | sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); |
1625 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); | 1613 | while (fans_handled) |
1626 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); | 1614 | sysfs_remove_group(&pdev->dev.kobj, |
1615 | &fan_attribute_groups[--fans_handled]); | ||
1627 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); | 1616 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); |
1628 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); | 1617 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); |
1629 | platform_device_unregister(pdev); | 1618 | platform_device_unregister(pdev); |
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c index 7f948105d8ad..0f388adc6187 100644 --- a/drivers/hwmon/asc7621.c +++ b/drivers/hwmon/asc7621.c | |||
@@ -268,8 +268,11 @@ static ssize_t store_fan16(struct device *dev, | |||
268 | if (strict_strtol(buf, 10, &reqval)) | 268 | if (strict_strtol(buf, 10, &reqval)) |
269 | return -EINVAL; | 269 | return -EINVAL; |
270 | 270 | ||
271 | /* If a minimum RPM of zero is requested, then we set the register to | ||
272 | 0xffff. This value allows the fan to be stopped completely without | ||
273 | generating an alarm. */ | ||
271 | reqval = | 274 | reqval = |
272 | (SENSORS_LIMIT((reqval) <= 0 ? 0 : 5400000 / (reqval), 0, 65534)); | 275 | (reqval <= 0 ? 0xffff : SENSORS_LIMIT(5400000 / reqval, 0, 0xfffe)); |
273 | 276 | ||
274 | mutex_lock(&data->update_lock); | 277 | mutex_lock(&data->update_lock); |
275 | data->reg[param->msb[0]] = (reqval >> 8) & 0xff; | 278 | data->reg[param->msb[0]] = (reqval >> 8) & 0xff; |
@@ -285,8 +288,9 @@ static ssize_t store_fan16(struct device *dev, | |||
285 | * Voltages are scaled in the device so that the nominal voltage | 288 | * Voltages are scaled in the device so that the nominal voltage |
286 | * is 3/4ths of the 0-255 range (i.e. 192). | 289 | * is 3/4ths of the 0-255 range (i.e. 192). |
287 | * If all voltages are 'normal' then all voltage registers will | 290 | * If all voltages are 'normal' then all voltage registers will |
288 | * read 0xC0. This doesn't help us if we don't have a point of refernce. | 291 | * read 0xC0. |
289 | * The data sheet however provides us with the full scale value for each | 292 | * |
293 | * The data sheet provides us with the 3/4 scale value for each voltage | ||
290 | * which is stored in in_scaling. The sda->index parameter value provides | 294 | * which is stored in in_scaling. The sda->index parameter value provides |
291 | * the index into in_scaling. | 295 | * the index into in_scaling. |
292 | * | 296 | * |
@@ -295,7 +299,7 @@ static ssize_t store_fan16(struct device *dev, | |||
295 | */ | 299 | */ |
296 | 300 | ||
297 | static int asc7621_in_scaling[] = { | 301 | static int asc7621_in_scaling[] = { |
298 | 3320, 3000, 4380, 6640, 16000 | 302 | 2500, 2250, 3300, 5000, 12000 |
299 | }; | 303 | }; |
300 | 304 | ||
301 | static ssize_t show_in10(struct device *dev, struct device_attribute *attr, | 305 | static ssize_t show_in10(struct device *dev, struct device_attribute *attr, |
@@ -306,19 +310,12 @@ static ssize_t show_in10(struct device *dev, struct device_attribute *attr, | |||
306 | u8 nr = sda->index; | 310 | u8 nr = sda->index; |
307 | 311 | ||
308 | mutex_lock(&data->update_lock); | 312 | mutex_lock(&data->update_lock); |
309 | regval = (data->reg[param->msb[0]] * asc7621_in_scaling[nr]) / 256; | 313 | regval = (data->reg[param->msb[0]] << 8) | (data->reg[param->lsb[0]]); |
310 | |||
311 | /* The LSB value is a 2-bit scaling of the MSB's LSbit value. | ||
312 | * I.E. If the maximim voltage for this input is 6640 millivolts then | ||
313 | * a MSB register value of 0 = 0mv and 255 = 6640mv. | ||
314 | * A 1 step change therefore represents 25.9mv (6640 / 256). | ||
315 | * The extra 2-bits therefore represent increments of 6.48mv. | ||
316 | */ | ||
317 | regval += ((asc7621_in_scaling[nr] / 256) / 4) * | ||
318 | (data->reg[param->lsb[0]] >> 6); | ||
319 | |||
320 | mutex_unlock(&data->update_lock); | 314 | mutex_unlock(&data->update_lock); |
321 | 315 | ||
316 | /* The LSB value is a 2-bit scaling of the MSB's LSbit value. */ | ||
317 | regval = (regval >> 6) * asc7621_in_scaling[nr] / (0xc0 << 2); | ||
318 | |||
322 | return sprintf(buf, "%u\n", regval); | 319 | return sprintf(buf, "%u\n", regval); |
323 | } | 320 | } |
324 | 321 | ||
@@ -331,7 +328,7 @@ static ssize_t show_in8(struct device *dev, struct device_attribute *attr, | |||
331 | 328 | ||
332 | return sprintf(buf, "%u\n", | 329 | return sprintf(buf, "%u\n", |
333 | ((data->reg[param->msb[0]] * | 330 | ((data->reg[param->msb[0]] * |
334 | asc7621_in_scaling[nr]) / 256)); | 331 | asc7621_in_scaling[nr]) / 0xc0)); |
335 | } | 332 | } |
336 | 333 | ||
337 | static ssize_t store_in8(struct device *dev, struct device_attribute *attr, | 334 | static ssize_t store_in8(struct device *dev, struct device_attribute *attr, |
@@ -344,9 +341,11 @@ static ssize_t store_in8(struct device *dev, struct device_attribute *attr, | |||
344 | if (strict_strtol(buf, 10, &reqval)) | 341 | if (strict_strtol(buf, 10, &reqval)) |
345 | return -EINVAL; | 342 | return -EINVAL; |
346 | 343 | ||
347 | reqval = SENSORS_LIMIT(reqval, 0, asc7621_in_scaling[nr]); | 344 | reqval = SENSORS_LIMIT(reqval, 0, 0xffff); |
345 | |||
346 | reqval = reqval * 0xc0 / asc7621_in_scaling[nr]; | ||
348 | 347 | ||
349 | reqval = (reqval * 255 + 128) / asc7621_in_scaling[nr]; | 348 | reqval = SENSORS_LIMIT(reqval, 0, 0xff); |
350 | 349 | ||
351 | mutex_lock(&data->update_lock); | 350 | mutex_lock(&data->update_lock); |
352 | data->reg[param->msb[0]] = reqval; | 351 | data->reg[param->msb[0]] = reqval; |
@@ -846,11 +845,11 @@ static struct asc7621_param asc7621_params[] = { | |||
846 | PWRITE(in3_max, 3, PRI_LOW, 0x4b, 0, 0, 0, in8), | 845 | PWRITE(in3_max, 3, PRI_LOW, 0x4b, 0, 0, 0, in8), |
847 | PWRITE(in4_max, 4, PRI_LOW, 0x4d, 0, 0, 0, in8), | 846 | PWRITE(in4_max, 4, PRI_LOW, 0x4d, 0, 0, 0, in8), |
848 | 847 | ||
849 | PREAD(in0_alarm, 0, PRI_LOW, 0x41, 0, 0x01, 0, bitmask), | 848 | PREAD(in0_alarm, 0, PRI_HIGH, 0x41, 0, 0x01, 0, bitmask), |
850 | PREAD(in1_alarm, 1, PRI_LOW, 0x41, 0, 0x01, 1, bitmask), | 849 | PREAD(in1_alarm, 1, PRI_HIGH, 0x41, 0, 0x01, 1, bitmask), |
851 | PREAD(in2_alarm, 2, PRI_LOW, 0x41, 0, 0x01, 2, bitmask), | 850 | PREAD(in2_alarm, 2, PRI_HIGH, 0x41, 0, 0x01, 2, bitmask), |
852 | PREAD(in3_alarm, 3, PRI_LOW, 0x41, 0, 0x01, 3, bitmask), | 851 | PREAD(in3_alarm, 3, PRI_HIGH, 0x41, 0, 0x01, 3, bitmask), |
853 | PREAD(in4_alarm, 4, PRI_LOW, 0x42, 0, 0x01, 0, bitmask), | 852 | PREAD(in4_alarm, 4, PRI_HIGH, 0x42, 0, 0x01, 0, bitmask), |
854 | 853 | ||
855 | PREAD(fan1_input, 0, PRI_HIGH, 0x29, 0x28, 0, 0, fan16), | 854 | PREAD(fan1_input, 0, PRI_HIGH, 0x29, 0x28, 0, 0, fan16), |
856 | PREAD(fan2_input, 1, PRI_HIGH, 0x2b, 0x2a, 0, 0, fan16), | 855 | PREAD(fan2_input, 1, PRI_HIGH, 0x2b, 0x2a, 0, 0, fan16), |
@@ -862,10 +861,10 @@ static struct asc7621_param asc7621_params[] = { | |||
862 | PWRITE(fan3_min, 2, PRI_LOW, 0x59, 0x58, 0, 0, fan16), | 861 | PWRITE(fan3_min, 2, PRI_LOW, 0x59, 0x58, 0, 0, fan16), |
863 | PWRITE(fan4_min, 3, PRI_LOW, 0x5b, 0x5a, 0, 0, fan16), | 862 | PWRITE(fan4_min, 3, PRI_LOW, 0x5b, 0x5a, 0, 0, fan16), |
864 | 863 | ||
865 | PREAD(fan1_alarm, 0, PRI_LOW, 0x42, 0, 0x01, 0, bitmask), | 864 | PREAD(fan1_alarm, 0, PRI_HIGH, 0x42, 0, 0x01, 2, bitmask), |
866 | PREAD(fan2_alarm, 1, PRI_LOW, 0x42, 0, 0x01, 1, bitmask), | 865 | PREAD(fan2_alarm, 1, PRI_HIGH, 0x42, 0, 0x01, 3, bitmask), |
867 | PREAD(fan3_alarm, 2, PRI_LOW, 0x42, 0, 0x01, 2, bitmask), | 866 | PREAD(fan3_alarm, 2, PRI_HIGH, 0x42, 0, 0x01, 4, bitmask), |
868 | PREAD(fan4_alarm, 3, PRI_LOW, 0x42, 0, 0x01, 3, bitmask), | 867 | PREAD(fan4_alarm, 3, PRI_HIGH, 0x42, 0, 0x01, 5, bitmask), |
869 | 868 | ||
870 | PREAD(temp1_input, 0, PRI_HIGH, 0x25, 0x10, 0, 0, temp10), | 869 | PREAD(temp1_input, 0, PRI_HIGH, 0x25, 0x10, 0, 0, temp10), |
871 | PREAD(temp2_input, 1, PRI_HIGH, 0x26, 0x15, 0, 0, temp10), | 870 | PREAD(temp2_input, 1, PRI_HIGH, 0x26, 0x15, 0, 0, temp10), |
@@ -886,10 +885,10 @@ static struct asc7621_param asc7621_params[] = { | |||
886 | PWRITE(temp3_max, 2, PRI_LOW, 0x53, 0, 0, 0, temp8), | 885 | PWRITE(temp3_max, 2, PRI_LOW, 0x53, 0, 0, 0, temp8), |
887 | PWRITE(temp4_max, 3, PRI_LOW, 0x35, 0, 0, 0, temp8), | 886 | PWRITE(temp4_max, 3, PRI_LOW, 0x35, 0, 0, 0, temp8), |
888 | 887 | ||
889 | PREAD(temp1_alarm, 0, PRI_LOW, 0x41, 0, 0x01, 4, bitmask), | 888 | PREAD(temp1_alarm, 0, PRI_HIGH, 0x41, 0, 0x01, 4, bitmask), |
890 | PREAD(temp2_alarm, 1, PRI_LOW, 0x41, 0, 0x01, 5, bitmask), | 889 | PREAD(temp2_alarm, 1, PRI_HIGH, 0x41, 0, 0x01, 5, bitmask), |
891 | PREAD(temp3_alarm, 2, PRI_LOW, 0x41, 0, 0x01, 6, bitmask), | 890 | PREAD(temp3_alarm, 2, PRI_HIGH, 0x41, 0, 0x01, 6, bitmask), |
892 | PREAD(temp4_alarm, 3, PRI_LOW, 0x43, 0, 0x01, 0, bitmask), | 891 | PREAD(temp4_alarm, 3, PRI_HIGH, 0x43, 0, 0x01, 0, bitmask), |
893 | 892 | ||
894 | PWRITE(temp1_source, 0, PRI_LOW, 0x02, 0, 0x07, 4, bitmask), | 893 | PWRITE(temp1_source, 0, PRI_LOW, 0x02, 0, 0x07, 4, bitmask), |
895 | PWRITE(temp2_source, 1, PRI_LOW, 0x02, 0, 0x07, 0, bitmask), | 894 | PWRITE(temp2_source, 1, PRI_LOW, 0x02, 0, 0x07, 0, bitmask), |
@@ -898,7 +897,7 @@ static struct asc7621_param asc7621_params[] = { | |||
898 | 897 | ||
899 | PWRITE(temp1_smoothing_enable, 0, PRI_LOW, 0x62, 0, 0x01, 3, bitmask), | 898 | PWRITE(temp1_smoothing_enable, 0, PRI_LOW, 0x62, 0, 0x01, 3, bitmask), |
900 | PWRITE(temp2_smoothing_enable, 1, PRI_LOW, 0x63, 0, 0x01, 7, bitmask), | 899 | PWRITE(temp2_smoothing_enable, 1, PRI_LOW, 0x63, 0, 0x01, 7, bitmask), |
901 | PWRITE(temp3_smoothing_enable, 2, PRI_LOW, 0x64, 0, 0x01, 3, bitmask), | 900 | PWRITE(temp3_smoothing_enable, 2, PRI_LOW, 0x63, 0, 0x01, 3, bitmask), |
902 | PWRITE(temp4_smoothing_enable, 3, PRI_LOW, 0x3c, 0, 0x01, 3, bitmask), | 901 | PWRITE(temp4_smoothing_enable, 3, PRI_LOW, 0x3c, 0, 0x01, 3, bitmask), |
903 | 902 | ||
904 | PWRITE(temp1_smoothing_time, 0, PRI_LOW, 0x62, 0, 0x07, 0, temp_st), | 903 | PWRITE(temp1_smoothing_time, 0, PRI_LOW, 0x62, 0, 0x07, 0, temp_st), |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index c8ab50516672..7580f55e67e3 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -328,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type) | |||
328 | lis3lv02d_joystick_disable(); | 328 | lis3lv02d_joystick_disable(); |
329 | lis3lv02d_poweroff(&lis3_dev); | 329 | lis3lv02d_poweroff(&lis3_dev); |
330 | 330 | ||
331 | flush_work(&hpled_led.work); | ||
332 | led_classdev_unregister(&hpled_led.led_classdev); | 331 | led_classdev_unregister(&hpled_led.led_classdev); |
332 | flush_work(&hpled_led.work); | ||
333 | 333 | ||
334 | return lis3lv02d_remove_fs(&lis3_dev); | 334 | return lis3lv02d_remove_fs(&lis3_dev); |
335 | } | 335 | } |