mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Move entirely to using only platform-profile
throttle_thermal_policy is not ideal anymore and may be removed from kernel in the future.
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v6.1.0-rc6]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Two small fixes, one for `low-power` profile name, and one for base gpu tdp
|
||||||
|
- Move to using platform_profile api only (no throttle_thermal_policy)
|
||||||
|
|
||||||
## [v6.1.0-rc5]
|
## [v6.1.0-rc5]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use gumdrop::Options;
|
use gumdrop::Options;
|
||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
|
|
||||||
use crate::anime_cli::AnimeCommand;
|
use crate::anime_cli::AnimeCommand;
|
||||||
use crate::aura_cli::{LedBrightness, LedPowerCommand1, LedPowerCommand2, SetAuraBuiltin};
|
use crate::aura_cli::{LedBrightness, LedPowerCommand1, LedPowerCommand2, SetAuraBuiltin};
|
||||||
@@ -71,7 +71,7 @@ pub struct ProfileCommand {
|
|||||||
pub profile_get: bool,
|
pub profile_get: bool,
|
||||||
|
|
||||||
#[options(meta = "", help = "set the active profile")]
|
#[options(meta = "", help = "set the active profile")]
|
||||||
pub profile_set: Option<ThrottlePolicy>
|
pub profile_set: Option<PlatformProfile>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Options)]
|
#[derive(Options)]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use gumdrop::Options;
|
use gumdrop::Options;
|
||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
use rog_profiles::fan_curve_set::CurveData;
|
use rog_profiles::fan_curve_set::CurveData;
|
||||||
use rog_profiles::FanCurvePU;
|
use rog_profiles::FanCurvePU;
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ pub struct FanCurveCommand {
|
|||||||
meta = "",
|
meta = "",
|
||||||
help = "profile to modify fan-curve for. Shows data if no options provided"
|
help = "profile to modify fan-curve for. Shows data if no options provided"
|
||||||
)]
|
)]
|
||||||
pub mod_profile: Option<ThrottlePolicy>,
|
pub mod_profile: Option<PlatformProfile>,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
meta = "",
|
meta = "",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use rog_dbus::zbus_aura::AuraProxyBlocking;
|
|||||||
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
|
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
|
||||||
use rog_dbus::zbus_platform::PlatformProxyBlocking;
|
use rog_dbus::zbus_platform::PlatformProxyBlocking;
|
||||||
use rog_dbus::zbus_slash::SlashProxyBlocking;
|
use rog_dbus::zbus_slash::SlashProxyBlocking;
|
||||||
use rog_platform::platform::{Properties, ThrottlePolicy};
|
use rog_platform::platform::{PlatformProfile, Properties};
|
||||||
use rog_profiles::error::ProfileError;
|
use rog_profiles::error::ProfileError;
|
||||||
use rog_scsi::AuraMode;
|
use rog_scsi::AuraMode;
|
||||||
use rog_slash::SlashMode;
|
use rog_slash::SlashMode;
|
||||||
@@ -918,16 +918,16 @@ fn handle_throttle_profile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let proxy = PlatformProxyBlocking::new(conn)?;
|
let proxy = PlatformProxyBlocking::new(conn)?;
|
||||||
let current = proxy.throttle_thermal_policy()?;
|
let current = proxy.platform_profile()?;
|
||||||
|
|
||||||
if cmd.next {
|
if cmd.next {
|
||||||
proxy.set_throttle_thermal_policy(current.next())?;
|
proxy.set_platform_profile(current.next())?;
|
||||||
} else if let Some(profile) = cmd.profile_set {
|
} else if let Some(profile) = cmd.profile_set {
|
||||||
proxy.set_throttle_thermal_policy(profile)?;
|
proxy.set_platform_profile(profile)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if cmd.list {
|
if cmd.list {
|
||||||
let res = ThrottlePolicy::list();
|
let res = PlatformProfile::list();
|
||||||
for p in &res {
|
for p in &res {
|
||||||
println!("{:?}", p);
|
println!("{:?}", p);
|
||||||
}
|
}
|
||||||
@@ -974,7 +974,7 @@ fn handle_fan_curve(
|
|||||||
|
|
||||||
let plat_proxy = PlatformProxyBlocking::new(conn)?;
|
let plat_proxy = PlatformProxyBlocking::new(conn)?;
|
||||||
if cmd.get_enabled {
|
if cmd.get_enabled {
|
||||||
let profile = plat_proxy.throttle_thermal_policy()?;
|
let profile = plat_proxy.platform_profile()?;
|
||||||
let curves = fan_proxy.fan_curve_data(profile)?;
|
let curves = fan_proxy.fan_curve_data(profile)?;
|
||||||
for curve in curves.iter() {
|
for curve in curves.iter() {
|
||||||
println!("{}", String::from(curve));
|
println!("{}", String::from(curve));
|
||||||
@@ -982,7 +982,7 @@ fn handle_fan_curve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cmd.default {
|
if cmd.default {
|
||||||
let active = plat_proxy.throttle_thermal_policy()?;
|
let active = plat_proxy.platform_profile()?;
|
||||||
fan_proxy.set_curves_to_defaults(active)?;
|
fan_proxy.set_curves_to_defaults(active)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
use std::str::FromStr;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ::zbus::export::futures_util::lock::Mutex;
|
use ::zbus::export::futures_util::lock::Mutex;
|
||||||
use config_traits::StdConfig;
|
use config_traits::StdConfig;
|
||||||
use log::{debug, error, info};
|
use log::{debug, error, info};
|
||||||
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
|
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
|
||||||
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
|
use rog_platform::platform::{PlatformProfile, RogPlatform};
|
||||||
use rog_platform::power::AsusPower;
|
use rog_platform::power::AsusPower;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use zbus::object_server::SignalEmitter;
|
use zbus::object_server::SignalEmitter;
|
||||||
@@ -100,8 +99,7 @@ impl AsusArmouryAttribute {
|
|||||||
impl crate::Reloadable for AsusArmouryAttribute {
|
impl crate::Reloadable for AsusArmouryAttribute {
|
||||||
async fn reload(&mut self) -> Result<(), RogError> {
|
async fn reload(&mut self) -> Result<(), RogError> {
|
||||||
info!("Reloading {}", self.attr.name());
|
info!("Reloading {}", self.attr.name());
|
||||||
let profile: ThrottlePolicy =
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
|
||||||
let power_plugged = self
|
let power_plugged = self
|
||||||
.power
|
.power
|
||||||
.get_online()
|
.get_online()
|
||||||
@@ -182,8 +180,7 @@ impl AsusArmouryAttribute {
|
|||||||
async fn restore_default(&self) -> fdo::Result<()> {
|
async fn restore_default(&self) -> fdo::Result<()> {
|
||||||
self.attr.restore_default()?;
|
self.attr.restore_default()?;
|
||||||
if self.name().is_ppt() {
|
if self.name().is_ppt() {
|
||||||
let profile: ThrottlePolicy =
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
|
||||||
let power_plugged = self
|
let power_plugged = self
|
||||||
.power
|
.power
|
||||||
.get_online()
|
.get_online()
|
||||||
@@ -257,8 +254,7 @@ impl AsusArmouryAttribute {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
if self.name().is_ppt() {
|
if self.name().is_ppt() {
|
||||||
let profile: ThrottlePolicy =
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
|
||||||
|
|
||||||
let power_plugged = self
|
let power_plugged = self
|
||||||
.power
|
.power
|
||||||
@@ -337,7 +333,7 @@ pub async fn set_config_or_default(
|
|||||||
attrs: &FirmwareAttributes,
|
attrs: &FirmwareAttributes,
|
||||||
config: &mut Config,
|
config: &mut Config,
|
||||||
power_plugged: bool,
|
power_plugged: bool,
|
||||||
profile: ThrottlePolicy
|
profile: PlatformProfile
|
||||||
) {
|
) {
|
||||||
for attr in attrs.attributes().iter() {
|
for attr in attrs.attributes().iter() {
|
||||||
let name: FirmwareAttribute = attr.name().into();
|
let name: FirmwareAttribute = attr.name().into();
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ use std::collections::HashMap;
|
|||||||
use config_traits::{StdConfig, StdConfigLoad1};
|
use config_traits::{StdConfig, StdConfigLoad1};
|
||||||
use rog_platform::asus_armoury::FirmwareAttribute;
|
use rog_platform::asus_armoury::FirmwareAttribute;
|
||||||
use rog_platform::cpu::CPUEPP;
|
use rog_platform::cpu::CPUEPP;
|
||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
const CONFIG_FILE: &str = "asusd.ron";
|
const CONFIG_FILE: &str = "asusd.ron";
|
||||||
type Tunings = HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>;
|
type Tunings = HashMap<PlatformProfile, HashMap<FirmwareAttribute, i32>>;
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, PartialEq)]
|
#[derive(Deserialize, Serialize, PartialEq)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
@@ -22,22 +22,22 @@ pub struct Config {
|
|||||||
/// An optional command/script to run when power is changed to battery
|
/// An optional command/script to run when power is changed to battery
|
||||||
pub bat_command: String,
|
pub bat_command: String,
|
||||||
/// Set true if energy_performance_preference should be set if the
|
/// Set true if energy_performance_preference should be set if the
|
||||||
/// throttle/platform profile is changed
|
/// platform profile is changed
|
||||||
pub throttle_policy_linked_epp: bool,
|
pub platform_profile_linked_epp: bool,
|
||||||
/// Which throttle/profile to use on battery power
|
/// Which platform profile to use on battery power
|
||||||
pub throttle_policy_on_battery: ThrottlePolicy,
|
pub platform_profile_on_battery: PlatformProfile,
|
||||||
/// Should the throttle policy be set on bat/ac change?
|
/// Should the throttle policy be set on bat/ac change?
|
||||||
pub change_throttle_policy_on_battery: bool,
|
pub change_platform_profile_on_battery: bool,
|
||||||
/// Which throttle/profile to use on AC power
|
/// Which platform profile to use on AC power
|
||||||
pub throttle_policy_on_ac: ThrottlePolicy,
|
pub platform_profile_on_ac: PlatformProfile,
|
||||||
/// Should the throttle policy be set on bat/ac change?
|
/// Should the platform profile be set on bat/ac change?
|
||||||
pub change_throttle_policy_on_ac: bool,
|
pub change_platform_profile_on_ac: bool,
|
||||||
/// The energy_performance_preference for this throttle/platform profile
|
/// The energy_performance_preference for this platform profile
|
||||||
pub throttle_quiet_epp: CPUEPP,
|
pub profile_quiet_epp: CPUEPP,
|
||||||
/// The energy_performance_preference for this throttle/platform profile
|
/// The energy_performance_preference for this platform profile
|
||||||
pub throttle_balanced_epp: CPUEPP,
|
pub profile_balanced_epp: CPUEPP,
|
||||||
/// The energy_performance_preference for this throttle/platform profile
|
/// The energy_performance_preference for this platform profile
|
||||||
pub throttle_performance_epp: CPUEPP,
|
pub profile_performance_epp: CPUEPP,
|
||||||
pub ac_profile_tunings: Tunings,
|
pub ac_profile_tunings: Tunings,
|
||||||
pub dc_profile_tunings: Tunings,
|
pub dc_profile_tunings: Tunings,
|
||||||
pub armoury_settings: HashMap<FirmwareAttribute, i32>,
|
pub armoury_settings: HashMap<FirmwareAttribute, i32>,
|
||||||
@@ -50,7 +50,7 @@ impl Config {
|
|||||||
pub fn select_tunings(
|
pub fn select_tunings(
|
||||||
&mut self,
|
&mut self,
|
||||||
power_plugged: bool,
|
power_plugged: bool,
|
||||||
profile: ThrottlePolicy
|
profile: PlatformProfile
|
||||||
) -> &mut HashMap<FirmwareAttribute, i32> {
|
) -> &mut HashMap<FirmwareAttribute, i32> {
|
||||||
let config = if power_plugged {
|
let config = if power_plugged {
|
||||||
&mut self.ac_profile_tunings
|
&mut self.ac_profile_tunings
|
||||||
@@ -69,14 +69,14 @@ impl Default for Config {
|
|||||||
disable_nvidia_powerd_on_battery: true,
|
disable_nvidia_powerd_on_battery: true,
|
||||||
ac_command: Default::default(),
|
ac_command: Default::default(),
|
||||||
bat_command: Default::default(),
|
bat_command: Default::default(),
|
||||||
throttle_policy_linked_epp: true,
|
platform_profile_linked_epp: true,
|
||||||
throttle_policy_on_battery: ThrottlePolicy::Quiet,
|
platform_profile_on_battery: PlatformProfile::Quiet,
|
||||||
change_throttle_policy_on_battery: true,
|
change_platform_profile_on_battery: true,
|
||||||
throttle_policy_on_ac: ThrottlePolicy::Performance,
|
platform_profile_on_ac: PlatformProfile::Performance,
|
||||||
change_throttle_policy_on_ac: true,
|
change_platform_profile_on_ac: true,
|
||||||
throttle_quiet_epp: CPUEPP::Power,
|
profile_quiet_epp: CPUEPP::Power,
|
||||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
profile_balanced_epp: CPUEPP::BalancePower,
|
||||||
throttle_performance_epp: CPUEPP::Performance,
|
profile_performance_epp: CPUEPP::Performance,
|
||||||
ac_profile_tunings: HashMap::default(),
|
ac_profile_tunings: HashMap::default(),
|
||||||
dc_profile_tunings: HashMap::default(),
|
dc_profile_tunings: HashMap::default(),
|
||||||
armoury_settings: HashMap::default(),
|
armoury_settings: HashMap::default(),
|
||||||
@@ -90,8 +90,8 @@ impl StdConfig for Config {
|
|||||||
Config {
|
Config {
|
||||||
charge_control_end_threshold: 100,
|
charge_control_end_threshold: 100,
|
||||||
disable_nvidia_powerd_on_battery: true,
|
disable_nvidia_powerd_on_battery: true,
|
||||||
throttle_policy_on_battery: ThrottlePolicy::Quiet,
|
platform_profile_on_battery: PlatformProfile::Quiet,
|
||||||
throttle_policy_on_ac: ThrottlePolicy::Performance,
|
platform_profile_on_ac: PlatformProfile::Performance,
|
||||||
ac_command: String::new(),
|
ac_command: String::new(),
|
||||||
bat_command: String::new(),
|
bat_command: String::new(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -120,14 +120,14 @@ pub struct Config601 {
|
|||||||
pub disable_nvidia_powerd_on_battery: bool,
|
pub disable_nvidia_powerd_on_battery: bool,
|
||||||
pub ac_command: String,
|
pub ac_command: String,
|
||||||
pub bat_command: String,
|
pub bat_command: String,
|
||||||
pub throttle_policy_linked_epp: bool,
|
pub platform_profile_linked_epp: bool,
|
||||||
pub throttle_policy_on_battery: ThrottlePolicy,
|
pub platform_profile_on_battery: PlatformProfile,
|
||||||
pub change_throttle_policy_on_battery: bool,
|
pub change_platform_profile_on_battery: bool,
|
||||||
pub throttle_policy_on_ac: ThrottlePolicy,
|
pub platform_profile_on_ac: PlatformProfile,
|
||||||
pub change_throttle_policy_on_ac: bool,
|
pub change_platform_profile_on_ac: bool,
|
||||||
pub throttle_quiet_epp: CPUEPP,
|
pub profile_quiet_epp: CPUEPP,
|
||||||
pub throttle_balanced_epp: CPUEPP,
|
pub profile_balanced_epp: CPUEPP,
|
||||||
pub throttle_performance_epp: CPUEPP,
|
pub profile_performance_epp: CPUEPP,
|
||||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||||
pub ppt_pl1_spl: Option<u8>,
|
pub ppt_pl1_spl: Option<u8>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||||
@@ -157,14 +157,14 @@ impl From<Config601> for Config {
|
|||||||
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
|
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
|
||||||
ac_command: c.ac_command,
|
ac_command: c.ac_command,
|
||||||
bat_command: c.bat_command,
|
bat_command: c.bat_command,
|
||||||
throttle_policy_linked_epp: c.throttle_policy_linked_epp,
|
platform_profile_linked_epp: c.platform_profile_linked_epp,
|
||||||
throttle_policy_on_battery: c.throttle_policy_on_battery,
|
platform_profile_on_battery: c.platform_profile_on_battery,
|
||||||
change_throttle_policy_on_battery: c.change_throttle_policy_on_battery,
|
change_platform_profile_on_battery: c.change_platform_profile_on_battery,
|
||||||
throttle_policy_on_ac: c.throttle_policy_on_ac,
|
platform_profile_on_ac: c.platform_profile_on_ac,
|
||||||
change_throttle_policy_on_ac: c.change_throttle_policy_on_ac,
|
change_platform_profile_on_ac: c.change_platform_profile_on_ac,
|
||||||
throttle_quiet_epp: c.throttle_quiet_epp,
|
profile_quiet_epp: c.profile_quiet_epp,
|
||||||
throttle_balanced_epp: c.throttle_balanced_epp,
|
profile_balanced_epp: c.profile_balanced_epp,
|
||||||
throttle_performance_epp: c.throttle_performance_epp,
|
profile_performance_epp: c.profile_performance_epp,
|
||||||
last_power_plugged: c.last_power_plugged,
|
last_power_plugged: c.last_power_plugged,
|
||||||
ac_profile_tunings: HashMap::default(),
|
ac_profile_tunings: HashMap::default(),
|
||||||
dc_profile_tunings: HashMap::default(),
|
dc_profile_tunings: HashMap::default(),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::sync::Arc;
|
|||||||
use config_traits::{StdConfig, StdConfigLoad};
|
use config_traits::{StdConfig, StdConfigLoad};
|
||||||
use futures_lite::StreamExt;
|
use futures_lite::StreamExt;
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
|
use rog_platform::platform::{PlatformProfile, RogPlatform};
|
||||||
use rog_profiles::error::ProfileError;
|
use rog_profiles::error::ProfileError;
|
||||||
use rog_profiles::fan_curve_set::CurveData;
|
use rog_profiles::fan_curve_set::CurveData;
|
||||||
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
|
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
|
||||||
@@ -23,7 +23,7 @@ pub const FAN_CURVE_ZBUS_PATH: &str = "/xyz/ljones";
|
|||||||
pub struct FanCurveConfig {
|
pub struct FanCurveConfig {
|
||||||
pub profiles: FanCurveProfiles,
|
pub profiles: FanCurveProfiles,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub current: u8
|
pub current: PlatformProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StdConfig for FanCurveConfig {
|
impl StdConfig for FanCurveConfig {
|
||||||
@@ -54,7 +54,7 @@ pub struct CtrlFanCurveZbus {
|
|||||||
impl CtrlFanCurveZbus {
|
impl CtrlFanCurveZbus {
|
||||||
pub fn new() -> Result<Self, RogError> {
|
pub fn new() -> Result<Self, RogError> {
|
||||||
let platform = RogPlatform::new()?;
|
let platform = RogPlatform::new()?;
|
||||||
if platform.has_throttle_thermal_policy() {
|
if platform.has_platform_profile() {
|
||||||
info!("Device has profile control available");
|
info!("Device has profile control available");
|
||||||
find_fan_curve_node()?;
|
find_fan_curve_node()?;
|
||||||
info!("Device has fan curves available");
|
info!("Device has fan curves available");
|
||||||
@@ -65,16 +65,16 @@ impl CtrlFanCurveZbus {
|
|||||||
if config.profiles.balanced.is_empty() || !config.file_path().exists() {
|
if config.profiles.balanced.is_empty() || !config.file_path().exists() {
|
||||||
info!("Fetching default fan curves");
|
info!("Fetching default fan curves");
|
||||||
|
|
||||||
let current = platform.get_throttle_thermal_policy()?;
|
let current = platform.get_platform_profile()?;
|
||||||
for this in [
|
for this in [
|
||||||
ThrottlePolicy::Balanced,
|
PlatformProfile::Balanced,
|
||||||
ThrottlePolicy::Performance,
|
PlatformProfile::Performance,
|
||||||
ThrottlePolicy::Quiet
|
PlatformProfile::Quiet
|
||||||
] {
|
] {
|
||||||
// For each profile we need to switch to it before we
|
// For each profile we need to switch to it before we
|
||||||
// can read the existing values from hardware. The ACPI method used
|
// can read the existing values from hardware. The ACPI method used
|
||||||
// for this is what limits us.
|
// for this is what limits us.
|
||||||
platform.set_throttle_thermal_policy(this.into())?;
|
platform.set_platform_profile(this.into())?;
|
||||||
let mut dev = find_fan_curve_node()?;
|
let mut dev = find_fan_curve_node()?;
|
||||||
fan_curves.set_active_curve_to_defaults(this, &mut dev)?;
|
fan_curves.set_active_curve_to_defaults(this, &mut dev)?;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ impl CtrlFanCurveZbus {
|
|||||||
info!("{}", String::from(curve));
|
info!("{}", String::from(curve));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
platform.set_throttle_thermal_policy(current)?;
|
platform.set_platform_profile(current.as_str())?;
|
||||||
config.profiles = fan_curves;
|
config.profiles = fan_curves;
|
||||||
config.write();
|
config.write();
|
||||||
} else {
|
} else {
|
||||||
@@ -107,7 +107,7 @@ impl CtrlFanCurveZbus {
|
|||||||
/// fan curve if in the same profile mode
|
/// fan curve if in the same profile mode
|
||||||
async fn set_fan_curves_enabled(
|
async fn set_fan_curves_enabled(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
enabled: bool
|
enabled: bool
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> zbus::fdo::Result<()> {
|
||||||
self.config
|
self.config
|
||||||
@@ -128,7 +128,7 @@ impl CtrlFanCurveZbus {
|
|||||||
/// activate a fan curve if in the same profile mode
|
/// activate a fan curve if in the same profile mode
|
||||||
async fn set_profile_fan_curve_enabled(
|
async fn set_profile_fan_curve_enabled(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
fan: FanCurvePU,
|
fan: FanCurvePU,
|
||||||
enabled: bool
|
enabled: bool
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> zbus::fdo::Result<()> {
|
||||||
@@ -149,7 +149,7 @@ impl CtrlFanCurveZbus {
|
|||||||
/// Get the fan-curve data for the currently active ThrottlePolicy
|
/// Get the fan-curve data for the currently active ThrottlePolicy
|
||||||
async fn fan_curve_data(
|
async fn fan_curve_data(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy
|
profile: PlatformProfile
|
||||||
) -> zbus::fdo::Result<Vec<CurveData>> {
|
) -> zbus::fdo::Result<Vec<CurveData>> {
|
||||||
let curve = self
|
let curve = self
|
||||||
.config
|
.config
|
||||||
@@ -165,7 +165,7 @@ impl CtrlFanCurveZbus {
|
|||||||
/// Will also activate the fan curve if the user is in the same mode.
|
/// Will also activate the fan curve if the user is in the same mode.
|
||||||
async fn set_fan_curve(
|
async fn set_fan_curve(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
curve: CurveData
|
curve: CurveData
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> zbus::fdo::Result<()> {
|
||||||
self.config
|
self.config
|
||||||
@@ -173,7 +173,7 @@ impl CtrlFanCurveZbus {
|
|||||||
.await
|
.await
|
||||||
.profiles
|
.profiles
|
||||||
.save_fan_curve(curve, profile)?;
|
.save_fan_curve(curve, profile)?;
|
||||||
let active: ThrottlePolicy = self.platform.get_throttle_thermal_policy()?.into();
|
let active: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
if active == profile {
|
if active == profile {
|
||||||
self.config
|
self.config
|
||||||
.lock()
|
.lock()
|
||||||
@@ -190,15 +190,15 @@ impl CtrlFanCurveZbus {
|
|||||||
///
|
///
|
||||||
/// Each platform_profile has a different default and the default can be
|
/// Each platform_profile has a different default and the default can be
|
||||||
/// read only for the currently active profile.
|
/// read only for the currently active profile.
|
||||||
async fn set_curves_to_defaults(&mut self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
|
async fn set_curves_to_defaults(&mut self, profile: PlatformProfile) -> zbus::fdo::Result<()> {
|
||||||
let active = self.platform.get_throttle_thermal_policy()?;
|
let active = self.platform.get_platform_profile()?;
|
||||||
self.platform.set_throttle_thermal_policy(profile.into())?;
|
self.platform.set_platform_profile(profile.into())?;
|
||||||
self.config
|
self.config
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.profiles
|
.profiles
|
||||||
.set_active_curve_to_defaults(profile, &mut find_fan_curve_node()?)?;
|
.set_active_curve_to_defaults(profile, &mut find_fan_curve_node()?)?;
|
||||||
self.platform.set_throttle_thermal_policy(active)?;
|
self.platform.set_platform_profile(active.as_str())?;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -208,16 +208,16 @@ impl CtrlFanCurveZbus {
|
|||||||
///
|
///
|
||||||
/// Each platform_profile has a different default and the defualt can be
|
/// Each platform_profile has a different default and the defualt can be
|
||||||
/// read only for the currently active profile.
|
/// read only for the currently active profile.
|
||||||
async fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
|
async fn reset_profile_curves(&self, profile: PlatformProfile) -> zbus::fdo::Result<()> {
|
||||||
let active = self.platform.get_throttle_thermal_policy()?;
|
let active = self.platform.get_platform_profile()?;
|
||||||
|
|
||||||
self.platform.set_throttle_thermal_policy(profile.into())?;
|
self.platform.set_platform_profile(profile.into())?;
|
||||||
self.config
|
self.config
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.profiles
|
.profiles
|
||||||
.set_active_curve_to_defaults(active.into(), &mut find_fan_curve_node()?)?;
|
.set_active_curve_to_defaults((&active).into(), &mut find_fan_curve_node()?)?;
|
||||||
self.platform.set_throttle_thermal_policy(active)?;
|
self.platform.set_platform_profile(active.as_str())?;
|
||||||
|
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -236,26 +236,31 @@ impl CtrlTask for CtrlFanCurveZbus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn create_tasks(&self, _signal_ctxt: SignalEmitter<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, _signal_ctxt: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||||
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
|
let watch_platform_profile = self.platform.monitor_platform_profile()?;
|
||||||
let platform = self.platform.clone();
|
let platform = self.platform.clone();
|
||||||
let config = self.config.clone();
|
let config = self.config.clone();
|
||||||
let fan_curves = self.config.clone();
|
let fan_curves = self.config.clone();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut buffer = [0; 32];
|
let mut buffer = [0; 32];
|
||||||
if let Ok(mut stream) = watch_throttle_thermal_policy.into_event_stream(&mut buffer) {
|
if let Ok(mut stream) = watch_platform_profile.into_event_stream(&mut buffer) {
|
||||||
while (stream.next().await).is_some() {
|
while (stream.next().await).is_some() {
|
||||||
debug!("watch_throttle_thermal_policy changed");
|
debug!("watch_platform_profile changed");
|
||||||
if let Ok(profile) = platform.get_throttle_thermal_policy().map_err(|e| {
|
if let Ok(profile) =
|
||||||
error!("get_throttle_thermal_policy error: {e}");
|
platform
|
||||||
}) {
|
.get_platform_profile()
|
||||||
|
.map(|p| p.into())
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("get_platform_profile error: {e}");
|
||||||
|
})
|
||||||
|
{
|
||||||
if profile != config.lock().await.current {
|
if profile != config.lock().await.current {
|
||||||
fan_curves
|
fan_curves
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.profiles
|
.profiles
|
||||||
.write_profile_curve_to_platform(
|
.write_profile_curve_to_platform(
|
||||||
profile.into(),
|
profile,
|
||||||
&mut find_fan_curve_node().unwrap()
|
&mut find_fan_curve_node().unwrap()
|
||||||
)
|
)
|
||||||
.map_err(|e| warn!("write_profile_curve_to_platform, {}", e))
|
.map_err(|e| warn!("write_profile_curve_to_platform, {}", e))
|
||||||
@@ -274,7 +279,7 @@ impl CtrlTask for CtrlFanCurveZbus {
|
|||||||
impl crate::Reloadable for CtrlFanCurveZbus {
|
impl crate::Reloadable for CtrlFanCurveZbus {
|
||||||
/// Fetch the active profile and use that to set all related components up
|
/// Fetch the active profile and use that to set all related components up
|
||||||
async fn reload(&mut self) -> Result<(), RogError> {
|
async fn reload(&mut self) -> Result<(), RogError> {
|
||||||
let active = self.platform.get_throttle_thermal_policy()?.into();
|
let active = self.platform.get_platform_profile()?.into();
|
||||||
let mut config = self.config.lock().await;
|
let mut config = self.config.lock().await;
|
||||||
if let Ok(mut device) = find_fan_curve_node() {
|
if let Ok(mut device) = find_fan_curve_node() {
|
||||||
config
|
config
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::str::FromStr;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use config_traits::StdConfig;
|
use config_traits::StdConfig;
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use rog_platform::asus_armoury::FirmwareAttributes;
|
use rog_platform::asus_armoury::FirmwareAttributes;
|
||||||
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
|
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
|
||||||
use rog_platform::platform::{Properties, RogPlatform, ThrottlePolicy};
|
use rog_platform::platform::{PlatformProfile, Properties, RogPlatform};
|
||||||
use rog_platform::power::AsusPower;
|
use rog_platform::power::AsusPower;
|
||||||
use zbus::export::futures_util::lock::Mutex;
|
use zbus::export::futures_util::lock::Mutex;
|
||||||
use zbus::fdo::Error as FdoErr;
|
use zbus::fdo::Error as FdoErr;
|
||||||
@@ -204,40 +203,38 @@ impl CtrlPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_config_epp_for_throttle(&self, throttle: ThrottlePolicy) -> CPUEPP {
|
async fn get_config_epp_for_throttle(&self, throttle: PlatformProfile) -> CPUEPP {
|
||||||
match throttle {
|
match throttle {
|
||||||
ThrottlePolicy::Balanced => self.config.lock().await.throttle_balanced_epp,
|
PlatformProfile::Balanced => self.config.lock().await.profile_balanced_epp,
|
||||||
ThrottlePolicy::Performance => self.config.lock().await.throttle_performance_epp,
|
PlatformProfile::Performance => self.config.lock().await.profile_performance_epp,
|
||||||
ThrottlePolicy::Quiet => self.config.lock().await.throttle_quiet_epp
|
PlatformProfile::Quiet => self.config.lock().await.profile_quiet_epp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
|
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
|
||||||
if power_plugged && !self.config.lock().await.change_throttle_policy_on_ac {
|
if power_plugged && !self.config.lock().await.change_platform_profile_on_ac {
|
||||||
debug!(
|
debug!(
|
||||||
"Power status changed but set_throttle_policy_on_ac set false. Not setting the \
|
"Power status changed but set_platform_profile_on_ac set false. Not setting the \
|
||||||
thing"
|
thing"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !power_plugged && !self.config.lock().await.change_throttle_policy_on_battery {
|
if !power_plugged && !self.config.lock().await.change_platform_profile_on_battery {
|
||||||
debug!(
|
debug!(
|
||||||
"Power status changed but set_throttle_policy_on_battery set false. Not setting \
|
"Power status changed but set_platform_profile_on_battery set false. Not setting \
|
||||||
the thing"
|
the thing"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let throttle = if power_plugged {
|
let throttle = if power_plugged {
|
||||||
self.config.lock().await.throttle_policy_on_ac
|
self.config.lock().await.platform_profile_on_ac
|
||||||
} else {
|
} else {
|
||||||
self.config.lock().await.throttle_policy_on_battery
|
self.config.lock().await.platform_profile_on_battery
|
||||||
};
|
};
|
||||||
debug!("Setting {throttle:?} before EPP");
|
debug!("Setting {throttle:?} before EPP");
|
||||||
let epp = self.get_config_epp_for_throttle(throttle).await;
|
let epp = self.get_config_epp_for_throttle(throttle).await;
|
||||||
self.platform
|
self.platform.set_platform_profile(throttle.into()).ok();
|
||||||
.set_throttle_thermal_policy(throttle.into())
|
|
||||||
.ok();
|
|
||||||
self.check_and_set_epp(epp, change_epp);
|
self.check_and_set_epp(epp, change_epp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,7 +276,7 @@ impl CtrlPlatform {
|
|||||||
Properties::ChargeControlEndThreshold
|
Properties::ChargeControlEndThreshold
|
||||||
);
|
);
|
||||||
|
|
||||||
platform_name!(throttle_thermal_policy, Properties::ThrottlePolicy);
|
platform_name!(platform_profile, Properties::ThrottlePolicy);
|
||||||
|
|
||||||
supported
|
supported
|
||||||
}
|
}
|
||||||
@@ -317,121 +314,119 @@ impl CtrlPlatform {
|
|||||||
|
|
||||||
/// Toggle to next platform_profile. Names provided by `Profiles`.
|
/// Toggle to next platform_profile. Names provided by `Profiles`.
|
||||||
/// If fan-curves are supported will also activate a fan curve for profile.
|
/// If fan-curves are supported will also activate a fan curve for profile.
|
||||||
async fn next_throttle_thermal_policy(
|
async fn next_platform_profile(
|
||||||
&mut self,
|
&mut self,
|
||||||
#[zbus(signal_context)] ctxt: SignalEmitter<'_>
|
#[zbus(signal_context)] ctxt: SignalEmitter<'_>
|
||||||
) -> Result<(), FdoErr> {
|
) -> Result<(), FdoErr> {
|
||||||
let policy: ThrottlePolicy =
|
let policy: PlatformProfile =
|
||||||
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
|
platform_get_value!(self, platform_profile, "platform_profile").map(|n| n.into())?;
|
||||||
.map(|n| n.into())?;
|
let policy = PlatformProfile::next(policy);
|
||||||
let policy = ThrottlePolicy::next(policy);
|
|
||||||
|
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_platform_profile() {
|
||||||
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
|
let change_epp = self.config.lock().await.platform_profile_linked_epp;
|
||||||
let epp = self.get_config_epp_for_throttle(policy).await;
|
let epp = self.get_config_epp_for_throttle(policy).await;
|
||||||
self.check_and_set_epp(epp, change_epp);
|
self.check_and_set_epp(epp, change_epp);
|
||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(policy.into())
|
.set_platform_profile(policy.into())
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("throttle_thermal_policy {}", err);
|
warn!("platform_profile {}", err);
|
||||||
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
|
FdoErr::Failed(format!("RogPlatform: platform_profile: {err}"))
|
||||||
})?;
|
})?;
|
||||||
Ok(self.throttle_thermal_policy_changed(&ctxt).await?)
|
Ok(self.platform_profile_changed(&ctxt).await?)
|
||||||
} else {
|
} else {
|
||||||
Err(FdoErr::NotSupported(
|
Err(FdoErr::NotSupported(
|
||||||
"RogPlatform: throttle_thermal_policy not supported".to_owned()
|
"RogPlatform: platform_profile not supported".to_owned()
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_thermal_policy(&self) -> Result<ThrottlePolicy, FdoErr> {
|
fn platform_profile(&self) -> Result<PlatformProfile, FdoErr> {
|
||||||
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
|
platform_get_value!(self, platform_profile, "platform_profile").map(|n| n.into())
|
||||||
.map(|n| n.into())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_thermal_policy(&mut self, policy: ThrottlePolicy) -> Result<(), FdoErr> {
|
async fn set_platform_profile(&mut self, policy: PlatformProfile) -> Result<(), FdoErr> {
|
||||||
// TODO: watch for external changes
|
// TODO: watch for external changes
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_platform_profile() {
|
||||||
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
|
let change_epp = self.config.lock().await.platform_profile_linked_epp;
|
||||||
let epp = self.get_config_epp_for_throttle(policy).await;
|
let epp = self.get_config_epp_for_throttle(policy).await;
|
||||||
self.check_and_set_epp(epp, change_epp);
|
self.check_and_set_epp(epp, change_epp);
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(policy.into())
|
.set_platform_profile(policy.into())
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("throttle_thermal_policy {}", err);
|
warn!("platform_profile {}", err);
|
||||||
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
|
FdoErr::Failed(format!("RogPlatform: platform_profile: {err}"))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Err(FdoErr::NotSupported(
|
Err(FdoErr::NotSupported(
|
||||||
"RogPlatform: throttle_thermal_policy not supported".to_owned()
|
"RogPlatform: platform_profile not supported".to_owned()
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_policy_linked_epp(&self) -> Result<bool, FdoErr> {
|
async fn platform_profile_linked_epp(&self) -> Result<bool, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_policy_linked_epp)
|
Ok(self.config.lock().await.platform_profile_linked_epp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_policy_linked_epp(&self, linked: bool) -> Result<(), zbus::Error> {
|
async fn set_platform_profile_linked_epp(&self, linked: bool) -> Result<(), zbus::Error> {
|
||||||
self.config.lock().await.throttle_policy_linked_epp = linked;
|
self.config.lock().await.platform_profile_linked_epp = linked;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_policy_on_battery(&self) -> Result<ThrottlePolicy, FdoErr> {
|
async fn platform_profile_on_battery(&self) -> Result<PlatformProfile, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_policy_on_battery)
|
Ok(self.config.lock().await.platform_profile_on_battery)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_policy_on_battery(
|
async fn set_platform_profile_on_battery(
|
||||||
&mut self,
|
&mut self,
|
||||||
policy: ThrottlePolicy
|
policy: PlatformProfile
|
||||||
) -> Result<(), FdoErr> {
|
) -> Result<(), FdoErr> {
|
||||||
self.config.lock().await.throttle_policy_on_battery = policy;
|
self.config.lock().await.platform_profile_on_battery = policy;
|
||||||
self.set_throttle_thermal_policy(policy).await?;
|
self.set_platform_profile(policy).await?;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn change_throttle_policy_on_battery(&self) -> Result<bool, FdoErr> {
|
async fn change_platform_profile_on_battery(&self) -> Result<bool, FdoErr> {
|
||||||
Ok(self.config.lock().await.change_throttle_policy_on_battery)
|
Ok(self.config.lock().await.change_platform_profile_on_battery)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_change_throttle_policy_on_battery(&mut self, change: bool) -> Result<(), FdoErr> {
|
async fn set_change_platform_profile_on_battery(&mut self, change: bool) -> Result<(), FdoErr> {
|
||||||
self.config.lock().await.change_throttle_policy_on_battery = change;
|
self.config.lock().await.change_platform_profile_on_battery = change;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_policy_on_ac(&self) -> Result<ThrottlePolicy, FdoErr> {
|
async fn platform_profile_on_ac(&self) -> Result<PlatformProfile, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_policy_on_ac)
|
Ok(self.config.lock().await.platform_profile_on_ac)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_policy_on_ac(&mut self, policy: ThrottlePolicy) -> Result<(), FdoErr> {
|
async fn set_platform_profile_on_ac(&mut self, policy: PlatformProfile) -> Result<(), FdoErr> {
|
||||||
self.config.lock().await.throttle_policy_on_ac = policy;
|
self.config.lock().await.platform_profile_on_ac = policy;
|
||||||
self.set_throttle_thermal_policy(policy).await?;
|
self.set_platform_profile(policy).await?;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn change_throttle_policy_on_ac(&self) -> Result<bool, FdoErr> {
|
async fn change_platform_profile_on_ac(&self) -> Result<bool, FdoErr> {
|
||||||
Ok(self.config.lock().await.change_throttle_policy_on_ac)
|
Ok(self.config.lock().await.change_platform_profile_on_ac)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_change_throttle_policy_on_ac(&mut self, change: bool) -> Result<(), FdoErr> {
|
async fn set_change_platform_profile_on_ac(&mut self, change: bool) -> Result<(), FdoErr> {
|
||||||
self.config.lock().await.change_throttle_policy_on_ac = change;
|
self.config.lock().await.change_platform_profile_on_ac = change;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -439,14 +434,14 @@ impl CtrlPlatform {
|
|||||||
/// The energy_performance_preference for the quiet throttle/platform
|
/// The energy_performance_preference for the quiet throttle/platform
|
||||||
/// profile
|
/// profile
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_quiet_epp(&self) -> Result<CPUEPP, FdoErr> {
|
async fn profile_quiet_epp(&self) -> Result<CPUEPP, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_quiet_epp)
|
Ok(self.config.lock().await.profile_quiet_epp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_quiet_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
|
async fn set_profile_quiet_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
|
||||||
let change_pp = self.config.lock().await.throttle_policy_linked_epp;
|
let change_pp = self.config.lock().await.platform_profile_linked_epp;
|
||||||
self.config.lock().await.throttle_quiet_epp = epp;
|
self.config.lock().await.profile_quiet_epp = epp;
|
||||||
self.check_and_set_epp(epp, change_pp);
|
self.check_and_set_epp(epp, change_pp);
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -455,14 +450,14 @@ impl CtrlPlatform {
|
|||||||
/// The energy_performance_preference for the balanced throttle/platform
|
/// The energy_performance_preference for the balanced throttle/platform
|
||||||
/// profile
|
/// profile
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_balanced_epp(&self) -> Result<CPUEPP, FdoErr> {
|
async fn profile_balanced_epp(&self) -> Result<CPUEPP, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_balanced_epp)
|
Ok(self.config.lock().await.profile_balanced_epp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_balanced_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
|
async fn set_profile_balanced_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
|
||||||
let change_pp = self.config.lock().await.throttle_policy_linked_epp;
|
let change_pp = self.config.lock().await.platform_profile_linked_epp;
|
||||||
self.config.lock().await.throttle_balanced_epp = epp;
|
self.config.lock().await.profile_balanced_epp = epp;
|
||||||
self.check_and_set_epp(epp, change_pp);
|
self.check_and_set_epp(epp, change_pp);
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -471,14 +466,14 @@ impl CtrlPlatform {
|
|||||||
/// The energy_performance_preference for the performance throttle/platform
|
/// The energy_performance_preference for the performance throttle/platform
|
||||||
/// profile
|
/// profile
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn throttle_performance_epp(&self) -> Result<CPUEPP, FdoErr> {
|
async fn profile_performance_epp(&self) -> Result<CPUEPP, FdoErr> {
|
||||||
Ok(self.config.lock().await.throttle_performance_epp)
|
Ok(self.config.lock().await.profile_performance_epp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_throttle_performance_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
|
async fn set_profile_performance_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
|
||||||
let change_pp = self.config.lock().await.throttle_policy_linked_epp;
|
let change_pp = self.config.lock().await.platform_profile_linked_epp;
|
||||||
self.config.lock().await.throttle_performance_epp = epp;
|
self.config.lock().await.profile_performance_epp = epp;
|
||||||
self.check_and_set_epp(epp, change_pp);
|
self.check_and_set_epp(epp, change_pp);
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -519,21 +514,20 @@ impl ReloadAndNotify for CtrlPlatform {
|
|||||||
.or(Some(limit));
|
.or(Some(limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.platform.has_throttle_thermal_policy()
|
if self.platform.has_platform_profile()
|
||||||
&& config.throttle_policy_linked_epp != data.throttle_policy_linked_epp
|
&& config.platform_profile_linked_epp != data.platform_profile_linked_epp
|
||||||
{
|
{
|
||||||
let profile: ThrottlePolicy =
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
|
||||||
|
|
||||||
let epp = match profile {
|
let epp = match profile {
|
||||||
ThrottlePolicy::Balanced => data.throttle_balanced_epp,
|
PlatformProfile::Balanced => data.profile_balanced_epp,
|
||||||
ThrottlePolicy::Performance => data.throttle_performance_epp,
|
PlatformProfile::Performance => data.profile_performance_epp,
|
||||||
ThrottlePolicy::Quiet => data.throttle_quiet_epp
|
PlatformProfile::Quiet => data.profile_quiet_epp
|
||||||
};
|
};
|
||||||
warn!("setting epp to {epp:?}");
|
warn!("setting epp to {epp:?}");
|
||||||
self.check_and_set_epp(epp, true);
|
self.check_and_set_epp(epp, true);
|
||||||
}
|
}
|
||||||
// reload_and_notify!(throttle_thermal_policy, "throttle_thermal_policy");
|
// reload_and_notify!(platform_profile, "platform_profile");
|
||||||
|
|
||||||
*config = data;
|
*config = data;
|
||||||
config.base_charge_control_end_threshold =
|
config.base_charge_control_end_threshold =
|
||||||
@@ -557,8 +551,8 @@ impl crate::Reloadable for CtrlPlatform {
|
|||||||
|
|
||||||
if let Ok(power_plugged) = self.power.get_online() {
|
if let Ok(power_plugged) = self.power.get_online() {
|
||||||
self.config.lock().await.last_power_plugged = power_plugged;
|
self.config.lock().await.last_power_plugged = power_plugged;
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_platform_profile() {
|
||||||
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
|
let change_epp = self.config.lock().await.platform_profile_linked_epp;
|
||||||
self.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
self.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
@@ -605,9 +599,9 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
}
|
}
|
||||||
if let Ok(power_plugged) = platform1.power.get_online() {
|
if let Ok(power_plugged) = platform1.power.get_online() {
|
||||||
if platform1.config.lock().await.last_power_plugged != power_plugged {
|
if platform1.config.lock().await.last_power_plugged != power_plugged {
|
||||||
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
|
if !sleeping && platform1.platform.has_platform_profile() {
|
||||||
let change_epp =
|
let change_epp =
|
||||||
platform1.config.lock().await.throttle_policy_linked_epp;
|
platform1.config.lock().await.platform_profile_linked_epp;
|
||||||
platform1
|
platform1
|
||||||
.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||||
.await;
|
.await;
|
||||||
@@ -651,8 +645,8 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
let platform3 = platform3.clone();
|
let platform3 = platform3.clone();
|
||||||
// power change
|
// power change
|
||||||
async move {
|
async move {
|
||||||
if platform3.platform.has_throttle_thermal_policy() {
|
if platform3.platform.has_platform_profile() {
|
||||||
let change_epp = platform3.config.lock().await.throttle_policy_linked_epp;
|
let change_epp = platform3.config.lock().await.platform_profile_linked_epp;
|
||||||
platform3
|
platform3
|
||||||
.update_policy_ac_or_bat(power_plugged, change_epp)
|
.update_policy_ac_or_bat(power_plugged, change_epp)
|
||||||
.await;
|
.await;
|
||||||
@@ -665,10 +659,10 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
|
|
||||||
if let Ok(profile) = platform3
|
if let Ok(profile) = platform3
|
||||||
.platform
|
.platform
|
||||||
.get_throttle_thermal_policy()
|
.get_platform_profile()
|
||||||
.map(ThrottlePolicy::from)
|
.map(|p| p.into())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("Platform: get_throttle_thermal_policy error: {e}");
|
error!("Platform: get_platform_profile error: {e}");
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
let attrs = FirmwareAttributes::new();
|
let attrs = FirmwareAttributes::new();
|
||||||
@@ -690,7 +684,7 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
self.watch_charge_control_end_threshold(signal_ctxt.clone())
|
self.watch_charge_control_end_threshold(signal_ctxt.clone())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
|
let watch_platform_profile = self.platform.monitor_platform_profile()?;
|
||||||
let ctrl = self.clone();
|
let ctrl = self.clone();
|
||||||
|
|
||||||
// Need a copy here, not ideal. But first use in asus_armoury.rs is
|
// Need a copy here, not ideal. But first use in asus_armoury.rs is
|
||||||
@@ -699,24 +693,22 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
use futures_lite::StreamExt;
|
use futures_lite::StreamExt;
|
||||||
let mut buffer = [0; 32];
|
let mut buffer = [0; 32];
|
||||||
if let Ok(mut stream) = watch_throttle_thermal_policy.into_event_stream(&mut buffer) {
|
if let Ok(mut stream) = watch_platform_profile.into_event_stream(&mut buffer) {
|
||||||
while (stream.next().await).is_some() {
|
while (stream.next().await).is_some() {
|
||||||
// this blocks
|
// this blocks
|
||||||
debug!("Platform: watch_throttle_thermal_policy changed");
|
debug!("Platform: watch_platform_profile changed");
|
||||||
if let Ok(profile) = ctrl
|
if let Ok(profile) = ctrl
|
||||||
.platform
|
.platform
|
||||||
.get_throttle_thermal_policy()
|
.get_platform_profile()
|
||||||
.map(ThrottlePolicy::from)
|
.map(|p| p.into())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("Platform: get_throttle_thermal_policy error: {e}");
|
error!("Platform: get_platform_profile error: {e}");
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
let change_epp = ctrl.config.lock().await.throttle_policy_linked_epp;
|
let change_epp = ctrl.config.lock().await.platform_profile_linked_epp;
|
||||||
let epp = ctrl.get_config_epp_for_throttle(profile).await;
|
let epp = ctrl.get_config_epp_for_throttle(profile).await;
|
||||||
ctrl.check_and_set_epp(epp, change_epp);
|
ctrl.check_and_set_epp(epp, change_epp);
|
||||||
ctrl.throttle_thermal_policy_changed(&signal_ctxt)
|
ctrl.platform_profile_changed(&signal_ctxt).await.ok();
|
||||||
.await
|
|
||||||
.ok();
|
|
||||||
let power_plugged = ctrl
|
let power_plugged = ctrl
|
||||||
.power
|
.power
|
||||||
.get_online()
|
.get_online()
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
use rog_profiles::FanCurvePU;
|
use rog_profiles::FanCurvePU;
|
||||||
|
|
||||||
use crate::{FanType, Profile};
|
use crate::{FanType, Profile};
|
||||||
|
|
||||||
impl From<Profile> for ThrottlePolicy {
|
impl From<Profile> for PlatformProfile {
|
||||||
fn from(value: Profile) -> Self {
|
fn from(value: Profile) -> Self {
|
||||||
match value {
|
match value {
|
||||||
Profile::Balanced => ThrottlePolicy::Balanced,
|
Profile::Balanced => PlatformProfile::Balanced,
|
||||||
Profile::Performance => ThrottlePolicy::Performance,
|
Profile::Performance => PlatformProfile::Performance,
|
||||||
Profile::Quiet => ThrottlePolicy::Quiet
|
Profile::Quiet => PlatformProfile::Quiet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ThrottlePolicy> for Profile {
|
impl From<PlatformProfile> for Profile {
|
||||||
fn from(value: ThrottlePolicy) -> Self {
|
fn from(value: PlatformProfile) -> Self {
|
||||||
match value {
|
match value {
|
||||||
ThrottlePolicy::Balanced => Profile::Balanced,
|
PlatformProfile::Balanced => Profile::Balanced,
|
||||||
ThrottlePolicy::Performance => Profile::Performance,
|
PlatformProfile::Performance => Profile::Performance,
|
||||||
ThrottlePolicy::Quiet => Profile::Quiet
|
PlatformProfile::Quiet => Profile::Quiet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex};
|
|||||||
|
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use rog_dbus::zbus_fan_curves::FanCurvesProxy;
|
use rog_dbus::zbus_fan_curves::FanCurvesProxy;
|
||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
use rog_profiles::fan_curve_set::CurveData;
|
use rog_profiles::fan_curve_set::CurveData;
|
||||||
use slint::{ComponentHandle, Model, Weak};
|
use slint::{ComponentHandle, Model, Weak};
|
||||||
|
|
||||||
@@ -109,21 +109,21 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
|||||||
let handle_copy = handle.clone();
|
let handle_copy = handle.clone();
|
||||||
// Do initial setup
|
// Do initial setup
|
||||||
let Ok(balanced) = fans
|
let Ok(balanced) = fans
|
||||||
.fan_curve_data(ThrottlePolicy::Balanced)
|
.fan_curve_data(PlatformProfile::Balanced)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| error!("{e:}"))
|
.map_err(|e| error!("{e:}"))
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let Ok(perf) = fans
|
let Ok(perf) = fans
|
||||||
.fan_curve_data(ThrottlePolicy::Performance)
|
.fan_curve_data(PlatformProfile::Performance)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| error!("{e:}"))
|
.map_err(|e| error!("{e:}"))
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let Ok(quiet) = fans
|
let Ok(quiet) = fans
|
||||||
.fan_curve_data(ThrottlePolicy::Quiet)
|
.fan_curve_data(PlatformProfile::Quiet)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| error!("{e:}"))
|
.map_err(|e| error!("{e:}"))
|
||||||
else {
|
else {
|
||||||
@@ -144,21 +144,21 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let Ok(balanced) = fans
|
let Ok(balanced) = fans
|
||||||
.fan_curve_data(ThrottlePolicy::Balanced)
|
.fan_curve_data(PlatformProfile::Balanced)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| error!("{e:}"))
|
.map_err(|e| error!("{e:}"))
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let Ok(perf) = fans
|
let Ok(perf) = fans
|
||||||
.fan_curve_data(ThrottlePolicy::Performance)
|
.fan_curve_data(PlatformProfile::Performance)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| error!("{e:}"))
|
.map_err(|e| error!("{e:}"))
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let Ok(quiet) = fans
|
let Ok(quiet) = fans
|
||||||
.fan_curve_data(ThrottlePolicy::Quiet)
|
.fan_curve_data(PlatformProfile::Quiet)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| error!("{e:}"))
|
.map_err(|e| error!("{e:}"))
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
|||||||
// Null everything before the setup step
|
// Null everything before the setup step
|
||||||
ui.global::<SystemPageData>()
|
ui.global::<SystemPageData>()
|
||||||
.set_charge_control_end_threshold(-1.0);
|
.set_charge_control_end_threshold(-1.0);
|
||||||
ui.global::<SystemPageData>()
|
ui.global::<SystemPageData>().set_platform_profile(-1);
|
||||||
.set_throttle_thermal_policy(-1);
|
|
||||||
ui.global::<SystemPageData>().set_panel_overdrive(-1);
|
ui.global::<SystemPageData>().set_panel_overdrive(-1);
|
||||||
ui.global::<SystemPageData>().set_boot_sound(-1);
|
ui.global::<SystemPageData>().set_boot_sound(-1);
|
||||||
ui.global::<SystemPageData>().set_mini_led_mode(-1);
|
ui.global::<SystemPageData>().set_mini_led_mode(-1);
|
||||||
@@ -204,11 +203,11 @@ macro_rules! setup_minmax_external {
|
|||||||
let proxy_copy = $attr.clone();
|
let proxy_copy = $attr.clone();
|
||||||
let platform_proxy_copy = $platform.clone();
|
let platform_proxy_copy = $platform.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut x = platform_proxy_copy.receive_throttle_thermal_policy_changed().await;
|
let mut x = platform_proxy_copy.receive_platform_profile_changed().await;
|
||||||
use zbus::export::futures_util::StreamExt;
|
use zbus::export::futures_util::StreamExt;
|
||||||
while let Some(e) = x.next().await {
|
while let Some(e) = x.next().await {
|
||||||
if let Ok(_) = e.get().await {
|
if let Ok(_) = e.get().await {
|
||||||
debug!("receive_throttle_thermal_policy_changed, getting new {}", stringify!(attr));
|
debug!("receive_platform_profile_changed, getting new {}", stringify!(attr));
|
||||||
let min = proxy_copy.min_value().await.unwrap();
|
let min = proxy_copy.min_value().await.unwrap();
|
||||||
let max = proxy_copy.max_value().await.unwrap();
|
let max = proxy_copy.max_value().await.unwrap();
|
||||||
let val = proxy_copy.current_value().await.unwrap() as f32;
|
let val = proxy_copy.current_value().await.unwrap() as f32;
|
||||||
@@ -259,24 +258,34 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
charge_control_end_threshold
|
charge_control_end_threshold
|
||||||
);
|
);
|
||||||
|
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_thermal_policy);
|
set_ui_props_async!(handle, platform, SystemPageData, platform_profile);
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_linked_epp);
|
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_balanced_epp);
|
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_performance_epp);
|
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_quiet_epp);
|
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_battery);
|
|
||||||
set_ui_props_async!(
|
set_ui_props_async!(
|
||||||
handle,
|
handle,
|
||||||
platform,
|
platform,
|
||||||
SystemPageData,
|
SystemPageData,
|
||||||
change_throttle_policy_on_battery
|
platform_profile_linked_epp
|
||||||
);
|
);
|
||||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_ac);
|
set_ui_props_async!(handle, platform, SystemPageData, profile_balanced_epp);
|
||||||
|
set_ui_props_async!(handle, platform, SystemPageData, profile_performance_epp);
|
||||||
|
set_ui_props_async!(handle, platform, SystemPageData, profile_quiet_epp);
|
||||||
set_ui_props_async!(
|
set_ui_props_async!(
|
||||||
handle,
|
handle,
|
||||||
platform,
|
platform,
|
||||||
SystemPageData,
|
SystemPageData,
|
||||||
change_throttle_policy_on_ac
|
platform_profile_on_battery
|
||||||
|
);
|
||||||
|
set_ui_props_async!(
|
||||||
|
handle,
|
||||||
|
platform,
|
||||||
|
SystemPageData,
|
||||||
|
change_platform_profile_on_battery
|
||||||
|
);
|
||||||
|
set_ui_props_async!(handle, platform, SystemPageData, platform_profile_on_ac);
|
||||||
|
set_ui_props_async!(
|
||||||
|
handle,
|
||||||
|
platform,
|
||||||
|
SystemPageData,
|
||||||
|
change_platform_profile_on_ac
|
||||||
);
|
);
|
||||||
|
|
||||||
let platform_copy = platform.clone();
|
let platform_copy = platform.clone();
|
||||||
@@ -290,56 +299,56 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform_copy.throttle_thermal_policy(.into()),
|
platform_copy.platform_profile(.into()),
|
||||||
"Throttle policy set to {}",
|
"Throttle policy set to {}",
|
||||||
"Setting Throttle policy failed"
|
"Setting Throttle policy failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform_copy.throttle_balanced_epp(.into()),
|
platform_copy.profile_balanced_epp(.into()),
|
||||||
"Throttle policy EPP set to {}",
|
"Throttle policy EPP set to {}",
|
||||||
"Setting Throttle policy EPP failed"
|
"Setting Throttle policy EPP failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform_copy.throttle_performance_epp(.into()),
|
platform_copy.profile_performance_epp(.into()),
|
||||||
"Throttle policy EPP set to {}",
|
"Throttle policy EPP set to {}",
|
||||||
"Setting Throttle policy EPP failed"
|
"Setting Throttle policy EPP failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform_copy.throttle_quiet_epp(.into()),
|
platform_copy.profile_quiet_epp(.into()),
|
||||||
"Throttle policy EPP set to {}",
|
"Throttle policy EPP set to {}",
|
||||||
"Setting Throttle policy EPP failed"
|
"Setting Throttle policy EPP failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(
|
set_ui_callbacks!(
|
||||||
handle,
|
handle,
|
||||||
SystemPageData(),
|
SystemPageData(),
|
||||||
platform_copy.throttle_policy_linked_epp(),
|
platform_copy.platform_profile_linked_epp(),
|
||||||
"Throttle policy linked to EPP: {}",
|
"Throttle policy linked to EPP: {}",
|
||||||
"Setting Throttle policy linked to EPP failed"
|
"Setting Throttle policy linked to EPP failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform_copy.throttle_policy_on_ac(.into()),
|
platform_copy.platform_profile_on_ac(.into()),
|
||||||
"Throttle policy on AC set to {}",
|
"Throttle policy on AC set to {}",
|
||||||
"Setting Throttle policy on AC failed"
|
"Setting Throttle policy on AC failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as bool),
|
SystemPageData(as bool),
|
||||||
platform_copy.change_throttle_policy_on_ac(.into()),
|
platform_copy.change_platform_profile_on_ac(.into()),
|
||||||
"Throttle policy on AC enabled: {}",
|
"Throttle policy on AC enabled: {}",
|
||||||
"Setting Throttle policy on AC failed"
|
"Setting Throttle policy on AC failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as i32),
|
SystemPageData(as i32),
|
||||||
platform_copy.throttle_policy_on_battery(.into()),
|
platform_copy.platform_profile_on_battery(.into()),
|
||||||
"Throttle policy on abttery set to {}",
|
"Throttle policy on abttery set to {}",
|
||||||
"Setting Throttle policy on battery failed"
|
"Setting Throttle policy on battery failed"
|
||||||
);
|
);
|
||||||
set_ui_callbacks!(handle,
|
set_ui_callbacks!(handle,
|
||||||
SystemPageData(as bool),
|
SystemPageData(as bool),
|
||||||
platform_copy.change_throttle_policy_on_battery(.into()),
|
platform_copy.change_platform_profile_on_battery(.into()),
|
||||||
"Throttle policy on battery enabled: {}",
|
"Throttle policy on battery enabled: {}",
|
||||||
"Setting Throttle policy on AC failed"
|
"Setting Throttle policy on AC failed"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ export struct AttrPossible {
|
|||||||
export global SystemPageData {
|
export global SystemPageData {
|
||||||
in-out property <float> charge_control_end_threshold: 30;
|
in-out property <float> charge_control_end_threshold: 30;
|
||||||
callback cb_charge_control_end_threshold(/* charge limit */ int);
|
callback cb_charge_control_end_threshold(/* charge limit */ int);
|
||||||
in-out property <int> throttle_thermal_policy: 0;
|
in-out property <int> platform_profile: 0;
|
||||||
in-out property <[string]> throttle_policy_choices: [@tr("Balanced"), @tr("Performance"), @tr("Quiet")];
|
in-out property <[string]> platform_profile_choices: [@tr("Balanced"), @tr("Performance"), @tr("Quiet")];
|
||||||
callback cb_throttle_thermal_policy(int);
|
callback cb_platform_profile(int);
|
||||||
in-out property <[string]> energy_performance_choices: [
|
in-out property <[string]> energy_performance_choices: [
|
||||||
@tr("Default"),
|
@tr("Default"),
|
||||||
@tr("Performance"),
|
@tr("Performance"),
|
||||||
@@ -25,23 +25,23 @@ export global SystemPageData {
|
|||||||
@tr("BalancePower"),
|
@tr("BalancePower"),
|
||||||
@tr("Power")
|
@tr("Power")
|
||||||
];
|
];
|
||||||
in-out property <int> throttle_balanced_epp: 0;
|
in-out property <int> profile_balanced_epp: 0;
|
||||||
callback cb_throttle_balanced_epp(int);
|
callback cb_profile_balanced_epp(int);
|
||||||
in-out property <int> throttle_performance_epp: 0;
|
in-out property <int> profile_performance_epp: 0;
|
||||||
callback cb_throttle_performance_epp(int);
|
callback cb_profile_performance_epp(int);
|
||||||
in-out property <int> throttle_quiet_epp: 0;
|
in-out property <int> profile_quiet_epp: 0;
|
||||||
callback cb_throttle_quiet_epp(int);
|
callback cb_profile_quiet_epp(int);
|
||||||
// if the EPP should change with throttle
|
// if the EPP should change with throttle
|
||||||
in-out property <bool> throttle_policy_linked_epp: true;
|
in-out property <bool> platform_profile_linked_epp: true;
|
||||||
callback cb_throttle_policy_linked_epp(bool);
|
callback cb_platform_profile_linked_epp(bool);
|
||||||
in-out property <int> throttle_policy_on_ac: 0;
|
in-out property <int> platform_profile_on_ac: 0;
|
||||||
callback cb_throttle_policy_on_ac(int);
|
callback cb_platform_profile_on_ac(int);
|
||||||
in-out property <bool> change_throttle_policy_on_ac: true;
|
in-out property <bool> change_platform_profile_on_ac: true;
|
||||||
callback cb_change_throttle_policy_on_ac(bool);
|
callback cb_change_platform_profile_on_ac(bool);
|
||||||
in-out property <int> throttle_policy_on_battery: 0;
|
in-out property <int> platform_profile_on_battery: 0;
|
||||||
callback cb_throttle_policy_on_battery(int);
|
callback cb_platform_profile_on_battery(int);
|
||||||
in-out property <bool> change_throttle_policy_on_battery: true;
|
in-out property <bool> change_platform_profile_on_battery: true;
|
||||||
callback cb_change_throttle_policy_on_battery(bool);
|
callback cb_change_platform_profile_on_battery(bool);
|
||||||
//
|
//
|
||||||
in-out property <int> panel_overdrive;
|
in-out property <int> panel_overdrive;
|
||||||
callback cb_panel_overdrive(int);
|
callback cb_panel_overdrive(int);
|
||||||
@@ -152,15 +152,15 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.throttle_thermal_policy != -1: HorizontalLayout {
|
if SystemPageData.platform_profile != -1: HorizontalLayout {
|
||||||
spacing: 10px;
|
spacing: 10px;
|
||||||
SystemDropdown {
|
SystemDropdown {
|
||||||
text: @tr("Throttle Policy");
|
text: @tr("Platform Profile");
|
||||||
current_index <=> SystemPageData.throttle_thermal_policy;
|
current_index <=> SystemPageData.platform_profile;
|
||||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_thermal_policy];
|
current_value: SystemPageData.platform_profile_choices[SystemPageData.platform_profile];
|
||||||
model <=> SystemPageData.throttle_policy_choices;
|
model <=> SystemPageData.platform_profile_choices;
|
||||||
selected => {
|
selected => {
|
||||||
SystemPageData.cb_throttle_thermal_policy(SystemPageData.throttle_thermal_policy)
|
SystemPageData.cb_platform_profile(SystemPageData.platform_profile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,39 +419,39 @@ export component PageSystem inherits Rectangle {
|
|||||||
|
|
||||||
SystemToggle {
|
SystemToggle {
|
||||||
text: @tr("Change EPP based on Throttle Policy");
|
text: @tr("Change EPP based on Throttle Policy");
|
||||||
checked <=> SystemPageData.throttle_policy_linked_epp;
|
checked <=> SystemPageData.platform_profile_linked_epp;
|
||||||
toggled => {
|
toggled => {
|
||||||
SystemPageData.cb_throttle_policy_linked_epp(SystemPageData.throttle_policy_linked_epp)
|
SystemPageData.cb_platform_profile_linked_epp(SystemPageData.platform_profile_linked_epp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDropdown {
|
SystemDropdown {
|
||||||
text: @tr("EPP for Balanced Policy");
|
text: @tr("EPP for Balanced Policy");
|
||||||
current_index <=> SystemPageData.throttle_balanced_epp;
|
current_index <=> SystemPageData.profile_balanced_epp;
|
||||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_balanced_epp];
|
current_value: SystemPageData.energy_performance_choices[SystemPageData.profile_balanced_epp];
|
||||||
model <=> SystemPageData.energy_performance_choices;
|
model <=> SystemPageData.energy_performance_choices;
|
||||||
selected => {
|
selected => {
|
||||||
SystemPageData.cb_throttle_balanced_epp(SystemPageData.throttle_balanced_epp)
|
SystemPageData.cb_profile_balanced_epp(SystemPageData.profile_balanced_epp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDropdown {
|
SystemDropdown {
|
||||||
text: @tr("EPP for Performance Policy");
|
text: @tr("EPP for Performance Policy");
|
||||||
current_index <=> SystemPageData.throttle_performance_epp;
|
current_index <=> SystemPageData.profile_performance_epp;
|
||||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_performance_epp];
|
current_value: SystemPageData.energy_performance_choices[SystemPageData.profile_performance_epp];
|
||||||
model <=> SystemPageData.energy_performance_choices;
|
model <=> SystemPageData.energy_performance_choices;
|
||||||
selected => {
|
selected => {
|
||||||
SystemPageData.cb_throttle_performance_epp(SystemPageData.throttle_performance_epp)
|
SystemPageData.cb_profile_performance_epp(SystemPageData.profile_performance_epp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDropdown {
|
SystemDropdown {
|
||||||
text: @tr("EPP for Quiet Policy");
|
text: @tr("EPP for Quiet Policy");
|
||||||
current_index <=> SystemPageData.throttle_quiet_epp;
|
current_index <=> SystemPageData.profile_quiet_epp;
|
||||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_quiet_epp];
|
current_value: SystemPageData.energy_performance_choices[SystemPageData.profile_quiet_epp];
|
||||||
model <=> SystemPageData.energy_performance_choices;
|
model <=> SystemPageData.energy_performance_choices;
|
||||||
selected => {
|
selected => {
|
||||||
SystemPageData.cb_throttle_quiet_epp(SystemPageData.throttle_quiet_epp)
|
SystemPageData.cb_profile_quiet_epp(SystemPageData.profile_quiet_epp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,19 +471,19 @@ export component PageSystem inherits Rectangle {
|
|||||||
spacing: 10px;
|
spacing: 10px;
|
||||||
SystemDropdown {
|
SystemDropdown {
|
||||||
text: @tr("Throttle Policy on Battery");
|
text: @tr("Throttle Policy on Battery");
|
||||||
current_index <=> SystemPageData.throttle_policy_on_battery;
|
current_index <=> SystemPageData.platform_profile_on_battery;
|
||||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
|
current_value: SystemPageData.platform_profile_choices[SystemPageData.platform_profile_on_battery];
|
||||||
model <=> SystemPageData.throttle_policy_choices;
|
model <=> SystemPageData.platform_profile_choices;
|
||||||
selected => {
|
selected => {
|
||||||
SystemPageData.cb_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
|
SystemPageData.cb_platform_profile_on_battery(SystemPageData.platform_profile_on_battery)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemToggle {
|
SystemToggle {
|
||||||
text: @tr("Enabled");
|
text: @tr("Enabled");
|
||||||
checked <=> SystemPageData.change_throttle_policy_on_battery;
|
checked <=> SystemPageData.change_platform_profile_on_battery;
|
||||||
toggled => {
|
toggled => {
|
||||||
SystemPageData.cb_change_throttle_policy_on_battery(SystemPageData.change_throttle_policy_on_battery);
|
SystemPageData.cb_change_platform_profile_on_battery(SystemPageData.change_platform_profile_on_battery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,19 +492,19 @@ export component PageSystem inherits Rectangle {
|
|||||||
spacing: 10px;
|
spacing: 10px;
|
||||||
SystemDropdown {
|
SystemDropdown {
|
||||||
text: @tr("Throttle Policy on AC");
|
text: @tr("Throttle Policy on AC");
|
||||||
current_index <=> SystemPageData.throttle_policy_on_ac;
|
current_index <=> SystemPageData.platform_profile_on_ac;
|
||||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
|
current_value: SystemPageData.platform_profile_choices[SystemPageData.platform_profile_on_ac];
|
||||||
model <=> SystemPageData.throttle_policy_choices;
|
model <=> SystemPageData.platform_profile_choices;
|
||||||
selected => {
|
selected => {
|
||||||
SystemPageData.cb_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
|
SystemPageData.cb_platform_profile_on_ac(SystemPageData.platform_profile_on_ac)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemToggle {
|
SystemToggle {
|
||||||
text: @tr("Enabled");
|
text: @tr("Enabled");
|
||||||
checked <=> SystemPageData.change_throttle_policy_on_ac;
|
checked <=> SystemPageData.change_platform_profile_on_ac;
|
||||||
toggled => {
|
toggled => {
|
||||||
SystemPageData.cb_change_throttle_policy_on_ac(SystemPageData.change_throttle_policy_on_ac);
|
SystemPageData.cb_change_platform_profile_on_ac(SystemPageData.change_platform_profile_on_ac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
//!
|
//!
|
||||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||||
|
|
||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
use rog_profiles::fan_curve_set::CurveData;
|
use rog_profiles::fan_curve_set::CurveData;
|
||||||
use rog_profiles::FanCurvePU;
|
use rog_profiles::FanCurvePU;
|
||||||
use zbus::proxy;
|
use zbus::proxy;
|
||||||
@@ -32,30 +32,30 @@ use zbus::proxy;
|
|||||||
)]
|
)]
|
||||||
pub trait FanCurves {
|
pub trait FanCurves {
|
||||||
/// Get the fan-curve data for the currently active PlatformProfile
|
/// Get the fan-curve data for the currently active PlatformProfile
|
||||||
fn fan_curve_data(&self, profile: ThrottlePolicy) -> zbus::Result<Vec<CurveData>>;
|
fn fan_curve_data(&self, profile: PlatformProfile) -> zbus::Result<Vec<CurveData>>;
|
||||||
|
|
||||||
/// Reset the stored (self) and device curve to the defaults of the
|
/// Reset the stored (self) and device curve to the defaults of the
|
||||||
/// platform.
|
/// platform.
|
||||||
///
|
///
|
||||||
/// Each platform_profile has a different default and the defualt can be
|
/// Each platform_profile has a different default and the defualt can be
|
||||||
/// read only for the currently active profile.
|
/// read only for the currently active profile.
|
||||||
fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::Result<()>;
|
fn reset_profile_curves(&self, profile: PlatformProfile) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// SetActiveCurveToDefaults method
|
/// SetActiveCurveToDefaults method
|
||||||
fn set_curves_to_defaults(&self, profile: ThrottlePolicy) -> zbus::Result<()>;
|
fn set_curves_to_defaults(&self, profile: PlatformProfile) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Set the fan curve for the specified profile, or the profile the user is
|
/// Set the fan curve for the specified profile, or the profile the user is
|
||||||
/// currently in if profile == None. Will also activate the fan curve.
|
/// currently in if profile == None. Will also activate the fan curve.
|
||||||
fn set_fan_curve(&self, profile: ThrottlePolicy, curve: CurveData) -> zbus::Result<()>;
|
fn set_fan_curve(&self, profile: PlatformProfile, curve: CurveData) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Set a profile fan curve enabled status. Will also activate a fan curve.
|
/// Set a profile fan curve enabled status. Will also activate a fan curve.
|
||||||
fn set_fan_curves_enabled(&self, profile: ThrottlePolicy, enabled: bool) -> zbus::Result<()>;
|
fn set_fan_curves_enabled(&self, profile: PlatformProfile, enabled: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Set a single fan curve for a profile to enabled status. Will also
|
/// Set a single fan curve for a profile to enabled status. Will also
|
||||||
/// activate a fan curve.
|
/// activate a fan curve.
|
||||||
async fn set_profile_fan_curve_enabled(
|
async fn set_profile_fan_curve_enabled(
|
||||||
&self,
|
&self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
fan: FanCurvePU,
|
fan: FanCurvePU,
|
||||||
enabled: bool
|
enabled: bool
|
||||||
) -> zbus::Result<()>;
|
) -> zbus::Result<()>;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||||
|
|
||||||
use rog_platform::cpu::CPUEPP;
|
use rog_platform::cpu::CPUEPP;
|
||||||
use rog_platform::platform::{Properties, ThrottlePolicy};
|
use rog_platform::platform::{PlatformProfile, Properties};
|
||||||
use zbus::proxy;
|
use zbus::proxy;
|
||||||
|
|
||||||
#[proxy(
|
#[proxy(
|
||||||
@@ -34,7 +34,7 @@ pub trait Platform {
|
|||||||
fn version(&self) -> zbus::Result<String>;
|
fn version(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
/// NextThrottleThermalPolicy method
|
/// NextThrottleThermalPolicy method
|
||||||
fn next_throttle_thermal_policy(&self) -> zbus::Result<()>;
|
fn next_platform_profile(&self) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// SupportedProperties method
|
/// SupportedProperties method
|
||||||
fn supported_properties(&self) -> zbus::Result<Vec<Properties>>;
|
fn supported_properties(&self) -> zbus::Result<Vec<Properties>>;
|
||||||
@@ -50,55 +50,58 @@ pub trait Platform {
|
|||||||
|
|
||||||
/// ThrottleBalancedEpp property
|
/// ThrottleBalancedEpp property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_balanced_epp(&self) -> zbus::Result<CPUEPP>;
|
fn profile_balanced_epp(&self) -> zbus::Result<CPUEPP>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_balanced_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
fn set_profile_balanced_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottlePerformanceEpp property
|
/// ThrottlePerformanceEpp property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_performance_epp(&self) -> zbus::Result<CPUEPP>;
|
fn profile_performance_epp(&self) -> zbus::Result<CPUEPP>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_performance_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
fn set_profile_performance_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottlePolicyLinkedEpp property
|
/// ThrottlePolicyLinkedEpp property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_policy_linked_epp(&self) -> zbus::Result<bool>;
|
fn platform_profile_linked_epp(&self) -> zbus::Result<bool>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_policy_linked_epp(&self, value: bool) -> zbus::Result<()>;
|
fn set_platform_profile_linked_epp(&self, value: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottlePolicyOnAc property
|
/// ThrottlePolicyOnAc property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_policy_on_ac(&self) -> zbus::Result<ThrottlePolicy>;
|
fn platform_profile_on_ac(&self) -> zbus::Result<PlatformProfile>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_policy_on_ac(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
fn set_platform_profile_on_ac(&self, platform_profile: PlatformProfile) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ChangeThrottlePolicyOnAc property
|
/// ChangeThrottlePolicyOnAc property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn change_throttle_policy_on_ac(&self) -> zbus::Result<bool>;
|
fn change_platform_profile_on_ac(&self) -> zbus::Result<bool>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_change_throttle_policy_on_ac(&self, change: bool) -> zbus::Result<()>;
|
fn set_change_platform_profile_on_ac(&self, change: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottlePolicyOnBattery property
|
/// ThrottlePolicyOnBattery property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_policy_on_battery(&self) -> zbus::Result<ThrottlePolicy>;
|
fn platform_profile_on_battery(&self) -> zbus::Result<PlatformProfile>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_policy_on_battery(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
fn set_platform_profile_on_battery(
|
||||||
|
&self,
|
||||||
|
platform_profile: PlatformProfile
|
||||||
|
) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ChangeThrottlePolicyOnAc property
|
/// ChangeThrottlePolicyOnAc property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn change_throttle_policy_on_battery(&self) -> zbus::Result<bool>;
|
fn change_platform_profile_on_battery(&self) -> zbus::Result<bool>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_change_throttle_policy_on_battery(&self, change: bool) -> zbus::Result<()>;
|
fn set_change_platform_profile_on_battery(&self, change: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottleQuietEpp property
|
/// ThrottleQuietEpp property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_quiet_epp(&self) -> zbus::Result<CPUEPP>;
|
fn profile_quiet_epp(&self) -> zbus::Result<CPUEPP>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_quiet_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
fn set_profile_quiet_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ThrottlePolicy property
|
/// ThrottlePolicy property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn throttle_thermal_policy(&self) -> zbus::Result<ThrottlePolicy>;
|
fn platform_profile(&self) -> zbus::Result<PlatformProfile>;
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn set_throttle_thermal_policy(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
fn set_platform_profile(&self, platform_profile: PlatformProfile) -> zbus::Result<()>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ impl FirmwareAttribute {
|
|||||||
| FirmwareAttribute::PptPlatformSppt
|
| FirmwareAttribute::PptPlatformSppt
|
||||||
| FirmwareAttribute::NvDynamicBoost
|
| FirmwareAttribute::NvDynamicBoost
|
||||||
| FirmwareAttribute::NvTempTarget
|
| FirmwareAttribute::NvTempTarget
|
||||||
| FirmwareAttribute::DgpuBaseTgp
|
|
||||||
| FirmwareAttribute::DgpuTgp
|
| FirmwareAttribute::DgpuTgp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||||
|
|
||||||
use crate::error::{PlatformError, Result};
|
use crate::error::{PlatformError, Result};
|
||||||
use crate::platform::ThrottlePolicy;
|
use crate::platform::PlatformProfile;
|
||||||
use crate::{read_attr_string, to_device};
|
use crate::{read_attr_string, to_device};
|
||||||
|
|
||||||
const ATTR_AVAILABLE_GOVERNORS: &str = "cpufreq/scaling_available_governors";
|
const ATTR_AVAILABLE_GOVERNORS: &str = "cpufreq/scaling_available_governors";
|
||||||
@@ -201,12 +201,12 @@ pub enum CPUEPP {
|
|||||||
Power = 4
|
Power = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ThrottlePolicy> for CPUEPP {
|
impl From<PlatformProfile> for CPUEPP {
|
||||||
fn from(value: ThrottlePolicy) -> Self {
|
fn from(value: PlatformProfile) -> Self {
|
||||||
match value {
|
match value {
|
||||||
ThrottlePolicy::Balanced => CPUEPP::BalancePerformance,
|
PlatformProfile::Balanced => CPUEPP::BalancePerformance,
|
||||||
ThrottlePolicy::Performance => CPUEPP::Performance,
|
PlatformProfile::Performance => CPUEPP::Performance,
|
||||||
ThrottlePolicy::Quiet => CPUEPP::Power
|
PlatformProfile::Quiet => CPUEPP::Power
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||||
|
|
||||||
use crate::error::{PlatformError, Result};
|
use crate::error::{PlatformError, Result};
|
||||||
use crate::{attr_string, attr_u8, to_device};
|
use crate::{attr_string, to_device};
|
||||||
|
|
||||||
/// The "platform" device provides access to things like:
|
/// The "platform" device provides access to things like:
|
||||||
/// - `dgpu_disable`
|
/// - `dgpu_disable`
|
||||||
@@ -24,13 +24,6 @@ pub struct RogPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RogPlatform {
|
impl RogPlatform {
|
||||||
attr_u8!(
|
|
||||||
/// This is technically the same as `platform_profile` since both are
|
|
||||||
/// tied in-kernel
|
|
||||||
"throttle_thermal_policy",
|
|
||||||
path
|
|
||||||
);
|
|
||||||
|
|
||||||
attr_string!(
|
attr_string!(
|
||||||
/// The acpi platform_profile support
|
/// The acpi platform_profile support
|
||||||
"platform_profile",
|
"platform_profile",
|
||||||
@@ -193,15 +186,15 @@ impl Display for GpuMode {
|
|||||||
Copy,
|
Copy,
|
||||||
)]
|
)]
|
||||||
#[zvariant(signature = "u")]
|
#[zvariant(signature = "u")]
|
||||||
/// `throttle_thermal_policy` in asus_wmi
|
/// `platform_profile` in asus_wmi
|
||||||
pub enum ThrottlePolicy {
|
pub enum PlatformProfile {
|
||||||
#[default]
|
#[default]
|
||||||
Balanced = 0,
|
Balanced = 0,
|
||||||
Performance = 1,
|
Performance = 1,
|
||||||
Quiet = 2
|
Quiet = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThrottlePolicy {
|
impl PlatformProfile {
|
||||||
pub const fn next(self) -> Self {
|
pub const fn next(self) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Balanced => Self::Performance,
|
Self::Balanced => Self::Performance,
|
||||||
@@ -219,7 +212,7 @@ impl ThrottlePolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u8> for ThrottlePolicy {
|
impl From<u8> for PlatformProfile {
|
||||||
fn from(num: u8) -> Self {
|
fn from(num: u8) -> Self {
|
||||||
match num {
|
match num {
|
||||||
0 => Self::Balanced,
|
0 => Self::Balanced,
|
||||||
@@ -233,52 +226,74 @@ impl From<u8> for ThrottlePolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<i32> for ThrottlePolicy {
|
impl From<i32> for PlatformProfile {
|
||||||
fn from(num: i32) -> Self {
|
fn from(num: i32) -> Self {
|
||||||
(num as u8).into()
|
(num as u8).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ThrottlePolicy> for u8 {
|
impl From<PlatformProfile> for u8 {
|
||||||
fn from(p: ThrottlePolicy) -> Self {
|
fn from(p: PlatformProfile) -> Self {
|
||||||
match p {
|
match p {
|
||||||
ThrottlePolicy::Balanced => 0,
|
PlatformProfile::Balanced => 0,
|
||||||
ThrottlePolicy::Performance => 1,
|
PlatformProfile::Performance => 1,
|
||||||
ThrottlePolicy::Quiet => 2
|
PlatformProfile::Quiet => 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ThrottlePolicy> for i32 {
|
impl From<PlatformProfile> for i32 {
|
||||||
fn from(p: ThrottlePolicy) -> Self {
|
fn from(p: PlatformProfile) -> Self {
|
||||||
<u8>::from(p) as i32
|
<u8>::from(p) as i32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ThrottlePolicy> for &str {
|
impl From<PlatformProfile> for &str {
|
||||||
fn from(profile: ThrottlePolicy) -> &'static str {
|
fn from(profile: PlatformProfile) -> &'static str {
|
||||||
match profile {
|
match profile {
|
||||||
ThrottlePolicy::Balanced => "balanced",
|
PlatformProfile::Balanced => "balanced",
|
||||||
ThrottlePolicy::Performance => "performance",
|
PlatformProfile::Performance => "performance",
|
||||||
ThrottlePolicy::Quiet => "quiet"
|
PlatformProfile::Quiet => "quiet"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::str::FromStr for ThrottlePolicy {
|
impl From<String> for PlatformProfile {
|
||||||
|
fn from(profile: String) -> Self {
|
||||||
|
Self::from(&profile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&String> for PlatformProfile {
|
||||||
|
fn from(profile: &String) -> Self {
|
||||||
|
match profile.to_ascii_lowercase().trim() {
|
||||||
|
"balanced" => PlatformProfile::Balanced,
|
||||||
|
"performance" => PlatformProfile::Performance,
|
||||||
|
"quiet" => PlatformProfile::Quiet,
|
||||||
|
"low-power" => PlatformProfile::Quiet,
|
||||||
|
_ => {
|
||||||
|
warn!("{profile} is unknown, using ThrottlePolicy::Balanced");
|
||||||
|
PlatformProfile::Balanced
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::str::FromStr for PlatformProfile {
|
||||||
type Err = PlatformError;
|
type Err = PlatformError;
|
||||||
|
|
||||||
fn from_str(profile: &str) -> Result<Self> {
|
fn from_str(profile: &str) -> Result<Self> {
|
||||||
match profile.to_ascii_lowercase().trim() {
|
match profile.to_ascii_lowercase().trim() {
|
||||||
"balanced" => Ok(ThrottlePolicy::Balanced),
|
"balanced" => Ok(PlatformProfile::Balanced),
|
||||||
"performance" => Ok(ThrottlePolicy::Performance),
|
"performance" => Ok(PlatformProfile::Performance),
|
||||||
"quiet" => Ok(ThrottlePolicy::Quiet),
|
"quiet" => Ok(PlatformProfile::Quiet),
|
||||||
|
"low-power" => Ok(PlatformProfile::Quiet),
|
||||||
_ => Err(PlatformError::NotSupported)
|
_ => Err(PlatformError::NotSupported)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for ThrottlePolicy {
|
impl Display for PlatformProfile {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{:?}", self)
|
write!(f, "{:?}", self)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ pub mod fan_curve_set;
|
|||||||
use error::ProfileError;
|
use error::ProfileError;
|
||||||
use fan_curve_set::CurveData;
|
use fan_curve_set::CurveData;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use rog_platform::platform::ThrottlePolicy;
|
use rog_platform::platform::PlatformProfile;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
pub use udev::Device;
|
pub use udev::Device;
|
||||||
#[cfg(feature = "dbus")]
|
#[cfg(feature = "dbus")]
|
||||||
@@ -125,7 +125,7 @@ impl FanCurveProfiles {
|
|||||||
|
|
||||||
pub fn read_from_dev_profile(
|
pub fn read_from_dev_profile(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
device: &Device
|
device: &Device
|
||||||
) -> Result<(), ProfileError> {
|
) -> Result<(), ProfileError> {
|
||||||
let fans = Self::supported_fans()?;
|
let fans = Self::supported_fans()?;
|
||||||
@@ -143,9 +143,9 @@ impl FanCurveProfiles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match profile {
|
match profile {
|
||||||
ThrottlePolicy::Balanced => self.balanced = curves,
|
PlatformProfile::Balanced => self.balanced = curves,
|
||||||
ThrottlePolicy::Performance => self.performance = curves,
|
PlatformProfile::Performance => self.performance = curves,
|
||||||
ThrottlePolicy::Quiet => self.quiet = curves
|
PlatformProfile::Quiet => self.quiet = curves
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ impl FanCurveProfiles {
|
|||||||
/// read only for the currently active profile.
|
/// read only for the currently active profile.
|
||||||
pub fn set_active_curve_to_defaults(
|
pub fn set_active_curve_to_defaults(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
device: &mut Device
|
device: &mut Device
|
||||||
) -> Result<(), ProfileError> {
|
) -> Result<(), ProfileError> {
|
||||||
let fans = Self::supported_fans()?;
|
let fans = Self::supported_fans()?;
|
||||||
@@ -175,13 +175,13 @@ impl FanCurveProfiles {
|
|||||||
/// in the enabled list it will become active.
|
/// in the enabled list it will become active.
|
||||||
pub fn write_profile_curve_to_platform(
|
pub fn write_profile_curve_to_platform(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
device: &mut Device
|
device: &mut Device
|
||||||
) -> Result<(), ProfileError> {
|
) -> Result<(), ProfileError> {
|
||||||
let fans = match profile {
|
let fans = match profile {
|
||||||
ThrottlePolicy::Balanced => &mut self.balanced,
|
PlatformProfile::Balanced => &mut self.balanced,
|
||||||
ThrottlePolicy::Performance => &mut self.performance,
|
PlatformProfile::Performance => &mut self.performance,
|
||||||
ThrottlePolicy::Quiet => &mut self.quiet
|
PlatformProfile::Quiet => &mut self.quiet
|
||||||
};
|
};
|
||||||
for fan in fans.iter().filter(|f| !f.enabled) {
|
for fan in fans.iter().filter(|f| !f.enabled) {
|
||||||
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
|
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
|
||||||
@@ -196,19 +196,19 @@ impl FanCurveProfiles {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_profile_curves_enabled(&mut self, profile: ThrottlePolicy, enabled: bool) {
|
pub fn set_profile_curves_enabled(&mut self, profile: PlatformProfile, enabled: bool) {
|
||||||
match profile {
|
match profile {
|
||||||
ThrottlePolicy::Balanced => {
|
PlatformProfile::Balanced => {
|
||||||
for curve in self.balanced.iter_mut() {
|
for curve in self.balanced.iter_mut() {
|
||||||
curve.enabled = enabled;
|
curve.enabled = enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Performance => {
|
PlatformProfile::Performance => {
|
||||||
for curve in self.performance.iter_mut() {
|
for curve in self.performance.iter_mut() {
|
||||||
curve.enabled = enabled;
|
curve.enabled = enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Quiet => {
|
PlatformProfile::Quiet => {
|
||||||
for curve in self.quiet.iter_mut() {
|
for curve in self.quiet.iter_mut() {
|
||||||
curve.enabled = enabled;
|
curve.enabled = enabled;
|
||||||
}
|
}
|
||||||
@@ -218,12 +218,12 @@ impl FanCurveProfiles {
|
|||||||
|
|
||||||
pub fn set_profile_fan_curve_enabled(
|
pub fn set_profile_fan_curve_enabled(
|
||||||
&mut self,
|
&mut self,
|
||||||
profile: ThrottlePolicy,
|
profile: PlatformProfile,
|
||||||
fan: FanCurvePU,
|
fan: FanCurvePU,
|
||||||
enabled: bool
|
enabled: bool
|
||||||
) {
|
) {
|
||||||
match profile {
|
match profile {
|
||||||
ThrottlePolicy::Balanced => {
|
PlatformProfile::Balanced => {
|
||||||
for curve in self.balanced.iter_mut() {
|
for curve in self.balanced.iter_mut() {
|
||||||
if curve.fan == fan {
|
if curve.fan == fan {
|
||||||
curve.enabled = enabled;
|
curve.enabled = enabled;
|
||||||
@@ -231,7 +231,7 @@ impl FanCurveProfiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Performance => {
|
PlatformProfile::Performance => {
|
||||||
for curve in self.performance.iter_mut() {
|
for curve in self.performance.iter_mut() {
|
||||||
if curve.fan == fan {
|
if curve.fan == fan {
|
||||||
curve.enabled = enabled;
|
curve.enabled = enabled;
|
||||||
@@ -239,7 +239,7 @@ impl FanCurveProfiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Quiet => {
|
PlatformProfile::Quiet => {
|
||||||
for curve in self.quiet.iter_mut() {
|
for curve in self.quiet.iter_mut() {
|
||||||
if curve.fan == fan {
|
if curve.fan == fan {
|
||||||
curve.enabled = enabled;
|
curve.enabled = enabled;
|
||||||
@@ -250,31 +250,31 @@ impl FanCurveProfiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_fan_curves_for(&self, name: ThrottlePolicy) -> &[CurveData] {
|
pub fn get_fan_curves_for(&self, name: PlatformProfile) -> &[CurveData] {
|
||||||
match name {
|
match name {
|
||||||
ThrottlePolicy::Balanced => &self.balanced,
|
PlatformProfile::Balanced => &self.balanced,
|
||||||
ThrottlePolicy::Performance => &self.performance,
|
PlatformProfile::Performance => &self.performance,
|
||||||
ThrottlePolicy::Quiet => &self.quiet
|
PlatformProfile::Quiet => &self.quiet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_fan_curve_for(&self, name: &ThrottlePolicy, pu: FanCurvePU) -> Option<&CurveData> {
|
pub fn get_fan_curve_for(&self, name: &PlatformProfile, pu: FanCurvePU) -> Option<&CurveData> {
|
||||||
match name {
|
match name {
|
||||||
ThrottlePolicy::Balanced => {
|
PlatformProfile::Balanced => {
|
||||||
for this_curve in self.balanced.iter() {
|
for this_curve in self.balanced.iter() {
|
||||||
if this_curve.fan == pu {
|
if this_curve.fan == pu {
|
||||||
return Some(this_curve);
|
return Some(this_curve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Performance => {
|
PlatformProfile::Performance => {
|
||||||
for this_curve in self.performance.iter() {
|
for this_curve in self.performance.iter() {
|
||||||
if this_curve.fan == pu {
|
if this_curve.fan == pu {
|
||||||
return Some(this_curve);
|
return Some(this_curve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Quiet => {
|
PlatformProfile::Quiet => {
|
||||||
for this_curve in self.quiet.iter() {
|
for this_curve in self.quiet.iter() {
|
||||||
if this_curve.fan == pu {
|
if this_curve.fan == pu {
|
||||||
return Some(this_curve);
|
return Some(this_curve);
|
||||||
@@ -288,10 +288,10 @@ impl FanCurveProfiles {
|
|||||||
pub fn save_fan_curve(
|
pub fn save_fan_curve(
|
||||||
&mut self,
|
&mut self,
|
||||||
curve: CurveData,
|
curve: CurveData,
|
||||||
profile: ThrottlePolicy
|
profile: PlatformProfile
|
||||||
) -> Result<(), ProfileError> {
|
) -> Result<(), ProfileError> {
|
||||||
match profile {
|
match profile {
|
||||||
ThrottlePolicy::Balanced => {
|
PlatformProfile::Balanced => {
|
||||||
for this_curve in self.balanced.iter_mut() {
|
for this_curve in self.balanced.iter_mut() {
|
||||||
if this_curve.fan == curve.fan {
|
if this_curve.fan == curve.fan {
|
||||||
*this_curve = curve;
|
*this_curve = curve;
|
||||||
@@ -299,7 +299,7 @@ impl FanCurveProfiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Performance => {
|
PlatformProfile::Performance => {
|
||||||
for this_curve in self.performance.iter_mut() {
|
for this_curve in self.performance.iter_mut() {
|
||||||
if this_curve.fan == curve.fan {
|
if this_curve.fan == curve.fan {
|
||||||
*this_curve = curve;
|
*this_curve = curve;
|
||||||
@@ -307,7 +307,7 @@ impl FanCurveProfiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThrottlePolicy::Quiet => {
|
PlatformProfile::Quiet => {
|
||||||
for this_curve in self.quiet.iter_mut() {
|
for this_curve in self.quiet.iter_mut() {
|
||||||
if this_curve.fan == curve.fan {
|
if this_curve.fan == curve.fan {
|
||||||
*this_curve = curve;
|
*this_curve = curve;
|
||||||
|
|||||||
Reference in New Issue
Block a user