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 {
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;
}
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);
return freq_khz / 1000
return freq_khz / 1000;
}
}
MAX_CLOCK
@ -747,5 +751,8 @@ fn cpu_available_governors_path(index: usize) -> String {
#[inline]
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 {
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;
}
if let super::Model::OLED = self.variant {
@ -152,12 +154,12 @@ impl Gpu {
.read_value(GPU_CLOCK_READOUT_ATTRIBUTE.to_owned())
{
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| {
let x = x.1 as u64;
log::debug!("Detected GPU max clock of {}MHz", x);
x
})
.unwrap_or(MAX_CLOCK);
}
@ -635,7 +637,7 @@ impl crate::settings::OnUnload for Gpu {
impl TGpu for Gpu {
fn limits(&self) -> crate::api::GpuLimits {
let max_gpu_clock = self.read_max_gpu_clock();
let max_gpu_clock = self.read_max_gpu_clock();
crate::api::GpuLimits {
fast_ppt_limits: Some(RangeLimit {
min: super::util::range_min_or_fallback(&self.limits.fast_ppt, MIN_FAST_PPT)

View File

@ -17,7 +17,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -33,7 +36,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -49,7 +55,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -65,7 +74,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -81,7 +93,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -97,7 +112,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -113,7 +131,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
), GenericCpuLimit(
clock_min: Some(RangeLimit(
min: Some(1400),
@ -129,7 +150,10 @@ Limits(
tdp_divisor: None,
tdp_step: None,
skip_resume_reclock: false,
experiments: false,
extras: LimitExtras(
experiments: false,
quirks: [],
),
)],
global_governors: true,
extras: LimitExtras(
@ -174,7 +198,7 @@ Limits(
skip_resume_reclock: false,
extras: LimitExtras(
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"],
),
),
),