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