sysclk: add vmin calculation feature
This commit is contained in:
@@ -52,6 +52,7 @@ Result sysclkIpcSetReverseNXRTMode(ReverseNXMode mode);
|
|||||||
Result hocClkIpcSetKipData();
|
Result hocClkIpcSetKipData();
|
||||||
Result hocClkIpcGetKipData();
|
Result hocClkIpcGetKipData();
|
||||||
Result hocClkIpcUpdateEmcRegs();
|
Result hocClkIpcUpdateEmcRegs();
|
||||||
|
Result hocClkIpcCalculateGpuVmin();
|
||||||
|
|
||||||
static inline Result sysclkIpcRemoveOverride(SysClkModule module)
|
static inline Result sysclkIpcRemoveOverride(SysClkModule module)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ enum SysClkIpcCmd
|
|||||||
HocClkIpcCmd_SetKipData = 13,
|
HocClkIpcCmd_SetKipData = 13,
|
||||||
HocClkIpcCmd_GetKipData = 14,
|
HocClkIpcCmd_GetKipData = 14,
|
||||||
HocClkIpcCmd_UpdateEmcRegs = 15,
|
HocClkIpcCmd_UpdateEmcRegs = 15,
|
||||||
|
HocClkIpcCmd_CalculateGpuVmin = 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -176,3 +176,8 @@ Result hocClkIpcUpdateEmcRegs()
|
|||||||
u32 temp = 0;
|
u32 temp = 0;
|
||||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_UpdateEmcRegs, temp);
|
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_UpdateEmcRegs, temp);
|
||||||
}
|
}
|
||||||
|
Result hocClkIpcCalculateGpuVmin()
|
||||||
|
{
|
||||||
|
u32 temp = 0;
|
||||||
|
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_CalculateGpuVmin, temp);
|
||||||
|
}
|
||||||
@@ -886,6 +886,19 @@ protected:
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
tsl::elm::ListItem* vminCalcBtn = new tsl::elm::ListItem("Calculate GPU Vmin");
|
||||||
|
vminCalcBtn->setClickListener([this](u64 keys) {
|
||||||
|
if (keys & HidNpadButton_A) {
|
||||||
|
Result rc = hocClkIpcCalculateGpuVmin();
|
||||||
|
if (R_FAILED(rc)) {
|
||||||
|
FatalGui::openWithResultCode("hocClkIpcCalculateGpuVmin", rc);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
addConfigButton(
|
addConfigButton(
|
||||||
KipConfigValue_marikoGpuVmin,
|
KipConfigValue_marikoGpuVmin,
|
||||||
"GPU VMIN",
|
"GPU VMIN",
|
||||||
|
|||||||
@@ -940,3 +940,55 @@ void ClockManager::UpdateRamTimings() {
|
|||||||
|
|
||||||
Board::UpdateShadowRegs(t1_tRCD, t2_tRP, t3_tRAS, t4_tRRD, t5_tRFC, t6_tRTW, t7_tWTR, t8_tREFI, ramFreq, rlAdd, wlAdd, hpMode);
|
Board::UpdateShadowRegs(t1_tRCD, t2_tRP, t3_tRAS, t4_tRRD, t5_tRFC, t6_tRTW, t7_tWTR, t8_tREFI, ramFreq, rlAdd, wlAdd, hpMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int ramBrackets[][22] =
|
||||||
|
{
|
||||||
|
{ 2133, 2200, 2266, 2300, 2366, 2400, 2433, 2466, 2533, 2566, 2600, 2633, 2700, 2733, 2766, 2833, 2866, 2900, 2933, 3033, 3066, 3100, },
|
||||||
|
{ 2300, 2366, 2433, 2466, 2533, 2566, 2633, 2700, 2733, 2800, 2833, 2900, 2933, 2966, 3033, 3066, 3100, 3133, 3166, 3200, 3233, 3266, },
|
||||||
|
{ 2433, 2466, 2533, 2600, 2666, 2733, 2766, 2800, 2833, 2866, 2933, 2966, 3033, 3066, 3100, 3133, 3166, 3200, 3233, 3300, 3333, 3366, },
|
||||||
|
{ 2500, 2533, 2600, 2633, 2666, 2733, 2800, 2866, 2900, 2966, 3033, 3100, 3166, 3200, 3233, 3266, 3300, 3333, 3366, 3400, 3400, 3400, }
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int gpuDvfsArray[] = { 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800};
|
||||||
|
|
||||||
|
int ClockManager::GetSpeedoBracket (int speedo)
|
||||||
|
{
|
||||||
|
int speedoBracket = 3;
|
||||||
|
if ((speedo < 1754) && (speedoBracket = 2, speedo < 1690)) {
|
||||||
|
speedoBracket = !!(1625 < speedo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return speedoBracket;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int ClockManager::GetGpuVoltage (unsigned int freq, int speedo)
|
||||||
|
{
|
||||||
|
long int loop;
|
||||||
|
int bracket = GetSpeedoBracket(speedo);
|
||||||
|
|
||||||
|
if (freq < 1601)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
loop = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (freq <= ramBrackets[bracket][loop])
|
||||||
|
return gpuDvfsArray[loop];
|
||||||
|
|
||||||
|
loop++;
|
||||||
|
} while (loop != 22);
|
||||||
|
|
||||||
|
return 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClockManager::calculateGpuVmin (void)
|
||||||
|
{
|
||||||
|
if(this->config->Refresh()) {
|
||||||
|
SysClkConfigValueList configValues;
|
||||||
|
this->config->GetConfigValues(&configValues);
|
||||||
|
|
||||||
|
int speedo = Board::getGPUSpeedo(), freq = this->config->GetConfigValue(KipConfigValue_marikoEmcMaxClock);
|
||||||
|
configValues.values[KipConfigValue_marikoGpuVmin] = GetGpuVoltage(freq, speedo);
|
||||||
|
this->config->SetConfigValues(&configValues, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -68,6 +68,10 @@ class ClockManager
|
|||||||
std::uint32_t count;
|
std::uint32_t count;
|
||||||
std::uint32_t list[SYSCLK_FREQ_LIST_MAX];
|
std::uint32_t list[SYSCLK_FREQ_LIST_MAX];
|
||||||
} freqTable[SysClkModule_EnumMax];
|
} freqTable[SysClkModule_EnumMax];
|
||||||
|
int GetSpeedoBracket (int speedo);
|
||||||
|
unsigned int GetGpuVoltage (unsigned int freq, int speedo);
|
||||||
|
void calculateGpuVmin(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool IsAssignableHz(SysClkModule module, std::uint32_t hz);
|
bool IsAssignableHz(SysClkModule module, std::uint32_t hz);
|
||||||
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile);
|
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile);
|
||||||
|
|||||||
@@ -214,6 +214,11 @@ Result IpcService::ServiceHandlerFunc(void* arg, const IpcServerRequest* r, u8*
|
|||||||
return ipcSrv->UpdateEmcRegs();
|
return ipcSrv->UpdateEmcRegs();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case HocClkIpcCmd_CalculateGpuVmin:
|
||||||
|
if (r->data.size >= 0) {
|
||||||
|
return ipcSrv->CalculateGPUVmin();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SYSCLK_ERROR(Generic);
|
return SYSCLK_ERROR(Generic);
|
||||||
@@ -387,3 +392,8 @@ Result IpcService::UpdateEmcRegs() {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result IpcService::CalculateGPUVmin() {
|
||||||
|
this->clockMgr->calculateGpuVmin();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -58,6 +58,7 @@ class IpcService
|
|||||||
Result SetKipData();
|
Result SetKipData();
|
||||||
Result GetKipData();
|
Result GetKipData();
|
||||||
Result UpdateEmcRegs();
|
Result UpdateEmcRegs();
|
||||||
|
Result CalculateGPUVmin();
|
||||||
bool running;
|
bool running;
|
||||||
Thread thread;
|
Thread thread;
|
||||||
LockableMutex threadMutex;
|
LockableMutex threadMutex;
|
||||||
|
|||||||
Reference in New Issue
Block a user