1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#include <linux/input/input_booster.h>
#include <linux/ems.h>
#include <linux/exynos-ucc.h>
static struct emstune_mode_request emstune_req_input;
static struct pm_qos_request cluster2_qos;
static struct pm_qos_request cluster1_qos;
static struct pm_qos_request cluster0_qos;
static struct pm_qos_request mif_qos;
static struct pm_qos_request int_qos;
static struct ucc_req ucc_req =
{
.name = "input",
};
static DEFINE_MUTEX(input_lock);
bool current_hmp_boost = INIT_ZERO;
bool current_ucc_boost = INIT_ZERO;
struct inform {
void *qos;
void (*set_func)(int);
int release_value;
};
struct inform informations[MAX_RES_COUNT];
void set_ucc(int enable) {
mutex_lock(&input_lock);
if (enable != current_ucc_boost) {
pr_booster("[Input Booster2] ****** set_ucc : %d ( %s )\n", enable, __FUNCTION__);
if (enable) {
ucc_add_request(&ucc_req, INPUT_LEVEL);
} else {
ucc_remove_request(&ucc_req);
}
current_ucc_boost = enable;
}
mutex_unlock(&input_lock);
}
void set_hmp(int enable) {
mutex_lock(&input_lock);
if (enable != current_hmp_boost) {
pr_booster("[Input Booster2] ****** set_ehmp : %d ( %s )\n", enable, __FUNCTION__);
if (enable) {
emstune_update_request(&emstune_req_input, INPUT_LEVEL);
} else {
emstune_update_request(&emstune_req_input, DEFAULT_LEVEL);
}
current_hmp_boost = enable;
}
mutex_unlock(&input_lock);
}
void init_input_emstune() {
emstune_add_request(&emstune_req_input);
}
void ib_set_booster(int* qos_values)
{
int value = -1;
int res_type = 0;
for (res_type = 0; res_type < MAX_RES_COUNT; res_type++) {
pr_info(" ib_set_booster qos_values[%d] : %d", res_type, qos_values[res_type]);
value = qos_values[res_type];
if (value <= 0)
continue;
if (informations[res_type].qos) {
pm_qos_update_request(informations[res_type].qos, qos_values[res_type]);
} else {
informations[res_type].set_func(qos_values[res_type]);
}
}
}
void ib_release_booster(long *rel_flags)
{
int res_type = 0;
long flag = -1;
for (res_type = 0; res_type < MAX_RES_COUNT; res_type++) {
flag = rel_flags[res_type];
if (flag <= 0)
continue;
if (informations[res_type].qos) {
pm_qos_update_request(informations[res_type].qos, informations[res_type].release_value);
} else {
informations[res_type].set_func(informations[res_type].release_value);
}
}
}
void input_booster_init_vendor(int* release_val)
{
int i = 0;
pm_qos_add_request(&cluster2_qos, PM_QOS_CLUSTER2_FREQ_MIN, PM_QOS_CLUSTER2_FREQ_MIN_DEFAULT_VALUE);
pm_qos_add_request(&cluster1_qos, PM_QOS_CLUSTER1_FREQ_MIN, PM_QOS_CLUSTER1_FREQ_MIN_DEFAULT_VALUE);
pm_qos_add_request(&cluster0_qos, PM_QOS_CLUSTER0_FREQ_MIN, PM_QOS_CLUSTER0_FREQ_MIN_DEFAULT_VALUE);
pm_qos_add_request(&mif_qos, PM_QOS_BUS_THROUGHPUT, PM_QOS_BUS_THROUGHPUT_DEFAULT_VALUE);
pm_qos_add_request(&int_qos, PM_QOS_DEVICE_THROUGHPUT, PM_QOS_DEVICE_THROUGHPUT_DEFAULT_VALUE);
informations[i++].qos = &cluster2_qos;
informations[i++].qos = &cluster1_qos;
informations[i++].qos = &cluster0_qos;
informations[i++].qos = &mif_qos;
informations[i++].qos = &int_qos;
informations[i++].set_func = set_hmp;
informations[i++].set_func = set_ucc;
for (i = 0; i < MAX_RES_COUNT; i++) {
informations[i].release_value = release_val[i];
}
init_input_emstune();
}
void input_booster_exit_vendor()
{
pm_qos_remove_request(&cluster2_qos);
pm_qos_remove_request(&cluster1_qos);
pm_qos_remove_request(&cluster0_qos);
pm_qos_remove_request(&mif_qos);
pm_qos_remove_request(&int_qos);
}
|