Skip to content

Commit 9bbdbf6

Browse files
committed
tgl: Don't get PD version from EC
That EC command is not supported on TGL. Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 8ff67b6 commit 9bbdbf6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

framework_lib/src/commandline/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,14 @@ fn selftest(ec: &CrosEc) -> Option<()> {
943943
return None;
944944
}
945945

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

949955
let pd_01 = PdController::new(PdPort::Left01, ec.clone());
950956
let pd_23 = PdController::new(PdPort::Right23, ec.clone());

framework_lib/src/power.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ pub fn print_memmap_version_info(ec: &CrosEc) {
194194
pub fn print_sensors(ec: &CrosEc) {
195195
let als = ec.read_memory(EC_MEMMAP_ALS, 0x04).unwrap();
196196

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

0 commit comments

Comments
 (0)