1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-27 17:07:44 +00:00

engine: reduce sysfs writes

This commit is contained in:
NotAShelf 2025-05-18 05:28:52 +03:00
parent aaa46e9223
commit 9db1a028bf
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -420,13 +420,25 @@ fn manage_auto_turbo(
hysteresis.update_state(enable_turbo);
}
// Apply the turbo setting
// Only apply the setting if the state has changed
let changed = previous_turbo_enabled != enable_turbo;
if changed {
let turbo_setting = if enable_turbo {
TurboSetting::Always
} else {
TurboSetting::Never
};
info!(
"Auto Turbo: Applying turbo change from {} to {}",
if previous_turbo_enabled {
"enabled"
} else {
"disabled"
},
if enable_turbo { "enabled" } else { "disabled" }
);
match cpu::set_turbo(turbo_setting) {
Ok(()) => {
debug!(
@ -437,6 +449,13 @@ fn manage_auto_turbo(
}
Err(e) => Err(EngineError::ControlError(e)),
}
} else {
debug!(
"Auto Turbo: Maintaining turbo state ({}) - no change needed",
if enable_turbo { "enabled" } else { "disabled" }
);
Ok(())
}
}
fn validate_turbo_auto_settings(settings: &TurboAutoSettings) -> Result<(), EngineError> {