Fix maxMemFreq detection; Add some other alternative governor logic

This commit is contained in:
KazushiM
2022-11-01 23:08:23 +08:00
parent 72a8421df6
commit 523d2dc45a
4 changed files with 185 additions and 51 deletions

View File

@@ -372,7 +372,8 @@ std::uint32_t Clocks::GetCurrentHz(SysClkModule module)
std::uint32_t Clocks::GetNearestHz(SysClkModule module, SysClkProfile profile, std::uint32_t inHz)
{
if (module == SysClkModule_MEM && inHz == MAX_MEM_CLOCK)
uint32_t inMHz = inHz / 1000000U;
if (module == SysClkModule_MEM && inMHz == MAX_MEM_CLOCK / 1000'000)
return Clocks::maxMemFreq;
uint32_t* min = NULL;
@@ -382,9 +383,7 @@ std::uint32_t Clocks::GetNearestHz(SysClkModule module, SysClkProfile profile, s
if (!min || !max)
ERROR_THROW("table lookup failed for SysClkModule: %u", module);
uint32_t inMHz = inHz / 1000000U;
uint32_t* p = min;
while(p <= max) {
if (inMHz == *p / 1000000U)
return *p;