Skip to content

Commit d767742

Browse files
Merge pull request #181 from FrameworkComputer/resetg3
Add support for EC_CMD_REBOOT_AP_ON_G3
2 parents 7114177 + 1acf72b commit d767742

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-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: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,42 @@ impl EcRequest<EcResponseAdcRead> for EcRequestAdcRead {
879879
}
880880
}
881881

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

0 commit comments

Comments
 (0)