summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal-uclass.c
diff options
context:
space:
mode:
authorYe.Li <B37916@freescale.com>2014-11-20 21:14:13 +0800
committerStefano Babic <sbabic@denx.de>2014-11-21 15:30:01 +0100
commite3568d2ecadda3e6c24ffab1670b77763df7419f (patch)
tree7cf42cfaf1907666407b8ff28cfb6aaaea59fa87 /drivers/thermal/thermal-uclass.c
parentcf202d268b5d27b84a8c6df1d749ed3967451be4 (diff)
downloadu-boot-imx-e3568d2ecadda3e6c24ffab1670b77763df7419f.zip
u-boot-imx-e3568d2ecadda3e6c24ffab1670b77763df7419f.tar.gz
u-boot-imx-e3568d2ecadda3e6c24ffab1670b77763df7419f.tar.bz2
DM: thermal: Add imx thermal DM driver
Add a new thermal uclass for thermal sensor and implement the imx thermal driver basing on this uclass. Signed-off-by: Ye.Li <B37916@freescale.com> Acked-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/thermal/thermal-uclass.c')
-rw-r--r--drivers/thermal/thermal-uclass.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/thermal/thermal-uclass.c b/drivers/thermal/thermal-uclass.c
new file mode 100644
index 0000000..3bee1a7
--- /dev/null
+++ b/drivers/thermal/thermal-uclass.c
@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2014 Freescale Semiconductor, Inc
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <thermal.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <malloc.h>
+#include <asm/io.h>
+#include <linux/list.h>
+
+
+int thermal_get_temp(struct udevice *dev, int *temp)
+{
+ const struct dm_thermal_ops *ops = device_get_ops(dev);
+
+ if (!ops->get_temp)
+ return -ENOSYS;
+
+ return ops->get_temp(dev, temp);
+}
+
+UCLASS_DRIVER(thermal) = {
+ .id = UCLASS_THERMAL,
+ .name = "thermal",
+};