summaryrefslogtreecommitdiff
path: root/amlogic_thermal.h (plain)
blob: 6f6d2567fd03974a36745bd3cc6b41a297bd1ff2
1
2#ifndef __AMLOGIC_THERMAL_H__
3#define __AMLOGIC_THERMAL_H__
4
5struct record_buf {
6 int idx;
7 int max;
8 unsigned long cool_flag;
9 unsigned int *op;
10};
11
12struct 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
24struct aml_virtual_thermal {
25 unsigned int freq;
26 unsigned int temp_time[4];
27};
28
29struct aml_virtual_thermal_device {
30 int count;
31 struct aml_virtual_thermal *thermal;
32};
33
34struct 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
50struct amlogic_thermal_platform_data {
51 const char *name;
52 struct temp_trip *tmp_trip;
53 unsigned int temp_trip_count;
54 unsigned int temp_valid;
55 unsigned int current_temp;
56 unsigned int idle_interval;
57 unsigned int trim_flag;
58 unsigned int virtual_thermal_en;
59 unsigned int keep_mode;
60 unsigned int keep_mode_threshold;
61 unsigned int keep_mode_ini_state[4];
62 unsigned int keep_mode_cur_state[4];
63 unsigned int keep_mode_max_state[4];
64 unsigned int keep_mode_max_range[4];
65 unsigned int freq_sample_period;
66 struct record_buf op_buf;
67 struct cpu_stat_monitor monitor;
68 struct thermal_zone_device *therm_dev;
69 struct thermal_cooling_device *cpu_cool_dev;
70 struct thermal_cooling_device *gpu_cool_dev;
71 struct thermal_cooling_device *cpucore_cool_dev;
72 struct thermal_cooling_device *gpucore_cool_dev;
73 enum thermal_device_mode mode;
74 struct mutex lock;
75 struct delayed_work thermal_work;
76};
77
78struct temp_level{
79 unsigned int temperature;
80 int cpu_high_freq;
81 int cpu_low_freq;
82 int gpu_high_freq;
83 int gpu_low_freq;
84 int cpu_core_num;
85 int gpu_core_num;
86};
87
88struct freq_trip_table {
89 unsigned int freq_state;
90};
91
92void *thermal_alloc(size_t len);
93extern int thermal_debug_enable;
94extern int high_temp_protect;
95extern atomic_t freq_update_flag;
96
97void thermal_atomic_set(atomic_t *a, int);
98void thermal_lock(struct mutex *lock);
99void thermal_unlock(struct mutex *lock);
100void keep_mode_set_mode(struct amlogic_thermal_platform_data *);
101void keep_mode_bind(struct amlogic_thermal_platform_data *, unsigned long , int );
102void keep_mode_work(struct amlogic_thermal_platform_data *, int);
103void keep_mode_update_threshold(struct amlogic_thermal_platform_data *, int );
104void keep_mode_temp_level_init(struct amlogic_thermal_platform_data *, struct temp_level *);
105void *aml_get_cdevdata(struct thermal_cooling_device *cdev);
106void aml_set_cdev_update(struct thermal_cooling_device *cdev, bool update);
107void aml_cdev_lockop(struct thermal_cooling_device *cdev, bool lock);
108void aml_cdev_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *ret);
109
110#endif /* __AMLOGIC_THERMAL_H__ */
111