xref: /linux/drivers/thermal/thermal_netlink.h (revision 621cde16e49b3ecf7d59a8106a20aaebfb4a59a9)
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
thermal_netlink_init(void)57 static inline int thermal_netlink_init(void)
58 {
59 	return 0;
60 }
61 
thermal_notify_tz_create(const struct thermal_zone_device * tz)62 static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
63 {
64 	return 0;
65 }
66 
thermal_genl_register_notifier(struct notifier_block * nb)67 static inline int thermal_genl_register_notifier(struct notifier_block *nb)
68 {
69 	return 0;
70 }
71 
thermal_genl_unregister_notifier(struct notifier_block * nb)72 static inline int thermal_genl_unregister_notifier(struct notifier_block *nb)
73 {
74 	return 0;
75 }
76 
thermal_notify_tz_delete(const struct thermal_zone_device * tz)77 static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
78 {
79 	return 0;
80 }
81 
thermal_notify_tz_enable(const struct thermal_zone_device * tz)82 static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
83 {
84 	return 0;
85 }
86 
thermal_notify_tz_disable(const struct thermal_zone_device * tz)87 static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
88 {
89 	return 0;
90 }
91 
thermal_notify_tz_trip_down(const struct thermal_zone_device * tz,const struct thermal_trip * trip)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 
thermal_notify_tz_trip_up(const struct thermal_zone_device * tz,const struct thermal_trip * trip)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 
thermal_notify_tz_trip_change(const struct thermal_zone_device * tz,const struct thermal_trip * trip)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 
thermal_notify_cdev_state_update(const struct thermal_cooling_device * cdev,int state)110 static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
111 						   int state)
112 {
113 	return 0;
114 }
115 
thermal_notify_cdev_add(const struct thermal_cooling_device * cdev)116 static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
117 {
118 	return 0;
119 }
120 
thermal_notify_cdev_delete(const struct thermal_cooling_device * cdev)121 static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
122 {
123 	return 0;
124 }
125 
thermal_notify_tz_gov_change(const struct thermal_zone_device * tz,const char * name)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 
thermal_genl_sampling_temp(int id,int temp)132 static inline int thermal_genl_sampling_temp(int id, int temp)
133 {
134 	return 0;
135 }
136 
thermal_genl_cpu_capability_event(int count,struct thermal_genl_cpu_caps * caps)137 static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
138 {
139 	return 0;
140 }
141 
thermal_netlink_exit(void)142 static inline void __init thermal_netlink_exit(void) {}
143 
144 #endif /* CONFIG_THERMAL_NETLINK */
145