fix(sys-clk-oc): fix governor not setting clocks correctly: fixes #1

- move hz check from ApplyTargetFreq to caller
This commit is contained in:
hanabbi
2023-04-24 00:35:53 +09:00
committed by hanabbi
parent f981716933
commit 8cfab71f4d
2 changed files with 5 additions and 2 deletions

View File

@@ -143,6 +143,8 @@ namespace GovernorImpl {
// Utilization is frequency-invariant (normalized):
// target_freq = C * max_freq(ref_freq) * util / max
void BaseGovernor::ApplyNewFreqFromNormUtil(uint32_t normUtil) {
uint32_t curr_hz = m_target_hz;
auto FindHzInTable = [](uint32_t* list, uint32_t hz) -> uint32_t {
uint32_t* p = list;
for (; *p != 0; p++) {
@@ -163,7 +165,8 @@ void BaseGovernor::ApplyNewFreqFromNormUtil(uint32_t normUtil) {
else
new_hz = FindHzInTable(m_hz_list, next_freq);
ApplyTargetFreq(new_hz);
if (new_hz != curr_hz)
ApplyTargetFreq(new_hz);
}
void CpuGovernor::GovernorWorker::Start() {