From d10a7825dd089caea4ee9b095e408e7f9ef51e0b Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 26 Jun 2025 00:55:14 +0800 Subject: [PATCH 1/2] Add support for EC_CD_AP_RESET Signed-off-by: Daniel Schaefer --- framework_lib/src/chromium_ec/command.rs | 1 + framework_lib/src/chromium_ec/commands.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/framework_lib/src/chromium_ec/command.rs b/framework_lib/src/chromium_ec/command.rs index e009a9ec..df433da9 100644 --- a/framework_lib/src/chromium_ec/command.rs +++ b/framework_lib/src/chromium_ec/command.rs @@ -53,6 +53,7 @@ pub enum EcCommands { /// Get information about PD controller power UsbPdPowerInfo = 0x0103, AdcRead = 0x0123, + ApReset = 0x0125, RgbKbdSetColor = 0x013A, RgbKbd = 0x013B, diff --git a/framework_lib/src/chromium_ec/commands.rs b/framework_lib/src/chromium_ec/commands.rs index 0a367ab3..65f37482 100644 --- a/framework_lib/src/chromium_ec/commands.rs +++ b/framework_lib/src/chromium_ec/commands.rs @@ -879,6 +879,15 @@ impl EcRequest for EcRequestAdcRead { } } +#[repr(C)] +pub struct EcRequestApReset {} + +impl EcRequest<()> for EcRequestApReset { + fn command_id() -> EcCommands { + EcCommands::ApReset + } +} + // TODO: Actually 128, but if we go above ~80 EC returns REQUEST_TRUNCATED // At least when I use the portio driver pub const EC_RGBKBD_MAX_KEY_COUNT: usize = 64; From 1acf72b21aa5e1c2670dc0fd3d7d88d914e86ece Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 26 Jun 2025 00:55:40 +0800 Subject: [PATCH 2/2] 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 --- framework_lib/src/chromium_ec/command.rs | 2 ++ framework_lib/src/chromium_ec/commands.rs | 27 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/framework_lib/src/chromium_ec/command.rs b/framework_lib/src/chromium_ec/command.rs index df433da9..608f29bc 100644 --- a/framework_lib/src/chromium_ec/command.rs +++ b/framework_lib/src/chromium_ec/command.rs @@ -54,6 +54,8 @@ pub enum EcCommands { UsbPdPowerInfo = 0x0103, AdcRead = 0x0123, ApReset = 0x0125, + LocateChip = 0x0126, + RebootApOnG3 = 0x0127, RgbKbdSetColor = 0x013A, RgbKbd = 0x013B, diff --git a/framework_lib/src/chromium_ec/commands.rs b/framework_lib/src/chromium_ec/commands.rs index 65f37482..48763c06 100644 --- a/framework_lib/src/chromium_ec/commands.rs +++ b/framework_lib/src/chromium_ec/commands.rs @@ -888,6 +888,33 @@ impl EcRequest<()> for EcRequestApReset { } } +#[repr(C)] +pub struct EcRequestRebootApOnG3V0 {} + +impl EcRequest<()> for EcRequestRebootApOnG3V0 { + fn command_id() -> EcCommands { + EcCommands::RebootApOnG3 + } + fn command_version() -> u8 { + 0 + } +} + +#[repr(C)] +pub struct EcRequestRebootApOnG3V1 { + /// Delay in seconds after entering G3 state + pub delay: u32, +} + +impl EcRequest<()> for EcRequestRebootApOnG3V1 { + fn command_id() -> EcCommands { + EcCommands::RebootApOnG3 + } + fn command_version() -> u8 { + 1 + } +} + // TODO: Actually 128, but if we go above ~80 EC returns REQUEST_TRUNCATED // At least when I use the portio driver pub const EC_RGBKBD_MAX_KEY_COUNT: usize = 64;