xref: /rk3399_rockchip-uboot/include/thermal.h (revision e3568d2ecadda3e6c24ffab1670b77763df7419f)
1*e3568d2eSYe.Li /*
2*e3568d2eSYe.Li  *
3*e3568d2eSYe.Li  * (C) Copyright 2014 Freescale Semiconductor, Inc
4*e3568d2eSYe.Li  *
5*e3568d2eSYe.Li  * SPDX-License-Identifier:	GPL-2.0+
6*e3568d2eSYe.Li  */
7*e3568d2eSYe.Li 
8*e3568d2eSYe.Li #ifndef _THERMAL_H_
9*e3568d2eSYe.Li #define _THERMAL_H_
10*e3568d2eSYe.Li 
11*e3568d2eSYe.Li #include <dm.h>
12*e3568d2eSYe.Li 
13*e3568d2eSYe.Li int thermal_get_temp(struct udevice *dev, int *temp);
14*e3568d2eSYe.Li 
15*e3568d2eSYe.Li /**
16*e3568d2eSYe.Li  * struct struct dm_thermal_ops - Driver model Thermal operations
17*e3568d2eSYe.Li  *
18*e3568d2eSYe.Li  * The uclass interface is implemented by all Thermal devices which use
19*e3568d2eSYe.Li  * driver model.
20*e3568d2eSYe.Li  */
21*e3568d2eSYe.Li struct dm_thermal_ops {
22*e3568d2eSYe.Li 	/**
23*e3568d2eSYe.Li 	 * Get the current temperature
24*e3568d2eSYe.Li 	 *
25*e3568d2eSYe.Li 	 * The device provided is the slave device. It's parent controller
26*e3568d2eSYe.Li 	 * will be used to provide the communication.
27*e3568d2eSYe.Li 	 *
28*e3568d2eSYe.Li 	 * This must be called before doing any transfers with a Thermal slave.
29*e3568d2eSYe.Li 	 * It will enable and initialize any Thermal hardware as necessary,
30*e3568d2eSYe.Li 	 * and make sure that the SCK line is in the correct idle state. It is
31*e3568d2eSYe.Li 	 * not allowed to claim the same bus for several slaves without
32*e3568d2eSYe.Li 	 * releasing the bus in between.
33*e3568d2eSYe.Li 	 *
34*e3568d2eSYe.Li 	 * @dev:	The Thermal device
35*e3568d2eSYe.Li 	 *
36*e3568d2eSYe.Li 	 * Returns: 0 if the bus was claimed successfully, or a negative value
37*e3568d2eSYe.Li 	 * if it wasn't.
38*e3568d2eSYe.Li 	 */
39*e3568d2eSYe.Li 	int (*get_temp)(struct udevice *dev, int *temp);
40*e3568d2eSYe.Li };
41*e3568d2eSYe.Li 
42*e3568d2eSYe.Li #endif	/* _THERMAL_H_ */
43