History

thermal: core: genetlink support for events/cmd/sampling

Initially the thermal framework had a very simple notification mechanism to send generic netlink messages to the userspace. The notification function was never called from anywhere and the corresponding dead code was removed. It was probably a first attempt to introduce the netlink notification. At LPC2018, the presentation "Linux thermal: User kernel interface", proposed to create the notifications to the userspace via a kfifo. The advantage of the kfifo is the performance. It is usually used from a 1:1 communication channel where a driver captures data and sends it as fast as possible to a userspace process. The drawback is that only one process uses the notification channel exclusively, thus no other process is allowed to use the channel to get temperature or notifications. This patch defines a generic netlink API to discover the current thermal setup and adds event notifications as well as temperature sampling. As any genetlink protocol, it can evolve and the versioning allows to keep the backward compatibility. In order to prevent the user from getting flooded with data on a single channel, there are two multicast channels, one for the temperature sampling when the thermal zone is updated and another one for the events, so the user can get the events only without the thermal zone temperature sampling. Also, a list of commands to discover the thermal setup is added and can be extended when needed.

Daniel Lezcano committed 6 years ago

Commit 1ce50e71 parent 329b0645 files · +739 −35Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/thermal.h+0−17
@@ -37,18 +37,6 @@ struct thermal_cooling_device; · 36 unmodified lines
3737 struct thermal_instance;
3838 struct thermal_attr;
3939
40−enum thermal_device_mode {
41− THERMAL_DEVICE_DISABLED = 0,
42− THERMAL_DEVICE_ENABLED,
43−};
44−
45−enum thermal_trip_type {
46− THERMAL_TRIP_ACTIVE = 0,
47− THERMAL_TRIP_PASSIVE,
48− THERMAL_TRIP_HOT,
49− THERMAL_TRIP_CRITICAL,
50−};
51−
5240 enum thermal_trend {
5341 THERMAL_TREND_STABLE, /* temperature is stable */
5442 THERMAL_TREND_RAISING, /* temperature is raising */
@@ -303,11 +291,6 @@ struct thermal_zone_params { · 248 unmodified lines
303291 int offset;
304292 };
305293
306−struct thermal_genl_event {
307− u32 orig;
308− enum events event;
309−};
310−
311294 /**
312295 * struct thermal_zone_of_device_ops - scallbacks for handling DT based zones
313296 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t