Skip to content

Commit

Permalink
tgl: Don't get PD version from EC
Browse files Browse the repository at this point in the history
That EC command is not supported on TGL.

Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Oct 21, 2024
1 parent 6fd13f2 commit bc44172
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,14 @@ fn selftest(ec: &CrosEc) -> Option<()> {
return None;
}

// Try to get PD versions through EC
power::read_pd_version(ec).ok()?;
println!("Reading PD Version from EC");
if let Err(err) = power::read_pd_version(ec) {
// TGL does not have this command, so we have to ignore it
if err != EcError::Response(EcResponseStatus::InvalidCommand) {
println!("Err: {:?}", err);
return None;
}
}

let pd_01 = PdController::new(PdPort::Left01, ec.clone());
let pd_23 = PdController::new(PdPort::Right23, ec.clone());
Expand Down
1 change: 1 addition & 0 deletions framework_lib/src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ pub fn print_memmap_version_info(ec: &CrosEc) {
let _events_ver = ec.read_memory(EC_MEMMAP_EVENTS_VERSION, 2).unwrap();
}

/// Not supported on TGL EC
pub fn get_als_reading(ec: &CrosEc) -> Option<u32> {
let als = ec.read_memory(EC_MEMMAP_ALS, 0x04)?;
Some(u32::from_le_bytes([als[0], als[1], als[2], als[3]]))
Expand Down

0 comments on commit bc44172

Please sign in to comment.