hwmon: (lm77) Add individual alarm files
The new libsensors needs this. As the old library never had support for the lm77 driver, I even dropped the legacy "alarms" file. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
This commit is contained in:
parent
7b501b1f53
commit
1f52af0f69
@ -31,6 +31,7 @@
|
|||||||
#include <linux/jiffies.h>
|
#include <linux/jiffies.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/hwmon.h>
|
#include <linux/hwmon.h>
|
||||||
|
#include <linux/hwmon-sysfs.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
|
||||||
@ -113,7 +114,6 @@ show(temp_input);
|
|||||||
show(temp_crit);
|
show(temp_crit);
|
||||||
show(temp_min);
|
show(temp_min);
|
||||||
show(temp_max);
|
show(temp_max);
|
||||||
show(alarms);
|
|
||||||
|
|
||||||
/* read routines for hysteresis values */
|
/* read routines for hysteresis values */
|
||||||
static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
@ -186,6 +186,14 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
|
||||||
|
char *buf)
|
||||||
|
{
|
||||||
|
int bitnr = to_sensor_dev_attr(attr)->index;
|
||||||
|
struct lm77_data *data = lm77_update_device(dev);
|
||||||
|
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
|
||||||
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(temp1_input, S_IRUGO,
|
static DEVICE_ATTR(temp1_input, S_IRUGO,
|
||||||
show_temp_input, NULL);
|
show_temp_input, NULL);
|
||||||
static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO,
|
static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO,
|
||||||
@ -202,8 +210,9 @@ static DEVICE_ATTR(temp1_min_hyst, S_IRUGO,
|
|||||||
static DEVICE_ATTR(temp1_max_hyst, S_IRUGO,
|
static DEVICE_ATTR(temp1_max_hyst, S_IRUGO,
|
||||||
show_temp_max_hyst, NULL);
|
show_temp_max_hyst, NULL);
|
||||||
|
|
||||||
static DEVICE_ATTR(alarms, S_IRUGO,
|
static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2);
|
||||||
show_alarms, NULL);
|
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0);
|
||||||
|
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1);
|
||||||
|
|
||||||
static int lm77_attach_adapter(struct i2c_adapter *adapter)
|
static int lm77_attach_adapter(struct i2c_adapter *adapter)
|
||||||
{
|
{
|
||||||
@ -220,8 +229,9 @@ static struct attribute *lm77_attributes[] = {
|
|||||||
&dev_attr_temp1_crit_hyst.attr,
|
&dev_attr_temp1_crit_hyst.attr,
|
||||||
&dev_attr_temp1_min_hyst.attr,
|
&dev_attr_temp1_min_hyst.attr,
|
||||||
&dev_attr_temp1_max_hyst.attr,
|
&dev_attr_temp1_max_hyst.attr,
|
||||||
&dev_attr_alarms.attr,
|
&sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
|
||||||
|
&sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
|
||||||
|
&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user