powerpc/hugetlb: Don't do runtime allocation of 16G pages in LPAR configuration
[linux-2.6-block.git] / include / linux / thermal.h
CommitLineData
7e3c0381 1/* SPDX-License-Identifier: GPL-2.0 */
203d3d4a
ZR
2/*
3 * thermal.h ($Revision: 0 $)
4 *
5 * Copyright (C) 2008 Intel Corp
6 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
7 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
203d3d4a
ZR
8 */
9
10#ifndef __THERMAL_H__
11#define __THERMAL_H__
12
a116b5d4 13#include <linux/of.h>
203d3d4a
ZR
14#include <linux/idr.h>
15#include <linux/device.h>
4d0fe749 16#include <linux/sysfs.h>
b1569e99 17#include <linux/workqueue.h>
af6c9f16 18#include <uapi/linux/thermal.h>
203d3d4a 19
23064088
D
20#define THERMAL_TRIPS_NONE -1
21#define THERMAL_MAX_TRIPS 12
23064088 22
57df8106
ZR
23/* invalid cooling state */
24#define THERMAL_CSTATE_INVALID -1UL
25
23064088 26/* No upper/lower limit requirement */
a940cb34 27#define THERMAL_NO_LIMIT ((u32)~0)
23064088 28
6cd9e9f6
KS
29/* Default weight of a bound cooling device */
30#define THERMAL_WEIGHT_DEFAULT 0
31
bb431ba2
ZR
32/* use value, which < 0K, to indicate an invalid/uninitialized temperature */
33#define THERMAL_TEMP_INVALID -274000
34
23064088 35/* Unit conversion macros */
e866a2e3
RV
36#define DECI_KELVIN_TO_CELSIUS(t) ({ \
37 long _t = (t); \
38 ((_t-2732 >= 0) ? (_t-2732+5)/10 : (_t-2732-5)/10); \
39})
40#define CELSIUS_TO_DECI_KELVIN(t) ((t)*10+2732)
7b83fd9d
AL
41#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
42#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
77e337c6
AL
43#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
44#define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732)
23064088 45
1f53ef17
ZR
46/* Default Thermal Governor */
47#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
48#define DEFAULT_THERMAL_GOVERNOR "step_wise"
49#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
50#define DEFAULT_THERMAL_GOVERNOR "fair_share"
51#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
52#define DEFAULT_THERMAL_GOVERNOR "user_space"
6b775e87
JM
53#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
54#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
1f53ef17 55#endif
a4a15485 56
203d3d4a
ZR
57struct thermal_zone_device;
58struct thermal_cooling_device;
35b11d2e 59struct thermal_instance;
203d3d4a 60
6503e5df
MG
61enum thermal_device_mode {
62 THERMAL_DEVICE_DISABLED = 0,
63 THERMAL_DEVICE_ENABLED,
64};
65
66enum thermal_trip_type {
67 THERMAL_TRIP_ACTIVE = 0,
68 THERMAL_TRIP_PASSIVE,
69 THERMAL_TRIP_HOT,
70 THERMAL_TRIP_CRITICAL,
71};
72
601f3d42
ZR
73enum thermal_trend {
74 THERMAL_TREND_STABLE, /* temperature is stable */
75 THERMAL_TREND_RAISING, /* temperature is raising */
76 THERMAL_TREND_DROPPING, /* temperature is dropping */
d069015e
ZR
77 THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */
78 THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */
601f3d42
ZR
79};
80
0e70f466
SP
81/* Thermal notification reason */
82enum thermal_notify_event {
83 THERMAL_EVENT_UNSPECIFIED, /* Unspecified event */
84 THERMAL_EVENT_TEMP_SAMPLE, /* New Temperature sample */
85 THERMAL_TRIP_VIOLATED, /* TRIP Point violation */
86 THERMAL_TRIP_CHANGED, /* TRIP Point temperature changed */
87 THERMAL_DEVICE_DOWN, /* Thermal device is down */
88 THERMAL_DEVICE_UP, /* Thermal device is up after a down event */
89 THERMAL_DEVICE_POWER_CAPABILITY_CHANGED, /* power capability changed */
38e44da5 90 THERMAL_TABLE_CHANGED, /* Thermal table(s) changed */
0e70f466
SP
91};
92
203d3d4a
ZR
93struct thermal_zone_device_ops {
94 int (*bind) (struct thermal_zone_device *,
95 struct thermal_cooling_device *);
96 int (*unbind) (struct thermal_zone_device *,
97 struct thermal_cooling_device *);
17e8351a 98 int (*get_temp) (struct thermal_zone_device *, int *);
060c034a 99 int (*set_trips) (struct thermal_zone_device *, int, int);
6503e5df
MG
100 int (*get_mode) (struct thermal_zone_device *,
101 enum thermal_device_mode *);
102 int (*set_mode) (struct thermal_zone_device *,
103 enum thermal_device_mode);
104 int (*get_trip_type) (struct thermal_zone_device *, int,
105 enum thermal_trip_type *);
17e8351a
SH
106 int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
107 int (*set_trip_temp) (struct thermal_zone_device *, int, int);
108 int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
109 int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
110 int (*get_crit_temp) (struct thermal_zone_device *, int *);
111 int (*set_emul_temp) (struct thermal_zone_device *, int);
601f3d42
ZR
112 int (*get_trend) (struct thermal_zone_device *, int,
113 enum thermal_trend *);
b1569e99
MG
114 int (*notify) (struct thermal_zone_device *, int,
115 enum thermal_trip_type);
203d3d4a
ZR
116};
117
118struct thermal_cooling_device_ops {
6503e5df
MG
119 int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
120 int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
121 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
35b11d2e
JM
122 int (*get_requested_power)(struct thermal_cooling_device *,
123 struct thermal_zone_device *, u32 *);
124 int (*state2power)(struct thermal_cooling_device *,
125 struct thermal_zone_device *, unsigned long, u32 *);
126 int (*power2state)(struct thermal_cooling_device *,
127 struct thermal_zone_device *, u32, unsigned long *);
203d3d4a
ZR
128};
129
203d3d4a
ZR
130struct thermal_cooling_device {
131 int id;
132 char type[THERMAL_NAME_LENGTH];
133 struct device device;
4e5e4705 134 struct device_node *np;
203d3d4a 135 void *devdata;
8ea22951 136 void *stats;
5b275ce2 137 const struct thermal_cooling_device_ops *ops;
ce119f83 138 bool updated; /* true if the cooling device does not need update */
f4a821ce 139 struct mutex lock; /* protect thermal_instances list */
b5e4ae62 140 struct list_head thermal_instances;
203d3d4a
ZR
141 struct list_head node;
142};
143
c56f5c03
D
144struct thermal_attr {
145 struct device_attribute attr;
146 char name[THERMAL_NAME_LENGTH];
147};
148
c708a98f
JM
149/**
150 * struct thermal_zone_device - structure for a thermal zone
151 * @id: unique id number for each thermal zone
152 * @type: the thermal zone device type
153 * @device: &struct device for this thermal zone
154 * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature
155 * @trip_type_attrs: attributes for trip points for sysfs: trip type
156 * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
157 * @devdata: private pointer for device private data
158 * @trips: number of trip points the thermal zone supports
81ad4276 159 * @trips_disabled; bitmap for disabled trips
c708a98f 160 * @passive_delay: number of milliseconds to wait between polls when
6b775e87 161 * performing passive cooling.
c708a98f
JM
162 * @polling_delay: number of milliseconds to wait between polls when
163 * checking whether trip points have been crossed (0 for
164 * interrupt driven systems)
165 * @temperature: current temperature. This is only for core code,
166 * drivers should use thermal_zone_get_temp() to get the
167 * current temperature
168 * @last_temperature: previous temperature read
169 * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION
170 * @passive: 1 if you've crossed a passive trip point, 0 otherwise.
060c034a
SH
171 * @prev_low_trip: the low current temperature if you've crossed a passive
172 trip point.
173 * @prev_high_trip: the above current temperature if you've crossed a
174 passive trip point.
c708a98f
JM
175 * @forced_passive: If > 0, temperature at which to switch on all ACPI
176 * processor cooling devices. Currently only used by the
177 * step-wise governor.
4511f716 178 * @need_update: if equals 1, thermal_zone_device_update needs to be invoked.
c708a98f
JM
179 * @ops: operations this &thermal_zone_device supports
180 * @tzp: thermal zone parameters
181 * @governor: pointer to the governor for this thermal zone
e33df1d2 182 * @governor_data: private pointer for governor data
c708a98f 183 * @thermal_instances: list of &struct thermal_instance of this thermal zone
b31ef828 184 * @ida: &struct ida to generate unique id for this zone's cooling
c708a98f
JM
185 * devices
186 * @lock: lock to protect thermal_instances list
187 * @node: node in thermal_tz_list (in thermal_core.c)
188 * @poll_queue: delayed work for polling
0e70f466 189 * @notify_event: Last notification event
c708a98f 190 */
203d3d4a
ZR
191struct thermal_zone_device {
192 int id;
193 char type[THERMAL_NAME_LENGTH];
194 struct device device;
4d0fe749 195 struct attribute_group trips_attribute_group;
c56f5c03
D
196 struct thermal_attr *trip_temp_attrs;
197 struct thermal_attr *trip_type_attrs;
27365a6c 198 struct thermal_attr *trip_hyst_attrs;
203d3d4a
ZR
199 void *devdata;
200 int trips;
81ad4276 201 unsigned long trips_disabled; /* bitmap for disabled trips */
b1569e99
MG
202 int passive_delay;
203 int polling_delay;
601f3d42 204 int temperature;
b1569e99 205 int last_temperature;
e6e238c3 206 int emul_temperature;
908b9fb7 207 int passive;
060c034a
SH
208 int prev_low_trip;
209 int prev_high_trip;
03a971a2 210 unsigned int forced_passive;
4511f716 211 atomic_t need_update;
4e5e4705 212 struct thermal_zone_device_ops *ops;
6b775e87 213 struct thermal_zone_params *tzp;
a4a15485 214 struct thermal_governor *governor;
e33df1d2 215 void *governor_data;
2d374139 216 struct list_head thermal_instances;
b31ef828 217 struct ida ida;
c708a98f 218 struct mutex lock;
203d3d4a 219 struct list_head node;
b1569e99 220 struct delayed_work poll_queue;
0e70f466 221 enum thermal_notify_event notify_event;
203d3d4a 222};
4cb18728 223
c708a98f
JM
224/**
225 * struct thermal_governor - structure that holds thermal governor information
226 * @name: name of the governor
e33df1d2
JM
227 * @bind_to_tz: callback called when binding to a thermal zone. If it
228 * returns 0, the governor is bound to the thermal zone,
229 * otherwise it fails.
230 * @unbind_from_tz: callback called when a governor is unbound from a
231 * thermal zone.
c708a98f
JM
232 * @throttle: callback called for every trip point even if temperature is
233 * below the trip point temperature
234 * @governor_list: node in thermal_governor_list (in thermal_core.c)
235 */
a4a15485
D
236struct thermal_governor {
237 char name[THERMAL_NAME_LENGTH];
e33df1d2
JM
238 int (*bind_to_tz)(struct thermal_zone_device *tz);
239 void (*unbind_from_tz)(struct thermal_zone_device *tz);
a4a15485
D
240 int (*throttle)(struct thermal_zone_device *tz, int trip);
241 struct list_head governor_list;
a4a15485
D
242};
243
ef873947
D
244/* Structure that holds binding parameters for a zone */
245struct thermal_bind_params {
246 struct thermal_cooling_device *cdev;
247
248 /*
249 * This is a measure of 'how effectively these devices can
bcdcbbc7
JM
250 * cool 'this' thermal zone. It shall be determined by
251 * platform characterization. This value is relative to the
252 * rest of the weights so a cooling device whose weight is
253 * double that of another cooling device is twice as
254 * effective. See Documentation/thermal/sysfs-api.txt for more
255 * information.
ef873947
D
256 */
257 int weight;
258
259 /*
260 * This is a bit mask that gives the binding relation between this
261 * thermal zone and cdev, for a particular trip point.
262 * See Documentation/thermal/sysfs-api.txt for more information.
263 */
264 int trip_mask;
a8892d83
EV
265
266 /*
267 * This is an array of cooling state limits. Must have exactly
268 * 2 * thermal_zone.number_of_trip_points. It is an array consisting
269 * of tuples <lower-state upper-state> of state limits. Each trip
270 * will be associated with one state limit tuple when binding.
271 * A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
272 * on all trips.
273 */
274 unsigned long *binding_limits;
ef873947
D
275 int (*match) (struct thermal_zone_device *tz,
276 struct thermal_cooling_device *cdev);
277};
278
279/* Structure to define Thermal Zone parameters */
280struct thermal_zone_params {
a4a15485 281 char governor_name[THERMAL_NAME_LENGTH];
ccba4ffd
EV
282
283 /*
284 * a boolean to indicate if the thermal to hwmon sysfs interface
285 * is required. when no_hwmon == false, a hwmon sysfs interface
286 * will be created. when no_hwmon == true, nothing will be done
287 */
288 bool no_hwmon;
289
ef873947
D
290 int num_tbps; /* Number of tbp entries */
291 struct thermal_bind_params *tbp;
6b775e87
JM
292
293 /*
294 * Sustainable power (heat) that this thermal zone can dissipate in
295 * mW
296 */
297 u32 sustainable_power;
298
299 /*
300 * Proportional parameter of the PID controller when
301 * overshooting (i.e., when temperature is below the target)
302 */
303 s32 k_po;
304
305 /*
306 * Proportional parameter of the PID controller when
307 * undershooting
308 */
309 s32 k_pu;
310
311 /* Integral parameter of the PID controller */
312 s32 k_i;
313
314 /* Derivative parameter of the PID controller */
315 s32 k_d;
316
317 /* threshold below which the error is no longer accumulated */
318 s32 integral_cutoff;
9d0be7f4
EV
319
320 /*
321 * @slope: slope of a linear temperature adjustment curve.
322 * Used by thermal zone drivers.
323 */
324 int slope;
325 /*
326 * @offset: offset of a linear temperature adjustment curve.
327 * Used by thermal zone drivers (default 0).
328 */
329 int offset;
ef873947
D
330};
331
4cb18728
D
332struct thermal_genl_event {
333 u32 orig;
334 enum events event;
335};
203d3d4a 336
2251aef6
EV
337/**
338 * struct thermal_zone_of_device_ops - scallbacks for handling DT based zones
339 *
340 * Mandatory:
341 * @get_temp: a pointer to a function that reads the sensor temperature.
342 *
343 * Optional:
344 * @get_trend: a pointer to a function that reads the sensor temperature trend.
826386e7
SH
345 * @set_trips: a pointer to a function that sets a temperature window. When
346 * this window is left the driver must inform the thermal core via
347 * thermal_zone_device_update.
184a4bf6
LM
348 * @set_emul_temp: a pointer to a function that sets sensor emulated
349 * temperature.
5a5e78cd
CW
350 * @set_trip_temp: a pointer to a function that sets the trip temperature on
351 * hardware.
2251aef6
EV
352 */
353struct thermal_zone_of_device_ops {
17e8351a 354 int (*get_temp)(void *, int *);
e78eaf45 355 int (*get_trend)(void *, int, enum thermal_trend *);
826386e7 356 int (*set_trips)(void *, int, int);
17e8351a 357 int (*set_emul_temp)(void *, int);
c3509521 358 int (*set_trip_temp)(void *, int, int);
2251aef6
EV
359};
360
ad9914ac
LM
361/**
362 * struct thermal_trip - representation of a point in temperature domain
363 * @np: pointer to struct device_node that this trip point was created from
364 * @temperature: temperature value in miliCelsius
365 * @hysteresis: relative hysteresis in miliCelsius
366 * @type: trip point type
367 */
368
369struct thermal_trip {
370 struct device_node *np;
1d0fd42f
WN
371 int temperature;
372 int hysteresis;
ad9914ac
LM
373 enum thermal_trip_type type;
374};
375
23064088 376/* Function declarations */
4e5e4705
EV
377#ifdef CONFIG_THERMAL_OF
378struct thermal_zone_device *
2251aef6
EV
379thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
380 const struct thermal_zone_of_device_ops *ops);
4e5e4705
EV
381void thermal_zone_of_sensor_unregister(struct device *dev,
382 struct thermal_zone_device *tz);
e498b498
LD
383struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
384 struct device *dev, int id, void *data,
385 const struct thermal_zone_of_device_ops *ops);
386void devm_thermal_zone_of_sensor_unregister(struct device *dev,
387 struct thermal_zone_device *tz);
4e5e4705
EV
388#else
389static inline struct thermal_zone_device *
2251aef6
EV
390thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
391 const struct thermal_zone_of_device_ops *ops)
4e5e4705 392{
cd33dc9a 393 return ERR_PTR(-ENODEV);
4e5e4705
EV
394}
395
396static inline
397void thermal_zone_of_sensor_unregister(struct device *dev,
398 struct thermal_zone_device *tz)
399{
400}
401
e498b498
LD
402static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
403 struct device *dev, int id, void *data,
404 const struct thermal_zone_of_device_ops *ops)
405{
406 return ERR_PTR(-ENODEV);
407}
408
409static inline
410void devm_thermal_zone_of_sensor_unregister(struct device *dev,
411 struct thermal_zone_device *tz)
412{
413}
414
4e5e4705 415#endif
12ca7188
NM
416
417#if IS_ENABLED(CONFIG_THERMAL)
35b11d2e
JM
418static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
419{
420 return cdev->ops->get_requested_power && cdev->ops->state2power &&
421 cdev->ops->power2state;
422}
423
424int power_actor_get_max_power(struct thermal_cooling_device *,
425 struct thermal_zone_device *tz, u32 *max_power);
c973c3bc
JM
426int power_actor_get_min_power(struct thermal_cooling_device *,
427 struct thermal_zone_device *tz, u32 *min_power);
35b11d2e
JM
428int power_actor_set_power(struct thermal_cooling_device *,
429 struct thermal_instance *, u32);
4b1bf587 430struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
4e5e4705 431 void *, struct thermal_zone_device_ops *,
6b775e87 432 struct thermal_zone_params *, int, int);
203d3d4a
ZR
433void thermal_zone_device_unregister(struct thermal_zone_device *);
434
435int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
9d99842f 436 struct thermal_cooling_device *,
6cd9e9f6
KS
437 unsigned long, unsigned long,
438 unsigned int);
203d3d4a
ZR
439int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
440 struct thermal_cooling_device *);
0e70f466
SP
441void thermal_zone_device_update(struct thermal_zone_device *,
442 enum thermal_notify_event);
060c034a 443void thermal_zone_set_trips(struct thermal_zone_device *);
23064088 444
203d3d4a 445struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
5b275ce2 446 const struct thermal_cooling_device_ops *);
a116b5d4
EV
447struct thermal_cooling_device *
448thermal_of_cooling_device_register(struct device_node *np, char *, void *,
449 const struct thermal_cooling_device_ops *);
203d3d4a 450void thermal_cooling_device_unregister(struct thermal_cooling_device *);
63c4d919 451struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
17e8351a 452int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
4a7069a3
RN
453int thermal_zone_get_slope(struct thermal_zone_device *tz);
454int thermal_zone_get_offset(struct thermal_zone_device *tz);
af06216a 455
9b4298a0
D
456int get_tz_trend(struct thermal_zone_device *, int);
457struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
458 struct thermal_cooling_device *, int);
dc765482 459void thermal_cdev_update(struct thermal_cooling_device *);
7b73c993 460void thermal_notify_framework(struct thermal_zone_device *, int);
12ca7188 461#else
35b11d2e
JM
462static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
463{ return false; }
464static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev,
465 struct thermal_zone_device *tz, u32 *max_power)
466{ return 0; }
c973c3bc
JM
467static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev,
468 struct thermal_zone_device *tz,
469 u32 *min_power)
470{ return -ENODEV; }
35b11d2e
JM
471static inline int power_actor_set_power(struct thermal_cooling_device *cdev,
472 struct thermal_instance *tz, u32 power)
473{ return 0; }
12ca7188
NM
474static inline struct thermal_zone_device *thermal_zone_device_register(
475 const char *type, int trips, int mask, void *devdata,
476 struct thermal_zone_device_ops *ops,
023b7b07 477 struct thermal_zone_params *tzp,
12ca7188
NM
478 int passive_delay, int polling_delay)
479{ return ERR_PTR(-ENODEV); }
480static inline void thermal_zone_device_unregister(
481 struct thermal_zone_device *tz)
482{ }
483static inline int thermal_zone_bind_cooling_device(
484 struct thermal_zone_device *tz, int trip,
485 struct thermal_cooling_device *cdev,
c86b3de8
AB
486 unsigned long upper, unsigned long lower,
487 unsigned int weight)
12ca7188
NM
488{ return -ENODEV; }
489static inline int thermal_zone_unbind_cooling_device(
490 struct thermal_zone_device *tz, int trip,
491 struct thermal_cooling_device *cdev)
492{ return -ENODEV; }
0e70f466
SP
493static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
494 enum thermal_notify_event event)
12ca7188 495{ }
060c034a
SH
496static inline void thermal_zone_set_trips(struct thermal_zone_device *tz)
497{ }
12ca7188
NM
498static inline struct thermal_cooling_device *
499thermal_cooling_device_register(char *type, void *devdata,
500 const struct thermal_cooling_device_ops *ops)
501{ return ERR_PTR(-ENODEV); }
502static inline struct thermal_cooling_device *
503thermal_of_cooling_device_register(struct device_node *np,
504 char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
505{ return ERR_PTR(-ENODEV); }
506static inline void thermal_cooling_device_unregister(
507 struct thermal_cooling_device *cdev)
508{ }
509static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
510 const char *name)
511{ return ERR_PTR(-ENODEV); }
512static inline int thermal_zone_get_temp(
17e8351a 513 struct thermal_zone_device *tz, int *temp)
12ca7188 514{ return -ENODEV; }
4a7069a3
RN
515static inline int thermal_zone_get_slope(
516 struct thermal_zone_device *tz)
517{ return -ENODEV; }
518static inline int thermal_zone_get_offset(
519 struct thermal_zone_device *tz)
520{ return -ENODEV; }
12ca7188
NM
521static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
522{ return -ENODEV; }
523static inline struct thermal_instance *
524get_thermal_instance(struct thermal_zone_device *tz,
525 struct thermal_cooling_device *cdev, int trip)
526{ return ERR_PTR(-ENODEV); }
527static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
528{ }
529static inline void thermal_notify_framework(struct thermal_zone_device *tz,
530 int trip)
531{ }
532#endif /* CONFIG_THERMAL */
533
534#if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL)
8ab3e6a0
EV
535extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
536 enum events event);
af06216a 537#else
f8b58705 538static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
8ab3e6a0 539 enum events event)
af06216a
RW
540{
541 return 0;
542}
543#endif
203d3d4a 544
a0dd25b2 545#endif /* __THERMAL_H__ */