mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 01:12:30 -04:00
power: Expose TDP limit range as platform config
This commit is contained in:
parent
36e88484a4
commit
7c3f2baa05
5 changed files with 46 additions and 7 deletions
10
src/power.rs
10
src/power.rs
|
@ -16,6 +16,7 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
|||
use tracing::{error, warn};
|
||||
|
||||
use crate::hardware::is_deck;
|
||||
use crate::platform::platform_config;
|
||||
use crate::{path, write_synced};
|
||||
|
||||
const GPU_HWMON_PREFIX: &str = "/sys/class/hwmon";
|
||||
|
@ -397,6 +398,15 @@ pub(crate) async fn set_tdp_limit(limit: u32) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn get_tdp_limit_range() -> Result<(u32, u32)> {
|
||||
let range = platform_config()
|
||||
.await?
|
||||
.as_ref()
|
||||
.and_then(|config| config.tdp_limit)
|
||||
.ok_or(anyhow!("No TDP limit range configured"))?;
|
||||
Ok((range.min, range.max))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue