1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) Linaro Ltd 2020
4 * Author: Daniel Lezcano <[email protected]>
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 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);
63 #else
thermal_netlink_init(void)64 static inline int thermal_netlink_init(void)
65 {
66 return 0;
67 }
68
thermal_notify_tz_create(const struct thermal_zone_device * tz)69 static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
70 {
71 return 0;
72 }
73
thermal_genl_register_notifier(struct notifier_block * nb)74 static inline int thermal_genl_register_notifier(struct notifier_block *nb)
75 {
76 return 0;
77 }
78
thermal_genl_unregister_notifier(struct notifier_block * nb)79 static inline int thermal_genl_unregister_notifier(struct notifier_block *nb)
80 {
81 return 0;
82 }
83
thermal_notify_tz_delete(const struct thermal_zone_device * tz)84 static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
85 {
86 return 0;
87 }
88
thermal_notify_tz_enable(const struct thermal_zone_device * tz)89 static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
90 {
91 return 0;
92 }
93
thermal_notify_tz_disable(const struct thermal_zone_device * tz)94 static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
95 {
96 return 0;
97 }
98
thermal_notify_tz_trip_down(const struct thermal_zone_device * tz,const struct thermal_trip * trip)99 static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
100 const struct thermal_trip *trip)
101 {
102 return 0;
103 }
104
thermal_notify_tz_trip_up(const struct thermal_zone_device * tz,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)
107 {
108 return 0;
109 }
110
thermal_notify_tz_trip_change(const struct thermal_zone_device * tz,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)
113 {
114 return 0;
115 }
116
thermal_notify_cdev_state_update(const struct thermal_cooling_device * cdev,int state)117 static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
118 int state)
119 {
120 return 0;
121 }
122
thermal_notify_cdev_add(const struct thermal_cooling_device * cdev)123 static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
124 {
125 return 0;
126 }
127
thermal_notify_cdev_delete(const struct thermal_cooling_device * cdev)128 static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
129 {
130 return 0;
131 }
132
thermal_notify_tz_gov_change(const struct thermal_zone_device * tz,const char * name)133 static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
134 const char *name)
135 {
136 return 0;
137 }
138
thermal_genl_sampling_temp(int id,int temp)139 static inline int thermal_genl_sampling_temp(int id, int temp)
140 {
141 return 0;
142 }
143
thermal_genl_cpu_capability_event(int count,struct thermal_genl_cpu_caps * caps)144 static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
145 {
146 return 0;
147 }
148
thermal_notify_threshold_add(const struct thermal_zone_device * tz,int temperature,int direction)149 static inline int thermal_notify_threshold_add(const struct thermal_zone_device *tz,
150 int temperature, int direction)
151 {
152 return 0;
153 }
154
thermal_notify_threshold_delete(const struct thermal_zone_device * tz,int temperature,int direction)155 static inline int thermal_notify_threshold_delete(const struct thermal_zone_device *tz,
156 int temperature, int direction)
157 {
158 return 0;
159 }
160
thermal_notify_threshold_flush(const struct thermal_zone_device * tz)161 static inline int thermal_notify_threshold_flush(const struct thermal_zone_device *tz)
162 {
163 return 0;
164 }
165
thermal_notify_threshold_down(const struct thermal_zone_device * tz)166 static inline int thermal_notify_threshold_down(const struct thermal_zone_device *tz)
167 {
168 return 0;
169 }
170
thermal_notify_threshold_up(const struct thermal_zone_device * tz)171 static inline int thermal_notify_threshold_up(const struct thermal_zone_device *tz)
172 {
173 return 0;
174 }
175
thermal_netlink_exit(void)176 static inline void __init thermal_netlink_exit(void) {}
177
178 #endif /* CONFIG_THERMAL_NETLINK */
179