sysclk: fully fix lite bug and add minimal mode
This commit is contained in:
@@ -40,13 +40,12 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HorizonOCConsoleType_Unknown = 0, ///< Invalid Model
|
||||
HorizonOCConsoleType_V1 = 1, ///< Erista Model
|
||||
HorizonOCConsoleType_UnreleasedErista = 2, ///< Erista "Simulation" Model
|
||||
HorizonOCConsoleType_V2 = 3, ///< Mariko Model
|
||||
HorizonOCConsoleType_Lite = 4, ///< Mariko Lite Model
|
||||
HorizonOCConsoleType_UnreleasedMariko = 5, ///< Mariko "Simulation" Model
|
||||
HorizonOCConsoleType_OLED = 6, ///< Mariko OLED Model
|
||||
HorizonOCConsoleType_Icosa = 0,
|
||||
HorizonOCConsoleType_Copper,
|
||||
HorizonOCConsoleType_Hoag,
|
||||
HorizonOCConsoleType_Iowa,
|
||||
HorizonOCConsoleType_Calcio,
|
||||
HorizonOCConsoleType_Aula,
|
||||
HorizonOCConsoleType_EnumMax,
|
||||
} HorizonOCConsoleType;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ TARGET_VERSION := $(APP_VERSION)
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
DEFINES := -DDISABLE_IPC -DTARGET="\"$(TARGET)\"" -DTARGET_VERSION="\"$(TARGET_VERSION)\"" -DIS_MINIMAL="\"$(IS_MINIMAL)\""
|
||||
DEFINES := -DDISABLE_IPC -DTARGET="\"$(TARGET)\"" -DTARGET_VERSION="\"$(TARGET_VERSION)\"" -DIS_MINIMAL=$(IS_MINIMAL)
|
||||
|
||||
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
this->addModuleListItem(profile, SysClkModule_CPU);
|
||||
this->addModuleListItem(profile, SysClkModule_GPU);
|
||||
this->addModuleListItem(profile, SysClkModule_MEM);
|
||||
#ifndef IS_MINIMAL
|
||||
#if IS_MINIMAL == 0
|
||||
if(!IsHoag()) {
|
||||
if(profile != SysClkProfile_Docked)
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0);
|
||||
|
||||
@@ -255,7 +255,7 @@ void GlobalOverrideGui::listUI()
|
||||
this->addModuleListItem(SysClkModule_CPU);
|
||||
this->addModuleListItem(SysClkModule_GPU);
|
||||
this->addModuleListItem(SysClkModule_MEM);
|
||||
#ifndef IS_MINIMAL
|
||||
#if IS_MINIMAL == 0
|
||||
if(!IsHoag())
|
||||
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0);
|
||||
#endif
|
||||
|
||||
@@ -97,7 +97,7 @@ void MainGui::listUI()
|
||||
return false;
|
||||
});
|
||||
this->listElement->addItem(miscItem);
|
||||
#ifndef IS_MINIMAL
|
||||
#if IS_MINIMAL == 0
|
||||
tsl::elm::ListItem* infoItem = new tsl::elm::ListItem("Information");
|
||||
infoItem->setClickListener([this](u64 keys) {
|
||||
if((keys & HidNpadButton_A) == HidNpadButton_A && this->context)
|
||||
|
||||
@@ -24,10 +24,9 @@
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <notification.h>
|
||||
#ifdef IS_MINIMAL
|
||||
#warning "Minimal compilation"
|
||||
#if IS_MINIMAL == 0
|
||||
#pragma message("Compiling with full features")
|
||||
#endif
|
||||
|
||||
class RamSubmenuGui;
|
||||
class RamTimingsSubmenuGui;
|
||||
class RamLatenciesSubmenuGui;
|
||||
@@ -267,47 +266,49 @@ void MiscGui::listUI()
|
||||
|
||||
addConfigToggle(HocClkConfigValue_UncappedClocks, nullptr);
|
||||
addConfigToggle(HocClkConfigValue_OverwriteBoostMode, nullptr);
|
||||
#ifndef IS_MINIMAL
|
||||
#if IS_MINIMAL == 0
|
||||
addConfigToggle(HocClkConfigValue_FixCpuVoltBug, nullptr);
|
||||
#endif
|
||||
addConfigToggle(HocClkConfigValue_ThermalThrottle, nullptr);
|
||||
addConfigToggle(HocClkConfigValue_HandheldTDP, nullptr);
|
||||
addConfigToggle(HocClkConfigValue_EnforceBoardLimit, nullptr);
|
||||
|
||||
std::map<uint32_t, std::string> labels_pwr_r = {
|
||||
{8600, "Official Rating"}
|
||||
};
|
||||
std::map<uint32_t, std::string> labels_pwr_l = {
|
||||
{6400, "Official Rating"}
|
||||
};
|
||||
#if IS_MINIMAL == 0
|
||||
std::map<uint32_t, std::string> labels_pwr_r = {
|
||||
{8600, "Official Rating"}
|
||||
};
|
||||
std::map<uint32_t, std::string> labels_pwr_l = {
|
||||
{6400, "Official Rating"}
|
||||
};
|
||||
ValueThresholds tdpThresholds(8600, 9500);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_HandheldTDPLimit,
|
||||
"TDP Threshold",
|
||||
ValueRange(5000, 10000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholds,
|
||||
labels_pwr_r
|
||||
);
|
||||
|
||||
ValueThresholds tdpThresholds(8600, 9500);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_HandheldTDPLimit,
|
||||
"TDP Threshold",
|
||||
ValueRange(5000, 10000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholds,
|
||||
labels_pwr_r
|
||||
);
|
||||
ValueThresholds tdpThresholdsLite(6400, 7500);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_LiteTDPLimit,
|
||||
"Lite TDP Threshold",
|
||||
ValueRange(4000, 8000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholdsLite,
|
||||
labels_pwr_l
|
||||
);
|
||||
|
||||
ValueThresholds tdpThresholdsLite(6400, 7500);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_LiteTDPLimit,
|
||||
"Lite TDP Threshold",
|
||||
ValueRange(4000, 8000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholdsLite,
|
||||
labels_pwr_l
|
||||
);
|
||||
|
||||
ValueThresholds throttleThresholds(70, 80);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_ThermalThrottleThreshold,
|
||||
"Thermal Throttle Limit",
|
||||
ValueRange(50, 85, 1, "°C", 1),
|
||||
"Temp",
|
||||
&throttleThresholds
|
||||
);
|
||||
ValueThresholds throttleThresholds(70, 80);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_ThermalThrottleThreshold,
|
||||
"Thermal Throttle Limit",
|
||||
ValueRange(50, 85, 1, "°C", 1),
|
||||
"Temp",
|
||||
&throttleThresholds
|
||||
);
|
||||
#endif
|
||||
|
||||
if(IsMariko()) {
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxCpuClock, nullptr, SysClkModule_CPU, cpu_freq_label_m);
|
||||
@@ -361,7 +362,7 @@ void MiscGui::listUI()
|
||||
});
|
||||
this->listElement->addItem(gpuSubmenu);
|
||||
|
||||
#ifndef IS_MINIMAL
|
||||
#if IS_MINIMAL == 0
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
|
||||
std::vector<NamedValue> chargerCurrents = {
|
||||
NamedValue("Disabled", 0),
|
||||
@@ -607,7 +608,7 @@ protected:
|
||||
addConfigButton(KipConfigValue_t6_tRTW, "t6 tRTW", ValueRange(0, 10, 1, "", 1), "tRTW", &thresholdsDisabled, {}, {}, false);
|
||||
addConfigButton(KipConfigValue_t7_tWTR, "t7 tWTR", ValueRange(0, 10, 1, "", 1), "tWTR", &thresholdsDisabled, {}, {}, false);
|
||||
addConfigButton(KipConfigValue_t8_tREFI, "t8 tREFI", ValueRange(0, 6, 1, "", 1), "tREFI", &thresholdsDisabled, {}, {}, false);
|
||||
|
||||
#if IS_MINIMAL == 0
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
|
||||
|
||||
tsl::elm::ListItem* emcUpdBtn = new tsl::elm::ListItem("Update RAM Timings");
|
||||
@@ -634,6 +635,7 @@ protected:
|
||||
});
|
||||
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 150);
|
||||
this->listElement->addItem(warningText);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -771,7 +773,7 @@ protected:
|
||||
);
|
||||
|
||||
std::vector<NamedValue> maxClkOptions = {
|
||||
NamedValue("1963MHz", 1963000),
|
||||
// NamedValue("1963MHz", 1963000),
|
||||
NamedValue("2397MHz", 2397000),
|
||||
NamedValue("2499MHz", 2499000),
|
||||
NamedValue("2601MHz", 2601000),
|
||||
|
||||
@@ -88,7 +88,7 @@ uint32_t GPU_Load_u = 0, fd = 0;
|
||||
BatteryChargeInfo info;
|
||||
|
||||
static SysClkSocType g_socType = SysClkSocType_Erista;
|
||||
static HorizonOCConsoleType g_consoleType = HorizonOCConsoleType_Unknown;
|
||||
static HorizonOCConsoleType g_consoleType = HorizonOCConsoleType_Iowa;
|
||||
|
||||
std::atomic<uint64_t> idletick0{systemtickfrequency};
|
||||
std::atomic<uint64_t> idletick1{systemtickfrequency};
|
||||
@@ -236,6 +236,9 @@ void Board::Initialize()
|
||||
rc = pmdmntInitialize();
|
||||
ASSERT_RESULT_OK(rc, "pmdmntInitialize");
|
||||
|
||||
rc = setInitialize();
|
||||
ASSERT_RESULT_OK(rc, "setInitialize");
|
||||
|
||||
threadCreate(&gpuLThread, gpuLoadThread, NULL, NULL, 0x1000, 0x3F, -2);
|
||||
threadStart(&gpuLThread);
|
||||
|
||||
@@ -255,7 +258,7 @@ void Board::Initialize()
|
||||
if (hosversionAtLeast(6,0,0) && R_SUCCEEDED(pwmInitialize())) {
|
||||
pwmCheck = pwmOpenSession2(&g_ICon, 0x3D000001);
|
||||
}
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite) {
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag) {
|
||||
u64 clkVirtAddr, dsiVirtAddr, outsize;
|
||||
rc = svcQueryMemoryMapping(&clkVirtAddr, &outsize, 0x60006000, 0x1000);
|
||||
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (clk)");
|
||||
@@ -368,7 +371,7 @@ void Board::Exit()
|
||||
rgltrExit();
|
||||
batteryInfoExit();
|
||||
pmdmntExit();
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
DisplayRefresh_Shutdown();
|
||||
}
|
||||
|
||||
@@ -404,7 +407,7 @@ void Board::SetHz(SysClkModule module, std::uint32_t hz)
|
||||
{
|
||||
Result rc = 0;
|
||||
|
||||
if(module == HorizonOCModule_Display && Board::GetConsoleType() != HorizonOCConsoleType_Lite) {
|
||||
if(module == HorizonOCModule_Display && Board::GetConsoleType() != HorizonOCConsoleType_Hoag) {
|
||||
DisplayRefresh_SetRate(hz);
|
||||
return;
|
||||
}
|
||||
@@ -434,7 +437,7 @@ std::uint32_t Board::GetHz(SysClkModule module)
|
||||
std::uint32_t hz = 0;
|
||||
|
||||
if(module == HorizonOCModule_Display) {
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
DisplayRefresh_GetRate(&hz, false);
|
||||
else
|
||||
hz = 60;
|
||||
@@ -474,7 +477,7 @@ std::uint32_t Board::GetRealHz(SysClkModule module)
|
||||
case SysClkModule_MEM:
|
||||
return t210ClkMemFreq();
|
||||
case HorizonOCModule_Display:
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
DisplayRefresh_GetRate(&hz, false);
|
||||
else
|
||||
hz = 60;
|
||||
@@ -672,12 +675,12 @@ void Board::ResetToStockGpu()
|
||||
}
|
||||
|
||||
void Board::ResetToStockDisplay() {
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
DisplayRefresh_SetRate(60);
|
||||
}
|
||||
|
||||
u8 Board::GetHighestDockedDisplayRate() {
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
|
||||
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
return DisplayRefresh_GetDockedHighestAllowed();
|
||||
else
|
||||
return 60;
|
||||
@@ -791,6 +794,8 @@ void Board::FetchHardwareInfos()
|
||||
g_socType = SysClkSocType_Erista;
|
||||
}
|
||||
|
||||
rc = splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
ASSERT_RESULT_OK(rc, "splGetConfig");
|
||||
g_consoleType = (HorizonOCConsoleType)sku;
|
||||
}
|
||||
|
||||
|
||||
@@ -420,19 +420,26 @@ void ClockManager::Tick()
|
||||
}
|
||||
|
||||
if(this->config->GetConfigValue(HocClkConfigValue_HandheldTDP) && opMode == AppletOperationMode_Handheld) {
|
||||
if(Board::GetConsoleType() == HorizonOCConsoleType_Lite) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)this->config->GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
|
||||
if(Board::GetConsoleType() == HorizonOCConsoleType_Hoag) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Now) < -(int)this->config->GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)this->config->GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Now) < -(int)this->config->GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this->config->GetConfigValue(HocClkConfigValue_EnforceBoardLimit) && opMode == AppletOperationMode_Console ) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Now) < 0) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(((tmp451TempSoc() / 1000) > (int)this->config->GetConfigValue(HocClkConfigValue_ThermalThrottleThreshold)) && this->config->GetConfigValue(HocClkConfigValue_ThermalThrottle)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
@@ -486,7 +493,7 @@ void ClockManager::Tick()
|
||||
isGovernorEnabled = newGovernorState;
|
||||
}
|
||||
|
||||
if(module == HorizonOCModule_Display && this->config->GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate) && Board::GetConsoleType() != HorizonOCConsoleType_Lite) {
|
||||
if(module == HorizonOCModule_Display && this->config->GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate) && Board::GetConsoleType() != HorizonOCConsoleType_Hoag) {
|
||||
if(targetHz)
|
||||
Board::SetHz(HorizonOCModule_Display, targetHz);
|
||||
else
|
||||
@@ -672,7 +679,7 @@ bool ClockManager::RefreshContext()
|
||||
FileUtils::WriteContextToCsv(this->context);
|
||||
}
|
||||
|
||||
if(this->context->profile == SysClkProfile_Docked && Board::GetConsoleType() != HorizonOCConsoleType_Lite)
|
||||
if(this->context->profile == SysClkProfile_Docked && Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
this->context->maxDisplayFreq = Board::GetHighestDockedDisplayRate();
|
||||
else
|
||||
this->context->maxDisplayFreq = 60;
|
||||
|
||||
@@ -71,7 +71,6 @@ class ClockManager
|
||||
int GetSpeedoBracket (int speedo);
|
||||
unsigned int GetGpuVoltage (unsigned int freq, int speedo);
|
||||
void calculateGpuVmin(void);
|
||||
|
||||
protected:
|
||||
bool IsAssignableHz(SysClkModule module, std::uint32_t hz);
|
||||
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile);
|
||||
|
||||
Reference in New Issue
Block a user