summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2018-03-01 21:41:04 -0800
committerMichael Bestas <mkbestas@lineageos.org>2019-10-23 01:12:56 +0300
commit689414dbd0c18379144f96e3bde393b259d541cd (patch)
tree8f1b68bdcf50591afd962b8a4aa73f5cd6e7ff2d
parentbd869d265f52e4d9e8f96fc625c185b9b762a0b5 (diff)
downloadvendor_qcom_opensource_power-689414dbd0c18379144f96e3bde393b259d541cd.tar.gz
vendor_qcom_opensource_power-689414dbd0c18379144f96e3bde393b259d541cd.tar.bz2
vendor_qcom_opensource_power-689414dbd0c18379144f96e3bde393b259d541cd.zip
power: Use is_interactive_governor/is_schedutil_governor
* Don't copy paste the same governor check code multiple times Change-Id: I2258553deb02a5ae149b0a96aca5fe5584f0ea14
-rw-r--r--power-660.c12
-rw-r--r--power-8909.c6
-rw-r--r--power-8916.c12
-rw-r--r--power-8952.c17
-rw-r--r--power-8953.c17
-rw-r--r--power-8992.c12
-rw-r--r--power-8994.c12
-rw-r--r--power-8996.c12
8 files changed, 32 insertions, 68 deletions
diff --git a/power-660.c b/power-660.c
index a336b85..b2f0b70 100644
--- a/power-660.c
+++ b/power-660.c
@@ -115,8 +115,7 @@ int set_interactive_override(int on) {
if (!on) {
/* Display off. */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/*
1. CPUfreq params
- hispeed freq for big - 1113Mhz
@@ -153,8 +152,7 @@ int set_interactive_override(int on) {
} else {
/* Display on. */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
}
@@ -197,8 +195,7 @@ static void process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/*
1. CPUfreq params
- hispeed freq for big - 1113Mhz
@@ -239,8 +236,7 @@ static void process_video_encode_hint(void* metadata) {
}
}
} else if (video_encode_metadata.state == 0) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
camera_hint_ref_count--;
if (!camera_hint_ref_count) {
undo_hint_action(video_encode_metadata.hint_id);
diff --git a/power-8909.c b/power-8909.c
index 219117c..a523be5 100644
--- a/power-8909.c
+++ b/power-8909.c
@@ -73,15 +73,13 @@ static void process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {HS_FREQ_800, THREAD_MIGRATION_SYNC_OFF};
perform_hint_action(video_encode_metadata.hint_id, resource_values,
sizeof(resource_values) / sizeof(resource_values[0]));
}
} else if (video_encode_metadata.state == 0) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(video_encode_metadata.hint_id);
}
}
diff --git a/power-8916.c b/power-8916.c
index 0c59ab3..873c51d 100644
--- a/power-8916.c
+++ b/power-8916.c
@@ -125,8 +125,7 @@ int set_interactive_override(int on) {
/* Display off. */
switch (is_target_8916()) {
case 8916: {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {TR_MS_50, THREAD_MIGRATION_SYNC_OFF};
if (!display_hint_sent) {
@@ -139,8 +138,7 @@ int set_interactive_override(int on) {
break;
default: {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {TR_MS_CPU0_50, TR_MS_CPU4_50,
THREAD_MIGRATION_SYNC_OFF};
@@ -174,15 +172,13 @@ int set_interactive_override(int on) {
/* Display on. */
switch (is_target_8916()) {
case 8916: {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
}
} break;
default: {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/* Recovering MIN_FREQ in display ON case */
snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_ON);
if (sysfs_write(scaling_min_freq[0], tmp_str) != 0) {
diff --git a/power-8952.c b/power-8952.c
index a3dd3e2..bc4d38b 100644
--- a/power-8952.c
+++ b/power-8952.c
@@ -118,8 +118,7 @@ int set_interactive_override(int on) {
if (!on) {
/* Display off. */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {INT_OP_CLUSTER0_TIMER_RATE, BIG_LITTLE_TR_MS_50,
INT_OP_CLUSTER1_TIMER_RATE, BIG_LITTLE_TR_MS_50,
INT_OP_NOTIFY_ON_MIGRATE, 0x00};
@@ -133,8 +132,7 @@ int set_interactive_override(int on) {
} else {
/* Display on. */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
}
@@ -206,8 +204,7 @@ static void process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, SCHEDUTIL_GOVERNOR, strlen(SCHEDUTIL_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(SCHEDUTIL_GOVERNOR))) {
+ if (is_schedutil_governor(governor)) {
if (is_target_SDM439()) {
/* sample_ms = 10mS
* SLB for Core0 = -6
@@ -248,8 +245,7 @@ static void process_video_encode_hint(void* metadata) {
}
}
}
- } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ } else if (is_interactive_governor(governor)) {
/* Sched_load and migration_notif*/
int res[] = {INT_OP_CLUSTER0_USE_SCHED_LOAD, 0x1,
INT_OP_CLUSTER1_USE_SCHED_LOAD, 0x1,
@@ -266,10 +262,7 @@ static void process_video_encode_hint(void* metadata) {
}
}
} else if (video_encode_metadata.state == 0) {
- if (((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) ||
- ((strncmp(governor, SCHEDUTIL_GOVERNOR, strlen(SCHEDUTIL_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(SCHEDUTIL_GOVERNOR)))) {
+ if (is_interactive_governor(governor) || is_schedutil_governor(governor)) {
camera_hint_ref_count--;
if (!camera_hint_ref_count) {
undo_hint_action(video_encode_metadata.hint_id);
diff --git a/power-8953.c b/power-8953.c
index 2525d7a..bd10669 100644
--- a/power-8953.c
+++ b/power-8953.c
@@ -122,8 +122,7 @@ int set_interactive_override(int on) {
if (!on) {
/* Display off. */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/* timer rate - 40mS*/
int resource_values[] = {
0x41424000,
@@ -138,8 +137,7 @@ int set_interactive_override(int on) {
} else {
/* Display on. */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
}
@@ -211,8 +209,7 @@ static void process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, SCHEDUTIL_GOVERNOR, strlen(SCHEDUTIL_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(SCHEDUTIL_GOVERNOR))) {
+ if (is_schedutil_governor(governor)) {
if (is_target_SDM632()) {
/* sample_ms = 10mS
* SLB for Core0 = -6
@@ -253,8 +250,7 @@ static void process_video_encode_hint(void* metadata) {
}
}
}
- } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ } else if (is_interactive_governor(governor)) {
/* Sched_load and migration_notification disable
* timer rate - 40mS*/
int res[] = {
@@ -272,10 +268,7 @@ static void process_video_encode_hint(void* metadata) {
}
}
} else if (video_encode_metadata.state == 0) {
- if (((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) ||
- ((strncmp(governor, SCHEDUTIL_GOVERNOR, strlen(SCHEDUTIL_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(SCHEDUTIL_GOVERNOR)))) {
+ if (is_interactive_governor(governor) || is_schedutil_governor(governor)) {
camera_hint_ref_count--;
if (!camera_hint_ref_count) {
undo_hint_action(video_encode_metadata.hint_id);
diff --git a/power-8992.c b/power-8992.c
index 3a6c5d4..49e73c6 100644
--- a/power-8992.c
+++ b/power-8992.c
@@ -74,8 +74,7 @@ static int process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/* sched and cpufreq params
* hispeed freq - 768 MHz
* target load - 90
@@ -89,8 +88,7 @@ static int process_video_encode_hint(void* metadata) {
return HINT_HANDLED;
}
} else if (video_encode_metadata.state == 0) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(video_encode_metadata.hint_id);
return HINT_HANDLED;
}
@@ -121,8 +119,7 @@ int set_interactive_override(int on) {
if (!on) {
/* Display off */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {0x777}; /* 4+0 core config in display off */
if (!display_hint_sent) {
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
@@ -133,8 +130,7 @@ int set_interactive_override(int on) {
}
} else {
/* Display on */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
return HINT_HANDLED;
diff --git a/power-8994.c b/power-8994.c
index 7ad7d17..7a04722 100644
--- a/power-8994.c
+++ b/power-8994.c
@@ -74,8 +74,7 @@ static int process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/* sched and cpufreq params
* hispeed freq - 768 MHz
* target load - 90
@@ -89,8 +88,7 @@ static int process_video_encode_hint(void* metadata) {
return HINT_HANDLED;
}
} else if (video_encode_metadata.state == 0) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(video_encode_metadata.hint_id);
return HINT_HANDLED;
}
@@ -121,8 +119,7 @@ int set_interactive_override(int on) {
if (!on) {
/* Display off */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {0x777}; /* 4+0 core config in display off */
if (!display_hint_sent) {
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
@@ -133,8 +130,7 @@ int set_interactive_override(int on) {
}
} else {
/* Display on */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
return HINT_HANDLED;
diff --git a/power-8996.c b/power-8996.c
index 440e9be..2cd8339 100644
--- a/power-8996.c
+++ b/power-8996.c
@@ -75,8 +75,7 @@ static int process_video_encode_hint(void* metadata) {
}
if (video_encode_metadata.state == 1) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
/* 1. cpufreq params
* -above_hispeed_delay for LVT - 40ms
* -go hispeed load for LVT - 95
@@ -108,8 +107,7 @@ static int process_video_encode_hint(void* metadata) {
return HINT_HANDLED;
}
} else if (video_encode_metadata.state == 0) {
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
camera_hint_ref_count--;
if (!camera_hint_ref_count) {
undo_hint_action(video_encode_metadata.hint_id);
@@ -146,8 +144,7 @@ int set_interactive_override(int on) {
if (!on) {
/* Display off */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
int resource_values[] = {}; /* dummy node */
if (!display_hint_sent) {
perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
@@ -159,8 +156,7 @@ int set_interactive_override(int on) {
}
} else {
/* Display on */
- if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
+ if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
ALOGI("Display Off hint stop");