Should correctly set AMD boost

This commit is contained in:
Luke
2020-05-23 19:19:11 +12:00
parent da05b8d90c
commit 727aa3066d
7 changed files with 44 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "rog-daemon"
version = "0.9.8"
version = "0.9.9"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]

View File

@@ -8,7 +8,7 @@ use rog_aura::{
AuraDbusWriter, LED_MSG_LEN,
};
static VERSION: &'static str = "0.9.8";
static VERSION: &'static str = "0.9.9";
#[derive(Debug, Options)]
struct CLIStart {

View File

@@ -15,7 +15,7 @@ use std::time::Duration;
static FAN_TYPE_1_PATH: &str = "/sys/devices/platform/asus-nb-wmi/throttle_thermal_policy";
static FAN_TYPE_2_PATH: &str = "/sys/devices/platform/asus-nb-wmi/fan_boost_mode";
static AMD_BOOST_APTH: &str = "/sys/devices/system/cpu/cpufreq/boost";
static AMD_BOOST_PATH: &str = "/sys/devices/system/cpu/cpufreq/boost";
/// ROG device controller
///
@@ -194,26 +194,44 @@ impl RogCore {
} else {
info!("Setting pstate for AMD CPU");
// must be AMD CPU
let mut file = OpenOptions::new().write(true).open(AMD_BOOST_APTH)?;
let mut file = OpenOptions::new()
.write(true)
.open(AMD_BOOST_PATH)
.map_err(|err| {
warn!("Failed to open AMD boost: {:?}", err);
err
})?;
match mode {
FanLevel::Normal => {
let boost = !config.mode_performance.normal.no_turbo as u8; // opposite of Intel
file.write_all(&[boost]).unwrap_or_else(|err| {
error!("Could not write to {}, {:?}", AMD_BOOST_APTH, err)
let boost = if config.mode_performance.normal.no_turbo {
"0"
} else {
"1"
}; // opposite of Intel
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
});
info!("CPU Power: turbo: {:?}", boost);
}
FanLevel::Boost => {
let boost = !config.mode_performance.boost.no_turbo as u8; // opposite of Intel
file.write_all(&[boost]).unwrap_or_else(|err| {
error!("Could not write to {}, {:?}", AMD_BOOST_APTH, err)
let boost = if config.mode_performance.boost.no_turbo {
"0"
} else {
"1"
};
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
});
info!("CPU Power: turbo: {:?}", boost);
}
FanLevel::Silent => {
let boost = !config.mode_performance.silent.no_turbo as u8; // opposite of Intel
file.write_all(&[boost]).unwrap_or_else(|err| {
error!("Could not write to {}, {:?}", AMD_BOOST_APTH, err)
let boost = if config.mode_performance.silent.no_turbo {
"0"
} else {
"1"
};
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
});
info!("CPU Power: turbo: {:?}", boost);
}