drivers: nct: shutdown and thermal register
[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-2012, 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 #include <linux/workqueue.h>
28
29 #include <mach/edp.h>
30
31 #define MAX_ZONES       16
32
33 struct nct1008_data;
34
35 enum nct1008_chip { NCT1008, NCT72 };
36
37 struct nct1008_platform_data {
38         bool supported_hwrev;
39         bool ext_range;
40         u8 conv_rate;
41         u8 offset;
42         s8 shutdown_ext_limit;
43         s8 shutdown_local_limit;
44         void (*probe_callback)(struct nct1008_data *);
45 };
46
47 struct nct1008_data {
48         struct workqueue_struct *workqueue;
49         struct work_struct work;
50         struct i2c_client *client;
51         struct nct1008_platform_data plat_data;
52         struct mutex mutex;
53         struct dentry *dent;
54         u8 config;
55         enum nct1008_chip chip;
56         struct regulator *nct_reg;
57         long current_lo_limit;
58         long current_hi_limit;
59         int conv_period_ms;
60
61         void (*alert_func)(void *);
62         void *alert_data;
63 };
64
65 #ifdef CONFIG_SENSORS_NCT1008
66 int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp);
67 int nct1008_thermal_get_temps(struct nct1008_data *data, long *etemp,
68                                 long *itemp);
69 int nct1008_thermal_set_limits(struct nct1008_data *data,
70                                 long lo_limit_milli,
71                                 long hi_limit_milli);
72 int nct1008_thermal_set_alert(struct nct1008_data *data,
73                                 void (*alert_func)(void *),
74                                 void *alert_data);
75 #else
76 static inline int nct1008_thermal_get_temp(struct nct1008_data *data,
77                                                 long *temp)
78 { return -EINVAL; }
79 static inline int nct1008_thermal_get_temps(struct nct1008_data *data,
80                                                 long *etemp, long *itemp)
81 { return -EINVAL; }
82 static inline int nct1008_thermal_set_limits(struct nct1008_data *data,
83                                 long lo_limit_milli,
84                                 long hi_limit_milli)
85 { return -EINVAL; }
86 static inline int nct1008_thermal_set_alert(struct nct1008_data *data,
87                                 void (*alert_func)(void *),
88                                 void *alert_data)
89 { return -EINVAL; }
90 #endif
91
92 #endif /* _LINUX_NCT1008_H */