1
2
3
4
5
6
7
8
9 #ifndef __STI_THERMAL_SYSCFG_H
10 #define __STI_THERMAL_SYSCFG_H
11
12 #include <linux/interrupt.h>
13 #include <linux/platform_device.h>
14 #include <linux/regmap.h>
15 #include <linux/thermal.h>
16
17 enum st_thermal_regfield_ids {
18 INT_THRESH_HI = 0,
19 TEMP_PWR = 0,
20 DCORRECT,
21 OVERFLOW,
22 DATA,
23 INT_ENABLE,
24
25 MAX_REGFIELDS
26 };
27
28
29 enum st_thermal_power_state {
30 POWER_OFF = 0,
31 POWER_ON
32 };
33
34 struct st_thermal_sensor;
35
36
37
38
39
40
41
42
43
44
45
46 struct st_thermal_sensor_ops {
47 int (*power_ctrl)(struct st_thermal_sensor *, enum st_thermal_power_state);
48 int (*alloc_regfields)(struct st_thermal_sensor *);
49 int (*regmap_init)(struct st_thermal_sensor *);
50 int (*register_enable_irq)(struct st_thermal_sensor *);
51 int (*enable_irq)(struct st_thermal_sensor *);
52 };
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 struct st_thermal_compat_data {
70 char *sys_compat;
71 const struct reg_field *reg_fields;
72 const struct st_thermal_sensor_ops *ops;
73 unsigned int calibration_val;
74 int temp_adjust_val;
75 int crit_temp;
76 };
77
78 struct st_thermal_sensor {
79 struct device *dev;
80 struct thermal_zone_device *thermal_dev;
81 const struct st_thermal_sensor_ops *ops;
82 const struct st_thermal_compat_data *cdata;
83 struct clk *clk;
84 struct regmap *regmap;
85 struct regmap_field *pwr;
86 struct regmap_field *dcorrect;
87 struct regmap_field *overflow;
88 struct regmap_field *temp_data;
89 struct regmap_field *int_thresh_hi;
90 struct regmap_field *int_enable;
91 int irq;
92 void __iomem *mmio_base;
93 };
94
95 extern int st_thermal_register(struct platform_device *pdev,
96 const struct of_device_id *st_thermal_of_match);
97 extern int st_thermal_unregister(struct platform_device *pdev);
98 extern const struct dev_pm_ops st_thermal_pm_ops;
99
100 #endif