diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /include/linux/nct1008.h | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'include/linux/nct1008.h')
-rw-r--r-- | include/linux/nct1008.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/include/linux/nct1008.h b/include/linux/nct1008.h new file mode 100644 index 00000000000..0a517f1d6d8 --- /dev/null +++ b/include/linux/nct1008.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | * include/linux/nct1008.h | ||
3 | * | ||
4 | * NCT1008, temperature monitoring device from ON Semiconductors | ||
5 | * | ||
6 | * Copyright (c) 2010, NVIDIA Corporation. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX_NCT1008_H | ||
24 | #define _LINUX_NCT1008_H | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | |||
28 | #include <mach/edp.h> | ||
29 | |||
30 | #define MAX_ZONES 16 | ||
31 | |||
32 | struct nct1008_data; | ||
33 | |||
34 | struct nct1008_platform_data { | ||
35 | bool supported_hwrev; | ||
36 | bool ext_range; | ||
37 | u8 conv_rate; | ||
38 | u8 offset; | ||
39 | u8 hysteresis; | ||
40 | s8 shutdown_ext_limit; | ||
41 | s8 shutdown_local_limit; | ||
42 | s8 throttling_ext_limit; | ||
43 | s8 thermal_zones[MAX_ZONES]; | ||
44 | u8 thermal_zones_sz; | ||
45 | void (*alarm_fn)(bool raised); | ||
46 | void (*probe_callback)(struct nct1008_data *); | ||
47 | }; | ||
48 | |||
49 | struct nct1008_data { | ||
50 | struct workqueue_struct *workqueue; | ||
51 | struct work_struct work; | ||
52 | struct i2c_client *client; | ||
53 | struct nct1008_platform_data plat_data; | ||
54 | struct mutex mutex; | ||
55 | struct dentry *dent; | ||
56 | u8 config; | ||
57 | s8 *limits; | ||
58 | u8 limits_sz; | ||
59 | void (*alarm_fn)(bool raised); | ||
60 | struct regulator *nct_reg; | ||
61 | long current_lo_limit; | ||
62 | long current_hi_limit; | ||
63 | int conv_period_ms; | ||
64 | |||
65 | void (*alert_func)(void *); | ||
66 | void *alert_data; | ||
67 | }; | ||
68 | |||
69 | #ifdef CONFIG_SENSORS_NCT1008 | ||
70 | int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp); | ||
71 | int nct1008_thermal_get_temp_low(struct nct1008_data *data, long *temp); | ||
72 | int nct1008_thermal_set_limits(struct nct1008_data *data, | ||
73 | long lo_limit_milli, | ||
74 | long hi_limit_milli); | ||
75 | int nct1008_thermal_set_alert(struct nct1008_data *data, | ||
76 | void (*alert_func)(void *), | ||
77 | void *alert_data); | ||
78 | int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data, | ||
79 | long shutdown_temp); | ||
80 | #else | ||
81 | static inline int nct1008_thermal_get_temp(struct nct1008_data *data, | ||
82 | long *temp) | ||
83 | { return -EINVAL; } | ||
84 | static inline int nct1008_thermal_get_temp_low(struct nct1008_data *data, | ||
85 | long *temp) | ||
86 | { return -EINVAL; } | ||
87 | static inline int nct1008_thermal_set_limits(struct nct1008_data *data, | ||
88 | long lo_limit_milli, | ||
89 | long hi_limit_milli) | ||
90 | { return -EINVAL; } | ||
91 | static inline int nct1008_thermal_set_alert(struct nct1008_data *data, | ||
92 | void (*alert_func)(void *), | ||
93 | void *alert_data) | ||
94 | { return -EINVAL; } | ||
95 | static inline int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data, | ||
96 | long shutdown_temp) | ||
97 | { return -EINVAL; } | ||
98 | #endif | ||
99 | |||
100 | #endif /* _LINUX_NCT1008_H */ | ||