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 8ff67b6 commit 9bbdbf6
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 @@ -943,8 +943,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 @@ -194,6 +194,7 @@ pub fn print_memmap_version_info(ec: &CrosEc) {
pub fn print_sensors(ec: &CrosEc) {
let als = ec.read_memory(EC_MEMMAP_ALS, 0x04).unwrap();

// Not supported on TGL EC
let als_int = u32::from_le_bytes([als[0], als[1], als[2], als[3]]);
println!("ALS: {:>4} Lux", als_int);
}
Expand Down

0 comments on commit 9bbdbf6

Please sign in to comment.