summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJoshua Primero <jprimero@nvidia.com>2012-08-29 21:12:46 -0400
committerNicolin Chen <nicolinc@nvidia.com>2017-08-11 15:14:13 -0400
commit2100cdffd1fb6a82618fc7610ef20a2c671e7116 (patch)
tree518a924b0908d0279d478d123ddb4dbeba60f851 /include/linux
parent01a5ab95d4dfb8bbd409dd734ee277b6f19ef5fa (diff)
drivers: misc: nct driver decouple
Decoupled nct driver from outside calls. Nct driver interacts with cooling devices by registering itself to the Linux thermal layer. Cooling devices is given via platform_data. Change-Id: I6df7d66e1fffd84670fd165fc9a9ded0127273c1 Signed-off-by: Joshua Primero <jprimero@nvidia.com> Reviewed-on: http://git-master/r/132881 (cherry picked from commit 5e1e60f2effbf8baed24d73f9c0b988f608cafe2) Signed-off-by: Gaurav Batra <gbatra@nvidia.com> Reviewed-on: http://git-master/r/130287 Rebase-Id: Rf061bdbe1c0e639cb7a3fbe363d78854304693e7
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/nct1008.h64
1 files changed, 14 insertions, 50 deletions
diff --git a/include/linux/nct1008.h b/include/linux/nct1008.h
index 244b26fff..5b8ae5142 100644
--- a/include/linux/nct1008.h
+++ b/include/linux/nct1008.h
@@ -27,14 +27,22 @@
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/thermal.h> 28#include <linux/thermal.h>
29 29
30#include <mach/edp.h>
31
32#define MAX_ZONES 16
33
34struct nct1008_data; 30struct nct1008_data;
35 31
36enum nct1008_chip { NCT1008, NCT72 }; 32enum nct1008_chip { NCT1008, NCT72 };
37 33
34struct nct1008_cdev {
35 struct thermal_cooling_device *(*create_cdev)(void *);
36 void *cdev_data;
37 long trip_temp;
38 enum thermal_trip_type type;
39 int tc1;
40 int tc2;
41 int passive_delay;
42};
43
44#define NCT1008_MAX_ACTIVE (16)
45
38struct nct1008_platform_data { 46struct nct1008_platform_data {
39 bool supported_hwrev; 47 bool supported_hwrev;
40 bool ext_range; 48 bool ext_range;
@@ -42,52 +50,8 @@ struct nct1008_platform_data {
42 u8 offset; 50 u8 offset;
43 s8 shutdown_ext_limit; 51 s8 shutdown_ext_limit;
44 s8 shutdown_local_limit; 52 s8 shutdown_local_limit;
45 void (*probe_callback)(struct nct1008_data *);
46};
47
48struct nct1008_data {
49 struct workqueue_struct *workqueue;
50 struct work_struct work;
51 struct i2c_client *client;
52 struct nct1008_platform_data plat_data;
53 struct mutex mutex;
54 struct dentry *dent;
55 u8 config;
56 enum nct1008_chip chip;
57 struct regulator *nct_reg;
58 long current_lo_limit;
59 long current_hi_limit;
60 int conv_period_ms;
61 53
62 void (*alert_func)(void *); 54 struct nct1008_cdev passive;
63 void *alert_data; 55 struct nct1008_cdev active[NCT1008_MAX_ACTIVE];
64}; 56};
65
66#ifdef CONFIG_SENSORS_NCT1008
67int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp);
68int nct1008_thermal_get_temps(struct nct1008_data *data, long *etemp,
69 long *itemp);
70int nct1008_thermal_set_limits(struct nct1008_data *data,
71 long lo_limit_milli,
72 long hi_limit_milli);
73int nct1008_thermal_set_alert(struct nct1008_data *data,
74 void (*alert_func)(void *),
75 void *alert_data);
76#else
77static inline int nct1008_thermal_get_temp(struct nct1008_data *data,
78 long *temp)
79{ return -EINVAL; }
80static inline int nct1008_thermal_get_temps(struct nct1008_data *data,
81 long *etemp, long *itemp)
82{ return -EINVAL; }
83static inline int nct1008_thermal_set_limits(struct nct1008_data *data,
84 long lo_limit_milli,
85 long hi_limit_milli)
86{ return -EINVAL; }
87static inline int nct1008_thermal_set_alert(struct nct1008_data *data,
88 void (*alert_func)(void *),
89 void *alert_data)
90{ return -EINVAL; }
91#endif
92
93#endif /* _LINUX_NCT1008_H */ 57#endif /* _LINUX_NCT1008_H */