diff --git a/Source/sys-clk-OC/README.md b/Source/sys-clk-OC/README.md index 3a5317e0..30038bd9 100644 --- a/Source/sys-clk-OC/README.md +++ b/Source/sys-clk-OC/README.md @@ -205,6 +205,7 @@ The `[values]` section allows you to alter timings in sys-clk, you should not ne |**charging_current** | Charging current limit (100 mA - 2000 mA) | 2000 mA | |**charging_limit_perc** | Charging limit (20% - 100%) | 100%(OFF) | |**governor_experimental** | CPU & GPU frequency governor (Experimental) | OFF | +|**governor_handheld_only**| Use governor only on Handheld Profile | OFF | |**temp_log_interval_ms** | Defines how often sys-clk log temperatures, in milliseconds (`0` to disable) | 0 ms | |**csv_write_interval_ms** | Defines how often sys-clk writes to the CSV, in milliseconds (`0` to disable) | 0 ms | |**poll_interval_ms** | Defines how fast sys-clk checks and applies profiles, in milliseconds | 500 ms | diff --git a/Source/sys-clk-OC/common/include/sysclk/config.h b/Source/sys-clk-OC/common/include/sysclk/config.h index 96f37f22..e45b8fa9 100644 --- a/Source/sys-clk-OC/common/include/sysclk/config.h +++ b/Source/sys-clk-OC/common/include/sysclk/config.h @@ -25,6 +25,7 @@ typedef enum { SysClkConfigValue_ChargingCurrentLimit, SysClkConfigValue_ChargingLimitPercentage, SysClkConfigValue_GovernorExperimental, + SysClkConfigValue_GovernorHandheldOnly, SysClkConfigValue_EnumMax, } SysClkConfigValue; @@ -54,6 +55,8 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr return pretty ? "Charging Limit (%%)" : "charging_limit_perc"; case SysClkConfigValue_GovernorExperimental: return pretty ? "Frequency Governor (Experimental)" : "governor_experimental"; + case SysClkConfigValue_GovernorHandheldOnly: + return pretty ? "Frequency Governor Handheld Only" : "governor_handheld_only"; default: return NULL; } @@ -69,6 +72,7 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val) case SysClkConfigValue_CsvWriteIntervalMs: case SysClkConfigValue_AllowUnsafeFrequencies: case SysClkConfigValue_GovernorExperimental: + case SysClkConfigValue_GovernorHandheldOnly: case SysClkConfigValue_AutoCPUBoost: return 0ULL; case SysClkConfigValue_SyncReverseNXMode: @@ -95,6 +99,7 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in case SysClkConfigValue_SyncReverseNXMode: case SysClkConfigValue_AllowUnsafeFrequencies: case SysClkConfigValue_GovernorExperimental: + case SysClkConfigValue_GovernorHandheldOnly: return (input & 0x1) == input; case SysClkConfigValue_ChargingCurrentLimit: return (input >= 100 && input <= CHARGING_CURRENT_MA_LIMIT && input % 100 == 0); diff --git a/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp b/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp index 494ad066..c9bfb32b 100644 --- a/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp +++ b/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp @@ -259,10 +259,14 @@ bool ClockManager::RefreshContext() SysClkOcGovernorConfig governorConfig = SysClkOcGovernorConfig_AllDisabled; if (this->GetConfig()->GetConfigValue(SysClkConfigValue_GovernorExperimental)) { + auto governorHandheldOnly = this->GetConfig()->GetConfigValue(SysClkConfigValue_GovernorHandheldOnly); governorConfig = SysClkOcGovernorConfig_Default; SysClkOcGovernorConfig governorConfigTitle = this->GetConfig()->GetTitleGovernorConfig(applicationId); if (governorConfig != governorConfigTitle) governorConfig = governorConfigTitle; + // Set governor config to disabled if Handheld Only is true + if (governorHandheldOnly && (realProfile != SysClkProfile_Handheld)) + governorConfig = SysClkOcGovernorConfig_AllDisabled; } this->governor->SetConfig(governorConfig);