Skip to content
Merged
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
25 changes: 21 additions & 4 deletions framework_lib/src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const EC_FAN_SPEED_ENTRIES: usize = 4;
const EC_FAN_SPEED_STALLED_DEPRECATED: u16 = 0xFFFE;
const EC_FAN_SPEED_NOT_PRESENT: u16 = 0xFFFF;

#[derive(Debug)]
#[derive(Debug, PartialEq)]
enum TempSensor {
Ok(u8),
NotPresent,
Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn print_thermal(ec: &CrosEc) {
let fans = ec.read_memory(EC_MEMMAP_FAN, 0x08).unwrap();

let platform = smbios::get_platform();
match platform {
let remaining_sensors = match platform {
Some(Platform::IntelGen11) | Some(Platform::IntelGen12) | Some(Platform::IntelGen13) => {
println!(" F75303_Local: {:>4}", TempSensor::from(temps[0]));
println!(" F75303_CPU: {:>4}", TempSensor::from(temps[1]));
Expand All @@ -324,6 +324,7 @@ pub fn print_thermal(ec: &CrosEc) {
) {
println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5]));
}
2
}

Some(Platform::IntelCoreUltra1) => {
Expand All @@ -332,6 +333,7 @@ pub fn print_thermal(ec: &CrosEc) {
println!(" Battery: {:>4}", TempSensor::from(temps[2]));
println!(" F75303_DDR: {:>4}", TempSensor::from(temps[3]));
println!(" PECI: {:>4}", TempSensor::from(temps[4]));
3
}

Some(Platform::Framework12IntelGen13) => {
Expand All @@ -340,6 +342,8 @@ pub fn print_thermal(ec: &CrosEc) {
println!(" F75303_Local: {:>4}", TempSensor::from(temps[2]));
println!(" Battery: {:>4}", TempSensor::from(temps[3]));
println!(" PECI: {:>4}", TempSensor::from(temps[4]));
println!(" Charger IC {:>4}", TempSensor::from(temps[5]));
2
}

Some(
Expand All @@ -356,6 +360,9 @@ pub fn print_thermal(ec: &CrosEc) {
println!(" dGPU VRAM: {:>4}", TempSensor::from(temps[5]));
println!(" dGPU AMB: {:>4}", TempSensor::from(temps[6]));
println!(" dGPU temp: {:>4}", TempSensor::from(temps[7]));
0
} else {
4
}
}

Expand All @@ -364,6 +371,7 @@ pub fn print_thermal(ec: &CrosEc) {
println!(" F75303_DDR: {:>4}", TempSensor::from(temps[1]));
println!(" F75303_AMB: {:>4}", TempSensor::from(temps[2]));
println!(" APU: {:>4}", TempSensor::from(temps[3]));
4
}

_ => {
Expand All @@ -375,17 +383,26 @@ pub fn print_thermal(ec: &CrosEc) {
println!(" Temp 5: {:>4}", TempSensor::from(temps[5]));
println!(" Temp 6: {:>4}", TempSensor::from(temps[6]));
println!(" Temp 7: {:>4}", TempSensor::from(temps[7]));
0
}
};

// Just in case EC has more sensors than we know about, print them
for (i, temp) in temps.iter().enumerate().take(8).skip(8 - remaining_sensors) {
let temp = TempSensor::from(*temp);
if temp != TempSensor::NotPresent {
println!(" Temp {}: {:>4}", i, temp);
}
}

for i in 0..EC_FAN_SPEED_ENTRIES {
let fan = u16::from_le_bytes([fans[i * 2], fans[1 + i * 2]]);
if fan == EC_FAN_SPEED_STALLED_DEPRECATED {
println!(" Fan Speed: {:>4} RPM (Stalled)", fan);
println!(" Fan Speed: {:>4} RPM (Stalled)", fan);
} else if fan == EC_FAN_SPEED_NOT_PRESENT {
info!(" Fan Speed: Not present");
} else {
println!(" Fan Speed: {:>4} RPM", fan);
println!(" Fan Speed: {:>4} RPM", fan);
}
}
}
Expand Down
Loading