Allow device auto detection to tell steam deck driver the specific model
This commit is contained in:
parent
0ee30eebe6
commit
85a9fc8f7e
11 changed files with 74 additions and 47 deletions
|
@ -6,8 +6,8 @@ use super::RangeLimit;
|
||||||
pub enum BatteryLimitType {
|
pub enum BatteryLimitType {
|
||||||
#[serde(rename = "GabeBoy", alias = "SteamDeck")]
|
#[serde(rename = "GabeBoy", alias = "SteamDeck")]
|
||||||
SteamDeck,
|
SteamDeck,
|
||||||
#[serde(rename = "GabeBoyAdvance", alias = "SteamDeckAdvance")]
|
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
|
||||||
SteamDeckAdvance,
|
SteamDeckOLED,
|
||||||
Generic,
|
Generic,
|
||||||
Unknown,
|
Unknown,
|
||||||
DevMode,
|
DevMode,
|
||||||
|
@ -25,7 +25,7 @@ pub struct GenericBatteryLimit {
|
||||||
impl GenericBatteryLimit {
|
impl GenericBatteryLimit {
|
||||||
pub fn default_for(t: BatteryLimitType) -> Self {
|
pub fn default_for(t: BatteryLimitType) -> Self {
|
||||||
match t {
|
match t {
|
||||||
BatteryLimitType::SteamDeck | BatteryLimitType::SteamDeckAdvance => Self::default_steam_deck(),
|
BatteryLimitType::SteamDeck | BatteryLimitType::SteamDeckOLED => Self::default_steam_deck(),
|
||||||
BatteryLimitType::DevMode => Self::default_dev_mode(),
|
BatteryLimitType::DevMode => Self::default_dev_mode(),
|
||||||
_t => Self::default(),
|
_t => Self::default(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ use super::RangeLimit;
|
||||||
pub enum CpuLimitType {
|
pub enum CpuLimitType {
|
||||||
#[serde(rename = "GabeBoy", alias = "SteamDeck")]
|
#[serde(rename = "GabeBoy", alias = "SteamDeck")]
|
||||||
SteamDeck,
|
SteamDeck,
|
||||||
#[serde(rename = "GabeBoyAdvance", alias = "SteamDeckAdvance")]
|
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
|
||||||
SteamDeckAdvance,
|
SteamDeckOLED,
|
||||||
Generic,
|
Generic,
|
||||||
GenericAMD,
|
GenericAMD,
|
||||||
Unknown,
|
Unknown,
|
||||||
|
@ -25,7 +25,7 @@ pub struct GenericCpusLimit {
|
||||||
impl GenericCpusLimit {
|
impl GenericCpusLimit {
|
||||||
pub fn default_for(t: CpuLimitType) -> Self {
|
pub fn default_for(t: CpuLimitType) -> Self {
|
||||||
match t {
|
match t {
|
||||||
CpuLimitType::SteamDeck | CpuLimitType::SteamDeckAdvance => {
|
CpuLimitType::SteamDeck | CpuLimitType::SteamDeckOLED => {
|
||||||
Self {
|
Self {
|
||||||
cpus: [(); 8].iter().enumerate().map(|(i, _)| GenericCpuLimit::default_for(&t, i)).collect(),
|
cpus: [(); 8].iter().enumerate().map(|(i, _)| GenericCpuLimit::default_for(&t, i)).collect(),
|
||||||
global_governors: true,
|
global_governors: true,
|
||||||
|
@ -96,7 +96,7 @@ pub struct GenericCpuLimit {
|
||||||
impl GenericCpuLimit {
|
impl GenericCpuLimit {
|
||||||
pub fn default_for(t: &CpuLimitType, _index: usize) -> Self {
|
pub fn default_for(t: &CpuLimitType, _index: usize) -> Self {
|
||||||
match t {
|
match t {
|
||||||
CpuLimitType::SteamDeck | CpuLimitType::SteamDeckAdvance => Self::default_steam_deck(),
|
CpuLimitType::SteamDeck | CpuLimitType::SteamDeckOLED => Self::default_steam_deck(),
|
||||||
CpuLimitType::DevMode => Self {
|
CpuLimitType::DevMode => Self {
|
||||||
clock_min: Some(RangeLimit { min: Some(100), max: Some(5000) }),
|
clock_min: Some(RangeLimit { min: Some(100), max: Some(5000) }),
|
||||||
clock_max: Some(RangeLimit { min: Some(100), max: Some(4800) }),
|
clock_max: Some(RangeLimit { min: Some(100), max: Some(4800) }),
|
||||||
|
|
|
@ -6,8 +6,6 @@ use super::RangeLimit;
|
||||||
pub enum GpuLimitType {
|
pub enum GpuLimitType {
|
||||||
#[serde(rename = "GabeBoy", alias = "SteamDeck")]
|
#[serde(rename = "GabeBoy", alias = "SteamDeck")]
|
||||||
SteamDeck,
|
SteamDeck,
|
||||||
#[serde(rename = "GabeBoyAdvance", alias = "SteamDeckAdvance")]
|
|
||||||
SteamDeckAdvance,
|
|
||||||
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
|
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
|
||||||
SteamDeckOLED,
|
SteamDeckOLED,
|
||||||
Generic,
|
Generic,
|
||||||
|
@ -40,7 +38,7 @@ pub struct GenericGpuLimit {
|
||||||
impl GenericGpuLimit {
|
impl GenericGpuLimit {
|
||||||
pub fn default_for(t: GpuLimitType) -> Self {
|
pub fn default_for(t: GpuLimitType) -> Self {
|
||||||
match t {
|
match t {
|
||||||
GpuLimitType::SteamDeck | GpuLimitType::SteamDeckAdvance => Self::default_steam_deck(),
|
GpuLimitType::SteamDeck => Self::default_steam_deck(),
|
||||||
GpuLimitType::SteamDeckOLED => Self::default_steam_deck_oled(),
|
GpuLimitType::SteamDeckOLED => Self::default_steam_deck_oled(),
|
||||||
GpuLimitType::DevMode => Self::default_dev_mode(),
|
GpuLimitType::DevMode => Self::default_dev_mode(),
|
||||||
_t => Self::default(),
|
_t => Self::default(),
|
||||||
|
|
|
@ -337,7 +337,7 @@ fn main() -> Result<(), ()> {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
std::thread::spawn(|| {
|
std::thread::spawn(|| {
|
||||||
utility::ioperm_power_ec();
|
utility::ioperm_power_ec();
|
||||||
settings::steam_deck::util::flash_led();
|
settings::steam_deck::flash_led();
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Err(e) = loaded_settings.on_set() {
|
if let Err(e) = loaded_settings.on_set() {
|
||||||
|
|
|
@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize};
|
||||||
pub enum DriverJson {
|
pub enum DriverJson {
|
||||||
#[serde(rename = "steam-deck", alias = "gabe-boy")]
|
#[serde(rename = "steam-deck", alias = "gabe-boy")]
|
||||||
SteamDeck,
|
SteamDeck,
|
||||||
#[serde(rename = "steam-deck-oc", alias = "gabe-boy-advance")]
|
#[serde(rename = "steam-deck-oled", alias = "gabe-boy-sp")]
|
||||||
SteamDeckAdvance,
|
SteamDeckOLED,
|
||||||
#[serde(rename = "generic")]
|
#[serde(rename = "generic")]
|
||||||
Generic,
|
Generic,
|
||||||
#[serde(rename = "generic-amd")]
|
#[serde(rename = "generic-amd")]
|
||||||
|
|
|
@ -156,14 +156,14 @@ pub fn auto_detect0(
|
||||||
settings.cpus.clone(),
|
settings.cpus.clone(),
|
||||||
settings.version,
|
settings.version,
|
||||||
relevant_limits.cpu.limits,
|
relevant_limits.cpu.limits,
|
||||||
))
|
).variant(super::super::steam_deck::Model::LCD))
|
||||||
}
|
}
|
||||||
CpuLimitType::SteamDeckAdvance => {
|
CpuLimitType::SteamDeckOLED => {
|
||||||
Box::new(crate::settings::steam_deck::Cpus::from_json_and_limits(
|
Box::new(crate::settings::steam_deck::Cpus::from_json_and_limits(
|
||||||
settings.cpus.clone(),
|
settings.cpus.clone(),
|
||||||
settings.version,
|
settings.version,
|
||||||
relevant_limits.cpu.limits,
|
relevant_limits.cpu.limits,
|
||||||
))
|
).variant(super::super::steam_deck::Model::OLED))
|
||||||
}
|
}
|
||||||
CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::<
|
CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::<
|
||||||
crate::settings::generic::Cpu,
|
crate::settings::generic::Cpu,
|
||||||
|
@ -201,21 +201,14 @@ pub fn auto_detect0(
|
||||||
settings.gpu.clone(),
|
settings.gpu.clone(),
|
||||||
settings.version,
|
settings.version,
|
||||||
relevant_limits.gpu.limits,
|
relevant_limits.gpu.limits,
|
||||||
))
|
).variant(super::super::steam_deck::Model::LCD))
|
||||||
}
|
|
||||||
GpuLimitType::SteamDeckAdvance => {
|
|
||||||
Box::new(crate::settings::steam_deck::Gpu::from_json_and_limits(
|
|
||||||
settings.gpu.clone(),
|
|
||||||
settings.version,
|
|
||||||
relevant_limits.gpu.limits,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
GpuLimitType::SteamDeckOLED => {
|
GpuLimitType::SteamDeckOLED => {
|
||||||
Box::new(crate::settings::steam_deck::Gpu::from_json_and_limits(
|
Box::new(crate::settings::steam_deck::Gpu::from_json_and_limits(
|
||||||
settings.gpu.clone(),
|
settings.gpu.clone(),
|
||||||
settings.version,
|
settings.version,
|
||||||
relevant_limits.gpu.limits,
|
relevant_limits.gpu.limits,
|
||||||
))
|
).variant(super::super::steam_deck::Model::OLED))
|
||||||
}
|
}
|
||||||
GpuLimitType::Generic => {
|
GpuLimitType::Generic => {
|
||||||
Box::new(crate::settings::generic::Gpu::from_json_and_limits(
|
Box::new(crate::settings::generic::Gpu::from_json_and_limits(
|
||||||
|
@ -252,14 +245,14 @@ pub fn auto_detect0(
|
||||||
settings.battery.clone(),
|
settings.battery.clone(),
|
||||||
settings.version,
|
settings.version,
|
||||||
relevant_limits.battery.limits,
|
relevant_limits.battery.limits,
|
||||||
))
|
).variant(super::super::steam_deck::Model::LCD))
|
||||||
}
|
}
|
||||||
BatteryLimitType::SteamDeckAdvance => {
|
BatteryLimitType::SteamDeckOLED => {
|
||||||
Box::new(crate::settings::steam_deck::Battery::from_json_and_limits(
|
Box::new(crate::settings::steam_deck::Battery::from_json_and_limits(
|
||||||
settings.battery.clone(),
|
settings.battery.clone(),
|
||||||
settings.version,
|
settings.version,
|
||||||
relevant_limits.battery.limits,
|
relevant_limits.battery.limits,
|
||||||
))
|
).variant(super::super::steam_deck::Model::OLED))
|
||||||
}
|
}
|
||||||
BatteryLimitType::Generic => Box::new(
|
BatteryLimitType::Generic => Box::new(
|
||||||
crate::settings::generic::Battery::from_json_and_limits(
|
crate::settings::generic::Battery::from_json_and_limits(
|
||||||
|
@ -293,10 +286,10 @@ pub fn auto_detect0(
|
||||||
} else {
|
} else {
|
||||||
let cpu_driver: Box<dyn TCpus> = match relevant_limits.cpu.provider {
|
let cpu_driver: Box<dyn TCpus> = match relevant_limits.cpu.provider {
|
||||||
CpuLimitType::SteamDeck => {
|
CpuLimitType::SteamDeck => {
|
||||||
Box::new(crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits))
|
Box::new(crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits).variant(super::super::steam_deck::Model::LCD))
|
||||||
}
|
}
|
||||||
CpuLimitType::SteamDeckAdvance => {
|
CpuLimitType::SteamDeckOLED => {
|
||||||
Box::new(crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits))
|
Box::new(crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits).variant(super::super::steam_deck::Model::OLED))
|
||||||
}
|
}
|
||||||
CpuLimitType::Generic => {
|
CpuLimitType::Generic => {
|
||||||
Box::new(crate::settings::generic::Cpus::<
|
Box::new(crate::settings::generic::Cpus::<
|
||||||
|
@ -315,13 +308,10 @@ pub fn auto_detect0(
|
||||||
};
|
};
|
||||||
let gpu_driver: Box<dyn TGpu> = match relevant_limits.gpu.provider {
|
let gpu_driver: Box<dyn TGpu> = match relevant_limits.gpu.provider {
|
||||||
GpuLimitType::SteamDeck => {
|
GpuLimitType::SteamDeck => {
|
||||||
Box::new(crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits))
|
Box::new(crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits).variant(super::super::steam_deck::Model::LCD))
|
||||||
}
|
|
||||||
GpuLimitType::SteamDeckAdvance => {
|
|
||||||
Box::new(crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits))
|
|
||||||
}
|
}
|
||||||
GpuLimitType::SteamDeckOLED => {
|
GpuLimitType::SteamDeckOLED => {
|
||||||
Box::new(crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits))
|
Box::new(crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits).variant(super::super::steam_deck::Model::OLED))
|
||||||
}
|
}
|
||||||
GpuLimitType::Generic => {
|
GpuLimitType::Generic => {
|
||||||
Box::new(crate::settings::generic::Gpu::from_limits(relevant_limits.gpu.limits))
|
Box::new(crate::settings::generic::Gpu::from_limits(relevant_limits.gpu.limits))
|
||||||
|
@ -338,10 +328,10 @@ pub fn auto_detect0(
|
||||||
};
|
};
|
||||||
let battery_driver: Box<dyn TBattery> = match relevant_limits.battery.provider {
|
let battery_driver: Box<dyn TBattery> = match relevant_limits.battery.provider {
|
||||||
BatteryLimitType::SteamDeck => {
|
BatteryLimitType::SteamDeck => {
|
||||||
Box::new(crate::settings::steam_deck::Battery::from_limits(relevant_limits.battery.limits))
|
Box::new(crate::settings::steam_deck::Battery::from_limits(relevant_limits.battery.limits).variant(super::super::steam_deck::Model::LCD))
|
||||||
}
|
}
|
||||||
BatteryLimitType::SteamDeckAdvance => {
|
BatteryLimitType::SteamDeckOLED => {
|
||||||
Box::new(crate::settings::steam_deck::Battery::from_limits(relevant_limits.battery.limits))
|
Box::new(crate::settings::steam_deck::Battery::from_limits(relevant_limits.battery.limits).variant(super::super::steam_deck::Model::OLED))
|
||||||
}
|
}
|
||||||
BatteryLimitType::Generic => {
|
BatteryLimitType::Generic => {
|
||||||
Box::new(crate::settings::generic::Battery::from_limits(relevant_limits.battery.limits))
|
Box::new(crate::settings::generic::Battery::from_limits(relevant_limits.battery.limits))
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl Driver {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn maybe_do_button() {
|
pub fn maybe_do_button() {
|
||||||
match super::auto_detect_provider() {
|
match super::auto_detect_provider() {
|
||||||
DriverJson::SteamDeck | DriverJson::SteamDeckAdvance => {
|
DriverJson::SteamDeck | DriverJson::SteamDeckOLED => {
|
||||||
crate::settings::steam_deck::flash_led();
|
crate::settings::steam_deck::flash_led();
|
||||||
}
|
}
|
||||||
DriverJson::Generic | DriverJson::GenericAMD => {
|
DriverJson::Generic | DriverJson::GenericAMD => {
|
||||||
|
|
|
@ -23,6 +23,7 @@ pub struct Battery {
|
||||||
sysfs_bat: PowerSupplyPath,
|
sysfs_bat: PowerSupplyPath,
|
||||||
sysfs_hwmon: Arc<HwMonPath>,
|
sysfs_hwmon: Arc<HwMonPath>,
|
||||||
bat_ec: Arc<Mutex<UnnamedPowerEC>>,
|
bat_ec: Arc<Mutex<UnnamedPowerEC>>,
|
||||||
|
variant: super::Model,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -542,6 +543,11 @@ impl Battery {
|
||||||
self.events.clone()
|
self.events.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn variant(mut self, model: super::Model) -> Self {
|
||||||
|
self.variant = model;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<BatteryJson> for Battery {
|
impl Into<BatteryJson> for Battery {
|
||||||
|
@ -579,6 +585,7 @@ impl ProviderBuilder<BatteryJson, GenericBatteryLimit> for Battery {
|
||||||
sysfs_bat: Self::find_battery_sysfs(None::<&'static str>),
|
sysfs_bat: Self::find_battery_sysfs(None::<&'static str>),
|
||||||
sysfs_hwmon: hwmon_sys,
|
sysfs_hwmon: hwmon_sys,
|
||||||
bat_ec: ec,
|
bat_ec: ec,
|
||||||
|
variant: super::Model::LCD,
|
||||||
}.remove_charge_limit_instructions(),
|
}.remove_charge_limit_instructions(),
|
||||||
_ => Self {
|
_ => Self {
|
||||||
charge_rate: persistent.charge_rate,
|
charge_rate: persistent.charge_rate,
|
||||||
|
@ -597,6 +604,7 @@ impl ProviderBuilder<BatteryJson, GenericBatteryLimit> for Battery {
|
||||||
sysfs_bat: Self::find_battery_sysfs(None::<&'static str>),
|
sysfs_bat: Self::find_battery_sysfs(None::<&'static str>),
|
||||||
sysfs_hwmon: hwmon_sys,
|
sysfs_hwmon: hwmon_sys,
|
||||||
bat_ec: ec,
|
bat_ec: ec,
|
||||||
|
variant: super::Model::LCD,
|
||||||
}.remove_charge_limit_instructions(),
|
}.remove_charge_limit_instructions(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,6 +620,7 @@ impl ProviderBuilder<BatteryJson, GenericBatteryLimit> for Battery {
|
||||||
sysfs_bat: Self::find_battery_sysfs(None::<&'static str>),
|
sysfs_bat: Self::find_battery_sysfs(None::<&'static str>),
|
||||||
sysfs_hwmon: Arc::new(Self::find_hwmon_sysfs(None::<&'static str>)),
|
sysfs_hwmon: Arc::new(Self::find_hwmon_sysfs(None::<&'static str>)),
|
||||||
bat_ec: Arc::new(Mutex::new(UnnamedPowerEC::new())),
|
bat_ec: Arc::new(Mutex::new(UnnamedPowerEC::new())),
|
||||||
|
variant: super::Model::LCD,
|
||||||
}.remove_charge_limit_instructions()
|
}.remove_charge_limit_instructions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,6 +815,9 @@ impl TBattery for Battery {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::SteamDeck
|
match self.variant {
|
||||||
|
super::Model::LCD => crate::persist::DriverJson::SteamDeck,
|
||||||
|
super::Model::OLED => crate::persist::DriverJson::SteamDeckOLED,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub struct Cpus {
|
||||||
pub smt: bool,
|
pub smt: bool,
|
||||||
pub smt_capable: bool,
|
pub smt_capable: bool,
|
||||||
pub(super) limits: GenericCpusLimit,
|
pub(super) limits: GenericCpusLimit,
|
||||||
|
variant: super::Model,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OnSet for Cpus {
|
impl OnSet for Cpus {
|
||||||
|
@ -100,6 +101,11 @@ impl Cpus {
|
||||||
Err(_) => (false, false),
|
Err(_) => (false, false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn variant(mut self, model: super::Model) -> Self {
|
||||||
|
self.variant = model;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProviderBuilder<Vec<CpuJson>, GenericCpusLimit> for Cpus {
|
impl ProviderBuilder<Vec<CpuJson>, GenericCpusLimit> for Cpus {
|
||||||
|
@ -144,6 +150,7 @@ impl ProviderBuilder<Vec<CpuJson>, GenericCpusLimit> for Cpus {
|
||||||
smt: smt_guess,
|
smt: smt_guess,
|
||||||
smt_capable: can_smt,
|
smt_capable: can_smt,
|
||||||
limits: limits,
|
limits: limits,
|
||||||
|
variant: super::Model::LCD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +175,7 @@ impl ProviderBuilder<Vec<CpuJson>, GenericCpusLimit> for Cpus {
|
||||||
smt: true,
|
smt: true,
|
||||||
smt_capable: can_smt,
|
smt_capable: can_smt,
|
||||||
limits: limits,
|
limits: limits,
|
||||||
|
variant: super::Model::LCD,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Self {
|
Self {
|
||||||
|
@ -175,6 +183,7 @@ impl ProviderBuilder<Vec<CpuJson>, GenericCpusLimit> for Cpus {
|
||||||
smt: false,
|
smt: false,
|
||||||
smt_capable: false,
|
smt_capable: false,
|
||||||
limits: limits,
|
limits: limits,
|
||||||
|
variant: super::Model::LCD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +227,10 @@ impl TCpus for Cpus {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::SteamDeck
|
match self.variant {
|
||||||
|
super::Model::LCD => crate::persist::DriverJson::SteamDeck,
|
||||||
|
super::Model::OLED => crate::persist::DriverJson::SteamDeckOLED,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ pub struct Gpu {
|
||||||
limits: GenericGpuLimit,
|
limits: GenericGpuLimit,
|
||||||
state: crate::state::steam_deck::Gpu,
|
state: crate::state::steam_deck::Gpu,
|
||||||
sysfs_card: BasicEntityPath,
|
sysfs_card: BasicEntityPath,
|
||||||
sysfs_hwmon: HwMonPath
|
sysfs_hwmon: HwMonPath,
|
||||||
|
variant: super::Model,
|
||||||
}
|
}
|
||||||
|
|
||||||
// same as CPU
|
// same as CPU
|
||||||
|
@ -346,6 +347,11 @@ impl Gpu {
|
||||||
self.memory_clock = Some(mem_clock.clamp(self.limits.memory_clock.and_then(|lim| lim.min).unwrap_or(MIN_MEMORY_CLOCK), self.limits.memory_clock.and_then(|lim| lim.max).unwrap_or(MAX_MEMORY_CLOCK)));
|
self.memory_clock = Some(mem_clock.clamp(self.limits.memory_clock.and_then(|lim| lim.min).unwrap_or(MIN_MEMORY_CLOCK), self.limits.memory_clock.and_then(|lim| lim.max).unwrap_or(MAX_MEMORY_CLOCK)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn variant(mut self, model: super::Model) -> Self {
|
||||||
|
self.variant = model;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<GpuJson> for Gpu {
|
impl Into<GpuJson> for Gpu {
|
||||||
|
@ -375,6 +381,7 @@ impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
|
||||||
state: crate::state::steam_deck::Gpu::default(),
|
state: crate::state::steam_deck::Gpu::default(),
|
||||||
sysfs_card: Self::find_card_sysfs(persistent.root.clone()),
|
sysfs_card: Self::find_card_sysfs(persistent.root.clone()),
|
||||||
sysfs_hwmon: Self::find_hwmon_sysfs(persistent.root),
|
sysfs_hwmon: Self::find_hwmon_sysfs(persistent.root),
|
||||||
|
variant: super::Model::LCD,
|
||||||
},
|
},
|
||||||
_ => Self {
|
_ => Self {
|
||||||
fast_ppt: persistent.fast_ppt,
|
fast_ppt: persistent.fast_ppt,
|
||||||
|
@ -385,6 +392,7 @@ impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
|
||||||
state: crate::state::steam_deck::Gpu::default(),
|
state: crate::state::steam_deck::Gpu::default(),
|
||||||
sysfs_card: Self::find_card_sysfs(persistent.root.clone()),
|
sysfs_card: Self::find_card_sysfs(persistent.root.clone()),
|
||||||
sysfs_hwmon: Self::find_hwmon_sysfs(persistent.root),
|
sysfs_hwmon: Self::find_hwmon_sysfs(persistent.root),
|
||||||
|
variant: super::Model::LCD,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,6 +407,7 @@ impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
|
||||||
state: crate::state::steam_deck::Gpu::default(),
|
state: crate::state::steam_deck::Gpu::default(),
|
||||||
sysfs_card: Self::find_card_sysfs(None::<&'static str>),
|
sysfs_card: Self::find_card_sysfs(None::<&'static str>),
|
||||||
sysfs_hwmon: Self::find_hwmon_sysfs(None::<&'static str>),
|
sysfs_hwmon: Self::find_hwmon_sysfs(None::<&'static str>),
|
||||||
|
variant: super::Model::LCD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +494,10 @@ impl TGpu for Gpu {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provider(&self) -> crate::persist::DriverJson {
|
fn provider(&self) -> crate::persist::DriverJson {
|
||||||
crate::persist::DriverJson::SteamDeck
|
match self.variant {
|
||||||
|
super::Model::LCD => crate::persist::DriverJson::SteamDeck,
|
||||||
|
super::Model::OLED => crate::persist::DriverJson::SteamDeckOLED,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@ mod battery;
|
||||||
mod cpu;
|
mod cpu;
|
||||||
mod gpu;
|
mod gpu;
|
||||||
mod power_dpm_force;
|
mod power_dpm_force;
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
pub mod util;
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
pub use battery::Battery;
|
pub use battery::Battery;
|
||||||
|
@ -12,6 +9,12 @@ pub use cpu::Cpus;
|
||||||
pub use gpu::Gpu;
|
pub use gpu::Gpu;
|
||||||
pub(self) use power_dpm_force::{POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT, DPM_FORCE_LIMITS_ATTRIBUTE};
|
pub(self) use power_dpm_force::{POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT, DPM_FORCE_LIMITS_ATTRIBUTE};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub enum Model {
|
||||||
|
LCD,
|
||||||
|
OLED,
|
||||||
|
}
|
||||||
|
|
||||||
pub use util::flash_led;
|
pub use util::flash_led;
|
||||||
|
|
||||||
fn _impl_checker() {
|
fn _impl_checker() {
|
||||||
|
|
Loading…
Reference in a new issue