1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* include/linux/therm_est.h
*
* Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _LINUX_THERM_EST_H
#define _LINUX_THERM_EST_H
#include <linux/workqueue.h>
#define HIST_LEN (20)
struct therm_est_subdevice {
void *dev_data;
int (*get_temp)(void *, long *);
long coeffs[HIST_LEN];
long hist[HIST_LEN];
};
struct therm_estimator {
long therm_est_lo_limit;
long therm_est_hi_limit;
void (*callback)(void *);
void *callback_data;
long cur_temp;
long polling_period;
struct workqueue_struct *workqueue;
struct delayed_work therm_est_work;
long toffset;
int ntemp;
int ndevs;
struct therm_est_subdevice **devs;
};
#ifdef CONFIG_THERM_EST
struct therm_estimator *therm_est_register(
struct therm_est_subdevice **devs,
int ndevs,
long toffset,
long pperiod);
int therm_est_get_temp(struct therm_estimator *est, long *temp);
int therm_est_set_limits(struct therm_estimator *est,
long lo_limit,
long hi_limit);
int therm_est_set_alert(struct therm_estimator *est,
void (*cb)(void *),
void *cb_data);
#else
static inline struct therm_estimator *therm_est_register(
struct therm_est_subdevice **devs,
int ndevs,
long toffset,
long pperiod)
{ return NULL; }
static inline int therm_est_get_temp(struct therm_estimator *est, long *temp)
{ return -EINVAL; }
static inline int therm_est_set_limits(struct therm_estimator *est,
long lo_limit,
long hi_limit)
{ return -EINVAL; }
static inline int therm_est_set_alert(struct therm_estimator *est,
void (*cb)(void *),
void *cb_data)
{ return -EINVAL; }
#endif
#endif /* _LINUX_THERM_EST_H */
|