1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) Linaro Ltd 2020
4 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
7 struct thermal_genl_cpu_caps
{
13 enum thermal_genl_multicast_groups
{
14 THERMAL_GENL_SAMPLING_GROUP
= 0,
15 THERMAL_GENL_EVENT_GROUP
= 1,
16 THERMAL_GENL_MAX_GROUP
= THERMAL_GENL_EVENT_GROUP
,
19 #define THERMAL_NOTIFY_BIND 0
20 #define THERMAL_NOTIFY_UNBIND 1
22 struct thermal_genl_notify
{
26 struct thermal_zone_device
;
28 struct thermal_cooling_device
;
30 /* Netlink notification function */
31 #ifdef CONFIG_THERMAL_NETLINK
32 int __init
thermal_netlink_init(void);
33 void __init
thermal_netlink_exit(void);
34 int thermal_genl_register_notifier(struct notifier_block
*nb
);
35 int thermal_genl_unregister_notifier(struct notifier_block
*nb
);
37 int thermal_notify_tz_create(const struct thermal_zone_device
*tz
);
38 int thermal_notify_tz_delete(const struct thermal_zone_device
*tz
);
39 int thermal_notify_tz_enable(const struct thermal_zone_device
*tz
);
40 int thermal_notify_tz_disable(const struct thermal_zone_device
*tz
);
41 int thermal_notify_tz_trip_down(const struct thermal_zone_device
*tz
,
42 const struct thermal_trip
*trip
);
43 int thermal_notify_tz_trip_up(const struct thermal_zone_device
*tz
,
44 const struct thermal_trip
*trip
);
45 int thermal_notify_tz_trip_change(const struct thermal_zone_device
*tz
,
46 const struct thermal_trip
*trip
);
47 int thermal_notify_cdev_state_update(const struct thermal_cooling_device
*cdev
,
49 int thermal_notify_cdev_add(const struct thermal_cooling_device
*cdev
);
50 int thermal_notify_cdev_delete(const struct thermal_cooling_device
*cdev
);
51 int thermal_notify_tz_gov_change(const struct thermal_zone_device
*tz
,
53 int thermal_genl_sampling_temp(int id
, int temp
);
54 int thermal_genl_cpu_capability_event(int count
,
55 struct thermal_genl_cpu_caps
*caps
);
56 int thermal_notify_threshold_add(const struct thermal_zone_device
*tz
,
57 int temperature
, int direction
);
58 int thermal_notify_threshold_delete(const struct thermal_zone_device
*tz
,
59 int temperature
, int direction
);
60 int thermal_notify_threshold_flush(const struct thermal_zone_device
*tz
);
61 int thermal_notify_threshold_down(const struct thermal_zone_device
*tz
);
62 int thermal_notify_threshold_up(const struct thermal_zone_device
*tz
);
64 static inline int thermal_netlink_init(void)
69 static inline int thermal_notify_tz_create(const struct thermal_zone_device
*tz
)
74 static inline int thermal_genl_register_notifier(struct notifier_block
*nb
)
79 static inline int thermal_genl_unregister_notifier(struct notifier_block
*nb
)
84 static inline int thermal_notify_tz_delete(const struct thermal_zone_device
*tz
)
89 static inline int thermal_notify_tz_enable(const struct thermal_zone_device
*tz
)
94 static inline int thermal_notify_tz_disable(const struct thermal_zone_device
*tz
)
99 static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device
*tz
,
100 const struct thermal_trip
*trip
)
105 static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device
*tz
,
106 const struct thermal_trip
*trip
)
111 static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device
*tz
,
112 const struct thermal_trip
*trip
)
117 static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device
*cdev
,
123 static inline int thermal_notify_cdev_add(const struct thermal_cooling_device
*cdev
)
128 static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device
*cdev
)
133 static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device
*tz
,
139 static inline int thermal_genl_sampling_temp(int id
, int temp
)
144 static inline int thermal_genl_cpu_capability_event(int count
, struct thermal_genl_cpu_caps
*caps
)
149 static inline int thermal_notify_threshold_add(const struct thermal_zone_device
*tz
,
150 int temperature
, int direction
)
155 static inline int thermal_notify_threshold_delete(const struct thermal_zone_device
*tz
,
156 int temperature
, int direction
)
161 static inline int thermal_notify_threshold_flush(const struct thermal_zone_device
*tz
)
166 static inline int thermal_notify_threshold_down(const struct thermal_zone_device
*tz
)
171 static inline int thermal_notify_threshold_up(const struct thermal_zone_device
*tz
)
176 static inline void __init
thermal_netlink_exit(void) {}
178 #endif /* CONFIG_THERMAL_NETLINK */