summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <xda@vinschen.de>2018-08-06 21:14:12 +0200
committerCorinna Vinschen <xda@vinschen.de>2018-08-09 12:50:01 +0200
commit7dd0696b6a53764bef0f6e5fa2b638e28c4bcdbc (patch)
tree4bd6c261099d5b22bc276413d20524c3ea122ebe
parent34c7410edd225097cb0316200d27be7015f1f4ad (diff)
downloadandroid_hardware_qcom_power-7dd0696b6a53764bef0f6e5fa2b638e28c4bcdbc.tar.gz
android_hardware_qcom_power-7dd0696b6a53764bef0f6e5fa2b638e28c4bcdbc.tar.bz2
android_hardware_qcom_power-7dd0696b6a53764bef0f6e5fa2b638e28c4bcdbc.zip
power-8084: clean up code
* express interactive boost frequencies as descriptive symbolic values rather than arbitrary hex numbers * express durations as descriptive symbolic values rather than just numbers in the code Change-Id: I47a92bd4c9b0b86ae0444d87345daf4e94d56126 Signed-off-by: Corinna Vinschen <xda@vinschen.de>
-rw-r--r--power-8084.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/power-8084.c b/power-8084.c
index ecdb1d6..edd1fee 100644
--- a/power-8084.c
+++ b/power-8084.c
@@ -133,18 +133,18 @@ static void set_power_profile(int profile)
static int resources_interaction_fling_boost[] = {
CPUS_ONLINE_MIN_3,
- 0x20F,
- 0x30F,
- 0x40F,
- 0x50F
+ CPU0_MIN_FREQ_NONTURBO_MAX + 5,
+ CPU1_MIN_FREQ_NONTURBO_MAX + 5,
+ CPU2_MIN_FREQ_NONTURBO_MAX + 5,
+ CPU3_MIN_FREQ_NONTURBO_MAX + 5
};
static int resources_interaction_boost[] = {
CPUS_ONLINE_MIN_2,
- 0x20F,
- 0x30F,
- 0x40F,
- 0x50F
+ CPU0_MIN_FREQ_NONTURBO_MAX + 5,
+ CPU1_MIN_FREQ_NONTURBO_MAX + 5,
+ CPU2_MIN_FREQ_NONTURBO_MAX + 5,
+ CPU3_MIN_FREQ_NONTURBO_MAX + 5
};
static int resources_launch[] = {
@@ -155,6 +155,11 @@ static int resources_launch[] = {
CPU3_MIN_FREQ_TURBO_MAX
};
+const int DEFAULT_INTERACTIVE_DURATION = 500; /* ms */
+const int MIN_FLING_DURATION = 1500; /* ms */
+const int MAX_INTERACTIVE_DURATION = 5000; /* ms */
+const int LAUNCH_DURATION = 2000; /* ms */
+
int power_hint_override(power_hint_t hint, void *data)
{
static struct timespec s_previous_boost_timespec;
@@ -176,11 +181,12 @@ int power_hint_override(power_hint_t hint, void *data)
switch (hint) {
case POWER_HINT_INTERACTION:
- duration = 500; // 500ms by default
+ duration = DEFAULT_INTERACTIVE_DURATION;
if (data) {
int input_duration = *((int*)data);
if (input_duration > duration) {
- duration = (input_duration > 5000) ? 5000 : input_duration;
+ duration = (input_duration > MAX_INTERACTIVE_DURATION) ?
+ MAX_INTERACTIVE_DURATION : input_duration;
}
}
@@ -194,7 +200,7 @@ int power_hint_override(power_hint_t hint, void *data)
s_previous_boost_timespec = cur_boost_timespec;
s_previous_duration = duration;
- if (duration >= 1500) {
+ if (duration >= MIN_FLING_DURATION) {
interaction(duration, ARRAY_SIZE(resources_interaction_fling_boost),
resources_interaction_fling_boost);
} else {
@@ -203,7 +209,7 @@ int power_hint_override(power_hint_t hint, void *data)
}
return HINT_HANDLED;
case POWER_HINT_LAUNCH:
- duration = 2000;
+ duration = LAUNCH_DURATION;
interaction(duration, ARRAY_SIZE(resources_launch),
resources_launch);
return HINT_HANDLED;