aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-05-22 02:36:56 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-05-22 02:36:56 -0400
commitcf9b59e9d3e008591d1f54830f570982bb307a0d (patch)
tree113478ce8fd8c832ba726ffdf59b82cb46356476 /drivers/hwmon
parent44504b2bebf8b5823c59484e73096a7d6574471d (diff)
parentf4b87dee923342505e1ddba8d34ce9de33e75050 (diff)
Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and build failures in vio.c after merge. Conflicts: drivers/i2c/busses/i2c-cpm.c drivers/i2c/busses/i2c-mpc.c drivers/net/gianfar.c Also fixed up one line in arch/powerpc/kernel/vio.c to use the correct node pointer. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/applesmc.c61
-rw-r--r--drivers/hwmon/asc7621.c63
-rw-r--r--drivers/hwmon/asus_atk0110.c4
-rw-r--r--drivers/hwmon/hp_accel.c6
4 files changed, 65 insertions, 69 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0f28d91f29d..f085c18d290 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. */
196static unsigned int applesmc_light; 196static unsigned int applesmc_light;
197 197
198/* The number of fans handled by the driver */
199static unsigned int fans_handled;
200
198/* Indicates which temperature sensors set to use. */ 201/* Indicates which temperature sensors set to use. */
199static unsigned int applesmc_temperature_set; 202static 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();
1594out_temperature: 1582out_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]); 1584out_fans:
1597out_fan_1: 1585 while (fans_handled)
1598 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1586 sysfs_remove_group(&pdev->dev.kobj,
1599out_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);
1601out_name: 1589out_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 7f948105d8a..0f388adc618 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
297static int asc7621_in_scaling[] = { 301static int asc7621_in_scaling[] = {
298 3320, 3000, 4380, 6640, 16000 302 2500, 2250, 3300, 5000, 12000
299}; 303};
300 304
301static ssize_t show_in10(struct device *dev, struct device_attribute *attr, 305static 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
337static ssize_t store_in8(struct device *dev, struct device_attribute *attr, 334static 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/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index 75f3fa55663..16c42024072 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -1169,15 +1169,19 @@ static int atk_create_files(struct atk_data *data)
1169 int err; 1169 int err;
1170 1170
1171 list_for_each_entry(s, &data->sensor_list, list) { 1171 list_for_each_entry(s, &data->sensor_list, list) {
1172 sysfs_attr_init(&s->input_attr.attr);
1172 err = device_create_file(data->hwmon_dev, &s->input_attr); 1173 err = device_create_file(data->hwmon_dev, &s->input_attr);
1173 if (err) 1174 if (err)
1174 return err; 1175 return err;
1176 sysfs_attr_init(&s->label_attr.attr);
1175 err = device_create_file(data->hwmon_dev, &s->label_attr); 1177 err = device_create_file(data->hwmon_dev, &s->label_attr);
1176 if (err) 1178 if (err)
1177 return err; 1179 return err;
1180 sysfs_attr_init(&s->limit1_attr.attr);
1178 err = device_create_file(data->hwmon_dev, &s->limit1_attr); 1181 err = device_create_file(data->hwmon_dev, &s->limit1_attr);
1179 if (err) 1182 if (err)
1180 return err; 1183 return err;
1184 sysfs_attr_init(&s->limit2_attr.attr);
1181 err = device_create_file(data->hwmon_dev, &s->limit2_attr); 1185 err = device_create_file(data->hwmon_dev, &s->limit2_attr);
1182 if (err) 1186 if (err)
1183 return err; 1187 return err;
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index be475e844c2..7580f55e67e 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -217,6 +217,10 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
217 AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted), 217 AXIS_DMI_MATCH("DV7", "HP Pavilion dv7", x_inverted),
218 AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted), 218 AXIS_DMI_MATCH("HP8710", "HP Compaq 8710", y_inverted),
219 AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted), 219 AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted),
220 AXIS_DMI_MATCH("HPB432x", "HP ProBook 432", xy_rotated_left),
221 AXIS_DMI_MATCH("HPB442x", "HP ProBook 442", xy_rotated_left),
222 AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted),
223 AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap),
220 { NULL, } 224 { NULL, }
221/* Laptop models without axis info (yet): 225/* Laptop models without axis info (yet):
222 * "NC6910" "HP Compaq 6910" 226 * "NC6910" "HP Compaq 6910"
@@ -324,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
324 lis3lv02d_joystick_disable(); 328 lis3lv02d_joystick_disable();
325 lis3lv02d_poweroff(&lis3_dev); 329 lis3lv02d_poweroff(&lis3_dev);
326 330
327 flush_work(&hpled_led.work);
328 led_classdev_unregister(&hpled_led.led_classdev); 331 led_classdev_unregister(&hpled_led.led_classdev);
332 flush_work(&hpled_led.work);
329 333
330 return lis3lv02d_remove_fs(&lis3_dev); 334 return lis3lv02d_remove_fs(&lis3_dev);
331} 335}