mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-08 07:30:36 -04:00
power: Allow returned GPU clocks range to overridden by a platform config
This commit is contained in:
parent
7c3f2baa05
commit
bdd095860e
5 changed files with 14 additions and 0 deletions
|
@ -23,3 +23,7 @@ systemd = "jupiter-fan-control.service"
|
||||||
[tdp_limit]
|
[tdp_limit]
|
||||||
min = 3
|
min = 3
|
||||||
max = 15
|
max = 15
|
||||||
|
|
||||||
|
[gpu_clocks]
|
||||||
|
min = 200
|
||||||
|
max = 1600
|
||||||
|
|
|
@ -370,6 +370,7 @@ pub mod test {
|
||||||
"jupiter-fan-control.service",
|
"jupiter-fan-control.service",
|
||||||
))),
|
))),
|
||||||
tdp_limit: None,
|
tdp_limit: None,
|
||||||
|
gpu_clocks: None,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let fan_control = FanControl::new(connection);
|
let fan_control = FanControl::new(connection);
|
||||||
|
|
|
@ -692,6 +692,7 @@ mod test {
|
||||||
"jupiter-fan-control.service",
|
"jupiter-fan-control.service",
|
||||||
))),
|
))),
|
||||||
tdp_limit: Some(RangeConfig::new(3, 15)),
|
tdp_limit: Some(RangeConfig::new(3, 15)),
|
||||||
|
gpu_clocks: Some(RangeConfig::new(200, 1600)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ pub(crate) struct PlatformConfig {
|
||||||
pub storage: Option<StorageConfig>,
|
pub storage: Option<StorageConfig>,
|
||||||
pub fan_control: Option<ServiceConfig>,
|
pub fan_control: Option<ServiceConfig>,
|
||||||
pub tdp_limit: Option<RangeConfig<u32>>,
|
pub tdp_limit: Option<RangeConfig<u32>>,
|
||||||
|
pub gpu_clocks: Option<RangeConfig<u32>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Debug)]
|
#[derive(Clone, Deserialize, Debug)]
|
||||||
|
|
|
@ -268,6 +268,13 @@ pub(crate) async fn set_cpu_scaling_governor(governor: CPUScalingGovernor) -> Re
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn get_gpu_clocks_range() -> Result<(u32, u32)> {
|
pub(crate) async fn get_gpu_clocks_range() -> Result<(u32, u32)> {
|
||||||
|
if let Some(range) = platform_config()
|
||||||
|
.await?
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|config| config.gpu_clocks)
|
||||||
|
{
|
||||||
|
return Ok((range.min, range.max));
|
||||||
|
}
|
||||||
let contents = read_gpu_sysfs_contents(GPU_CLOCK_LEVELS_SUFFIX).await?;
|
let contents = read_gpu_sysfs_contents(GPU_CLOCK_LEVELS_SUFFIX).await?;
|
||||||
let lines = contents.lines();
|
let lines = contents.lines();
|
||||||
let mut min = 1_000_000;
|
let mut min = 1_000_000;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue