aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/max1619.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/max1619.c')
-rw-r--r--drivers/hwmon/max1619.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index 38a44c3d6cee..7e7267a04544 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -32,14 +32,13 @@
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/hwmon.h> 34#include <linux/hwmon.h>
35#include <linux/hwmon-sysfs.h>
35#include <linux/err.h> 36#include <linux/err.h>
36#include <linux/mutex.h> 37#include <linux/mutex.h>
37#include <linux/sysfs.h> 38#include <linux/sysfs.h>
38 39
39static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, 40static const unsigned short normal_i2c[] = {
40 0x29, 0x2a, 0x2b, 41 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
41 0x4c, 0x4d, 0x4e,
42 I2C_CLIENT_END };
43 42
44/* 43/*
45 * Insmod parameters 44 * Insmod parameters
@@ -161,6 +160,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
161 return sprintf(buf, "%d\n", data->alarms); 160 return sprintf(buf, "%d\n", data->alarms);
162} 161}
163 162
163static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
164 char *buf)
165{
166 int bitnr = to_sensor_dev_attr(attr)->index;
167 struct max1619_data *data = max1619_update_device(dev);
168 return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1);
169}
170
164static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); 171static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL);
165static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); 172static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL);
166static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, 173static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2,
@@ -172,6 +179,10 @@ static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2,
172static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, 179static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2,
173 set_temp_hyst2); 180 set_temp_hyst2);
174static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 181static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
182static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1);
183static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2);
184static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
185static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4);
175 186
176static struct attribute *max1619_attributes[] = { 187static struct attribute *max1619_attributes[] = {
177 &dev_attr_temp1_input.attr, 188 &dev_attr_temp1_input.attr,
@@ -182,6 +193,10 @@ static struct attribute *max1619_attributes[] = {
182 &dev_attr_temp2_crit_hyst.attr, 193 &dev_attr_temp2_crit_hyst.attr,
183 194
184 &dev_attr_alarms.attr, 195 &dev_attr_alarms.attr,
196 &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr,
197 &sensor_dev_attr_temp2_fault.dev_attr.attr,
198 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
199 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
185 NULL 200 NULL
186}; 201};
187 202