xref: /OK3568_Linux_fs/u-boot/drivers/thermal/thermal-uclass.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * (C) Copyright 2014 Freescale Semiconductor, Inc
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <common.h>
8*4882a593Smuzhiyun #include <dm.h>
9*4882a593Smuzhiyun #include <thermal.h>
10*4882a593Smuzhiyun #include <errno.h>
11*4882a593Smuzhiyun #include <fdtdec.h>
12*4882a593Smuzhiyun #include <malloc.h>
13*4882a593Smuzhiyun #include <asm/io.h>
14*4882a593Smuzhiyun #include <linux/list.h>
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun 
thermal_get_temp(struct udevice * dev,int * temp)17*4882a593Smuzhiyun int thermal_get_temp(struct udevice *dev, int *temp)
18*4882a593Smuzhiyun {
19*4882a593Smuzhiyun 	const struct dm_thermal_ops *ops = device_get_ops(dev);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun 	if (!ops->get_temp)
22*4882a593Smuzhiyun 		return -ENOSYS;
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun 	return ops->get_temp(dev, temp);
25*4882a593Smuzhiyun }
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun UCLASS_DRIVER(thermal) = {
28*4882a593Smuzhiyun 	.id		= UCLASS_THERMAL,
29*4882a593Smuzhiyun 	.name		= "thermal",
30*4882a593Smuzhiyun };
31