Adding_event_notification_to_thermal_framework
Subsystems (3)
PATCH 1/1 Adding_event_notification_to_thermal_framework
This patch adds event notification support to the generic thermal sysfs framework in the kernel. The notification is in the form of a netlink event.
Signed-off-by R.Durgadoss <[email protected]>
--- Documentation/ABI/stable/thermal-notification | 4 + Documentation/thermal/sysfs-api.txt | 12 +++ drivers/thermal/thermal_sys.c | 103 ++++++++++++++++++++++++- include/linux/thermal.h | 32 ++++++++ 4 files changed, 150 insertions(+), 1 deletions(-) create mode 100644 Documentation/ABI/stable/thermal-notification
Documentation/ABI/stable/thermal-notification new file +4 -0
@@ -0,0 +1,4 @@ +What: A notification mechanism for thermal related events +Description: + This interface enables notification for thermal related events. + The notification is in the form of a netlink event.
Documentation/thermal/sysfs-api.txt +12 -0
@@ -278,3 +278,15 @@ method, the sys I/F structure will be built like this: |---name: acpitz |---temp1_input: 37000 |---temp1_crit: 100000 + +4. Event Notification + +The framework includes a simple notification mechanism, in the form of a +netlink event. Netlink socket initialization is done during the _init_ +of the framework. Drivers which intend to use the notification mechanism +just need to call generate_netlink_event() with two arguments viz +(originator, event). Typically the originator will be an integer assigned +to a thermal_zone_device when it registers itself with the framework. The +event will be one of:{THERMAL_AUX0, THERMAL_AUX1, THERMAL_CRITICAL, +THERMAL_DEV_FAULT}. Notification can be sent when the current temperature +crosses any of the configured thresholds.
drivers/thermal/thermal_sys.c +102 -1
136 lines not on this page · raw message
include/linux/thermal.h +32 -0
@@ -127,6 +127,37 @@ struct thermal_zone_device {struct thermal_hwmon_attr temp_crit;/* hwmon sys attr */ #endif }; +/* Adding event notification support elements */ +#define THERMAL_GENL_FAMILY_NAME "thermal_event" +#define THERMAL_GENL_VERSION 0x01 +#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group" + +enum events { +THERMAL_AUX0 , +THERMAL_AUX1 , +THERMAL_CRITICAL , +THERMAL_DEV_FAULT , +}; + +struct thermal_genl_event { +u32 orig; +enum events event; +}; +/* attributes of thermal_genl_family */ +enum { +THERMAL_GENL_ATTR_UNSPEC , +THERMAL_GENL_ATTR_EVENT , + __THERMAL_GENL_ATTR_MAX, +}; +#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1) + +/* commands supported by the thermal_genl_family */ +enum { +THERMAL_GENL_CMD_UNSPEC , +THERMAL_GENL_CMD_EVENT , + __THERMAL_GENL_CMD_MAX, +}; +#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, struct
@@ -146,5 +177,6 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, thermal_cooling_device_ops *);void thermal_cooling_device_unregister (struct thermal_cooling_device *); +extern int generate_netlink_event (u32 orig,enum events event);#endif /* __THERMAL_H__ */
Signature · 1 line
1.7.2.3
Len Brown
reviewerapplied to acpi-test
thanks,
Len Brown, Intel Open Source Technology Center