Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) Linaro Ltd 2020
4 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
5 */
6
7struct thermal_genl_cpu_caps {
8 int cpu;
9 int performance;
10 int efficiency;
11};
12
13enum 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
22struct thermal_genl_notify {
23 int mcgrp;
24};
25
26struct thermal_zone_device;
27struct thermal_trip;
28struct thermal_cooling_device;
29
30/* Netlink notification function */
31#ifdef CONFIG_THERMAL_NETLINK
32int __init thermal_netlink_init(void);
33void __init thermal_netlink_exit(void);
34int thermal_genl_register_notifier(struct notifier_block *nb);
35int thermal_genl_unregister_notifier(struct notifier_block *nb);
36
37int thermal_notify_tz_create(const struct thermal_zone_device *tz);
38int thermal_notify_tz_delete(const struct thermal_zone_device *tz);
39int thermal_notify_tz_enable(const struct thermal_zone_device *tz);
40int thermal_notify_tz_disable(const struct thermal_zone_device *tz);
41int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
42 const struct thermal_trip *trip);
43int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
44 const struct thermal_trip *trip);
45int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
46 const struct thermal_trip *trip);
47int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
48 int state);
49int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev);
50int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev);
51int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
52 const char *name);
53int thermal_genl_sampling_temp(int id, int temp);
54int thermal_genl_cpu_capability_event(int count,
55 struct thermal_genl_cpu_caps *caps);
56int thermal_notify_threshold_add(const struct thermal_zone_device *tz,
57 int temperature, int direction);
58int thermal_notify_threshold_delete(const struct thermal_zone_device *tz,
59 int temperature, int direction);
60int thermal_notify_threshold_flush(const struct thermal_zone_device *tz);
61int thermal_notify_threshold_down(const struct thermal_zone_device *tz);
62int thermal_notify_threshold_up(const struct thermal_zone_device *tz);
63#else
64static inline int thermal_netlink_init(void)
65{
66 return 0;
67}
68
69static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
70{
71 return 0;
72}
73
74static inline int thermal_genl_register_notifier(struct notifier_block *nb)
75{
76 return 0;
77}
78
79static inline int thermal_genl_unregister_notifier(struct notifier_block *nb)
80{
81 return 0;
82}
83
84static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
85{
86 return 0;
87}
88
89static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
90{
91 return 0;
92}
93
94static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
95{
96 return 0;
97}
98
99static 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
105static 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
111static 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
117static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
118 int state)
119{
120 return 0;
121}
122
123static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
124{
125 return 0;
126}
127
128static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
129{
130 return 0;
131}
132
133static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
134 const char *name)
135{
136 return 0;
137}
138
139static inline int thermal_genl_sampling_temp(int id, int temp)
140{
141 return 0;
142}
143
144static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
145{
146 return 0;
147}
148
149static inline int thermal_notify_threshold_add(const struct thermal_zone_device *tz,
150 int temperature, int direction)
151{
152 return 0;
153}
154
155static inline int thermal_notify_threshold_delete(const struct thermal_zone_device *tz,
156 int temperature, int direction)
157{
158 return 0;
159}
160
161static inline int thermal_notify_threshold_flush(const struct thermal_zone_device *tz)
162{
163 return 0;
164}
165
166static inline int thermal_notify_threshold_down(const struct thermal_zone_device *tz)
167{
168 return 0;
169}
170
171static inline int thermal_notify_threshold_up(const struct thermal_zone_device *tz)
172{
173 return 0;
174}
175
176static inline void __init thermal_netlink_exit(void) {}
177
178#endif /* CONFIG_THERMAL_NETLINK */
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) Linaro Ltd 2020
4 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
5 */
6
7struct thermal_genl_cpu_caps {
8 int cpu;
9 int performance;
10 int efficiency;
11};
12
13/* Netlink notification function */
14#ifdef CONFIG_THERMAL_NETLINK
15int __init thermal_netlink_init(void);
16int thermal_notify_tz_create(int tz_id, const char *name);
17int thermal_notify_tz_delete(int tz_id);
18int thermal_notify_tz_enable(int tz_id);
19int thermal_notify_tz_disable(int tz_id);
20int thermal_notify_tz_trip_down(int tz_id, int id, int temp);
21int thermal_notify_tz_trip_up(int tz_id, int id, int temp);
22int thermal_notify_tz_trip_delete(int tz_id, int id);
23int thermal_notify_tz_trip_add(int tz_id, int id, int type,
24 int temp, int hyst);
25int thermal_notify_tz_trip_change(int tz_id, int id, int type,
26 int temp, int hyst);
27int thermal_notify_cdev_state_update(int cdev_id, int state);
28int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state);
29int thermal_notify_cdev_delete(int cdev_id);
30int thermal_notify_tz_gov_change(int tz_id, const char *name);
31int thermal_genl_sampling_temp(int id, int temp);
32int thermal_genl_cpu_capability_event(int count,
33 struct thermal_genl_cpu_caps *caps);
34#else
35static inline int thermal_netlink_init(void)
36{
37 return 0;
38}
39
40static inline int thermal_notify_tz_create(int tz_id, const char *name)
41{
42 return 0;
43}
44
45static inline int thermal_notify_tz_delete(int tz_id)
46{
47 return 0;
48}
49
50static inline int thermal_notify_tz_enable(int tz_id)
51{
52 return 0;
53}
54
55static inline int thermal_notify_tz_disable(int tz_id)
56{
57 return 0;
58}
59
60static inline int thermal_notify_tz_trip_down(int tz_id, int id, int temp)
61{
62 return 0;
63}
64
65static inline int thermal_notify_tz_trip_up(int tz_id, int id, int temp)
66{
67 return 0;
68}
69
70static inline int thermal_notify_tz_trip_delete(int tz_id, int id)
71{
72 return 0;
73}
74
75static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type,
76 int temp, int hyst)
77{
78 return 0;
79}
80
81static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type,
82 int temp, int hyst)
83{
84 return 0;
85}
86
87static inline int thermal_notify_cdev_state_update(int cdev_id, int state)
88{
89 return 0;
90}
91
92static inline int thermal_notify_cdev_add(int cdev_id, const char *name,
93 int max_state)
94{
95 return 0;
96}
97
98static inline int thermal_notify_cdev_delete(int cdev_id)
99{
100 return 0;
101}
102
103static inline int thermal_notify_tz_gov_change(int tz_id, const char *name)
104{
105 return 0;
106}
107
108static inline int thermal_genl_sampling_temp(int id, int temp)
109{
110 return 0;
111}
112
113static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
114{
115 return 0;
116}
117
118#endif /* CONFIG_THERMAL_NETLINK */