- 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:
@@ -69,7 +69,7 @@ This project will not be actively maintained or regularly updated along with Atm
|
|||||||
- Unsafe: CPU/GPU @ 2397/1305 MHz
|
- Unsafe: CPU/GPU @ 2397/1305 MHz
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
- Without chargers, CPU/GPU would be capped @ 1963/921 MHz.
|
- Without chargers, CPU/GPU would be capped @ 1963/921 MHz or -/460 MHz (Emulator mode).
|
||||||
|
|
||||||
- Without official chargers, GPU would be capped @ 1267 MHz.
|
- Without official chargers, GPU would be capped @ 1267 MHz.
|
||||||
|
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ From Hekate Minerva module [sys_sdrammtc.c](https://github.com/CTCaer/hekate/blo
|
|||||||
|
|
||||||
To protect the battery from excessive strain, clocks requested from config may be capped before applying, depending on your current profile:
|
To protect the battery from excessive strain, clocks requested from config may be capped before applying, depending on your current profile:
|
||||||
|
|
||||||
| | Handheld | Charging (USB) | Charging (Official) | Docked |
|
| | Handheld | Handheld (Emulator) | Charging (USB) | Charging (Official) | Docked |
|
||||||
|:-------:|:--------:|:--------------:|:-------------------:|:------:|
|
|:-------:|:--------:|:-------------------:|:--------------:|:-------------------:|:------:|
|
||||||
| **MEM** | - | - | - | - |
|
| **MEM** | - | - | - | - | - |
|
||||||
| **CPU** | 1963 | - | - | - |
|
| **CPU** | 1963 | - | - | - | - |
|
||||||
| **GPU** | 921 | 1267 | - | - |
|
| **GPU** | 921 | 460 | 1267 | - | - |
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
bool systemCoreBoostCPU;
|
bool systemCoreBoostCPU;
|
||||||
bool gotBoostCPUFreq;
|
bool gotBoostCPUFreq;
|
||||||
|
bool handheldEmulatorMode;
|
||||||
ReverseNXMode reverseNXMode;
|
ReverseNXMode reverseNXMode;
|
||||||
uint32_t maxMEMFreq;
|
uint32_t maxMEMFreq;
|
||||||
uint32_t boostCPUFreq;
|
uint32_t boostCPUFreq;
|
||||||
@@ -80,9 +81,10 @@ typedef struct
|
|||||||
};
|
};
|
||||||
} SysClkTitleProfileList;
|
} SysClkTitleProfileList;
|
||||||
|
|
||||||
#define SYSCLK_CPU_HANDHELD_MAX_HZ 1963500000
|
#define SYSCLK_CPU_HANDHELD_MAX_HZ 1963500000U
|
||||||
#define SYSCLK_GPU_HANDHELD_MAX_HZ 921600000
|
#define SYSCLK_GPU_HANDHELD_EMULATOR_HZ 460800000U
|
||||||
#define SYSCLK_GPU_CHARGING_USB_MAX_HZ 1267200000
|
#define SYSCLK_GPU_HANDHELD_MAX_HZ 921600000U
|
||||||
|
#define SYSCLK_GPU_CHARGING_USB_MAX_HZ 1267200000U
|
||||||
|
|
||||||
extern uint32_t sysclk_g_freq_table_mem_hz[];
|
extern uint32_t sysclk_g_freq_table_mem_hz[];
|
||||||
extern uint32_t sysclk_g_freq_table_cpu_hz[];
|
extern uint32_t sysclk_g_freq_table_cpu_hz[];
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ ClockManager::ClockManager()
|
|||||||
this->oc = new SysClkOcExtra;
|
this->oc = new SysClkOcExtra;
|
||||||
this->oc->systemCoreBoostCPU = false;
|
this->oc->systemCoreBoostCPU = false;
|
||||||
this->oc->gotBoostCPUFreq = false;
|
this->oc->gotBoostCPUFreq = false;
|
||||||
|
this->oc->handheldEmulatorMode = false;
|
||||||
this->oc->reverseNXMode = ReverseNX_NotFound;
|
this->oc->reverseNXMode = ReverseNX_NotFound;
|
||||||
this->oc->maxMEMFreq = 0;
|
this->oc->maxMEMFreq = 0;
|
||||||
this->oc->boostCPUFreq = 1785'000'000;
|
this->oc->boostCPUFreq = 1785'000'000;
|
||||||
@@ -162,8 +163,26 @@ uint32_t ClockManager::GetHz(SysClkModule module)
|
|||||||
|
|
||||||
return this->oc->maxMEMFreq;
|
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 (module == SysClkModule_CPU)
|
||||||
{
|
{
|
||||||
if (this->oc->systemCoreBoostCPU && hz < this->oc->boostCPUFreq)
|
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)
|
std::uint32_t Clocks::GetMaxAllowedHz(SysClkModule module, SysClkProfile profile)
|
||||||
{
|
{
|
||||||
switch (module) {
|
switch (module) {
|
||||||
case SysClkModule_CPU:
|
|
||||||
if (profile == SysClkProfile_Handheld)
|
|
||||||
return SYSCLK_CPU_HANDHELD_MAX_HZ;
|
|
||||||
break;
|
|
||||||
case SysClkModule_GPU:
|
case SysClkModule_GPU:
|
||||||
if (profile == SysClkProfile_Handheld)
|
if (profile == SysClkProfile_Handheld)
|
||||||
return SYSCLK_GPU_HANDHELD_MAX_HZ;
|
return SYSCLK_GPU_HANDHELD_MAX_HZ;
|
||||||
@@ -341,26 +337,43 @@ std::uint32_t Clocks::GetNearestHz(SysClkModule module, std::uint32_t inHz)
|
|||||||
return inHz;
|
return inHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t Clocks::GetTemperatureMilli(SysClkThermalSensor sensor)
|
std::int32_t Clocks::GetTsTemperatureMilli(TsLocation location)
|
||||||
{
|
{
|
||||||
Result rc;
|
Result rc;
|
||||||
std::int32_t millis = 0;
|
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)
|
if(sensor == SysClkThermalSensor_SOC)
|
||||||
{
|
{
|
||||||
rc = tsGetTemperatureMilliC(TsLocation_External, &millis);
|
millis = GetTsTemperatureMilli(TsLocation_External);
|
||||||
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC");
|
|
||||||
}
|
}
|
||||||
else if(sensor == SysClkThermalSensor_PCB)
|
else if(sensor == SysClkThermalSensor_PCB)
|
||||||
{
|
{
|
||||||
rc = tsGetTemperatureMilliC(TsLocation_Internal, &millis);
|
millis = GetTsTemperatureMilli(TsLocation_Internal);
|
||||||
ASSERT_RESULT_OK(rc, "tsGetTemperatureMilliC");
|
|
||||||
}
|
}
|
||||||
else if(sensor == SysClkThermalSensor_Skin)
|
else if(sensor == SysClkThermalSensor_Skin)
|
||||||
{
|
{
|
||||||
if(hosversionAtLeast(5,0,0))
|
if(hosversionAtLeast(5,0,0))
|
||||||
{
|
{
|
||||||
rc = tcGetSkinTemperatureMilliC(&millis);
|
Result rc = tcGetSkinTemperatureMilliC(&millis);
|
||||||
ASSERT_RESULT_OK(rc, "tcGetSkinTemperatureMilliC");
|
ASSERT_RESULT_OK(rc, "tcGetSkinTemperatureMilliC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class Clocks
|
|||||||
static std::uint32_t GetTemperatureMilli(SysClkThermalSensor sensor);
|
static std::uint32_t GetTemperatureMilli(SysClkThermalSensor sensor);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
static std::int32_t GetTsTemperatureMilli(TsLocation location);
|
||||||
static PcvModule GetPcvModule(SysClkModule sysclkModule);
|
static PcvModule GetPcvModule(SysClkModule sysclkModule);
|
||||||
static PcvModuleId GetPcvModuleId(SysClkModule sysclkModule);
|
static PcvModuleId GetPcvModuleId(SysClkModule sysclkModule);
|
||||||
static std::uint32_t GetNearestHz(SysClkModule module, std::uint32_t inHz);
|
static std::uint32_t GetNearestHz(SysClkModule module, std::uint32_t inHz);
|
||||||
|
|||||||
Reference in New Issue
Block a user