Fix the handling of of the kernel change from "quiet" to "low-power"

A coming kernel change will convert "quiet" to "low-power" due to how
platform_profile can now have multiple registered handlers.
(kernel 6.14 est)

Fixes #609
This commit is contained in:
Luke Jones
2025-02-14 19:38:02 +13:00
parent 2c006699f2
commit 4dd29952c8
13 changed files with 146 additions and 71 deletions

View File

@@ -145,7 +145,7 @@ impl FanCurveProfiles {
match profile {
PlatformProfile::Balanced => self.balanced = curves,
PlatformProfile::Performance => self.performance = curves,
PlatformProfile::Quiet => self.quiet = curves,
PlatformProfile::Quiet | PlatformProfile::LowPower => self.quiet = curves,
}
Ok(())
}
@@ -181,7 +181,7 @@ impl FanCurveProfiles {
let fans = match profile {
PlatformProfile::Balanced => &mut self.balanced,
PlatformProfile::Performance => &mut self.performance,
PlatformProfile::Quiet => &mut self.quiet,
PlatformProfile::Quiet | PlatformProfile::LowPower => &mut self.quiet,
};
for fan in fans.iter().filter(|f| !f.enabled) {
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
@@ -208,7 +208,7 @@ impl FanCurveProfiles {
curve.enabled = enabled;
}
}
PlatformProfile::Quiet => {
PlatformProfile::Quiet | PlatformProfile::LowPower => {
for curve in self.quiet.iter_mut() {
curve.enabled = enabled;
}
@@ -239,7 +239,7 @@ impl FanCurveProfiles {
}
}
}
PlatformProfile::Quiet => {
PlatformProfile::Quiet | PlatformProfile::LowPower => {
for curve in self.quiet.iter_mut() {
if curve.fan == fan {
curve.enabled = enabled;
@@ -254,7 +254,7 @@ impl FanCurveProfiles {
match name {
PlatformProfile::Balanced => &self.balanced,
PlatformProfile::Performance => &self.performance,
PlatformProfile::Quiet => &self.quiet,
PlatformProfile::Quiet | PlatformProfile::LowPower => &self.quiet,
}
}
@@ -274,7 +274,7 @@ impl FanCurveProfiles {
}
}
}
PlatformProfile::Quiet => {
PlatformProfile::Quiet | PlatformProfile::LowPower => {
for this_curve in self.quiet.iter() {
if this_curve.fan == pu {
return Some(this_curve);
@@ -307,7 +307,7 @@ impl FanCurveProfiles {
}
}
}
PlatformProfile::Quiet => {
PlatformProfile::Quiet | PlatformProfile::LowPower => {
for this_curve in self.quiet.iter_mut() {
if this_curve.fan == curve.fan {
*this_curve = curve;