Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ sensors and number of fans, so your output may look different:
F75303_DDR: 39 C
APU: 62 C
API Fan: 0 RPM
AP Throttle Status
Soft: false
Hard: false
```

## Check sensors
Expand Down
2 changes: 2 additions & 0 deletions framework_lib/src/chromium_ec/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ pub enum EcCommands {
ProgramGpuEeprom = 0x3E1F,
/// Get battery cutoff (ship mode) status
GetCutoffStatus = 0x3E21,
/// This command return the AP throttle status
GetApThrottleStatus = 0x3E22,
/// Get PD port state from Cypress PD controller
GetPdPortState = 0x3E23,
/// Read board ID of specific ADC channel
Expand Down
16 changes: 16 additions & 0 deletions framework_lib/src/chromium_ec/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1787,3 +1787,19 @@ impl EcRequest<EcResponseReadBoardId> for EcRequestReadBoardId {
EcCommands::ReadBoardId
}
}

#[repr(C, packed)]
pub struct EcRequestGetApThrottleStatus {}

#[repr(C, packed)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct EcResponseGetApThrottleStatus {
pub soft_ap_throttle: u8,
pub hard_ap_throttle: u8,
}

impl EcRequest<EcResponseGetApThrottleStatus> for EcRequestGetApThrottleStatus {
fn command_id() -> EcCommands {
EcCommands::GetApThrottleStatus
}
}
4 changes: 4 additions & 0 deletions framework_lib/src/chromium_ec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,10 @@ impl CrosEc {
}
Ok(())
}

pub fn get_ap_throttle_status(&self) -> EcResult<EcResponseGetApThrottleStatus> {
EcRequestGetApThrottleStatus {}.send_command(self)
}
}

#[cfg_attr(not(feature = "uefi"), derive(clap::ValueEnum))]
Expand Down
8 changes: 8 additions & 0 deletions framework_lib/src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ pub fn print_thermal(ec: &CrosEc) {
println!(" {name:<11} {:>4} RPM", fan);
}
}

println!(" AP Throttle Status");
if let Ok(throttle) = ec.get_ap_throttle_status() {
println!(" Soft: {:?}", throttle.soft_ap_throttle == 1);
println!(" Hard: {:?}", throttle.hard_ap_throttle == 1);
} else {
println!(" Unknown");
}
}

pub fn get_fan_num(ec: &CrosEc) -> EcResult<usize> {
Expand Down
Loading