misc: nct1008: add id for nct72
[linux-2.6.git] / include / linux / nct1008.h
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 enum nct1008_chip { NCT1008, NCT72 };
35
36 struct nct1008_platform_data {
37         bool supported_hwrev;
38         bool ext_range;
39         u8 conv_rate;
40         u8 offset;
41         u8 hysteresis;
42         s8 shutdown_ext_limit;
43         s8 shutdown_local_limit;
44         s8 throttling_ext_limit;
45         s8 thermal_zones[MAX_ZONES];
46         u8 thermal_zones_sz;
47         void (*alarm_fn)(bool raised);
48         void (*probe_callback)(struct nct1008_data *);
49 };
50
51 struct nct1008_data {
52         struct workqueue_struct *workqueue;
53         struct work_struct work;
54         struct i2c_client *client;
55         struct nct1008_platform_data plat_data;
56         struct mutex mutex;
57         struct dentry *dent;
58         u8 config;
59         s8 *limits;
60         u8 limits_sz;
61         enum nct1008_chip chip;
62         void (*alarm_fn)(bool raised);
63         struct regulator *nct_reg;
64         long current_lo_limit;
65         long current_hi_limit;
66         int conv_period_ms;
67
68         void (*alert_func)(void *);
69         void *alert_data;
70 };
71
72 #ifdef CONFIG_SENSORS_NCT1008
73 int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp);
74 int nct1008_thermal_get_temp_low(struct nct1008_data *data, long *temp);
75 int nct1008_thermal_set_limits(struct nct1008_data *data,
76                                 long lo_limit_milli,
77                                 long hi_limit_milli);
78 int nct1008_thermal_set_alert(struct nct1008_data *data,
79                                 void (*alert_func)(void *),
80                                 void *alert_data);
81 int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data,
82                                         long shutdown_temp);
83 #else
84 static inline int nct1008_thermal_get_temp(struct nct1008_data *data,
85                                                 long *temp)
86 { return -EINVAL; }
87 static inline int nct1008_thermal_get_temp_low(struct nct1008_data *data,
88                                                 long *temp)
89 { return -EINVAL; }
90 static inline int nct1008_thermal_set_limits(struct nct1008_data *data,
91                                 long lo_limit_milli,
92                                 long hi_limit_milli)
93 { return -EINVAL; }
94 static inline int nct1008_thermal_set_alert(struct nct1008_data *data,
95                                 void (*alert_func)(void *),
96                                 void *alert_data)
97 { return -EINVAL; }
98 static inline int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data,
99                                         long shutdown_temp)
100 { return -EINVAL; }
101 #endif
102
103 #endif /* _LINUX_NCT1008_H */