summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJoshua Primero <jprimero@nvidia.com>2012-05-31 21:11:23 -0400
committerNicolin Chen <nicolinc@nvidia.com>2017-08-14 21:38:51 -0400
commitc911cea00d8b0275f80362efae41bfcdae4fe136 (patch)
tree429ed3fd98451f002b50f590c81cdad0ac89cf1a /include/linux
parent34c6962a85813f6c99534000856282a6daf51916 (diff)
drivers: misc: Thermal estimator driver
Added driver which estimates temperature based on a linear formula from other temperature sensors. Edit: WQ_RESCUER has been removed for K4.9 port. bug 1007726 Change-Id: Ic0d3ba7f0d369d4321f55b03e6326ff4efbb512e Signed-off-by: Joshua Primero <jprimero@nvidia.com> Reviewed-on: http://git-master/r/105988
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/therm_est.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/include/linux/therm_est.h b/include/linux/therm_est.h
new file mode 100644
index 000000000..035b08fa9
--- /dev/null
+++ b/include/linux/therm_est.h
@@ -0,0 +1,77 @@
1/*
2 * include/linux/therm_est.h
3 *
4 * Copyright (c) 2010-2012, NVIDIA Corporation.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_THERM_EST_H
18#define _LINUX_THERM_EST_H
19
20#include <linux/workqueue.h>
21
22#define HIST_LEN (20)
23
24struct therm_est_subdevice {
25 void *dev_data;
26 int (*get_temp)(void *, long *);
27 long coeffs[HIST_LEN];
28 long hist[HIST_LEN];
29};
30
31struct therm_estimator {
32 long therm_est_lo_limit;
33 long therm_est_hi_limit;
34 void (*callback)(void *);
35 void *callback_data;
36 long cur_temp;
37 long polling_period;
38 struct workqueue_struct *workqueue;
39 struct delayed_work therm_est_work;
40 long toffset;
41 int ntemp;
42 int ndevs;
43 struct therm_est_subdevice **devs;
44};
45
46#ifdef CONFIG_THERM_EST
47struct therm_estimator *therm_est_register(
48 struct therm_est_subdevice **devs,
49 int ndevs,
50 long toffset,
51 long pperiod);
52int therm_est_get_temp(struct therm_estimator *est, long *temp);
53int therm_est_set_limits(struct therm_estimator *est,
54 long lo_limit,
55 long hi_limit);
56int therm_est_set_alert(struct therm_estimator *est,
57 void (*cb)(void *),
58 void *cb_data);
59#else
60static inline struct therm_estimator *therm_est_register(
61 struct therm_est_subdevice **devs,
62 int ndevs,
63 long toffset,
64 long pperiod)
65{ return NULL; }
66static inline int therm_est_get_temp(struct therm_estimator *est, long *temp)
67{ return -EINVAL; }
68static inline int therm_est_set_limits(struct therm_estimator *est,
69 long lo_limit,
70 long hi_limit)
71{ return -EINVAL; }
72static inline int therm_est_set_alert(struct therm_estimator *est,
73 void (*cb)(void *),
74 void *cb_data)
75{ return -EINVAL; }
76#endif
77#endif /* _LINUX_THERM_EST_H */