mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
cpu: simplify turbo management
This commit is contained in:
parent
806cf64d29
commit
cbaab9f160
2 changed files with 14 additions and 11 deletions
19
src/cpu.rs
19
src/cpu.rs
|
@ -213,23 +213,24 @@ fn get_available_governors() -> Result<Vec<String>> {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: I think the Auto Turbo behaviour is still pretty confusing for the end-user
|
||||||
|
// who might not have read the documentation in detail. We could just make the program
|
||||||
|
// more verbose here, but I think this is a fundamental design flaw that I will want
|
||||||
|
// to refactor in the future. For now though, I think this is a good-ish solution.
|
||||||
pub fn set_turbo(setting: TurboSetting) -> Result<()> {
|
pub fn set_turbo(setting: TurboSetting) -> Result<()> {
|
||||||
let value_pstate = match setting {
|
let value_pstate = match setting {
|
||||||
TurboSetting::Always => "0", // no_turbo = 0 means turbo is enabled
|
TurboSetting::Always => "0", // no_turbo = 0 means turbo is enabled
|
||||||
TurboSetting::Never => "1", // no_turbo = 1 means turbo is disabled
|
TurboSetting::Never => "1", // no_turbo = 1 means turbo is disabled
|
||||||
// Auto mode is handled at the engine level, not directly at the sysfs level
|
// For Auto, we need to enable the hardware default (which is turbo enabled)
|
||||||
TurboSetting::Auto => {
|
// and we reset to the system default when explicitly set to Auto
|
||||||
debug!("Turbo Auto mode is managed by engine logic based on system conditions");
|
TurboSetting::Auto => "0", // Set to enabled (default hardware state) when Auto is requested
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let value_boost = match setting {
|
let value_boost = match setting {
|
||||||
TurboSetting::Always => "1", // boost = 1 means turbo is enabled
|
TurboSetting::Always => "1", // boost = 1 means turbo is enabled
|
||||||
TurboSetting::Never => "0", // boost = 0 means turbo is disabled
|
TurboSetting::Never => "0", // boost = 0 means turbo is disabled
|
||||||
TurboSetting::Auto => {
|
// For Auto, we need to enable the hardware default (which is turbo enabled)
|
||||||
debug!("Turbo Auto mode is managed by engine logic based on system conditions");
|
// and we reset to the system default when explicitly set to Auto
|
||||||
return Ok(());
|
TurboSetting::Auto => "1", // Set to enabled (default hardware state) when Auto is requested
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// AMD specific paths
|
// AMD specific paths
|
||||||
|
|
|
@ -118,10 +118,12 @@ pub fn determine_and_apply_settings(
|
||||||
manage_auto_turbo(report, selected_profile_config)?;
|
manage_auto_turbo(report, selected_profile_config)?;
|
||||||
} else {
|
} else {
|
||||||
debug!(
|
debug!(
|
||||||
"Auto turbo management disabled by configuration, using system default behavior"
|
"Superfreq's dynamic turbo management is disabled by configuration. Ensuring system uses its default behavior for automatic turbo control."
|
||||||
);
|
);
|
||||||
|
// Make sure the system is set to its default automatic turbo mode.
|
||||||
|
// This is important if turbo was previously forced off.
|
||||||
try_apply_feature("Turbo boost", "system default (Auto)", || {
|
try_apply_feature("Turbo boost", "system default (Auto)", || {
|
||||||
cpu::set_turbo(turbo_setting)
|
cpu::set_turbo(TurboSetting::Auto)
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue