sysclk: add lineon's cpu volt bugfix

thanks, lineon!
This commit is contained in:
souldbminersmwc
2026-02-12 19:49:52 -05:00
parent b1ca62ce61
commit e6b4cb6612
4 changed files with 10 additions and 47 deletions

View File

@@ -248,9 +248,6 @@ void MiscGui::listUI()
addConfigToggle(HocClkConfigValue_UncappedClocks, nullptr);
addConfigToggle(HocClkConfigValue_OverwriteBoostMode, nullptr);
#if IS_MINIMAL == 0
addConfigToggle(HocClkConfigValue_FixCpuVoltBug, nullptr);
#endif
addConfigToggle(HocClkConfigValue_ThermalThrottle, nullptr);
addConfigToggle(HocClkConfigValue_HandheldTDP, nullptr);
addConfigToggle(HocClkConfigValue_EnforceBoardLimit, nullptr);

View File

@@ -451,13 +451,22 @@ void Board::SetHz(SysClkModule module, std::uint32_t hz)
ASSERT_RESULT_OK(rc, "clkrstOpenSession");
rc = clkrstSetClockRate(&session, hz);
ASSERT_RESULT_OK(rc, "clkrstSetClockRate");
if(module == SysClkModule_CPU) {
svcSleepThread(200'000'000);
rc = clkrstSetClockRate(&session, hz);
ASSERT_RESULT_OK(rc, "clkrstSetClockRate");
}
clkrstCloseSession(&session);
}
else
{
rc = pcvSetClockRate(Board::GetPcvModule(module), hz);
ASSERT_RESULT_OK(rc, "pcvSetClockRate");
if(module == SysClkModule_CPU) {
svcSleepThread(200'000'000);
rc = pcvSetClockRate(Board::GetPcvModule(module), hz);
ASSERT_RESULT_OK(rc, "pcvSetClockRate");
}
}
}

View File

@@ -114,44 +114,6 @@ ClockManager::ClockManager()
previousRamHz = Board::GetHz(SysClkModule_MEM);
}
void ClockManager::FixCpuBug() {
static constexpr u64 freqs[] = {
1785000000, // this will just set to the max when kip is unloaded so idgaf
1887000000,
1963000000,
2091000000,
2193000000,
2295000000,
2397000000,
2499000000,
2601000000,
2703000000 // replicates manual fix; if unstable it resets to 1020 due to speed
};
for (u64 hz : freqs) {
Board::SetHz(SysClkModule_CPU, hz);
}
svcSleepThread(1'000'000);
Board::SetHz(SysClkModule_CPU, 1020000000);
ResetToStockClocks();
u32 targetHz = this->context->overrideFreqs[SysClkModule_CPU];
if (!targetHz)
{
targetHz = this->config->GetAutoClockHz(this->context->applicationId, SysClkModule_CPU, this->context->profile, false);
if(!targetHz)
targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_CPU, this->context->profile, false);
}
if (targetHz)
{
Board::SetHz(SysClkModule_CPU, targetHz);
this->context->freqs[SysClkModule_CPU] = targetHz;
}
}
ClockManager::~ClockManager()
{
threadClose(&governorTHREAD);
@@ -611,10 +573,6 @@ void ClockManager::Tick()
Board::ResetToStockGpu();
}
}
if(module == SysClkModule_CPU && this->config->GetConfigValue(HocClkConfigValue_FixCpuVoltBug)) {
FixCpuBug();
}
}
}
}

View File

@@ -49,7 +49,6 @@ class ClockManager
ClockManager();
virtual ~ClockManager();
void FixCpuBug();
SysClkContext GetCurrentContext();
Config* GetConfig();