Make CPU reset workaround skip resume from sleep

This commit is contained in:
NGnius (Graham) 2023-08-24 20:02:31 -04:00
parent b1d53ab038
commit 5f6370e778
4 changed files with 24 additions and 20 deletions

2
backend/Cargo.lock generated
View file

@ -1052,7 +1052,7 @@ dependencies = [
[[package]] [[package]]
name = "powertools" name = "powertools"
version = "1.4.0-beta2" version = "1.4.0-beta3"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"libryzenadj", "libryzenadj",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "powertools" name = "powertools"
version = "1.4.0-beta2" version = "1.4.0-beta3"
edition = "2021" edition = "2021"
authors = ["NGnius (Graham) <ngniusness@gmail.com>"] authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
description = "Backend (superuser) functionality for PowerTools" description = "Backend (superuser) functionality for PowerTools"

View file

@ -375,25 +375,29 @@ impl Cpu {
// https://github.com/NGnius/PowerTools/issues/107 // https://github.com/NGnius/PowerTools/issues/107
fn clock_unset_workaround(&self) -> Result<(), Vec<SettingError>> { fn clock_unset_workaround(&self) -> Result<(), Vec<SettingError>> {
let mut errors = Vec::new(); if !self.state.is_resuming {
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_cpu(true, self.index); let mut errors = Vec::new();
// always set clock speeds, since it doesn't reset correctly (kernel/hardware bug) POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_cpu(true, self.index);
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.enforce_level(&self.sysfs)?; // always set clock speeds, since it doesn't reset correctly (kernel/hardware bug)
// disable manual clock limits POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.enforce_level(&self.sysfs)?;
log::debug!("Setting CPU {} to default clockspeed", self.index); // disable manual clock limits
// max clock log::debug!("Setting CPU {} to default clockspeed", self.index);
self.set_clock_limit(self.index, self.limits.clock_max.max, ClockType::Max) // max clock
.unwrap_or_else(|e| errors.push(e)); self.set_clock_limit(self.index, self.limits.clock_max.max, ClockType::Max)
// min clock .unwrap_or_else(|e| errors.push(e));
self.set_clock_limit(self.index, self.limits.clock_min.min, ClockType::Min) // min clock
.unwrap_or_else(|e| errors.push(e)); self.set_clock_limit(self.index, self.limits.clock_min.min, ClockType::Min)
.unwrap_or_else(|e| errors.push(e));
self.set_confirm().unwrap_or_else(|e| errors.push(e)); self.set_confirm().unwrap_or_else(|e| errors.push(e));
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_cpu(false, self.index); POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_cpu(false, self.index);
if errors.is_empty() { if errors.is_empty() {
Ok(()) Ok(())
} else {
Err(errors)
}
} else { } else {
Err(errors) Ok(())
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "PowerTools", "name": "PowerTools",
"version": "1.4.0-beta2", "version": "1.4.0-beta3",
"description": "Power tweaks for power users", "description": "Power tweaks for power users",
"scripts": { "scripts": {
"build": "shx rm -rf dist && rollup -c", "build": "shx rm -rf dist && rollup -c",