xref: /linux-6.15/include/linux/thermal.h (revision 9e6ec8cf)
17e3c0381SLina Iyer /* SPDX-License-Identifier: GPL-2.0 */
2203d3d4aSZhang Rui /*
3203d3d4aSZhang Rui  *  thermal.h  ($Revision: 0 $)
4203d3d4aSZhang Rui  *
5203d3d4aSZhang Rui  *  Copyright (C) 2008  Intel Corp
6203d3d4aSZhang Rui  *  Copyright (C) 2008  Zhang Rui <[email protected]>
7203d3d4aSZhang Rui  *  Copyright (C) 2008  Sujith Thomas <[email protected]>
8203d3d4aSZhang Rui  */
9203d3d4aSZhang Rui 
10203d3d4aSZhang Rui #ifndef __THERMAL_H__
11203d3d4aSZhang Rui #define __THERMAL_H__
12203d3d4aSZhang Rui 
13a116b5d4SEduardo Valentin #include <linux/of.h>
14203d3d4aSZhang Rui #include <linux/idr.h>
15203d3d4aSZhang Rui #include <linux/device.h>
164d0fe749SEduardo Valentin #include <linux/sysfs.h>
17b1569e99SMatthew Garrett #include <linux/workqueue.h>
18af6c9f16SFlorian Fainelli #include <uapi/linux/thermal.h>
19203d3d4aSZhang Rui 
2057df8106SZhang Rui /* invalid cooling state */
2157df8106SZhang Rui #define THERMAL_CSTATE_INVALID -1UL
2257df8106SZhang Rui 
2323064088SDurgadoss R /* No upper/lower limit requirement */
24a940cb34SPunit Agrawal #define THERMAL_NO_LIMIT	((u32)~0)
2523064088SDurgadoss R 
266cd9e9f6SKapileshwar Singh /* Default weight of a bound cooling device */
276cd9e9f6SKapileshwar Singh #define THERMAL_WEIGHT_DEFAULT 0
286cd9e9f6SKapileshwar Singh 
29bb431ba2SZhang Rui /* use value, which < 0K, to indicate an invalid/uninitialized temperature */
30bb431ba2SZhang Rui #define THERMAL_TEMP_INVALID	-274000
31bb431ba2SZhang Rui 
32203d3d4aSZhang Rui struct thermal_zone_device;
33203d3d4aSZhang Rui struct thermal_cooling_device;
3435b11d2eSJavi Merino struct thermal_instance;
35755113d7SDaniel Lezcano struct thermal_debugfs;
36c68df440SDaniel Lezcano struct thermal_attr;
37203d3d4aSZhang Rui 
38601f3d42SZhang Rui enum thermal_trend {
39601f3d42SZhang Rui 	THERMAL_TREND_STABLE, /* temperature is stable */
40601f3d42SZhang Rui 	THERMAL_TREND_RAISING, /* temperature is raising */
41601f3d42SZhang Rui 	THERMAL_TREND_DROPPING, /* temperature is dropping */
42601f3d42SZhang Rui };
43601f3d42SZhang Rui 
440e70f466SSrinivas Pandruvada /* Thermal notification reason */
450e70f466SSrinivas Pandruvada enum thermal_notify_event {
460e70f466SSrinivas Pandruvada 	THERMAL_EVENT_UNSPECIFIED, /* Unspecified event */
470e70f466SSrinivas Pandruvada 	THERMAL_EVENT_TEMP_SAMPLE, /* New Temperature sample */
480e70f466SSrinivas Pandruvada 	THERMAL_TRIP_VIOLATED, /* TRIP Point violation */
490e70f466SSrinivas Pandruvada 	THERMAL_TRIP_CHANGED, /* TRIP Point temperature changed */
500e70f466SSrinivas Pandruvada 	THERMAL_DEVICE_DOWN, /* Thermal device is down */
510e70f466SSrinivas Pandruvada 	THERMAL_DEVICE_UP, /* Thermal device is up after a down event */
520e70f466SSrinivas Pandruvada 	THERMAL_DEVICE_POWER_CAPABILITY_CHANGED, /* power capability changed */
5338e44da5SBrian Bian 	THERMAL_TABLE_CHANGED, /* Thermal table(s) changed */
5488052319SSrinivas Pandruvada 	THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */
55a8c95940SLukasz Luba 	THERMAL_TZ_BIND_CDEV, /* Cooling dev is bind to the thermal zone */
56a8c95940SLukasz Luba 	THERMAL_TZ_UNBIND_CDEV, /* Cooling dev is unbind from the thermal zone */
57bfc57bd1SLukasz Luba 	THERMAL_INSTANCE_WEIGHT_CHANGED, /* Thermal instance weight changed */
586e6f58a1SRafael J. Wysocki 	THERMAL_TZ_RESUME, /* Thermal zone is resuming after system sleep */
59445936f9SDaniel Lezcano 	THERMAL_TZ_ADD_THRESHOLD, /* Threshold added */
60445936f9SDaniel Lezcano 	THERMAL_TZ_DEL_THRESHOLD, /* Threshold deleted */
61445936f9SDaniel Lezcano 	THERMAL_TZ_FLUSH_THRESHOLDS, /* All thresholds deleted */
620e70f466SSrinivas Pandruvada };
630e70f466SSrinivas Pandruvada 
648289d810SRafael J. Wysocki /**
658289d810SRafael J. Wysocki  * struct thermal_trip - representation of a point in temperature domain
668289d810SRafael J. Wysocki  * @temperature: temperature value in miliCelsius
678289d810SRafael J. Wysocki  * @hysteresis: relative hysteresis in miliCelsius
688289d810SRafael J. Wysocki  * @type: trip point type
698289d810SRafael J. Wysocki  * @priv: pointer to driver data associated with this trip
705340f764SRafael J. Wysocki  * @flags: flags representing binary properties of the trip
718289d810SRafael J. Wysocki  */
728289d810SRafael J. Wysocki struct thermal_trip {
738289d810SRafael J. Wysocki 	int temperature;
748289d810SRafael J. Wysocki 	int hysteresis;
758289d810SRafael J. Wysocki 	enum thermal_trip_type type;
765340f764SRafael J. Wysocki 	u8 flags;
778289d810SRafael J. Wysocki 	void *priv;
788289d810SRafael J. Wysocki };
798289d810SRafael J. Wysocki 
805340f764SRafael J. Wysocki #define THERMAL_TRIP_FLAG_RW_TEMP	BIT(0)
815340f764SRafael J. Wysocki #define THERMAL_TRIP_FLAG_RW_HYST	BIT(1)
825340f764SRafael J. Wysocki 
835340f764SRafael J. Wysocki #define THERMAL_TRIP_FLAG_RW	(THERMAL_TRIP_FLAG_RW_TEMP | \
845340f764SRafael J. Wysocki 				 THERMAL_TRIP_FLAG_RW_HYST)
855340f764SRafael J. Wysocki 
86d1fbf18aSRafael J. Wysocki #define THERMAL_TRIP_PRIV_TO_INT(_val_)	(uintptr_t)(_val_)
87d1fbf18aSRafael J. Wysocki #define THERMAL_INT_TO_TRIP_PRIV(_val_)	(void *)(uintptr_t)(_val_)
88d1fbf18aSRafael J. Wysocki 
89aa35e56aSRafael J. Wysocki struct cooling_spec {
90aa35e56aSRafael J. Wysocki 	unsigned long upper;	/* Highest cooling state  */
91aa35e56aSRafael J. Wysocki 	unsigned long lower;	/* Lowest cooling state  */
92aa35e56aSRafael J. Wysocki 	unsigned int weight;	/* Cooling device weight */
93aa35e56aSRafael J. Wysocki };
94aa35e56aSRafael J. Wysocki 
95203d3d4aSZhang Rui struct thermal_zone_device_ops {
96aa35e56aSRafael J. Wysocki 	bool (*should_bind) (struct thermal_zone_device *,
97aa35e56aSRafael J. Wysocki 			     const struct thermal_trip *,
98aa35e56aSRafael J. Wysocki 			     struct thermal_cooling_device *,
99aa35e56aSRafael J. Wysocki 			     struct cooling_spec *);
10017e8351aSSascha Hauer 	int (*get_temp) (struct thermal_zone_device *, int *);
101060c034aSSascha Hauer 	int (*set_trips) (struct thermal_zone_device *, int, int);
102f5e50bf4SAndrzej Pietrasiewicz 	int (*change_mode) (struct thermal_zone_device *,
1036503e5dfSMatthew Garrett 		enum thermal_device_mode);
1040728c810SRafael J. Wysocki 	int (*set_trip_temp) (struct thermal_zone_device *,
1050728c810SRafael J. Wysocki 			      const struct thermal_trip *, int);
10617e8351aSSascha Hauer 	int (*get_crit_temp) (struct thermal_zone_device *, int *);
10717e8351aSSascha Hauer 	int (*set_emul_temp) (struct thermal_zone_device *, int);
108ebc7abb3SRafael J. Wysocki 	int (*get_trend) (struct thermal_zone_device *,
109ebc7abb3SRafael J. Wysocki 			  const struct thermal_trip *, enum thermal_trend *);
110d7203eedSDaniel Lezcano 	void (*hot)(struct thermal_zone_device *);
111d7203eedSDaniel Lezcano 	void (*critical)(struct thermal_zone_device *);
112203d3d4aSZhang Rui };
113203d3d4aSZhang Rui 
114203d3d4aSZhang Rui struct thermal_cooling_device_ops {
1156503e5dfSMatthew Garrett 	int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
1166503e5dfSMatthew Garrett 	int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
1176503e5dfSMatthew Garrett 	int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
118ecd1d2a3Szhuguangqing 	int (*get_requested_power)(struct thermal_cooling_device *, u32 *);
119ecd1d2a3Szhuguangqing 	int (*state2power)(struct thermal_cooling_device *, unsigned long, u32 *);
120ecd1d2a3Szhuguangqing 	int (*power2state)(struct thermal_cooling_device *, u32, unsigned long *);
121203d3d4aSZhang Rui };
122203d3d4aSZhang Rui 
123203d3d4aSZhang Rui struct thermal_cooling_device {
124203d3d4aSZhang Rui 	int id;
12557a427c8SChristophe JAILLET 	const char *type;
126c408b3d1SViresh Kumar 	unsigned long max_state;
127203d3d4aSZhang Rui 	struct device device;
1284e5e4705SEduardo Valentin 	struct device_node *np;
129203d3d4aSZhang Rui 	void *devdata;
1308ea22951SViresh Kumar 	void *stats;
1315b275ce2SAlan Cox 	const struct thermal_cooling_device_ops *ops;
132ce119f83SZhang Rui 	bool updated; /* true if the cooling device does not need update */
133f4a821ceSZhang Rui 	struct mutex lock; /* protect thermal_instances list */
134b5e4ae62SZhang Rui 	struct list_head thermal_instances;
135203d3d4aSZhang Rui 	struct list_head node;
136755113d7SDaniel Lezcano #ifdef CONFIG_THERMAL_DEBUGFS
137755113d7SDaniel Lezcano 	struct thermal_debugfs *debugfs;
138755113d7SDaniel Lezcano #endif
139203d3d4aSZhang Rui };
140203d3d4aSZhang Rui 
141a5a98a78SRafael J. Wysocki DEFINE_GUARD(cooling_dev, struct thermal_cooling_device *, mutex_lock(&_T->lock),
142a5a98a78SRafael J. Wysocki 	     mutex_unlock(&_T->lock))
143a5a98a78SRafael J. Wysocki 
144ef873947SDurgadoss R /* Structure to define Thermal Zone parameters */
145ef873947SDurgadoss R struct thermal_zone_params {
146b377252eSAngeloGioacchino Del Regno 	const char *governor_name;
147ccba4ffdSEduardo Valentin 
148ccba4ffdSEduardo Valentin 	/*
149ccba4ffdSEduardo Valentin 	 * a boolean to indicate if the thermal to hwmon sysfs interface
150ccba4ffdSEduardo Valentin 	 * is required. when no_hwmon == false, a hwmon sysfs interface
151ccba4ffdSEduardo Valentin 	 * will be created. when no_hwmon == true, nothing will be done
152ccba4ffdSEduardo Valentin 	 */
153ccba4ffdSEduardo Valentin 	bool no_hwmon;
154ccba4ffdSEduardo Valentin 
1556b775e87SJavi Merino 	/*
1566b775e87SJavi Merino 	 * Sustainable power (heat) that this thermal zone can dissipate in
1576b775e87SJavi Merino 	 * mW
1586b775e87SJavi Merino 	 */
1596b775e87SJavi Merino 	u32 sustainable_power;
1606b775e87SJavi Merino 
1616b775e87SJavi Merino 	/*
1626b775e87SJavi Merino 	 * Proportional parameter of the PID controller when
1636b775e87SJavi Merino 	 * overshooting (i.e., when temperature is below the target)
1646b775e87SJavi Merino 	 */
1656b775e87SJavi Merino 	s32 k_po;
1666b775e87SJavi Merino 
1676b775e87SJavi Merino 	/*
1686b775e87SJavi Merino 	 * Proportional parameter of the PID controller when
1696b775e87SJavi Merino 	 * undershooting
1706b775e87SJavi Merino 	 */
1716b775e87SJavi Merino 	s32 k_pu;
1726b775e87SJavi Merino 
1736b775e87SJavi Merino 	/* Integral parameter of the PID controller */
1746b775e87SJavi Merino 	s32 k_i;
1756b775e87SJavi Merino 
1766b775e87SJavi Merino 	/* Derivative parameter of the PID controller */
1776b775e87SJavi Merino 	s32 k_d;
1786b775e87SJavi Merino 
1796b775e87SJavi Merino 	/* threshold below which the error is no longer accumulated */
1806b775e87SJavi Merino 	s32 integral_cutoff;
1819d0be7f4SEduardo Valentin 
1829d0be7f4SEduardo Valentin 	/*
1839d0be7f4SEduardo Valentin 	 * @slope:	slope of a linear temperature adjustment curve.
1849d0be7f4SEduardo Valentin 	 * 		Used by thermal zone drivers.
1859d0be7f4SEduardo Valentin 	 */
1869d0be7f4SEduardo Valentin 	int slope;
1879d0be7f4SEduardo Valentin 	/*
1889d0be7f4SEduardo Valentin 	 * @offset:	offset of a linear temperature adjustment curve.
1899d0be7f4SEduardo Valentin 	 * 		Used by thermal zone drivers (default 0).
1909d0be7f4SEduardo Valentin 	 */
1919d0be7f4SEduardo Valentin 	int offset;
192ef873947SDurgadoss R };
193ef873947SDurgadoss R 
19423064088SDurgadoss R /* Function declarations */
1954e5e4705SEduardo Valentin #ifdef CONFIG_THERMAL_OF
1963fd6d6e2SDaniel Lezcano struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int id, void *data,
1973fd6d6e2SDaniel Lezcano 							  const struct thermal_zone_device_ops *ops);
1983fd6d6e2SDaniel Lezcano 
1993fd6d6e2SDaniel Lezcano void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_device *tz);
2003fd6d6e2SDaniel Lezcano 
2014e5e4705SEduardo Valentin #else
202f59ac19bSDaniel Lezcano 
203f59ac19bSDaniel Lezcano static inline
devm_thermal_of_zone_register(struct device * dev,int id,void * data,const struct thermal_zone_device_ops * ops)204f59ac19bSDaniel Lezcano struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int id, void *data,
205f59ac19bSDaniel Lezcano 							  const struct thermal_zone_device_ops *ops)
206f59ac19bSDaniel Lezcano {
207f59ac19bSDaniel Lezcano 	return ERR_PTR(-ENOTSUPP);
208f59ac19bSDaniel Lezcano }
209f59ac19bSDaniel Lezcano 
devm_thermal_of_zone_unregister(struct device * dev,struct thermal_zone_device * tz)210f59ac19bSDaniel Lezcano static inline void devm_thermal_of_zone_unregister(struct device *dev,
211f59ac19bSDaniel Lezcano 						   struct thermal_zone_device *tz)
212f59ac19bSDaniel Lezcano {
213f59ac19bSDaniel Lezcano }
2144e5e4705SEduardo Valentin #endif
21512ca7188SNishanth Menon 
21696b8b436SRafael J. Wysocki int for_each_thermal_trip(struct thermal_zone_device *tz,
21796b8b436SRafael J. Wysocki 			  int (*cb)(struct thermal_trip *, void *),
21896b8b436SRafael J. Wysocki 			  void *data);
219a56cc0a8SRafael J. Wysocki int thermal_zone_for_each_trip(struct thermal_zone_device *tz,
220a56cc0a8SRafael J. Wysocki 			       int (*cb)(struct thermal_trip *, void *),
221a56cc0a8SRafael J. Wysocki 			       void *data);
222bdc22c8dSRafael J. Wysocki void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
223bdc22c8dSRafael J. Wysocki 				struct thermal_trip *trip, int temp);
2247c3d5c20SDaniel Lezcano 
2257c3d5c20SDaniel Lezcano int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp);
2267c3d5c20SDaniel Lezcano 
22760518260SDaniel Lezcano #ifdef CONFIG_THERMAL
2289ffa7b92SRafael J. Wysocki struct thermal_zone_device *thermal_zone_device_register_with_trips(
2299ffa7b92SRafael J. Wysocki 					const char *type,
2309b0a6275SRafael J. Wysocki 					const struct thermal_trip *trips,
2314a62d588SRafael J. Wysocki 					int num_trips, void *devdata,
232698a1eb1SRafael J. Wysocki 					const struct thermal_zone_device_ops *ops,
2339ffa7b92SRafael J. Wysocki 					const struct thermal_zone_params *tzp,
234d05374deSRafael J. Wysocki 					unsigned int passive_delay,
235d05374deSRafael J. Wysocki 					unsigned int polling_delay);
236203d3d4aSZhang Rui 
237d332db8fSRafael J. Wysocki struct thermal_zone_device *thermal_tripless_zone_device_register(
238d332db8fSRafael J. Wysocki 					const char *type,
239d332db8fSRafael J. Wysocki 					void *devdata,
240698a1eb1SRafael J. Wysocki 					const struct thermal_zone_device_ops *ops,
241d332db8fSRafael J. Wysocki 					const struct thermal_zone_params *tzp);
242d332db8fSRafael J. Wysocki 
2439ffa7b92SRafael J. Wysocki void thermal_zone_device_unregister(struct thermal_zone_device *tz);
244fae11de5SDaniel Lezcano 
245a6ff3c00SDaniel Lezcano void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
246072e35c9SDaniel Lezcano const char *thermal_zone_device_type(struct thermal_zone_device *tzd);
2473034f859SDaniel Lezcano int thermal_zone_device_id(struct thermal_zone_device *tzd);
2487cefbaf0SDaniel Lezcano struct device *thermal_zone_device(struct thermal_zone_device *tzd);
249a6ff3c00SDaniel Lezcano 
2500e70f466SSrinivas Pandruvada void thermal_zone_device_update(struct thermal_zone_device *,
2510e70f466SSrinivas Pandruvada 				enum thermal_notify_event);
25223064088SDurgadoss R 
253f991de53SJean-Francois Dagenais struct thermal_cooling_device *thermal_cooling_device_register(const char *,
254f991de53SJean-Francois Dagenais 		void *, const struct thermal_cooling_device_ops *);
255a116b5d4SEduardo Valentin struct thermal_cooling_device *
256f991de53SJean-Francois Dagenais thermal_of_cooling_device_register(struct device_node *np, const char *, void *,
257a116b5d4SEduardo Valentin 				   const struct thermal_cooling_device_ops *);
258b4ab114cSGuenter Roeck struct thermal_cooling_device *
259b4ab114cSGuenter Roeck devm_thermal_of_cooling_device_register(struct device *dev,
260b4ab114cSGuenter Roeck 				struct device_node *np,
2614acab508SKrzysztof Kozlowski 				const char *type, void *devdata,
262b4ab114cSGuenter Roeck 				const struct thermal_cooling_device_ops *ops);
263790930f4SRafael J. Wysocki void thermal_cooling_device_update(struct thermal_cooling_device *);
264203d3d4aSZhang Rui void thermal_cooling_device_unregister(struct thermal_cooling_device *);
26563c4d919SEduardo Valentin struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
26617e8351aSSascha Hauer int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
2674a7069a3SRajendra Nayak int thermal_zone_get_slope(struct thermal_zone_device *tz);
2684a7069a3SRajendra Nayak int thermal_zone_get_offset(struct thermal_zone_device *tz);
269463b86feSRafael J. Wysocki bool thermal_trip_is_bound_to_cdev(struct thermal_zone_device *tz,
270463b86feSRafael J. Wysocki 				   const struct thermal_trip *trip,
271463b86feSRafael J. Wysocki 				   struct thermal_cooling_device *cdev);
272af06216aSRafael J. Wysocki 
273ac5d9eccSAndrzej Pietrasiewicz int thermal_zone_device_enable(struct thermal_zone_device *tz);
274ac5d9eccSAndrzej Pietrasiewicz int thermal_zone_device_disable(struct thermal_zone_device *tz);
275d7203eedSDaniel Lezcano void thermal_zone_device_critical(struct thermal_zone_device *tz);
27612ca7188SNishanth Menon #else
thermal_zone_device_register_with_trips(const char * type,const struct thermal_trip * trips,int num_trips,void * devdata,const struct thermal_zone_device_ops * ops,const struct thermal_zone_params * tzp,int passive_delay,int polling_delay)2779ffa7b92SRafael J. Wysocki static inline struct thermal_zone_device *thermal_zone_device_register_with_trips(
2789ffa7b92SRafael J. Wysocki 					const char *type,
2799b0a6275SRafael J. Wysocki 					const struct thermal_trip *trips,
2804a62d588SRafael J. Wysocki 					int num_trips, void *devdata,
281698a1eb1SRafael J. Wysocki 					const struct thermal_zone_device_ops *ops,
2829ffa7b92SRafael J. Wysocki 					const struct thermal_zone_params *tzp,
2839ffa7b92SRafael J. Wysocki 					int passive_delay, int polling_delay)
2849ffa7b92SRafael J. Wysocki { return ERR_PTR(-ENODEV); }
2859ffa7b92SRafael J. Wysocki 
thermal_tripless_zone_device_register(const char * type,void * devdata,struct thermal_zone_device_ops * ops,const struct thermal_zone_params * tzp)286d332db8fSRafael J. Wysocki static inline struct thermal_zone_device *thermal_tripless_zone_device_register(
287d332db8fSRafael J. Wysocki 					const char *type,
288d332db8fSRafael J. Wysocki 					void *devdata,
289d332db8fSRafael J. Wysocki 					struct thermal_zone_device_ops *ops,
290d332db8fSRafael J. Wysocki 					const struct thermal_zone_params *tzp)
291d332db8fSRafael J. Wysocki { return ERR_PTR(-ENODEV); }
292d332db8fSRafael J. Wysocki 
thermal_zone_device_unregister(struct thermal_zone_device * tz)2939ffa7b92SRafael J. Wysocki static inline void thermal_zone_device_unregister(struct thermal_zone_device *tz)
29412ca7188SNishanth Menon { }
2959ffa7b92SRafael J. Wysocki 
thermal_zone_device_update(struct thermal_zone_device * tz,enum thermal_notify_event event)296*868dc3cdSThomas Weißschuh static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
297*868dc3cdSThomas Weißschuh 					      enum thermal_notify_event event)
298*868dc3cdSThomas Weißschuh { }
299*868dc3cdSThomas Weißschuh 
30012ca7188SNishanth Menon static inline struct thermal_cooling_device *
thermal_cooling_device_register(const char * type,void * devdata,const struct thermal_cooling_device_ops * ops)301fb836107SArnd Bergmann thermal_cooling_device_register(const char *type, void *devdata,
30212ca7188SNishanth Menon 	const struct thermal_cooling_device_ops *ops)
30312ca7188SNishanth Menon { return ERR_PTR(-ENODEV); }
30412ca7188SNishanth Menon static inline struct thermal_cooling_device *
thermal_of_cooling_device_register(struct device_node * np,const char * type,void * devdata,const struct thermal_cooling_device_ops * ops)30512ca7188SNishanth Menon thermal_of_cooling_device_register(struct device_node *np,
306fb836107SArnd Bergmann 	const char *type, void *devdata,
307fb836107SArnd Bergmann 	const struct thermal_cooling_device_ops *ops)
30812ca7188SNishanth Menon { return ERR_PTR(-ENODEV); }
309b4ab114cSGuenter Roeck static inline struct thermal_cooling_device *
devm_thermal_of_cooling_device_register(struct device * dev,struct device_node * np,const char * type,void * devdata,const struct thermal_cooling_device_ops * ops)310b4ab114cSGuenter Roeck devm_thermal_of_cooling_device_register(struct device *dev,
311b4ab114cSGuenter Roeck 				struct device_node *np,
3124acab508SKrzysztof Kozlowski 				const char *type, void *devdata,
313b4ab114cSGuenter Roeck 				const struct thermal_cooling_device_ops *ops)
314b4ab114cSGuenter Roeck {
315b4ab114cSGuenter Roeck 	return ERR_PTR(-ENODEV);
316b4ab114cSGuenter Roeck }
thermal_cooling_device_unregister(struct thermal_cooling_device * cdev)31712ca7188SNishanth Menon static inline void thermal_cooling_device_unregister(
31812ca7188SNishanth Menon 	struct thermal_cooling_device *cdev)
31912ca7188SNishanth Menon { }
thermal_zone_get_zone_by_name(const char * name)32012ca7188SNishanth Menon static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
32112ca7188SNishanth Menon 		const char *name)
32212ca7188SNishanth Menon { return ERR_PTR(-ENODEV); }
thermal_zone_get_temp(struct thermal_zone_device * tz,int * temp)32312ca7188SNishanth Menon static inline int thermal_zone_get_temp(
32417e8351aSSascha Hauer 		struct thermal_zone_device *tz, int *temp)
32512ca7188SNishanth Menon { return -ENODEV; }
thermal_zone_get_slope(struct thermal_zone_device * tz)3264a7069a3SRajendra Nayak static inline int thermal_zone_get_slope(
3274a7069a3SRajendra Nayak 		struct thermal_zone_device *tz)
3284a7069a3SRajendra Nayak { return -ENODEV; }
thermal_zone_get_offset(struct thermal_zone_device * tz)3294a7069a3SRajendra Nayak static inline int thermal_zone_get_offset(
3304a7069a3SRajendra Nayak 		struct thermal_zone_device *tz)
3314a7069a3SRajendra Nayak { return -ENODEV; }
332f0129c23SDaniel Lezcano 
thermal_zone_device_priv(struct thermal_zone_device * tz)333a6ff3c00SDaniel Lezcano static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz)
334a6ff3c00SDaniel Lezcano {
335a6ff3c00SDaniel Lezcano 	return NULL;
336a6ff3c00SDaniel Lezcano }
337a6ff3c00SDaniel Lezcano 
thermal_zone_device_type(struct thermal_zone_device * tzd)338072e35c9SDaniel Lezcano static inline const char *thermal_zone_device_type(struct thermal_zone_device *tzd)
339072e35c9SDaniel Lezcano {
340072e35c9SDaniel Lezcano 	return NULL;
341072e35c9SDaniel Lezcano }
342072e35c9SDaniel Lezcano 
thermal_zone_device_id(struct thermal_zone_device * tzd)3433034f859SDaniel Lezcano static inline int thermal_zone_device_id(struct thermal_zone_device *tzd)
3443034f859SDaniel Lezcano {
3453034f859SDaniel Lezcano 	return -ENODEV;
3463034f859SDaniel Lezcano }
3473034f859SDaniel Lezcano 
thermal_zone_device_enable(struct thermal_zone_device * tz)348ac5d9eccSAndrzej Pietrasiewicz static inline int thermal_zone_device_enable(struct thermal_zone_device *tz)
349ac5d9eccSAndrzej Pietrasiewicz { return -ENODEV; }
350ac5d9eccSAndrzej Pietrasiewicz 
thermal_zone_device_disable(struct thermal_zone_device * tz)351ac5d9eccSAndrzej Pietrasiewicz static inline int thermal_zone_device_disable(struct thermal_zone_device *tz)
352ac5d9eccSAndrzej Pietrasiewicz { return -ENODEV; }
35312ca7188SNishanth Menon #endif /* CONFIG_THERMAL */
354a4a15485SDurgadoss R 
355203d3d4aSZhang Rui #endif /* __THERMAL_H__ */
356