1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef __QCOM_TSENS_H__
14#define __QCOM_TSENS_H__
15
16#define ONE_PT_CALIB 0x1
17#define ONE_PT_CALIB2 0x2
18#define TWO_PT_CALIB 0x3
19
20#include <linux/thermal.h>
21
22struct tsens_device;
23
24struct tsens_sensor {
25 struct tsens_device *tmdev;
26 struct thermal_zone_device *tzd;
27 int offset;
28 int id;
29 int hw_id;
30 int slope;
31 u32 status;
32};
33
34
35
36
37
38
39
40
41
42
43
44
45struct tsens_ops {
46
47 int (*init)(struct tsens_device *);
48 int (*calibrate)(struct tsens_device *);
49 int (*get_temp)(struct tsens_device *, int, int *);
50
51 int (*enable)(struct tsens_device *, int);
52 void (*disable)(struct tsens_device *);
53 int (*suspend)(struct tsens_device *);
54 int (*resume)(struct tsens_device *);
55 int (*get_trend)(struct tsens_device *, int, enum thermal_trend *);
56};
57
58
59
60
61
62
63
64struct tsens_data {
65 const u32 num_sensors;
66 const struct tsens_ops *ops;
67 unsigned int *hw_ids;
68};
69
70
71struct tsens_context {
72 int threshold;
73 int control;
74};
75
76struct tsens_device {
77 struct device *dev;
78 u32 num_sensors;
79 struct regmap *map;
80 struct regmap_field *status_field;
81 struct tsens_context ctx;
82 bool trdy;
83 const struct tsens_ops *ops;
84 struct tsens_sensor sensor[0];
85};
86
87char *qfprom_read(struct device *, const char *);
88void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32);
89int init_common(struct tsens_device *);
90int get_temp_common(struct tsens_device *, int, int *);
91
92extern const struct tsens_data data_8916, data_8974, data_8960, data_8996;
93
94#endif
95