blob: a987ee36008d5a1ecbc2c025042ca1ae9601c0ed
1 | |
2 | #ifndef __AMLOGIC_THERMAL_H__ |
3 | #define __AMLOGIC_THERMAL_H__ |
4 | |
5 | struct record_buf { |
6 | int idx; |
7 | int max; |
8 | unsigned long cool_flag; |
9 | unsigned int *op; |
10 | }; |
11 | |
12 | struct cpu_stat_monitor { |
13 | unsigned int total_cpu_freq; |
14 | unsigned int total_gpu_freq; |
15 | unsigned int total_cpu_cores; |
16 | unsigned int total_gpu_cores; |
17 | unsigned int avg_cpu_freq; |
18 | unsigned int avg_gpu_freq; |
19 | unsigned int avg_cpu_cores; |
20 | unsigned int avg_gpu_cores; |
21 | unsigned int filter_temp; |
22 | }; |
23 | |
24 | struct aml_virtual_thermal { |
25 | unsigned int freq; |
26 | unsigned int temp_time[4]; |
27 | }; |
28 | |
29 | struct aml_virtual_thermal_device { |
30 | int count; |
31 | struct aml_virtual_thermal *thermal; |
32 | }; |
33 | |
34 | struct temp_trip{ |
35 | unsigned int temperature; |
36 | unsigned int cpu_upper_freq; |
37 | unsigned int cpu_lower_freq; |
38 | int cpu_upper_level; |
39 | int cpu_lower_level; |
40 | unsigned int gpu_upper_freq; |
41 | unsigned int gpu_lower_freq; |
42 | int gpu_upper_level; |
43 | int gpu_lower_level; |
44 | int cpu_core_num; |
45 | int cpu_core_upper; |
46 | int gpu_core_num; |
47 | int gpu_core_upper; |
48 | }; |
49 | |
50 | struct amlogic_thermal_platform_data { |
51 | const char *name; |
52 | struct temp_trip *tmp_trip; |
53 | unsigned int temp_trip_count; |
54 | unsigned int current_temp; |
55 | unsigned int idle_interval; |
56 | unsigned int trim_flag; |
57 | unsigned int virtual_thermal_en; |
58 | unsigned int keep_mode; |
59 | unsigned int keep_mode_threshold; |
60 | unsigned int keep_mode_ini_state[4]; |
61 | unsigned int keep_mode_cur_state[4]; |
62 | unsigned int keep_mode_max_state[4]; |
63 | unsigned int keep_mode_max_range[4]; |
64 | unsigned int freq_sample_period; |
65 | struct record_buf op_buf; |
66 | struct cpu_stat_monitor monitor; |
67 | struct thermal_zone_device *therm_dev; |
68 | struct thermal_cooling_device *cpu_cool_dev; |
69 | struct thermal_cooling_device *gpu_cool_dev; |
70 | struct thermal_cooling_device *cpucore_cool_dev; |
71 | struct thermal_cooling_device *gpucore_cool_dev; |
72 | enum thermal_device_mode mode; |
73 | struct mutex lock; |
74 | struct delayed_work thermal_work; |
75 | }; |
76 | |
77 | struct temp_level{ |
78 | unsigned int temperature; |
79 | int cpu_high_freq; |
80 | int cpu_low_freq; |
81 | int gpu_high_freq; |
82 | int gpu_low_freq; |
83 | int cpu_core_num; |
84 | int gpu_core_num; |
85 | }; |
86 | |
87 | struct freq_trip_table { |
88 | unsigned int freq_state; |
89 | }; |
90 | |
91 | void *thermal_alloc(size_t len); |
92 | extern int thermal_debug_enable; |
93 | extern int high_temp_protect; |
94 | extern atomic_t freq_update_flag; |
95 | |
96 | void thermal_atomic_set(atomic_t *a, int); |
97 | void thermal_lock(struct mutex *lock); |
98 | void thermal_unlock(struct mutex *lock); |
99 | void keep_mode_set_mode(struct amlogic_thermal_platform_data *); |
100 | void keep_mode_bind(struct amlogic_thermal_platform_data *, unsigned long , int ); |
101 | void keep_mode_work(struct amlogic_thermal_platform_data *, int); |
102 | void keep_mode_update_threshold(struct amlogic_thermal_platform_data *, int ); |
103 | void keep_mode_temp_level_init(struct amlogic_thermal_platform_data *, struct temp_level *); |
104 | |
105 | #endif /* __AMLOGIC_THERMAL_H__ */ |
106 |