Skip to contentSkip to conversation

hwmon: Add notification and uevent support

RFC PATCH In review Guenter Roeck 2 participants 2 messages Sep 18, 2011 – Sep 19, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 hwmon: Add notification and uevent support

Some hwmon drivers start adding support for alarm attribute notifications and generate uevents. Standardize the ABI to be used for this purpose.

---
An attempt to standardize notification and uevent support for hwmon drivers.

 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
Documentation/hwmon/sysfs-interface +30 -0
index e65e7e8..735d33f 100644
@@ -97,6 +97,16 @@ update_interval	The interval at which the chip will update readings.
 		Some devices have a variable update rate or interval.
 		This attribute can be used to change it to the desired value.
 
+notification	This attribute exists if the driver supports notifications on
+		alarm and trigger attributes. Valid attribute values are:
+		0: The driver does not support notifications or uevents.
+		1: The driver supports notifications.
+		2: The driver generates a uevent if an alarm or trigger status
+		   changes.
+		3: The driver suports notifications and generates a uevent if
+		   an alarm or trigger status changes.
+		RO
+
 
 ************
 * Voltages *
@@ -706,6 +716,26 @@ intrusion[0-*]_beep
 		RW
 
 
+Notifications and uevents
+-------------------------
+
+Hwmon drivers may support generating notification on sysfs alarm and trigger
+attributes. This support is reflected in the existence of the "notification"
+attribute described above.
+
+If a driver supports notifications, applications do not have to manually poll
+alarm and trigger attributes, but can use poll(2) or epoll(4) instead.
+
+If a driver supports notifications, it shall support it for all alarm and
+trigger attributes. Notifications shall be generated for all state transistions
+(0->1 as well as 1->0).
+
+In addition to notifications, drivers may also support uevents. If so, a uevent
+shall be triggered whenever an alarm or trigger attribute changes its state.
+The uevent shall be triggered on the driver's hwmon device kobject
+(TBD: on the platform device kobject ?).
+
+
 sysfs attribute writes interpretation
 -------------------------------------
 
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

Re: [lm-sensors] [PATCH RFC] hwmon: Add notification and uevent

Hi Guenter,

Quoted 25 lines

-----Original Message-----
From: Guenter Roeck [mailto:[email protected]]
Sent: Monday, September 19, 2011 12:55 AM
To: Jean Delvare
Cc: R, Durgadoss; Lucas Stach; Hans de Goede; [email protected]; linux- [email protected]; Guenter Roeck
Subject: [PATCH RFC] hwmon: Add notification and uevent support to sysfs ABI

Some hwmon drivers start adding support for alarm attribute notifications and generate uevents. Standardize the ABI to be used for this purpose.

---
An attempt to standardize notification and uevent support for hwmon drivers.

 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
Documentation/hwmon/sysfs- renamed from Documentation/hwmon/sysfs-interface +0 -0

interface
index e65e7e8..735d33f 100644

Documentation/hwmon/sysfs-interface +0 -0
@@ -97,6 +97,16 @@ update_interval	The interval at which the chip will update

readings.

Documentation/hwmon/sysfs-interface update_interval The interval at which the chip will update readings. · line 106

Quoted 10 lines
Documentation/hwmon/sysfs-interface +7 -0
 		Some devices have a variable update rate or interval.
 		This attribute can be used to change it to the desired value.
 
+notification	This attribute exists if the driver supports notifications on
+		alarm and trigger attributes. Valid attribute values are:
+		0: The driver does not support notifications or uevents.
+		1: The driver supports notifications.
+		2: The driver generates a uevent if an alarm or trigger status
+		   changes.
+		3: The driver suports notifications and generates a uevent if

s/suports/supports

Documentation/hwmon/sysfs-interface intrusion[0-*]_beep · line 736

Quoted 5 lines

+In addition to notifications, drivers may also support uevents. If so, a uevent

Documentation/hwmon/sysfs-interface +3 -0
+shall be triggered whenever an alarm or trigger attribute changes its state.
+The uevent shall be triggered on the driver's hwmon device kobject
+(TBD: on the platform device kobject ?).

I would prefer the uevent to be on the hwmon device kobject. This way the user space can look for uevents from hwmon 'subsystem'. Then it can retrieve the exact device location from DEVPATH attribute.

Thanks,
Durga

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors