- Add emulator mode (GPU-only freq capping) for handheld profile
- HOS 14.0.0+ removed ts:GetTemperatureMilliC · retronx-team/sys-clk@dcd0d5d
This commit is contained in:
@@ -60,6 +60,7 @@ ClockManager::ClockManager()
|
||||
this->oc = new SysClkOcExtra;
|
||||
this->oc->systemCoreBoostCPU = false;
|
||||
this->oc->gotBoostCPUFreq = false;
|
||||
this->oc->handheldEmulatorMode = false;
|
||||
this->oc->reverseNXMode = ReverseNX_NotFound;
|
||||
this->oc->maxMEMFreq = 0;
|
||||
this->oc->boostCPUFreq = 1785'000'000;
|
||||
@@ -162,8 +163,26 @@ uint32_t ClockManager::GetHz(SysClkModule module)
|
||||
|
||||
return this->oc->maxMEMFreq;
|
||||
}
|
||||
|
||||
/* Handle Handheld Emulator-Mode limit */
|
||||
if (this->context->realProfile == SysClkProfile_Handheld)
|
||||
{
|
||||
switch (module)
|
||||
{
|
||||
case SysClkModule_CPU:
|
||||
this->oc->handheldEmulatorMode = (hz > SYSCLK_CPU_HANDHELD_MAX_HZ);
|
||||
break;
|
||||
case SysClkModule_GPU:
|
||||
if (this->oc->handheldEmulatorMode)
|
||||
hz = std::min(hz, SYSCLK_GPU_HANDHELD_EMULATOR_HZ);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle CPU Auto Boost, no user-defined hz required */
|
||||
if (module == SysClkModule_CPU)
|
||||
{
|
||||
if (this->oc->systemCoreBoostCPU && hz < this->oc->boostCPUFreq)
|
||||
|
||||
@@ -298,10 +298,6 @@ std::uint32_t Clocks::GetNearestHz(SysClkModule module, SysClkProfile profile, s
|
||||
std::uint32_t Clocks::GetMaxAllowedHz(SysClkModule module, SysClkProfile profile)
|
||||
{
|
||||
switch (module) {
|
||||
case SysClkModule_CPU:
|
||||
if (profile == SysClkProfile_Handheld)
|
||||
return SYSCLK_CPU_HANDHELD_MAX_HZ;
|
||||
break;
|
||||
case SysClkModule_GPU:
|
||||
if (profile == SysClkProfile_Handheld)
|
||||
return SYSCLK_GPU_HANDHELD_MAX_HZ;
|
||||
@@ -341,26 +337,43 @@ std::uint32_t Clocks::GetNearestHz(SysClkModule module, std::uint32_t inHz)
|
||||
return inHz;
|
||||
}
|
||||
|
||||
std::uint32_t Clocks::GetTemperatureMilli(SysClkThermalSensor sensor)
|
||||
std::int32_t Clocks::GetTsTemperatureMilli(TsLocation location)
|
||||
{
|
||||
Result rc;
|
||||
std::int32_t millis = 0;
|
||||
|
||||
if(hosversionAtLeast(14,0,0))
|
||||
{
|
||||
rc = tsGetTemperature(location, &millis);
|
||||
ASSERT_RESULT_OK(rc, "tsGetTemperature(%u)", location);
|
||||
millis *= 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = tsGetTemperatureMilliC(location, &millis);
|
||||
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC(%u)", location);
|
||||
}
|
||||
|
||||
return millis;
|
||||
}
|
||||
|
||||
std::uint32_t Clocks::GetTemperatureMilli(SysClkThermalSensor sensor)
|
||||
{
|
||||
std::int32_t millis = 0;
|
||||
|
||||
if(sensor == SysClkThermalSensor_SOC)
|
||||
{
|
||||
rc = tsGetTemperatureMilliC(TsLocation_External, &millis);
|
||||
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC");
|
||||
millis = GetTsTemperatureMilli(TsLocation_External);
|
||||
}
|
||||
else if(sensor == SysClkThermalSensor_PCB)
|
||||
{
|
||||
rc = tsGetTemperatureMilliC(TsLocation_Internal, &millis);
|
||||
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC");
|
||||
millis = GetTsTemperatureMilli(TsLocation_Internal);
|
||||
}
|
||||
else if(sensor == SysClkThermalSensor_Skin)
|
||||
{
|
||||
if(hosversionAtLeast(5,0,0))
|
||||
{
|
||||
rc = tcGetSkinTemperatureMilliC(&millis);
|
||||
Result rc = tcGetSkinTemperatureMilliC(&millis);
|
||||
ASSERT_RESULT_OK(rc, "tcGetSkinTemperatureMilliC");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class Clocks
|
||||
static std::uint32_t GetTemperatureMilli(SysClkThermalSensor sensor);
|
||||
|
||||
protected:
|
||||
static std::int32_t GetTsTemperatureMilli(TsLocation location);
|
||||
static PcvModule GetPcvModule(SysClkModule sysclkModule);
|
||||
static PcvModuleId GetPcvModuleId(SysClkModule sysclkModule);
|
||||
static std::uint32_t GetNearestHz(SysClkModule module, std::uint32_t inHz);
|
||||
|
||||
Reference in New Issue
Block a user