Skip to content

Commit ed33374

Browse files
committed
Add support for EC_CMD_REBOOT_AP_ON_G3
Reset AP after entering G3 by the EC after configurable delay. V0 resets immediately. Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 00023c5 commit ed33374

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

framework_lib/src/chromium_ec/command.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ pub enum EcCommands {
5353
/// Get information about PD controller power
5454
UsbPdPowerInfo = 0x0103,
5555
AdcRead = 0x0123,
56+
ApReset = 0x0125,
57+
LocateChip = 0x0126,
58+
RebootApOnG3 = 0x0127,
5659
RgbKbdSetColor = 0x013A,
5760
RgbKbd = 0x013B,
5861

framework_lib/src/chromium_ec/commands.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,33 @@ impl EcRequest<EcResponseAdcRead> for EcRequestAdcRead {
879879
}
880880
}
881881

882+
#[repr(C)]
883+
pub struct EcRequestRebootApOnG3V0 {}
884+
885+
impl EcRequest<()> for EcRequestRebootApOnG3V0 {
886+
fn command_id() -> EcCommands {
887+
EcCommands::RebootApOnG3
888+
}
889+
fn command_version() -> u8 {
890+
0
891+
}
892+
}
893+
894+
#[repr(C)]
895+
pub struct EcRequestRebootApOnG3V1 {
896+
/// Delay in seconds after entering G3 state
897+
pub delay: u32,
898+
}
899+
900+
impl EcRequest<()> for EcRequestRebootApOnG3V1 {
901+
fn command_id() -> EcCommands {
902+
EcCommands::RebootApOnG3
903+
}
904+
fn command_version() -> u8 {
905+
1
906+
}
907+
}
908+
882909
// TODO: Actually 128, but if we go above ~80 EC returns REQUEST_TRUNCATED
883910
// At least when I use the portio driver
884911
pub const EC_RGBKBD_MAX_KEY_COUNT: usize = 64;

0 commit comments

Comments
 (0)