sm6375-common: power-libperfmgr: Properly handle sustained performance mode

* when tested with [1], even after exiting the app, spm was
   still active in powerhal thereby keeping max freqs limited
   and blocking boosts

 * enable/disable it properly and end all other hints before
   enabling, to fix this issue

 * while we're at it, don't handle max freq for anything other
   than spm in powerhint

[1] https://android.googlesource.com/platform/cts/+/refs/heads/master/hostsidetests/sustainedperf

Change-Id: I6e37dfa7ffab0137d70cb5ba5d1b156133416062
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
This commit is contained in:
Adithya R 2024-07-18 20:16:00 +05:30 committed by Anand S
parent 52a7d65121
commit 431daebc40
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61

View file

@ -97,9 +97,12 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
#endif #endif
case Mode::SUSTAINED_PERFORMANCE: case Mode::SUSTAINED_PERFORMANCE:
if (enabled) { if (enabled) {
endAllHints();
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE"); HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
} else {
HintManager::GetInstance()->EndHint("SUSTAINED_PERFORMANCE");
} }
mSustainedPerfModeOn = true; mSustainedPerfModeOn = enabled;
break; break;
case Mode::LOW_POWER: case Mode::LOW_POWER:
if (enabled) { if (enabled) {
@ -111,9 +114,6 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
mBatterySaverOn = enabled; mBatterySaverOn = enabled;
break; break;
case Mode::LAUNCH: case Mode::LAUNCH:
if (mSustainedPerfModeOn) {
break;
}
[[fallthrough]]; [[fallthrough]];
#ifndef TAP_TO_WAKE_NODE #ifndef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE: case Mode::DOUBLE_TAP_TO_WAKE:
@ -132,7 +132,9 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
case Mode::AUDIO_STREAMING_LOW_LATENCY: case Mode::AUDIO_STREAMING_LOW_LATENCY:
[[fallthrough]]; [[fallthrough]];
default: default:
if (mBatterySaverOn) break; if (mBatterySaverOn || mSustainedPerfModeOn) {
break;
}
if (enabled) { if (enabled) {
HintManager::GetInstance()->DoHint(toString(type)); HintManager::GetInstance()->DoHint(toString(type));
} else { } else {