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:
Luke D. Jones
2025-01-19 21:34:38 +13:00
parent 450205f9a9
commit b9296862df
18 changed files with 404 additions and 379 deletions

View File

@@ -20,7 +20,7 @@
//!
//! …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::FanCurvePU;
use zbus::proxy;
@@ -32,30 +32,30 @@ use zbus::proxy;
)]
pub trait FanCurves {
/// 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
/// platform.
///
/// Each platform_profile has a different default and the defualt can be
/// 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
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
/// 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.
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
/// activate a fan curve.
async fn set_profile_fan_curve_enabled(
&self,
profile: ThrottlePolicy,
profile: PlatformProfile,
fan: FanCurvePU,
enabled: bool
) -> zbus::Result<()>;

View File

@@ -21,7 +21,7 @@
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
use rog_platform::cpu::CPUEPP;
use rog_platform::platform::{Properties, ThrottlePolicy};
use rog_platform::platform::{PlatformProfile, Properties};
use zbus::proxy;
#[proxy(
@@ -34,7 +34,7 @@ pub trait Platform {
fn version(&self) -> zbus::Result<String>;
/// NextThrottleThermalPolicy method
fn next_throttle_thermal_policy(&self) -> zbus::Result<()>;
fn next_platform_profile(&self) -> zbus::Result<()>;
/// SupportedProperties method
fn supported_properties(&self) -> zbus::Result<Vec<Properties>>;
@@ -50,55 +50,58 @@ pub trait Platform {
/// ThrottleBalancedEpp property
#[zbus(property)]
fn throttle_balanced_epp(&self) -> zbus::Result<CPUEPP>;
fn profile_balanced_epp(&self) -> zbus::Result<CPUEPP>;
#[zbus(property)]
fn set_throttle_balanced_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
fn set_profile_balanced_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
/// ThrottlePerformanceEpp property
#[zbus(property)]
fn throttle_performance_epp(&self) -> zbus::Result<CPUEPP>;
fn profile_performance_epp(&self) -> zbus::Result<CPUEPP>;
#[zbus(property)]
fn set_throttle_performance_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
fn set_profile_performance_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
/// ThrottlePolicyLinkedEpp property
#[zbus(property)]
fn throttle_policy_linked_epp(&self) -> zbus::Result<bool>;
fn platform_profile_linked_epp(&self) -> zbus::Result<bool>;
#[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
#[zbus(property)]
fn throttle_policy_on_ac(&self) -> zbus::Result<ThrottlePolicy>;
fn platform_profile_on_ac(&self) -> zbus::Result<PlatformProfile>;
#[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
#[zbus(property)]
fn change_throttle_policy_on_ac(&self) -> zbus::Result<bool>;
fn change_platform_profile_on_ac(&self) -> zbus::Result<bool>;
#[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
#[zbus(property)]
fn throttle_policy_on_battery(&self) -> zbus::Result<ThrottlePolicy>;
fn platform_profile_on_battery(&self) -> zbus::Result<PlatformProfile>;
#[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
#[zbus(property)]
fn change_throttle_policy_on_battery(&self) -> zbus::Result<bool>;
fn change_platform_profile_on_battery(&self) -> zbus::Result<bool>;
#[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
#[zbus(property)]
fn throttle_quiet_epp(&self) -> zbus::Result<CPUEPP>;
fn profile_quiet_epp(&self) -> zbus::Result<CPUEPP>;
#[zbus(property)]
fn set_throttle_quiet_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
fn set_profile_quiet_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
/// ThrottlePolicy property
#[zbus(property)]
fn throttle_thermal_policy(&self) -> zbus::Result<ThrottlePolicy>;
fn platform_profile(&self) -> zbus::Result<PlatformProfile>;
#[zbus(property)]
fn set_throttle_thermal_policy(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
fn set_platform_profile(&self, platform_profile: PlatformProfile) -> zbus::Result<()>;
}