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