c82bd1e4860f853dc0fbe8f470450af37e198106
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / include / linux / thermal.h
1 /*
2 * thermal.h ($Revision: 0 $)
3 *
4 * Copyright (C) 2008 Intel Corp
5 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
6 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 */
24
25 #ifndef __THERMAL_H__
26 #define __THERMAL_H__
27
28 #include <linux/of.h>
29 #include <linux/idr.h>
30 #include <linux/device.h>
31 #include <linux/sysfs.h>
32 #include <linux/workqueue.h>
33 #include <uapi/linux/thermal.h>
34
35 #define THERMAL_TRIPS_NONE -1
36 #define THERMAL_MAX_TRIPS 12
37
38 /* invalid cooling state */
39 #define THERMAL_CSTATE_INVALID -1UL
40
41 /* invalid cooling frequency */
42 #define THERMAL_CFREQ_INVALID -1
43
44 /* No upper/lower limit requirement */
45 #define THERMAL_NO_LIMIT ((u32)~0)
46
47 /* Default weight of a bound cooling device */
48 #define THERMAL_WEIGHT_DEFAULT 0
49
50 /* use value, which < 0K, to indicate an invalid/uninitialized temperature */
51 #define THERMAL_TEMP_INVALID -274000
52
53 /* Unit conversion macros */
54 #define DECI_KELVIN_TO_CELSIUS(t) ({ \
55 long _t = (t); \
56 ((_t-2732 >= 0) ? (_t-2732+5)/10 : (_t-2732-5)/10); \
57 })
58 #define CELSIUS_TO_DECI_KELVIN(t) ((t)*10+2732)
59 #define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
60 #define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
61 #define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
62 #define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732)
63
64 /* Default Thermal Governor */
65 #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
66 #define DEFAULT_THERMAL_GOVERNOR "step_wise"
67 #elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
68 #define DEFAULT_THERMAL_GOVERNOR "fair_share"
69 #elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
70 #define DEFAULT_THERMAL_GOVERNOR "user_space"
71 #elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
72 #define DEFAULT_THERMAL_GOVERNOR "power_allocator"
73 #endif
74
75 struct thermal_zone_device;
76 struct thermal_cooling_device;
77 struct thermal_instance;
78
79 enum thermal_device_mode {
80 THERMAL_DEVICE_DISABLED = 0,
81 THERMAL_DEVICE_ENABLED,
82 };
83
84 enum thermal_trip_type {
85 THERMAL_TRIP_ACTIVE = 0,
86 THERMAL_TRIP_PASSIVE,
87 THERMAL_TRIP_HOT,
88 THERMAL_TRIP_CRITICAL,
89 };
90
91 enum thermal_trend {
92 THERMAL_TREND_STABLE, /* temperature is stable */
93 THERMAL_TREND_RAISING, /* temperature is raising */
94 THERMAL_TREND_DROPPING, /* temperature is dropping */
95 THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */
96 THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */
97 };
98
99 /* Thermal notification reason */
100 enum thermal_notify_event {
101 THERMAL_EVENT_UNSPECIFIED, /* Unspecified event */
102 THERMAL_EVENT_TEMP_SAMPLE, /* New Temperature sample */
103 THERMAL_TRIP_VIOLATED, /* TRIP Point violation */
104 THERMAL_TRIP_CHANGED, /* TRIP Point temperature changed */
105 THERMAL_DEVICE_DOWN, /* Thermal device is down */
106 THERMAL_DEVICE_UP, /* Thermal device is up after a down event */
107 THERMAL_DEVICE_POWER_CAPABILITY_CHANGED, /* power capability changed */
108 THERMAL_TABLE_CHANGED, /* Thermal table(s) changed */
109 };
110
111 struct thermal_zone_device_ops {
112 int (*bind) (struct thermal_zone_device *,
113 struct thermal_cooling_device *);
114 int (*unbind) (struct thermal_zone_device *,
115 struct thermal_cooling_device *);
116 int (*get_temp) (struct thermal_zone_device *, int *);
117 int (*set_trips) (struct thermal_zone_device *, int, int);
118 int (*get_mode) (struct thermal_zone_device *,
119 enum thermal_device_mode *);
120 int (*set_mode) (struct thermal_zone_device *,
121 enum thermal_device_mode);
122 int (*get_trip_type) (struct thermal_zone_device *, int,
123 enum thermal_trip_type *);
124 int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
125 int (*set_trip_temp) (struct thermal_zone_device *, int, int);
126 int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
127 int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
128 int (*get_crit_temp) (struct thermal_zone_device *, int *);
129 int (*set_emul_temp) (struct thermal_zone_device *, int);
130 int (*get_trend) (struct thermal_zone_device *, int,
131 enum thermal_trend *);
132 int (*notify) (struct thermal_zone_device *, int,
133 enum thermal_trip_type);
134 int (*throttle_hotplug) (struct thermal_zone_device *);
135 };
136
137 struct thermal_cooling_device_ops {
138 int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
139 int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
140 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
141 int (*get_requested_power)(struct thermal_cooling_device *,
142 struct thermal_zone_device *, u32 *);
143 int (*state2power)(struct thermal_cooling_device *,
144 struct thermal_zone_device *, unsigned long, u32 *);
145 int (*power2state)(struct thermal_cooling_device *,
146 struct thermal_zone_device *, u32, unsigned long *);
147 int (*set_cur_temp)(struct thermal_cooling_device *, bool, int);
148 int (*get_cooling_level)(struct thermal_cooling_device *, unsigned long);
149 };
150
151 struct thermal_cooling_device {
152 int id;
153 char type[THERMAL_NAME_LENGTH];
154 struct device device;
155 struct device_node *np;
156 void *devdata;
157 const struct thermal_cooling_device_ops *ops;
158 bool updated; /* true if the cooling device does not need update */
159 struct mutex lock; /* protect thermal_instances list */
160 struct list_head thermal_instances;
161 struct list_head node;
162 };
163
164 struct thermal_attr {
165 struct device_attribute attr;
166 char name[THERMAL_NAME_LENGTH];
167 };
168
169 /**
170 * struct thermal_zone_device - structure for a thermal zone
171 * @id: unique id number for each thermal zone
172 * @type: the thermal zone device type
173 * @device: &struct device for this thermal zone
174 * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature
175 * @trip_type_attrs: attributes for trip points for sysfs: trip type
176 * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
177 * @devdata: private pointer for device private data
178 * @trips: number of trip points the thermal zone supports
179 * @trips_disabled; bitmap for disabled trips
180 * @passive_delay: number of milliseconds to wait between polls when
181 * performing passive cooling.
182 * @polling_delay: number of milliseconds to wait between polls when
183 * checking whether trip points have been crossed (0 for
184 * interrupt driven systems)
185 * @temperature: current temperature. This is only for core code,
186 * drivers should use thermal_zone_get_temp() to get the
187 * current temperature
188 * @last_temperature: previous temperature read
189 * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION
190 * @passive: 1 if you've crossed a passive trip point, 0 otherwise.
191 * @prev_low_trip: the low current temperature if you've crossed a passive
192 trip point.
193 * @prev_high_trip: the above current temperature if you've crossed a
194 passive trip point.
195 * @forced_passive: If > 0, temperature at which to switch on all ACPI
196 * processor cooling devices. Currently only used by the
197 * step-wise governor.
198 * @need_update: if equals 1, thermal_zone_device_update needs to be invoked.
199 * @ops: operations this &thermal_zone_device supports
200 * @tzp: thermal zone parameters
201 * @governor: pointer to the governor for this thermal zone
202 * @governor_data: private pointer for governor data
203 * @thermal_instances: list of &struct thermal_instance of this thermal zone
204 * @ida: &struct ida to generate unique id for this zone's cooling
205 * devices
206 * @lock: lock to protect thermal_instances list
207 * @node: node in thermal_tz_list (in thermal_core.c)
208 * @poll_queue: delayed work for polling
209 * @notify_event: Last notification event
210 * @cdev_bound: cooling device bind done
211 */
212 struct thermal_zone_device {
213 int id;
214 char type[THERMAL_NAME_LENGTH];
215 struct device device;
216 struct attribute_group trips_attribute_group;
217 struct thermal_attr *trip_temp_attrs;
218 struct thermal_attr *trip_type_attrs;
219 struct thermal_attr *trip_hyst_attrs;
220 void *devdata;
221 int trips;
222 unsigned long trips_disabled; /* bitmap for disabled trips */
223 int passive_delay;
224 int polling_delay;
225 int temperature;
226 int last_temperature;
227 int emul_temperature;
228 int passive;
229 int prev_low_trip;
230 int prev_high_trip;
231 unsigned int forced_passive;
232 atomic_t need_update;
233 struct thermal_zone_device_ops *ops;
234 struct thermal_zone_params *tzp;
235 struct thermal_governor *governor;
236 void *governor_data;
237 struct list_head thermal_instances;
238 struct ida ida;
239 struct mutex lock;
240 struct list_head node;
241 struct delayed_work poll_queue;
242 enum thermal_notify_event notify_event;
243 bool cdev_bound;
244 };
245
246 /**
247 * struct thermal_governor - structure that holds thermal governor information
248 * @name: name of the governor
249 * @bind_to_tz: callback called when binding to a thermal zone. If it
250 * returns 0, the governor is bound to the thermal zone,
251 * otherwise it fails.
252 * @unbind_from_tz: callback called when a governor is unbound from a
253 * thermal zone.
254 * @throttle: callback called for every trip point even if temperature is
255 * below the trip point temperature
256 * @governor_list: node in thermal_governor_list (in thermal_core.c)
257 */
258 struct thermal_governor {
259 char name[THERMAL_NAME_LENGTH];
260 int (*bind_to_tz)(struct thermal_zone_device *tz);
261 void (*unbind_from_tz)(struct thermal_zone_device *tz);
262 int (*throttle)(struct thermal_zone_device *tz, int trip);
263 struct list_head governor_list;
264 };
265
266 /* Structure that holds binding parameters for a zone */
267 struct thermal_bind_params {
268 struct thermal_cooling_device *cdev;
269
270 /*
271 * This is a measure of 'how effectively these devices can
272 * cool 'this' thermal zone. It shall be determined by
273 * platform characterization. This value is relative to the
274 * rest of the weights so a cooling device whose weight is
275 * double that of another cooling device is twice as
276 * effective. See Documentation/thermal/sysfs-api.txt for more
277 * information.
278 */
279 int weight;
280
281 /*
282 * This is a bit mask that gives the binding relation between this
283 * thermal zone and cdev, for a particular trip point.
284 * See Documentation/thermal/sysfs-api.txt for more information.
285 */
286 int trip_mask;
287
288 /*
289 * This is an array of cooling state limits. Must have exactly
290 * 2 * thermal_zone.number_of_trip_points. It is an array consisting
291 * of tuples <lower-state upper-state> of state limits. Each trip
292 * will be associated with one state limit tuple when binding.
293 * A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
294 * on all trips.
295 */
296 unsigned long *binding_limits;
297 int (*match) (struct thermal_zone_device *tz,
298 struct thermal_cooling_device *cdev);
299 };
300
301 /* Structure to define Thermal Zone parameters */
302 struct thermal_zone_params {
303 char governor_name[THERMAL_NAME_LENGTH];
304
305 /*
306 * a boolean to indicate if the thermal to hwmon sysfs interface
307 * is required. when no_hwmon == false, a hwmon sysfs interface
308 * will be created. when no_hwmon == true, nothing will be done
309 */
310 bool no_hwmon;
311
312 int num_tbps; /* Number of tbp entries */
313 struct thermal_bind_params *tbp;
314
315 /*
316 * Sustainable power (heat) that this thermal zone can dissipate in
317 * mW
318 */
319 u32 sustainable_power;
320
321 /*
322 * Proportional parameter of the PID controller when
323 * overshooting (i.e., when temperature is below the target)
324 */
325 s32 k_po;
326
327 /*
328 * Proportional parameter of the PID controller when
329 * undershooting
330 */
331 s32 k_pu;
332
333 /* Integral parameter of the PID controller */
334 s32 k_i;
335
336 /* Derivative parameter of the PID controller */
337 s32 k_d;
338
339 /* threshold below which the error is no longer accumulated */
340 s32 integral_cutoff;
341
342 s32 integral_max;
343
344 /*
345 * @slope: slope of a linear temperature adjustment curve.
346 * Used by thermal zone drivers.
347 */
348 int slope;
349 /*
350 * @offset: offset of a linear temperature adjustment curve.
351 * Used by thermal zone drivers (default 0).
352 */
353 int offset;
354 };
355
356 struct thermal_genl_event {
357 u32 orig;
358 enum events event;
359 };
360
361 /**
362 * struct thermal_zone_of_device_ops - scallbacks for handling DT based zones
363 *
364 * Mandatory:
365 * @get_temp: a pointer to a function that reads the sensor temperature.
366 *
367 * Optional:
368 * @get_trend: a pointer to a function that reads the sensor temperature trend.
369 * @set_trips: a pointer to a function that sets a temperature window. When
370 * this window is left the driver must inform the thermal core via
371 * thermal_zone_device_update.
372 * @set_emul_temp: a pointer to a function that sets sensor emulated
373 * temperature.
374 * @set_trip_temp: a pointer to a function that sets the trip temperature on
375 * hardware.
376 */
377 struct thermal_zone_of_device_ops {
378 int (*get_temp)(void *, int *);
379 int (*get_trend)(void *, int, enum thermal_trend *);
380 int (*set_trips)(void *, int, int);
381 int (*set_emul_temp)(void *, int);
382 int (*set_trip_temp)(void *, int, int);
383 int (*throttle_cpu_hotplug)(void *, int temp);
384 };
385
386 /**
387 * struct thermal_trip - representation of a point in temperature domain
388 * @np: pointer to struct device_node that this trip point was created from
389 * @temperature: temperature value in miliCelsius
390 * @hysteresis: relative hysteresis in miliCelsius
391 * @type: trip point type
392 */
393
394 struct thermal_trip {
395 struct device_node *np;
396 int temperature;
397 int hysteresis;
398 enum thermal_trip_type type;
399 };
400
401 /*** Private data structures to represent thermal device tree data ***/
402
403 /**
404 * struct __thermal_bind_param - a match between trip and cooling device
405 * @cooling_device: a pointer to identify the referred cooling device
406 * @trip_id: the trip point index
407 * @usage: the percentage (from 0 to 100) of cooling contribution
408 * @min: minimum cooling state used at this trip point
409 * @max: maximum cooling state used at this trip point
410 * @value: cooling value corresponding to max state
411 */
412
413 struct __thermal_bind_params {
414 struct device_node *cooling_device;
415 unsigned int trip_id;
416 unsigned int usage;
417 unsigned long min;
418 unsigned long max;
419 unsigned long value;
420 };
421
422 /**
423 * struct __thermal_zone - internal representation of a thermal zone
424 * @mode: current thermal zone device mode (enabled/disabled)
425 * @passive_delay: polling interval while passive cooling is activated
426 * @polling_delay: zone polling interval
427 * @slope: slope of the temperature adjustment curve
428 * @offset: offset of the temperature adjustment curve
429 * @ntrips: number of trip points
430 * @trips: an array of trip points (0..ntrips - 1)
431 * @num_tbps: number of thermal bind params
432 * @tbps: an array of thermal bind params (0..num_tbps - 1)
433 * @sensor_data: sensor private data used while reading temperature and trend
434 * @ops: set of callbacks to handle the thermal zone based on DT
435 */
436
437 struct __thermal_zone {
438 enum thermal_device_mode mode;
439 int passive_delay;
440 int polling_delay;
441 int slope;
442 int offset;
443
444 /* trip data */
445 int ntrips;
446 struct thermal_trip *trips;
447
448 /* cooling binding data */
449 int num_tbps;
450 struct __thermal_bind_params *tbps;
451
452 /* sensor interface */
453 void *sensor_data;
454 const struct thermal_zone_of_device_ops *ops;
455 };
456
457 /* Function declarations */
458 #ifdef CONFIG_THERMAL_OF
459 struct thermal_zone_device *
460 thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
461 const struct thermal_zone_of_device_ops *ops);
462 void thermal_zone_of_sensor_unregister(struct device *dev,
463 struct thermal_zone_device *tz);
464 struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
465 struct device *dev, int id, void *data,
466 const struct thermal_zone_of_device_ops *ops);
467 void devm_thermal_zone_of_sensor_unregister(struct device *dev,
468 struct thermal_zone_device *tz);
469 #else
470 static inline struct thermal_zone_device *
471 thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
472 const struct thermal_zone_of_device_ops *ops)
473 {
474 return ERR_PTR(-ENODEV);
475 }
476
477 static inline
478 void thermal_zone_of_sensor_unregister(struct device *dev,
479 struct thermal_zone_device *tz)
480 {
481 }
482
483 static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
484 struct device *dev, int id, void *data,
485 const struct thermal_zone_of_device_ops *ops)
486 {
487 return ERR_PTR(-ENODEV);
488 }
489
490 static inline
491 void devm_thermal_zone_of_sensor_unregister(struct device *dev,
492 struct thermal_zone_device *tz)
493 {
494 }
495
496 #endif
497
498 #if IS_ENABLED(CONFIG_THERMAL)
499 static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
500 {
501 return cdev->ops->get_requested_power && cdev->ops->state2power &&
502 cdev->ops->power2state;
503 }
504
505 int power_actor_get_max_power(struct thermal_cooling_device *,
506 struct thermal_zone_device *tz, u32 *max_power);
507 int power_actor_get_min_power(struct thermal_cooling_device *,
508 struct thermal_zone_device *tz, u32 *min_power);
509 int power_actor_set_power(struct thermal_cooling_device *,
510 struct thermal_instance *, u32);
511 struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
512 void *, struct thermal_zone_device_ops *,
513 struct thermal_zone_params *, int, int);
514 void thermal_zone_device_unregister(struct thermal_zone_device *);
515
516 int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
517 struct thermal_cooling_device *,
518 unsigned long, unsigned long,
519 unsigned int);
520 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
521 struct thermal_cooling_device *);
522 void thermal_zone_device_update(struct thermal_zone_device *,
523 enum thermal_notify_event);
524 void thermal_zone_set_trips(struct thermal_zone_device *);
525
526 struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
527 const struct thermal_cooling_device_ops *);
528 struct thermal_cooling_device *
529 thermal_of_cooling_device_register(struct device_node *np, char *, void *,
530 const struct thermal_cooling_device_ops *);
531 void thermal_cooling_device_unregister(struct thermal_cooling_device *);
532 struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
533 struct thermal_zone_device *thermal_zone_get_zone_by_cool_np(struct device_node *cool_np);
534 int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
535 int thermal_zone_get_slope(struct thermal_zone_device *tz);
536 int thermal_zone_get_offset(struct thermal_zone_device *tz);
537
538 int get_tz_trend(struct thermal_zone_device *, int);
539 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
540 struct thermal_cooling_device *, int);
541 void thermal_cdev_update(struct thermal_cooling_device *);
542 void thermal_notify_framework(struct thermal_zone_device *, int);
543 #else
544 static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
545 { return false; }
546 static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev,
547 struct thermal_zone_device *tz, u32 *max_power)
548 { return 0; }
549 static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev,
550 struct thermal_zone_device *tz,
551 u32 *min_power)
552 { return -ENODEV; }
553 static inline int power_actor_set_power(struct thermal_cooling_device *cdev,
554 struct thermal_instance *tz, u32 power)
555 { return 0; }
556 static inline struct thermal_zone_device *thermal_zone_device_register(
557 const char *type, int trips, int mask, void *devdata,
558 struct thermal_zone_device_ops *ops,
559 const struct thermal_zone_params *tzp,
560 int passive_delay, int polling_delay)
561 { return ERR_PTR(-ENODEV); }
562 static inline void thermal_zone_device_unregister(
563 struct thermal_zone_device *tz)
564 { }
565 static inline int thermal_zone_bind_cooling_device(
566 struct thermal_zone_device *tz, int trip,
567 struct thermal_cooling_device *cdev,
568 unsigned long upper, unsigned long lower,
569 unsigned int weight)
570 { return -ENODEV; }
571 static inline int thermal_zone_unbind_cooling_device(
572 struct thermal_zone_device *tz, int trip,
573 struct thermal_cooling_device *cdev)
574 { return -ENODEV; }
575 static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
576 enum thermal_notify_event event)
577 { }
578 static inline void thermal_zone_set_trips(struct thermal_zone_device *tz)
579 { }
580 static inline struct thermal_cooling_device *
581 thermal_cooling_device_register(char *type, void *devdata,
582 const struct thermal_cooling_device_ops *ops)
583 { return ERR_PTR(-ENODEV); }
584 static inline struct thermal_cooling_device *
585 thermal_of_cooling_device_register(struct device_node *np,
586 char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
587 { return ERR_PTR(-ENODEV); }
588 static inline void thermal_cooling_device_unregister(
589 struct thermal_cooling_device *cdev)
590 { }
591 static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
592 const char *name)
593 { return ERR_PTR(-ENODEV); }
594 static inline struct thermal_zone_device *thermal_zone_get_zone_by_cool_np(
595 struct device_node *cool_np)
596 { return ERR_PTR(-ENODEV); }
597 static inline int thermal_zone_get_temp(
598 struct thermal_zone_device *tz, int *temp)
599 { return -ENODEV; }
600 static inline int thermal_zone_get_slope(
601 struct thermal_zone_device *tz)
602 { return -ENODEV; }
603 static inline int thermal_zone_get_offset(
604 struct thermal_zone_device *tz)
605 { return -ENODEV; }
606 static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
607 { return -ENODEV; }
608 static inline struct thermal_instance *
609 get_thermal_instance(struct thermal_zone_device *tz,
610 struct thermal_cooling_device *cdev, int trip)
611 { return ERR_PTR(-ENODEV); }
612 static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
613 { }
614 static inline void thermal_notify_framework(struct thermal_zone_device *tz,
615 int trip)
616 { }
617 #endif /* CONFIG_THERMAL */
618
619 #if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL)
620 extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
621 enum events event);
622 #else
623 static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
624 enum events event)
625 {
626 return 0;
627 }
628 #endif
629
630 #endif /* __THERMAL_H__ */