Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SteamDeck): add Steam Deck OLED limits #6

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ use std::{error::Error, future::pending};
use zbus::Connection;

use crate::constants::{BUS_NAME, CPU_PATH, GPU_PATH};
use crate::performance::cpu::cpu;
use crate::performance::gpu::dbus;
use crate::dbus::gpu::GPUBus;
use crate::dbus::gpu::get_connectors;
use crate::dbus::gpu::get_gpus;
use crate::dbus::gpu::GPUBus;
use crate::performance::cpu::cpu;
use crate::performance::gpu::dbus;

mod constants;
mod performance;

#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
async fn main() -> Result<(), Box<dyn Error>> {
SimpleLogger::new().init().unwrap();
log::info!("Starting PowerStation");
const VERSION: &str = env!("CARGO_PKG_VERSION");
log::info!("Starting PowerStation v{}", VERSION);

// Discover all CPUs
let cpu = cpu::CPU::new();
Expand Down
6 changes: 5 additions & 1 deletion src/performance/gpu/amd/tdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::performance::gpu::tdp::{TDPDevice, TDPError, TDPResult};

/// Steam Deck GPU ID
const DEV_ID_VANGOGH: &str = "163f";
const DEV_ID_SEPHIROTH: &str = "1435";

/// Implementation of TDP control for AMD GPUs
pub struct TDP {
Expand All @@ -27,14 +28,17 @@ impl TDP {
// Set fake TDP limits for GPUs that don't support ryzenadj monitoring (e.g. Steam Deck)
let unsupported_stapm_limit: f32 = match device_id.as_str() {
DEV_ID_VANGOGH => 12.0,
DEV_ID_SEPHIROTH => 12.0,
_ => 10.0,
};
let unsupported_ppt_limit_fast: f32 = match device_id.as_str() {
DEV_ID_VANGOGH => 15.0,
DEV_ID_SEPHIROTH => 15.0,
_ => 10.0,
};
let unsupported_thm_limit: f32 = match device_id.as_str() {
DEV_ID_VANGOGH => 95.0,
DEV_ID_SEPHIROTH => 95.0,
_ => 95.0,
};

Expand All @@ -50,7 +54,7 @@ impl TDP {

/// Returns true if ryzenadj cannot read values from the given GPU
fn is_unsupported_gpu(&self) -> bool {
self.device_id == DEV_ID_VANGOGH
matches!(self.device_id.as_str(), DEV_ID_VANGOGH | DEV_ID_SEPHIROTH)
}

/// Set the current Slow PPT limit using ryzenadj
Expand Down
Loading