13d0407baSopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
23d0407baSopenharmony_ci/*
33d0407baSopenharmony_ci *  thermal.h  ($Revision: 0 $)
43d0407baSopenharmony_ci *
53d0407baSopenharmony_ci *  Copyright (C) 2008  Intel Corp
63d0407baSopenharmony_ci *  Copyright (C) 2008  Zhang Rui <rui.zhang@intel.com>
73d0407baSopenharmony_ci *  Copyright (C) 2008  Sujith Thomas <sujith.thomas@intel.com>
83d0407baSopenharmony_ci */
93d0407baSopenharmony_ci
103d0407baSopenharmony_ci#ifndef __THERMAL_H__
113d0407baSopenharmony_ci#define __THERMAL_H__
123d0407baSopenharmony_ci
133d0407baSopenharmony_ci#include <linux/of.h>
143d0407baSopenharmony_ci#include <linux/idr.h>
153d0407baSopenharmony_ci#include <linux/device.h>
163d0407baSopenharmony_ci#include <linux/sysfs.h>
173d0407baSopenharmony_ci#include <linux/workqueue.h>
183d0407baSopenharmony_ci#include <uapi/linux/thermal.h>
193d0407baSopenharmony_ci
203d0407baSopenharmony_ci#define THERMAL_TRIPS_NONE (-1)
213d0407baSopenharmony_ci#define THERMAL_MAX_TRIPS 12
223d0407baSopenharmony_ci
233d0407baSopenharmony_ci/* invalid cooling state */
243d0407baSopenharmony_ci#define THERMAL_CSTATE_INVALID (-1UL)
253d0407baSopenharmony_ci
263d0407baSopenharmony_ci/* No upper/lower limit requirement */
273d0407baSopenharmony_ci#define THERMAL_NO_LIMIT ((u32)~0)
283d0407baSopenharmony_ci
293d0407baSopenharmony_ci/* Default weight of a bound cooling device */
303d0407baSopenharmony_ci#define THERMAL_WEIGHT_DEFAULT 0
313d0407baSopenharmony_ci
323d0407baSopenharmony_ci/* use value, which < 0K, to indicate an invalid/uninitialized temperature */
333d0407baSopenharmony_ci#define THERMAL_TEMP_INVALID (-274000)
343d0407baSopenharmony_ci
353d0407baSopenharmony_cistruct thermal_zone_device;
363d0407baSopenharmony_cistruct thermal_cooling_device;
373d0407baSopenharmony_cistruct thermal_instance;
383d0407baSopenharmony_cistruct thermal_attr;
393d0407baSopenharmony_ci
403d0407baSopenharmony_cienum thermal_trend {
413d0407baSopenharmony_ci    THERMAL_TREND_STABLE,     /* temperature is stable */
423d0407baSopenharmony_ci    THERMAL_TREND_RAISING,    /* temperature is raising */
433d0407baSopenharmony_ci    THERMAL_TREND_DROPPING,   /* temperature is dropping */
443d0407baSopenharmony_ci    THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */
453d0407baSopenharmony_ci    THERMAL_TREND_DROP_FULL,  /* apply lowest cooling action */
463d0407baSopenharmony_ci};
473d0407baSopenharmony_ci
483d0407baSopenharmony_ci/* Thermal notification reason */
493d0407baSopenharmony_cienum thermal_notify_event {
503d0407baSopenharmony_ci    THERMAL_EVENT_UNSPECIFIED,               /* Unspecified event */
513d0407baSopenharmony_ci    THERMAL_EVENT_TEMP_SAMPLE,               /* New Temperature sample */
523d0407baSopenharmony_ci    THERMAL_TRIP_VIOLATED,                   /* TRIP Point violation */
533d0407baSopenharmony_ci    THERMAL_TRIP_CHANGED,                    /* TRIP Point temperature changed */
543d0407baSopenharmony_ci    THERMAL_DEVICE_DOWN,                     /* Thermal device is down */
553d0407baSopenharmony_ci    THERMAL_DEVICE_UP,                       /* Thermal device is up after a down event */
563d0407baSopenharmony_ci    THERMAL_DEVICE_POWER_CAPABILITY_CHANGED, /* power capability changed */
573d0407baSopenharmony_ci    THERMAL_TABLE_CHANGED,                   /* Thermal table(s) changed */
583d0407baSopenharmony_ci    THERMAL_EVENT_KEEP_ALIVE,                /* Request for user space handler to respond */
593d0407baSopenharmony_ci};
603d0407baSopenharmony_ci
613d0407baSopenharmony_cistruct thermal_zone_device_ops {
623d0407baSopenharmony_ci    int (*bind)(struct thermal_zone_device *, struct thermal_cooling_device *);
633d0407baSopenharmony_ci    int (*unbind)(struct thermal_zone_device *, struct thermal_cooling_device *);
643d0407baSopenharmony_ci    int (*get_temp)(struct thermal_zone_device *, int *);
653d0407baSopenharmony_ci    int (*set_trips)(struct thermal_zone_device *, int, int);
663d0407baSopenharmony_ci    int (*change_mode)(struct thermal_zone_device *, enum thermal_device_mode);
673d0407baSopenharmony_ci    int (*get_trip_type)(struct thermal_zone_device *, int, enum thermal_trip_type *);
683d0407baSopenharmony_ci    int (*get_trip_temp)(struct thermal_zone_device *, int, int *);
693d0407baSopenharmony_ci    int (*set_trip_temp)(struct thermal_zone_device *, int, int);
703d0407baSopenharmony_ci    int (*get_trip_hyst)(struct thermal_zone_device *, int, int *);
713d0407baSopenharmony_ci    int (*set_trip_hyst)(struct thermal_zone_device *, int, int);
723d0407baSopenharmony_ci    int (*get_crit_temp)(struct thermal_zone_device *, int *);
733d0407baSopenharmony_ci    int (*set_emul_temp)(struct thermal_zone_device *, int);
743d0407baSopenharmony_ci    int (*get_trend)(struct thermal_zone_device *, int, enum thermal_trend *);
753d0407baSopenharmony_ci    int (*notify)(struct thermal_zone_device *, int, enum thermal_trip_type);
763d0407baSopenharmony_ci};
773d0407baSopenharmony_ci
783d0407baSopenharmony_cistruct thermal_cooling_device_ops {
793d0407baSopenharmony_ci    int (*get_max_state)(struct thermal_cooling_device *, unsigned long *);
803d0407baSopenharmony_ci    int (*get_cur_state)(struct thermal_cooling_device *, unsigned long *);
813d0407baSopenharmony_ci    int (*set_cur_state)(struct thermal_cooling_device *, unsigned long);
823d0407baSopenharmony_ci    int (*get_requested_power)(struct thermal_cooling_device *, u32 *);
833d0407baSopenharmony_ci    int (*state2power)(struct thermal_cooling_device *, unsigned long, u32 *);
843d0407baSopenharmony_ci    int (*power2state)(struct thermal_cooling_device *, u32, unsigned long *);
853d0407baSopenharmony_ci};
863d0407baSopenharmony_ci
873d0407baSopenharmony_cistruct thermal_cooling_device {
883d0407baSopenharmony_ci    int id;
893d0407baSopenharmony_ci    char *type;
903d0407baSopenharmony_ci    struct device device;
913d0407baSopenharmony_ci    struct device_node *np;
923d0407baSopenharmony_ci    void *devdata;
933d0407baSopenharmony_ci    void *stats;
943d0407baSopenharmony_ci    const struct thermal_cooling_device_ops *ops;
953d0407baSopenharmony_ci    bool updated;      /* true if the cooling device does not need update */
963d0407baSopenharmony_ci    struct mutex lock; /* protect thermal_instances list */
973d0407baSopenharmony_ci    struct list_head thermal_instances;
983d0407baSopenharmony_ci    struct list_head node;
993d0407baSopenharmony_ci};
1003d0407baSopenharmony_ci
1013d0407baSopenharmony_ci/**
1023d0407baSopenharmony_ci * struct thermal_zone_device - structure for a thermal zone
1033d0407baSopenharmony_ci * @id:        unique id number for each thermal zone
1043d0407baSopenharmony_ci * @type:    the thermal zone device type
1053d0407baSopenharmony_ci * @device:    &struct device for this thermal zone
1063d0407baSopenharmony_ci * @trip_temp_attrs:    attributes for trip points for sysfs: trip temperature
1073d0407baSopenharmony_ci * @trip_type_attrs:    attributes for trip points for sysfs: trip type
1083d0407baSopenharmony_ci * @trip_hyst_attrs:    attributes for trip points for sysfs: trip hysteresis
1093d0407baSopenharmony_ci * @mode:        current mode of this thermal zone
1103d0407baSopenharmony_ci * @devdata:    private pointer for device private data
1113d0407baSopenharmony_ci * @trips:    number of trip points the thermal zone supports
1123d0407baSopenharmony_ci * @trips_disabled;    bitmap for disabled trips
1133d0407baSopenharmony_ci * @passive_delay:    number of milliseconds to wait between polls when
1143d0407baSopenharmony_ci *            performing passive cooling.
1153d0407baSopenharmony_ci * @polling_delay:    number of milliseconds to wait between polls when
1163d0407baSopenharmony_ci *            checking whether trip points have been crossed (0 for
1173d0407baSopenharmony_ci *            interrupt driven systems)
1183d0407baSopenharmony_ci * @temperature:    current temperature.  This is only for core code,
1193d0407baSopenharmony_ci *            drivers should use thermal_zone_get_temp() to get the
1203d0407baSopenharmony_ci *            current temperature
1213d0407baSopenharmony_ci * @last_temperature:    previous temperature read
1223d0407baSopenharmony_ci * @emul_temperature:    emulated temperature when using CONFIG_THERMAL_EMULATION
1233d0407baSopenharmony_ci * @passive:        1 if you've crossed a passive trip point, 0 otherwise.
1243d0407baSopenharmony_ci * @prev_low_trip:    the low current temperature if you've crossed a passive
1253d0407baSopenharmony_ci            trip point.
1263d0407baSopenharmony_ci * @prev_high_trip:    the above current temperature if you've crossed a
1273d0407baSopenharmony_ci            passive trip point.
1283d0407baSopenharmony_ci * @forced_passive:    If > 0, temperature at which to switch on all ACPI
1293d0407baSopenharmony_ci *            processor cooling devices.  Currently only used by the
1303d0407baSopenharmony_ci *            step-wise governor.
1313d0407baSopenharmony_ci * @need_update:    if equals 1, thermal_zone_device_update needs to be invoked.
1323d0407baSopenharmony_ci * @ops:    operations this &thermal_zone_device supports
1333d0407baSopenharmony_ci * @tzp:    thermal zone parameters
1343d0407baSopenharmony_ci * @governor:    pointer to the governor for this thermal zone
1353d0407baSopenharmony_ci * @governor_data:    private pointer for governor data
1363d0407baSopenharmony_ci * @thermal_instances:    list of &struct thermal_instance of this thermal zone
1373d0407baSopenharmony_ci * @ida:    &struct ida to generate unique id for this zone's cooling
1383d0407baSopenharmony_ci *        devices
1393d0407baSopenharmony_ci * @lock:    lock to protect thermal_instances list
1403d0407baSopenharmony_ci * @node:    node in thermal_tz_list (in thermal_core.c)
1413d0407baSopenharmony_ci * @poll_queue:    delayed work for polling
1423d0407baSopenharmony_ci * @notify_event: Last notification event
1433d0407baSopenharmony_ci */
1443d0407baSopenharmony_cistruct thermal_zone_device {
1453d0407baSopenharmony_ci    int id;
1463d0407baSopenharmony_ci    char type[THERMAL_NAME_LENGTH];
1473d0407baSopenharmony_ci    struct device device;
1483d0407baSopenharmony_ci    struct attribute_group trips_attribute_group;
1493d0407baSopenharmony_ci    struct thermal_attr *trip_temp_attrs;
1503d0407baSopenharmony_ci    struct thermal_attr *trip_type_attrs;
1513d0407baSopenharmony_ci    struct thermal_attr *trip_hyst_attrs;
1523d0407baSopenharmony_ci    enum thermal_device_mode mode;
1533d0407baSopenharmony_ci    void *devdata;
1543d0407baSopenharmony_ci    int trips;
1553d0407baSopenharmony_ci    unsigned long trips_disabled; /* bitmap for disabled trips */
1563d0407baSopenharmony_ci    int passive_delay;
1573d0407baSopenharmony_ci    int polling_delay;
1583d0407baSopenharmony_ci    int temperature;
1593d0407baSopenharmony_ci    int last_temperature;
1603d0407baSopenharmony_ci    int emul_temperature;
1613d0407baSopenharmony_ci    int passive;
1623d0407baSopenharmony_ci    int prev_low_trip;
1633d0407baSopenharmony_ci    int prev_high_trip;
1643d0407baSopenharmony_ci    unsigned int forced_passive;
1653d0407baSopenharmony_ci    atomic_t need_update;
1663d0407baSopenharmony_ci    struct thermal_zone_device_ops *ops;
1673d0407baSopenharmony_ci    struct thermal_zone_params *tzp;
1683d0407baSopenharmony_ci    struct thermal_governor *governor;
1693d0407baSopenharmony_ci    void *governor_data;
1703d0407baSopenharmony_ci    struct list_head thermal_instances;
1713d0407baSopenharmony_ci    struct ida ida;
1723d0407baSopenharmony_ci    struct mutex lock;
1733d0407baSopenharmony_ci    struct list_head node;
1743d0407baSopenharmony_ci    struct delayed_work poll_queue;
1753d0407baSopenharmony_ci    enum thermal_notify_event notify_event;
1763d0407baSopenharmony_ci};
1773d0407baSopenharmony_ci
1783d0407baSopenharmony_ci/**
1793d0407baSopenharmony_ci * struct thermal_governor - structure that holds thermal governor information
1803d0407baSopenharmony_ci * @name:    name of the governor
1813d0407baSopenharmony_ci * @bind_to_tz: callback called when binding to a thermal zone.  If it
1823d0407baSopenharmony_ci *        returns 0, the governor is bound to the thermal zone,
1833d0407baSopenharmony_ci *        otherwise it fails.
1843d0407baSopenharmony_ci * @unbind_from_tz:    callback called when a governor is unbound from a
1853d0407baSopenharmony_ci *            thermal zone.
1863d0407baSopenharmony_ci * @throttle:    callback called for every trip point even if temperature is
1873d0407baSopenharmony_ci *        below the trip point temperature
1883d0407baSopenharmony_ci * @governor_list:    node in thermal_governor_list (in thermal_core.c)
1893d0407baSopenharmony_ci */
1903d0407baSopenharmony_cistruct thermal_governor {
1913d0407baSopenharmony_ci    char name[THERMAL_NAME_LENGTH];
1923d0407baSopenharmony_ci    int (*bind_to_tz)(struct thermal_zone_device *tz);
1933d0407baSopenharmony_ci    void (*unbind_from_tz)(struct thermal_zone_device *tz);
1943d0407baSopenharmony_ci    int (*throttle)(struct thermal_zone_device *tz, int trip);
1953d0407baSopenharmony_ci    struct list_head governor_list;
1963d0407baSopenharmony_ci};
1973d0407baSopenharmony_ci
1983d0407baSopenharmony_ci/* Structure that holds binding parameters for a zone */
1993d0407baSopenharmony_cistruct thermal_bind_params {
2003d0407baSopenharmony_ci    struct thermal_cooling_device *cdev;
2013d0407baSopenharmony_ci
2023d0407baSopenharmony_ci    /*
2033d0407baSopenharmony_ci     * This is a measure of 'how effectively these devices can
2043d0407baSopenharmony_ci     * cool 'this' thermal zone. It shall be determined by
2053d0407baSopenharmony_ci     * platform characterization. This value is relative to the
2063d0407baSopenharmony_ci     * rest of the weights so a cooling device whose weight is
2073d0407baSopenharmony_ci     * double that of another cooling device is twice as
2083d0407baSopenharmony_ci     * effective. See Documentation/driver-api/thermal/sysfs-api.rst for more
2093d0407baSopenharmony_ci     * information.
2103d0407baSopenharmony_ci     */
2113d0407baSopenharmony_ci    int weight;
2123d0407baSopenharmony_ci
2133d0407baSopenharmony_ci    /*
2143d0407baSopenharmony_ci     * This is a bit mask that gives the binding relation between this
2153d0407baSopenharmony_ci     * thermal zone and cdev, for a particular trip point.
2163d0407baSopenharmony_ci     * See Documentation/driver-api/thermal/sysfs-api.rst for more information.
2173d0407baSopenharmony_ci     */
2183d0407baSopenharmony_ci    int trip_mask;
2193d0407baSopenharmony_ci
2203d0407baSopenharmony_ci    /*
2213d0407baSopenharmony_ci     * This is an array of cooling state limits. Must have exactly
2223d0407baSopenharmony_ci     * 2 * thermal_zone.number_of_trip_points. It is an array consisting
2233d0407baSopenharmony_ci     * of tuples <lower-state upper-state> of state limits. Each trip
2243d0407baSopenharmony_ci     * will be associated with one state limit tuple when binding.
2253d0407baSopenharmony_ci     * A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
2263d0407baSopenharmony_ci     * on all trips.
2273d0407baSopenharmony_ci     */
2283d0407baSopenharmony_ci    unsigned long *binding_limits;
2293d0407baSopenharmony_ci    int (*match)(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev);
2303d0407baSopenharmony_ci};
2313d0407baSopenharmony_ci
2323d0407baSopenharmony_ci/* Structure to define Thermal Zone parameters */
2333d0407baSopenharmony_cistruct thermal_zone_params {
2343d0407baSopenharmony_ci    char governor_name[THERMAL_NAME_LENGTH];
2353d0407baSopenharmony_ci
2363d0407baSopenharmony_ci    /*
2373d0407baSopenharmony_ci     * a boolean to indicate if the thermal to hwmon sysfs interface
2383d0407baSopenharmony_ci     * is required. when no_hwmon == false, a hwmon sysfs interface
2393d0407baSopenharmony_ci     * will be created. when no_hwmon == true, nothing will be done
2403d0407baSopenharmony_ci     */
2413d0407baSopenharmony_ci    bool no_hwmon;
2423d0407baSopenharmony_ci
2433d0407baSopenharmony_ci    int num_tbps; /* Number of tbp entries */
2443d0407baSopenharmony_ci    struct thermal_bind_params *tbp;
2453d0407baSopenharmony_ci
2463d0407baSopenharmony_ci    /*
2473d0407baSopenharmony_ci     * Sustainable power (heat) that this thermal zone can dissipate in
2483d0407baSopenharmony_ci     * mW
2493d0407baSopenharmony_ci     */
2503d0407baSopenharmony_ci    u32 sustainable_power;
2513d0407baSopenharmony_ci
2523d0407baSopenharmony_ci    /*
2533d0407baSopenharmony_ci     * Proportional parameter of the PID controller when
2543d0407baSopenharmony_ci     * overshooting (i.e., when temperature is below the target)
2553d0407baSopenharmony_ci     */
2563d0407baSopenharmony_ci    s32 k_po;
2573d0407baSopenharmony_ci
2583d0407baSopenharmony_ci    /*
2593d0407baSopenharmony_ci     * Proportional parameter of the PID controller when
2603d0407baSopenharmony_ci     * undershooting
2613d0407baSopenharmony_ci     */
2623d0407baSopenharmony_ci    s32 k_pu;
2633d0407baSopenharmony_ci
2643d0407baSopenharmony_ci    /* Integral parameter of the PID controller */
2653d0407baSopenharmony_ci    s32 k_i;
2663d0407baSopenharmony_ci
2673d0407baSopenharmony_ci    /* Derivative parameter of the PID controller */
2683d0407baSopenharmony_ci    s32 k_d;
2693d0407baSopenharmony_ci
2703d0407baSopenharmony_ci    /* threshold below which the error is no longer accumulated */
2713d0407baSopenharmony_ci    s32 integral_cutoff;
2723d0407baSopenharmony_ci
2733d0407baSopenharmony_ci    /*
2743d0407baSopenharmony_ci     * @slope:    slope of a linear temperature adjustment curve.
2753d0407baSopenharmony_ci     *         Used by thermal zone drivers.
2763d0407baSopenharmony_ci     */
2773d0407baSopenharmony_ci    int slope;
2783d0407baSopenharmony_ci    /*
2793d0407baSopenharmony_ci     * @offset:    offset of a linear temperature adjustment curve.
2803d0407baSopenharmony_ci     *         Used by thermal zone drivers (default 0).
2813d0407baSopenharmony_ci     */
2823d0407baSopenharmony_ci    int offset;
2833d0407baSopenharmony_ci};
2843d0407baSopenharmony_ci
2853d0407baSopenharmony_ci/**
2863d0407baSopenharmony_ci * struct thermal_zone_of_device_ops - scallbacks for handling DT based zones
2873d0407baSopenharmony_ci *
2883d0407baSopenharmony_ci * Mandatory:
2893d0407baSopenharmony_ci * @get_temp: a pointer to a function that reads the sensor temperature.
2903d0407baSopenharmony_ci *
2913d0407baSopenharmony_ci * Optional:
2923d0407baSopenharmony_ci * @get_trend: a pointer to a function that reads the sensor temperature trend.
2933d0407baSopenharmony_ci * @set_trips: a pointer to a function that sets a temperature window. When
2943d0407baSopenharmony_ci *           this window is left the driver must inform the thermal core via
2953d0407baSopenharmony_ci *           thermal_zone_device_update.
2963d0407baSopenharmony_ci * @set_emul_temp: a pointer to a function that sets sensor emulated
2973d0407baSopenharmony_ci *           temperature.
2983d0407baSopenharmony_ci * @set_trip_temp: a pointer to a function that sets the trip temperature on
2993d0407baSopenharmony_ci *           hardware.
3003d0407baSopenharmony_ci */
3013d0407baSopenharmony_cistruct thermal_zone_of_device_ops {
3023d0407baSopenharmony_ci    int (*get_temp)(void *, int *);
3033d0407baSopenharmony_ci    int (*get_trend)(void *, int, enum thermal_trend *);
3043d0407baSopenharmony_ci    int (*set_trips)(void *, int, int);
3053d0407baSopenharmony_ci    int (*set_emul_temp)(void *, int);
3063d0407baSopenharmony_ci    int (*set_trip_temp)(void *, int, int);
3073d0407baSopenharmony_ci};
3083d0407baSopenharmony_ci
3093d0407baSopenharmony_ci/* Function declarations */
3103d0407baSopenharmony_ci#ifdef CONFIG_THERMAL_OF
3113d0407baSopenharmony_ciint thermal_zone_of_get_sensor_id(struct device_node *tz_np, struct device_node *sensor_np, u32 *id);
3123d0407baSopenharmony_cistruct thermal_zone_device *thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
3133d0407baSopenharmony_ci                                                            const struct thermal_zone_of_device_ops *ops);
3143d0407baSopenharmony_civoid thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz);
3153d0407baSopenharmony_cistruct thermal_zone_device *devm_thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
3163d0407baSopenharmony_ci                                                                 const struct thermal_zone_of_device_ops *ops);
3173d0407baSopenharmony_civoid devm_thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz);
3183d0407baSopenharmony_ci#else
3193d0407baSopenharmony_ci
3203d0407baSopenharmony_cistatic inline int thermal_zone_of_get_sensor_id(struct device_node *tz_np, struct device_node *sensor_np, u32 *id)
3213d0407baSopenharmony_ci{
3223d0407baSopenharmony_ci    return -ENOENT;
3233d0407baSopenharmony_ci}
3243d0407baSopenharmony_cistatic inline struct thermal_zone_device *thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
3253d0407baSopenharmony_ci                                                                          const struct thermal_zone_of_device_ops *ops)
3263d0407baSopenharmony_ci{
3273d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
3283d0407baSopenharmony_ci}
3293d0407baSopenharmony_ci
3303d0407baSopenharmony_cistatic inline void thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz)
3313d0407baSopenharmony_ci{
3323d0407baSopenharmony_ci}
3333d0407baSopenharmony_ci
3343d0407baSopenharmony_cistatic inline struct thermal_zone_device *
3353d0407baSopenharmony_cidevm_thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
3363d0407baSopenharmony_ci                                     const struct thermal_zone_of_device_ops *ops)
3373d0407baSopenharmony_ci{
3383d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
3393d0407baSopenharmony_ci}
3403d0407baSopenharmony_ci
3413d0407baSopenharmony_cistatic inline void devm_thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz)
3423d0407baSopenharmony_ci{
3433d0407baSopenharmony_ci}
3443d0407baSopenharmony_ci
3453d0407baSopenharmony_ci#endif
3463d0407baSopenharmony_ci
3473d0407baSopenharmony_ci#ifdef CONFIG_THERMAL
3483d0407baSopenharmony_cistruct thermal_zone_device *thermal_zone_device_register(const char *, int, int, void *,
3493d0407baSopenharmony_ci                                                         struct thermal_zone_device_ops *, struct thermal_zone_params *,
3503d0407baSopenharmony_ci                                                         int, int);
3513d0407baSopenharmony_civoid thermal_zone_device_unregister(struct thermal_zone_device *);
3523d0407baSopenharmony_ci
3533d0407baSopenharmony_ciint thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, unsigned long,
3543d0407baSopenharmony_ci                                     unsigned long, unsigned int);
3553d0407baSopenharmony_ciint thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *);
3563d0407baSopenharmony_civoid thermal_zone_device_update(struct thermal_zone_device *, enum thermal_notify_event);
3573d0407baSopenharmony_ci
3583d0407baSopenharmony_cistruct thermal_cooling_device *thermal_cooling_device_register(const char *, void *,
3593d0407baSopenharmony_ci                                                               const struct thermal_cooling_device_ops *);
3603d0407baSopenharmony_cistruct thermal_cooling_device *thermal_of_cooling_device_register(struct device_node *np, const char *, void *,
3613d0407baSopenharmony_ci                                                                  const struct thermal_cooling_device_ops *);
3623d0407baSopenharmony_cistruct thermal_cooling_device *devm_thermal_of_cooling_device_register(struct device *dev, struct device_node *np,
3633d0407baSopenharmony_ci                                                                       char *type, void *devdata,
3643d0407baSopenharmony_ci                                                                       const struct thermal_cooling_device_ops *ops);
3653d0407baSopenharmony_civoid thermal_cooling_device_unregister(struct thermal_cooling_device *);
3663d0407baSopenharmony_cistruct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
3673d0407baSopenharmony_ciint thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
3683d0407baSopenharmony_ciint thermal_zone_get_slope(struct thermal_zone_device *tz);
3693d0407baSopenharmony_ciint thermal_zone_get_offset(struct thermal_zone_device *tz);
3703d0407baSopenharmony_ci
3713d0407baSopenharmony_civoid thermal_cdev_update(struct thermal_cooling_device *);
3723d0407baSopenharmony_civoid thermal_notify_framework(struct thermal_zone_device *, int);
3733d0407baSopenharmony_ciint thermal_zone_device_enable(struct thermal_zone_device *tz);
3743d0407baSopenharmony_ciint thermal_zone_device_disable(struct thermal_zone_device *tz);
3753d0407baSopenharmony_ciint thermal_zone_device_is_enabled(struct thermal_zone_device *tz);
3763d0407baSopenharmony_ci#else
3773d0407baSopenharmony_cistatic inline struct thermal_zone_device *
3783d0407baSopenharmony_cithermal_zone_device_register(const char *type, int trips, int mask, void *devdata, struct thermal_zone_device_ops *ops,
3793d0407baSopenharmony_ci                             struct thermal_zone_params *tzp, int passive_delay, int polling_delay)
3803d0407baSopenharmony_ci{
3813d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
3823d0407baSopenharmony_ci}
3833d0407baSopenharmony_cistatic inline void thermal_zone_device_unregister(struct thermal_zone_device *tz)
3843d0407baSopenharmony_ci{
3853d0407baSopenharmony_ci}
3863d0407baSopenharmony_cistatic inline struct thermal_cooling_device *
3873d0407baSopenharmony_cithermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
3883d0407baSopenharmony_ci{
3893d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
3903d0407baSopenharmony_ci}
3913d0407baSopenharmony_cistatic inline struct thermal_cooling_device *
3923d0407baSopenharmony_cithermal_of_cooling_device_register(struct device_node *np, const char *type, void *devdata,
3933d0407baSopenharmony_ci                                   const struct thermal_cooling_device_ops *ops)
3943d0407baSopenharmony_ci{
3953d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
3963d0407baSopenharmony_ci}
3973d0407baSopenharmony_cistatic inline struct thermal_cooling_device *
3983d0407baSopenharmony_cidevm_thermal_of_cooling_device_register(struct device *dev, struct device_node *np, char *type, void *devdata,
3993d0407baSopenharmony_ci                                        const struct thermal_cooling_device_ops *ops)
4003d0407baSopenharmony_ci{
4013d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
4023d0407baSopenharmony_ci}
4033d0407baSopenharmony_cistatic inline void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
4043d0407baSopenharmony_ci{
4053d0407baSopenharmony_ci}
4063d0407baSopenharmony_cistatic inline struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name)
4073d0407baSopenharmony_ci{
4083d0407baSopenharmony_ci    return ERR_PTR(-ENODEV);
4093d0407baSopenharmony_ci}
4103d0407baSopenharmony_cistatic inline int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
4113d0407baSopenharmony_ci{
4123d0407baSopenharmony_ci    return -ENODEV;
4133d0407baSopenharmony_ci}
4143d0407baSopenharmony_cistatic inline int thermal_zone_get_slope(struct thermal_zone_device *tz)
4153d0407baSopenharmony_ci{
4163d0407baSopenharmony_ci    return -ENODEV;
4173d0407baSopenharmony_ci}
4183d0407baSopenharmony_cistatic inline int thermal_zone_get_offset(struct thermal_zone_device *tz)
4193d0407baSopenharmony_ci{
4203d0407baSopenharmony_ci    return -ENODEV;
4213d0407baSopenharmony_ci}
4223d0407baSopenharmony_ci
4233d0407baSopenharmony_cistatic inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
4243d0407baSopenharmony_ci{
4253d0407baSopenharmony_ci}
4263d0407baSopenharmony_cistatic inline void thermal_notify_framework(struct thermal_zone_device *tz, int trip)
4273d0407baSopenharmony_ci{
4283d0407baSopenharmony_ci}
4293d0407baSopenharmony_ci
4303d0407baSopenharmony_cistatic inline int thermal_zone_device_enable(struct thermal_zone_device *tz)
4313d0407baSopenharmony_ci{
4323d0407baSopenharmony_ci    return -ENODEV;
4333d0407baSopenharmony_ci}
4343d0407baSopenharmony_ci
4353d0407baSopenharmony_cistatic inline int thermal_zone_device_disable(struct thermal_zone_device *tz)
4363d0407baSopenharmony_ci{
4373d0407baSopenharmony_ci    return -ENODEV;
4383d0407baSopenharmony_ci}
4393d0407baSopenharmony_ci
4403d0407baSopenharmony_cistatic inline int thermal_zone_device_is_enabled(struct thermal_zone_device *tz)
4413d0407baSopenharmony_ci{
4423d0407baSopenharmony_ci    return -ENODEV;
4433d0407baSopenharmony_ci}
4443d0407baSopenharmony_ci#endif /* CONFIG_THERMAL */
4453d0407baSopenharmony_ci
4463d0407baSopenharmony_ci#endif /* __THERMAL_H__ */
447