xref: /linux/drivers/thermal/thermal_netlink.h (revision 40ccd6aa3e2e05be93394e3cd560c718dedfcc77)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  Copyright (C) Linaro Ltd 2020
4  *  Author: Daniel Lezcano <daniel.lezcano@linaro.org>
5  */
6 
7 struct thermal_genl_cpu_caps {
8 	int cpu;
9 	int performance;
10 	int efficiency;
11 };
12 
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,
17 };
18 
19 #define THERMAL_NOTIFY_BIND	0
20 #define THERMAL_NOTIFY_UNBIND	1
21 
22 struct thermal_genl_notify {
23 	int mcgrp;
24 };
25 
26 struct thermal_zone_device;
27 struct thermal_trip;
28 struct thermal_cooling_device;
29 
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);
36 
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,
48 				     int state);
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,
52 				 const char *name);
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 #else
57 static inline int thermal_netlink_init(void)
58 {
59 	return 0;
60 }
61 
62 static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
63 {
64 	return 0;
65 }
66 
67 static inline int thermal_genl_register_notifier(struct notifier_block *nb)
68 {
69 	return 0;
70 }
71 
72 static inline int thermal_genl_unregister_notifier(struct notifier_block *nb)
73 {
74 	return 0;
75 }
76 
77 static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
78 {
79 	return 0;
80 }
81 
82 static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
83 {
84 	return 0;
85 }
86 
87 static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
88 {
89 	return 0;
90 }
91 
92 static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
93 					      const struct thermal_trip *trip)
94 {
95 	return 0;
96 }
97 
98 static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
99 					    const struct thermal_trip *trip)
100 {
101 	return 0;
102 }
103 
104 static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
105 						const struct thermal_trip *trip)
106 {
107 	return 0;
108 }
109 
110 static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
111 						   int state)
112 {
113 	return 0;
114 }
115 
116 static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
117 {
118 	return 0;
119 }
120 
121 static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
122 {
123 	return 0;
124 }
125 
126 static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
127 					       const char *name)
128 {
129 	return 0;
130 }
131 
132 static inline int thermal_genl_sampling_temp(int id, int temp)
133 {
134 	return 0;
135 }
136 
137 static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
138 {
139 	return 0;
140 }
141 
142 static inline void __init thermal_netlink_exit(void) {}
143 
144 #endif /* CONFIG_THERMAL_NETLINK */
145