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