mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
engine: allow users to explicitly disable auto-turbo
This commit is contained in:
parent
23c526a61e
commit
9935ae9fe3
2 changed files with 19 additions and 2 deletions
|
@ -51,6 +51,7 @@ pub struct ProfileConfig {
|
||||||
pub max_freq_mhz: Option<u32>,
|
pub max_freq_mhz: Option<u32>,
|
||||||
pub platform_profile: Option<String>,
|
pub platform_profile: Option<String>,
|
||||||
pub turbo_auto_settings: Option<TurboAutoSettings>,
|
pub turbo_auto_settings: Option<TurboAutoSettings>,
|
||||||
|
pub enable_auto_turbo: bool,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub battery_charge_thresholds: Option<BatteryChargeThresholds>,
|
pub battery_charge_thresholds: Option<BatteryChargeThresholds>,
|
||||||
}
|
}
|
||||||
|
@ -66,6 +67,7 @@ impl Default for ProfileConfig {
|
||||||
max_freq_mhz: None, // no override
|
max_freq_mhz: None, // no override
|
||||||
platform_profile: None, // no override
|
platform_profile: None, // no override
|
||||||
turbo_auto_settings: Some(TurboAutoSettings::default()),
|
turbo_auto_settings: Some(TurboAutoSettings::default()),
|
||||||
|
enable_auto_turbo: default_enable_auto_turbo(),
|
||||||
battery_charge_thresholds: None,
|
battery_charge_thresholds: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +127,8 @@ pub struct ProfileConfigToml {
|
||||||
pub max_freq_mhz: Option<u32>,
|
pub max_freq_mhz: Option<u32>,
|
||||||
pub platform_profile: Option<String>,
|
pub platform_profile: Option<String>,
|
||||||
pub turbo_auto_settings: Option<TurboAutoSettings>,
|
pub turbo_auto_settings: Option<TurboAutoSettings>,
|
||||||
|
#[serde(default = "default_enable_auto_turbo")]
|
||||||
|
pub enable_auto_turbo: bool,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub battery_charge_thresholds: Option<BatteryChargeThresholds>,
|
pub battery_charge_thresholds: Option<BatteryChargeThresholds>,
|
||||||
}
|
}
|
||||||
|
@ -153,6 +157,7 @@ impl Default for ProfileConfigToml {
|
||||||
max_freq_mhz: None,
|
max_freq_mhz: None,
|
||||||
platform_profile: None,
|
platform_profile: None,
|
||||||
turbo_auto_settings: None,
|
turbo_auto_settings: None,
|
||||||
|
enable_auto_turbo: default_enable_auto_turbo(),
|
||||||
battery_charge_thresholds: None,
|
battery_charge_thresholds: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,6 +218,7 @@ impl From<ProfileConfigToml> for ProfileConfig {
|
||||||
turbo_auto_settings: toml_config
|
turbo_auto_settings: toml_config
|
||||||
.turbo_auto_settings
|
.turbo_auto_settings
|
||||||
.or_else(|| Some(TurboAutoSettings::default())),
|
.or_else(|| Some(TurboAutoSettings::default())),
|
||||||
|
enable_auto_turbo: toml_config.enable_auto_turbo,
|
||||||
battery_charge_thresholds: toml_config.battery_charge_thresholds,
|
battery_charge_thresholds: toml_config.battery_charge_thresholds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,6 +292,10 @@ const fn default_stats_file_path() -> Option<String> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fn default_enable_auto_turbo() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||||
pub struct DaemonConfigToml {
|
pub struct DaemonConfigToml {
|
||||||
#[serde(default = "default_poll_interval_sec")]
|
#[serde(default = "default_poll_interval_sec")]
|
||||||
|
|
|
@ -113,8 +113,15 @@ pub fn determine_and_apply_settings(
|
||||||
info!("Setting turbo to '{turbo_setting:?}'");
|
info!("Setting turbo to '{turbo_setting:?}'");
|
||||||
match turbo_setting {
|
match turbo_setting {
|
||||||
TurboSetting::Auto => {
|
TurboSetting::Auto => {
|
||||||
debug!("Managing turbo in auto mode based on system conditions");
|
if selected_profile_config.enable_auto_turbo {
|
||||||
manage_auto_turbo(report, selected_profile_config)?;
|
debug!("Managing turbo in auto mode based on system conditions");
|
||||||
|
manage_auto_turbo(report, selected_profile_config)?;
|
||||||
|
} else {
|
||||||
|
debug!("Auto turbo management disabled by configuration, using system default behavior");
|
||||||
|
try_apply_feature("Turbo boost", "system default (Auto)", || {
|
||||||
|
cpu::set_turbo(turbo_setting)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
try_apply_feature("Turbo boost", &format!("{turbo_setting:?}"), || {
|
try_apply_feature("Turbo boost", &format!("{turbo_setting:?}"), || {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue