sys-clk: add config to use governor only on handheld profile #28
This commit is contained in:
@@ -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 |
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user