aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm90.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-09-24 14:52:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:15 -0400
commit2d45771e6ea79f56a7d85e448f702f60ef86c228 (patch)
treec3cdd385657c59fe9356cb32283f85f09a717382 /drivers/hwmon/lm90.c
parent51bd56339335fad3643739504523190cd6d3416b (diff)
hwmon: Add individual alarm files to 4 drivers
hwmon: Add individual alarm files to 4 drivers Add individual sysfs files for all f71805f, lm63, lm83 and lm90 alarm and fault conditions. This is a requirement for the planned chip-independent libsensors. Almost all other hwmon drivers will need the same improvement. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r--drivers/hwmon/lm90.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index d9eeaf7585bd..77f8e3f7fd49 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * lm90.c - Part of lm_sensors, Linux kernel modules for hardware 2 * lm90.c - Part of lm_sensors, Linux kernel modules for hardware
3 * monitoring 3 * monitoring
4 * Copyright (C) 2003-2005 Jean Delvare <khali@linux-fr.org> 4 * Copyright (C) 2003-2006 Jean Delvare <khali@linux-fr.org>
5 * 5 *
6 * Based on the lm83 driver. The LM90 is a sensor chip made by National 6 * Based on the lm83 driver. The LM90 is a sensor chip made by National
7 * Semiconductor. It reports up to two temperatures (its own plus up to 7 * Semiconductor. It reports up to two temperatures (its own plus up to
@@ -327,6 +327,16 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *dummy,
327 return sprintf(buf, "%d\n", data->alarms); 327 return sprintf(buf, "%d\n", data->alarms);
328} 328}
329 329
330static ssize_t show_alarm(struct device *dev, struct device_attribute
331 *devattr, char *buf)
332{
333 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
334 struct lm90_data *data = lm90_update_device(dev);
335 int bitnr = attr->index;
336
337 return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1);
338}
339
330static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); 340static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0);
331static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); 341static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0);
332static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp8, 342static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp8,
@@ -344,6 +354,16 @@ static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp8,
344static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temphyst, 354static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temphyst,
345 set_temphyst, 3); 355 set_temphyst, 3);
346static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, show_temphyst, NULL, 4); 356static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, show_temphyst, NULL, 4);
357
358/* Individual alarm files */
359static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0);
360static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1);
361static SENSOR_DEVICE_ATTR(temp2_input_fault, S_IRUGO, show_alarm, NULL, 2);
362static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
363static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4);
364static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 5);
365static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6);
366/* Raw alarm file for compatibility */
347static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 367static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
348 368
349/* pec used for ADM1032 only */ 369/* pec used for ADM1032 only */
@@ -595,6 +615,21 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind)
595 &sensor_dev_attr_temp1_crit_hyst.dev_attr); 615 &sensor_dev_attr_temp1_crit_hyst.dev_attr);
596 device_create_file(&new_client->dev, 616 device_create_file(&new_client->dev,
597 &sensor_dev_attr_temp2_crit_hyst.dev_attr); 617 &sensor_dev_attr_temp2_crit_hyst.dev_attr);
618
619 device_create_file(&new_client->dev,
620 &sensor_dev_attr_temp2_input_fault.dev_attr);
621 device_create_file(&new_client->dev,
622 &sensor_dev_attr_temp1_min_alarm.dev_attr);
623 device_create_file(&new_client->dev,
624 &sensor_dev_attr_temp2_min_alarm.dev_attr);
625 device_create_file(&new_client->dev,
626 &sensor_dev_attr_temp1_max_alarm.dev_attr);
627 device_create_file(&new_client->dev,
628 &sensor_dev_attr_temp2_max_alarm.dev_attr);
629 device_create_file(&new_client->dev,
630 &sensor_dev_attr_temp1_crit_alarm.dev_attr);
631 device_create_file(&new_client->dev,
632 &sensor_dev_attr_temp2_crit_alarm.dev_attr);
598 device_create_file(&new_client->dev, &dev_attr_alarms); 633 device_create_file(&new_client->dev, &dev_attr_alarms);
599 634
600 if (new_client->flags & I2C_CLIENT_PEC) 635 if (new_client->flags & I2C_CLIENT_PEC)