thermal.h 20 KB

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