thermal.h 20 KB

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