sysclk: fix 1963mhz bug
This commit is contained in:
@@ -114,38 +114,40 @@ ClockManager::ClockManager()
|
|||||||
|
|
||||||
|
|
||||||
void ClockManager::FixCpuBug() {
|
void ClockManager::FixCpuBug() {
|
||||||
u32 targetHz = 0;
|
if(this->config->Refresh() && this->RefreshContext()) {
|
||||||
u32 maxHz = 0;
|
u32 targetHz = 0;
|
||||||
u32 nearestHz = 0;
|
u32 maxHz = 0;
|
||||||
|
u32 nearestHz = 0;
|
||||||
|
|
||||||
// ResetToStockClocks();
|
// ResetToStockClocks();
|
||||||
|
|
||||||
targetHz = this->context->overrideFreqs[SysClkModule_CPU];
|
targetHz = this->context->overrideFreqs[SysClkModule_CPU];
|
||||||
if (!targetHz) {
|
if (!targetHz) {
|
||||||
targetHz = this->config->GetAutoClockHz(this->context->applicationId, SysClkModule_CPU, this->context->profile, false);
|
targetHz = this->config->GetAutoClockHz(this->context->applicationId, SysClkModule_CPU, this->context->profile, false);
|
||||||
if(!targetHz)
|
if(!targetHz)
|
||||||
targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_CPU, this->context->profile, false);
|
targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_CPU, this->context->profile, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetHz) {
|
if (targetHz) {
|
||||||
maxHz = this->GetMaxAllowedHz(SysClkModule_CPU, this->context->profile);
|
maxHz = this->GetMaxAllowedHz(SysClkModule_CPU, this->context->profile);
|
||||||
nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz);
|
nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz);
|
||||||
|
|
||||||
while ((nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz)) != targetHz) {
|
while ((nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz)) != targetHz) {
|
||||||
Board::SetHz(SysClkModule_CPU, 1020000000);
|
Board::SetHz(SysClkModule_CPU, 1020000000);
|
||||||
svcSleepThread(1'000'000);
|
svcSleepThread(1'000'000);
|
||||||
Board::SetHz(SysClkModule_CPU, maxHz);
|
Board::SetHz(SysClkModule_CPU, maxHz);
|
||||||
this->context->freqs[SysClkModule_CPU] = maxHz;
|
this->context->freqs[SysClkModule_CPU] = maxHz;
|
||||||
|
}
|
||||||
|
Board::SetHz(SysClkModule_CPU, targetHz);
|
||||||
}
|
}
|
||||||
Board::SetHz(SysClkModule_CPU, targetHz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClockManager::~ClockManager()
|
ClockManager::~ClockManager()
|
||||||
{
|
{
|
||||||
|
threadClose(&governorTHREAD);
|
||||||
delete this->config;
|
delete this->config;
|
||||||
delete this->context;
|
delete this->context;
|
||||||
threadClose(&governorTHREAD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SysClkContext ClockManager::GetCurrentContext()
|
SysClkContext ClockManager::GetCurrentContext()
|
||||||
@@ -323,7 +325,6 @@ void ClockManager::GovernorThread(void* arg)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::scoped_lock lock{mgr->contextMutex};
|
|
||||||
|
|
||||||
if (!isGovernorEnabled)
|
if (!isGovernorEnabled)
|
||||||
{
|
{
|
||||||
@@ -337,6 +338,8 @@ void ClockManager::GovernorThread(void* arg)
|
|||||||
svcSleepThread(50'000'000);
|
svcSleepThread(50'000'000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::scoped_lock lock{mgr->contextMutex};
|
||||||
|
|
||||||
u32 currentHz = Board::GetHz(SysClkModule_GPU);
|
u32 currentHz = Board::GetHz(SysClkModule_GPU);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user