This commit is contained in:
Luke D. Jones
2024-02-27 14:39:46 +13:00
parent 7b0f037cba
commit a88c33c201
64 changed files with 3424 additions and 7019 deletions

View File

@@ -239,6 +239,25 @@ impl From<CPUEPP> for String {
}
}
impl From<i32> for CPUEPP {
fn from(value: i32) -> Self {
match value {
0 => Self::Default,
1 => Self::Performance,
2 => Self::BalancePerformance,
3 => Self::BalancePower,
4 => Self::Power,
_ => Self::Default,
}
}
}
impl From<CPUEPP> for i32 {
fn from(value: CPUEPP) -> Self {
value as i32
}
}
#[cfg(test)]
mod tests {
use super::CPUControl;

View File

@@ -29,12 +29,12 @@ impl RogPlatform {
attr_bool!("egpu_enable", path);
attr_u8!("gpu_mux_mode", path);
attr_bool!("panel_od", path);
attr_bool!("mini_led_mode", path);
attr_u8!("gpu_mux_mode", path);
attr_u8!(
/// This is technically the same as `platform_profile` since both are
/// tied in-kernel
@@ -303,6 +303,12 @@ impl From<u8> for ThrottlePolicy {
}
}
impl From<i32> for ThrottlePolicy {
fn from(num: i32) -> Self {
(num as u8).into()
}
}
impl From<ThrottlePolicy> for u8 {
fn from(p: ThrottlePolicy) -> Self {
match p {
@@ -313,6 +319,12 @@ impl From<ThrottlePolicy> for u8 {
}
}
impl From<ThrottlePolicy> for i32 {
fn from(p: ThrottlePolicy) -> Self {
<u8>::from(p) as i32
}
}
impl From<ThrottlePolicy> for &str {
fn from(profile: ThrottlePolicy) -> &'static str {
match profile {