From c49ad0c15a3f4757ba7ffecec763e66b63479696 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 7 May 2025 13:49:50 +0800 Subject: [PATCH 1/3] --thermal: Add Framework 12 charger IC temp ``` > sudo framework_tool --thermal F75303_CPU: 35 C F75303_Skin: 33 C F75303_Local: 33 C Battery: 33 C PECI: 51 C Charger IC 32 C Fan Speed: 0 RPM ``` Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index bb3e9ea4..266d4f07 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -340,6 +340,7 @@ 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])); } Some( From 8a6249fa2e7a2f38406af27738cb5f1b683f06c9 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 7 May 2025 13:59:20 +0800 Subject: [PATCH 2/3] --thermal: Print sensors we don't know about, if present Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index 266d4f07..4868ba24 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -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, @@ -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])); @@ -324,6 +324,7 @@ pub fn print_thermal(ec: &CrosEc) { ) { println!(" F57397_VCCGT: {:>4}", TempSensor::from(temps[5])); } + 2 } Some(Platform::IntelCoreUltra1) => { @@ -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) => { @@ -341,6 +343,7 @@ pub fn print_thermal(ec: &CrosEc) { println!(" Battery: {:>4}", TempSensor::from(temps[3])); println!(" PECI: {:>4}", TempSensor::from(temps[4])); println!(" Charger IC {:>4}", TempSensor::from(temps[5])); + 2 } Some( @@ -357,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 } } @@ -365,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 } _ => { @@ -376,6 +383,15 @@ 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); } } From b80e2cba6e783550d342670a4aa51eed12232da1 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 7 May 2025 14:15:17 +0800 Subject: [PATCH 3/3] --thermal: Align RPM with C ``` sudo framework_tool --thermal F75303_CPU: 36 C F75303_Skin: 34 C F75303_Local: 33 C Battery: 31 C PECI: 53 C Charger IC 30 C Fan Speed: 0 RPM ``` Signed-off-by: Daniel Schaefer --- framework_lib/src/power.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework_lib/src/power.rs b/framework_lib/src/power.rs index 4868ba24..df0d8031 100644 --- a/framework_lib/src/power.rs +++ b/framework_lib/src/power.rs @@ -398,11 +398,11 @@ pub fn print_thermal(ec: &CrosEc) { 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); } } }