mmc: core: Fix PowerOff Notify suspend/resume
[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         u8 hysteresis;
43         s8 shutdown_ext_limit;
44         s8 shutdown_local_limit;
45         s8 throttling_ext_limit;
46         s8 thermal_zones[MAX_ZONES];
47         u8 thermal_zones_sz;
48         void (*alarm_fn)(bool raised);
49         void (*probe_callback)(struct nct1008_data *);
50 };
51
52 struct nct1008_data {
53         struct workqueue_struct *workqueue;
54         struct work_struct work;
55         struct i2c_client *client;
56         struct nct1008_platform_data plat_data;
57         struct mutex mutex;
58         struct dentry *dent;
59         u8 config;
60         s8 *limits;
61         u8 limits_sz;
62         enum nct1008_chip chip;
63         void (*alarm_fn)(bool raised);
64         struct regulator *nct_reg;
65         long current_lo_limit;
66         long current_hi_limit;
67         int conv_period_ms;
68
69         void (*alert_func)(void *);
70         void *alert_data;
71 };
72
73 #ifdef CONFIG_SENSORS_NCT1008
74 int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp);
75 int nct1008_thermal_get_temps(struct nct1008_data *data, long *etemp,
76                                 long *itemp);
77 int nct1008_thermal_get_temp_low(struct nct1008_data *data, long *temp);
78 int nct1008_thermal_set_limits(struct nct1008_data *data,
79                                 long lo_limit_milli,
80                                 long hi_limit_milli);
81 int nct1008_thermal_set_alert(struct nct1008_data *data,
82                                 void (*alert_func)(void *),
83                                 void *alert_data);
84 int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data,
85                                         long shutdown_temp);
86 #else
87 static inline int nct1008_thermal_get_temp(struct nct1008_data *data,
88                                                 long *temp)
89 { return -EINVAL; }
90 static inline int nct1008_thermal_get_temps(struct nct1008_data *data,
91                                                 long *etemp, long *itemp)
92 { return -EINVAL; }
93 static inline int nct1008_thermal_get_temp_low(struct nct1008_data *data,
94                                                 long *temp)
95 { return -EINVAL; }
96 static inline int nct1008_thermal_set_limits(struct nct1008_data *data,
97                                 long lo_limit_milli,
98                                 long hi_limit_milli)
99 { return -EINVAL; }
100 static inline int nct1008_thermal_set_alert(struct nct1008_data *data,
101                                 void (*alert_func)(void *),
102                                 void *alert_data)
103 { return -EINVAL; }
104 static inline int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data,
105                                         long shutdown_temp)
106 { return -EINVAL; }
107 #endif
108
109 #endif /* _LINUX_NCT1008_H */