feat(sys-clk-oc): set mariko min clock to 1020Mhz if using governor

Mariko: If using governor and cpu profile is higher than 1020, min clock will be set to 1020.
Not much power saved by underclocking below 1020, so to prevent stutter and hanging
This commit is contained in:
hanabbi
2023-04-25 00:35:57 +09:00
parent ccf0eccbf1
commit b9b36de4c9
3 changed files with 15 additions and 0 deletions

View File

@@ -147,6 +147,14 @@ void ClockManager::Tick()
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++)
{
uint32_t hz = GetHz((SysClkModule)module);
if (module == SysClkModule_CPU) {
this->governor->SetMinHz(*Clocks::freqRange[module].first, SysClkModule_CPU);
if (Clocks::GetIsMariko() && hz > (uint32_t)1020'000'000) {
this->governor->SetMinHz(1020'000'000, SysClkModule_CPU);
}
}
this->governor->SetMaxHz(hz, (SysClkModule)module);
if (hz && hz != this->context->freqs[module] && !this->governor->IsHandledByGovernor((SysClkModule)module))

View File

@@ -294,6 +294,12 @@ void Governor::SetMaxHz(uint32_t maxHz, SysClkModule module) {
}
}
void Governor::SetMinHz(uint32_t minHz, SysClkModule module) {
if (module == SysClkModule_CPU) {
m_cpu_gov->min_hz = minHz;
}
}
void Governor::GovernorManager::Start() {
if (this->running)
return;

View File

@@ -337,6 +337,7 @@ public:
uint32_t GetPerfConf() { return m_perf_conf_id; };
void SetMaxHz(uint32_t maxHz, SysClkModule module);
void SetMinHz(uint32_t minHz, SysClkModule module);
void SetAutoCPUBoost(bool enabled) { m_cpu_gov->auto_boost = enabled; };
void SetCPUBoostHz(uint32_t boostHz) { m_cpu_gov->boost_hz = boostHz; };