All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (lm73) Add temp1_max_hyst entry to sysfs
@ 2016-10-07  4:42 Joshua Scott
  2016-10-07 18:44 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Joshua Scott @ 2016-10-07  4:42 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, linux-hwmon; +Cc: Joshua Scott, Chris Packham

Currently, the lm73 driver has a temp1_max and a temp1_min. These make
sense when using temp1_max_alarm and temp1_min_alarm to determine if the
temperature has exceeded the chosen limits.

However, when using the ALARM output pin on the lm73 chip, the lower
temperature value behaves as a hysteresis value. Rather than the low value
triggering a "too cold" alarm, it is the point at which an existing high
temperature alarm is turned off.

Add a sysfs entry for temp1_max_hyst, tied to the same register as
temp1_min.

Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz>
---
 drivers/hwmon/lm73.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 9653bb8..b46a91a 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -170,6 +170,8 @@ abort:
 
 static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
 			show_temp, set_temp, LM73_REG_MAX);
+static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
+			show_temp, set_temp, LM73_REG_MIN);
 static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO,
 			show_temp, set_temp, LM73_REG_MIN);
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
@@ -184,6 +186,7 @@ static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO,
 static struct attribute *lm73_attrs[] = {
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_max.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
 	&sensor_dev_attr_temp1_min.dev_attr.attr,
 	&sensor_dev_attr_update_interval.dev_attr.attr,
 	&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-07 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07  4:42 [PATCH] hwmon: (lm73) Add temp1_max_hyst entry to sysfs Joshua Scott
2016-10-07 18:44 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.