Update limits_override reference

This commit is contained in:
NGnius (Graham) 2024-02-10 15:02:08 -05:00
parent 1da7bafe5e
commit fb038665c9
3 changed files with 50 additions and 17 deletions

View file

@ -353,13 +353,17 @@ impl Cpu {
} }
fn read_max_cpu_clock(&self) -> u64 { fn read_max_cpu_clock(&self) -> u64 {
if !(self.limits.extras.experiments || self.limits.extras.quirks.contains("clock-autodetect")) { if !(self.limits.extras.experiments
|| self.limits.extras.quirks.contains("clock-autodetect"))
{
return MAX_CLOCK; return MAX_CLOCK;
} }
if let super::Model::OLED = self.variant { if let super::Model::OLED = self.variant {
if let Ok(freq_khz) = usdpl_back::api::files::read_single::<_, u64, _>(cpu_max_clock_path(self.index)) { if let Ok(freq_khz) =
usdpl_back::api::files::read_single::<_, u64, _>(cpu_max_clock_path(self.index))
{
log::debug!("Detected CPU max clock of {}KHz", freq_khz); log::debug!("Detected CPU max clock of {}KHz", freq_khz);
return freq_khz / 1000 return freq_khz / 1000;
} }
} }
MAX_CLOCK MAX_CLOCK
@ -747,5 +751,8 @@ fn cpu_available_governors_path(index: usize) -> String {
#[inline] #[inline]
fn cpu_max_clock_path(index: usize) -> String { fn cpu_max_clock_path(index: usize) -> String {
format!("/sys/devices/system/cpu/cpufreq/policy{}/cpuinfo_max_freq", index) format!(
"/sys/devices/system/cpu/cpufreq/policy{}/cpuinfo_max_freq",
index
)
} }

View file

@ -143,7 +143,9 @@ impl Gpu {
} }
fn read_max_gpu_clock(&self) -> u64 { fn read_max_gpu_clock(&self) -> u64 {
if !(self.limits.extras.experiments || self.limits.extras.quirks.contains("clock-autodetect")) { if !(self.limits.extras.experiments
|| self.limits.extras.quirks.contains("clock-autodetect"))
{
return MAX_CLOCK; return MAX_CLOCK;
} }
if let super::Model::OLED = self.variant { if let super::Model::OLED = self.variant {
@ -152,12 +154,12 @@ impl Gpu {
.read_value(GPU_CLOCK_READOUT_ATTRIBUTE.to_owned()) .read_value(GPU_CLOCK_READOUT_ATTRIBUTE.to_owned())
{ {
let options = parse_pp_dpm_sclk(&String::from_utf8_lossy(&f)); let options = parse_pp_dpm_sclk(&String::from_utf8_lossy(&f));
return options.get(options.len() - 1) return options
.get(options.len() - 1)
.map(|x| { .map(|x| {
let x = x.1 as u64; let x = x.1 as u64;
log::debug!("Detected GPU max clock of {}MHz", x); log::debug!("Detected GPU max clock of {}MHz", x);
x x
}) })
.unwrap_or(MAX_CLOCK); .unwrap_or(MAX_CLOCK);
} }

View file

@ -17,7 +17,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -33,7 +36,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -49,7 +55,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -65,7 +74,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -81,7 +93,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -97,7 +112,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -113,7 +131,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
), GenericCpuLimit( ), GenericCpuLimit(
clock_min: Some(RangeLimit( clock_min: Some(RangeLimit(
min: Some(1400), min: Some(1400),
@ -129,7 +150,10 @@ Limits(
tdp_divisor: None, tdp_divisor: None,
tdp_step: None, tdp_step: None,
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras(
experiments: false, experiments: false,
quirks: [],
),
)], )],
global_governors: true, global_governors: true,
extras: LimitExtras( extras: LimitExtras(
@ -174,7 +198,7 @@ Limits(
skip_resume_reclock: false, skip_resume_reclock: false,
extras: LimitExtras( extras: LimitExtras(
experiments: false, experiments: false,
quirks: ["pp_dpm_fclk-not-updated-on-LCD", "pp_dpm_fclk-reversed"], quirks: ["pp_dpm_fclk-reversed", "pp_dpm_fclk-not-updated-on-LCD"],
), ),
), ),
), ),