sm6375-common: power-libperfmgr: Fix uclamp_min stuck at high freq

Separate Stale and EarlyBoost handlers and refine the code.

Test: adb shell dumpsys android.hardware.power.IPower/default
Test: Manual
Bug: 232992641

Change-Id: I81a4fd96fb7311ae5bbb7cbabe72378c9cad4aa3
This commit is contained in:
jimmyshiu 2024-07-18 12:56:42 +05:30 committed by Anand S
commit 921f444f21
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
3 changed files with 191 additions and 154 deletions

View file

@ -162,12 +162,11 @@ void PowerSessionManager::setUclampMinLocked(PowerHintSession *session, int val)
// Get thex max uclamp.min across sessions which include the tid.
int tidMax = 0;
for (PowerHintSession *s : mTidSessionListMap[t]) {
if (!s->isActive() || s->isStale())
if (!s->isActive() || s->isTimeout())
continue;
tidMax = std::max(tidMax, s->getUclampMin());
}
val = std::max(val, tidMax);
set_uclamp_min(t, val);
set_uclamp_min(t, std::max(val, tidMax));
}
}
@ -176,7 +175,7 @@ std::optional<bool> PowerSessionManager::isAnyAppSessionActive() {
bool active = false;
for (PowerHintSession *s : mSessions) {
// session active and not stale is actually active.
if (s->isActive() && !s->isStale() && s->isAppSession()) {
if (s->isActive() && !s->isTimeout() && s->isAppSession()) {
active = true;
break;
}