Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ye.Li | d049afa | 2014-11-20 21:14:13 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2014 Freescale Semiconductor, Inc |
Ye.Li | d049afa | 2014-11-20 21:14:13 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
Patrick Delaunay | 8131335 | 2021-04-27 11:02:19 +0200 | [diff] [blame] | 6 | #define LOG_CATEGORY UCLASS_THERMAL |
| 7 | |
Ye.Li | d049afa | 2014-11-20 21:14:13 +0800 | [diff] [blame] | 8 | #include <dm.h> |
| 9 | #include <thermal.h> |
| 10 | #include <errno.h> |
| 11 | #include <fdtdec.h> |
| 12 | #include <malloc.h> |
| 13 | #include <asm/io.h> |
| 14 | #include <linux/list.h> |
| 15 | |
Ye.Li | d049afa | 2014-11-20 21:14:13 +0800 | [diff] [blame] | 16 | int thermal_get_temp(struct udevice *dev, int *temp) |
| 17 | { |
| 18 | const struct dm_thermal_ops *ops = device_get_ops(dev); |
| 19 | |
| 20 | if (!ops->get_temp) |
| 21 | return -ENOSYS; |
| 22 | |
| 23 | return ops->get_temp(dev, temp); |
| 24 | } |
| 25 | |
| 26 | UCLASS_DRIVER(thermal) = { |
| 27 | .id = UCLASS_THERMAL, |
| 28 | .name = "thermal", |
| 29 | }; |