Skip to content

Commit 917d885

Browse files
committed
chromium_ec: Add all Framework host commands
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent b905a83 commit 917d885

2 files changed

Lines changed: 82 additions & 9 deletions

File tree

framework_lib/src/chromium_ec/command.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,29 @@ pub enum EcCommands {
6565
// Framework specific commands
6666
/// Configure the behavior of the flash notify
6767
FlashNotified = 0x3E01,
68+
FactoryMode = 0x3E02,
6869
/// Change charge limit
6970
ChargeLimitControl = 0x3E03,
71+
SetApRebootDelay = 0x30E4,
72+
PwmGetFanActualRpm = 0x30E5,
73+
NonAcpiNotify = 0x3E07,
7074
DisablePs2Emulation = 0x3E08,
75+
/// Get information about historical chassis open/close (intrusion) information
76+
ChassisIntrusion = 0x3E09,
77+
/// See GetHwDiag for a more powerful version
78+
Diagnosis = 0x3E0B,
7179
UpdateKeyboardMatrix = 0x3E0C,
80+
VProControl = 0x3E0D,
7281
/// Get/Set Fingerprint LED brightness
7382
FpLedLevelControl = 0x3E0E,
7483
/// Get information about the current chassis open/close status
7584
ChassisOpenCheck = 0x3E0F,
76-
/// Get information about historical chassis open/close (intrusion) information
77-
ChassisIntrusion = 0x3E09,
7885
/// Control and check retimer modes (firmware update and compliance)
7986
RetimerControl = 0x3E0A,
8087

81-
/// Not used by this library
82-
AcpiNotify = 0xE10,
83-
88+
AcpiNotify = 0x3E10,
8489
/// Get information about PD controller version
8590
ReadPdVersion = 0x3E11,
86-
87-
/// Not used by this library
8891
StandaloneMode = 0x3E13,
8992
/// Get information about current state of privacy switches
9093
PriavcySwitchesCheckMode = 0x3E14,
@@ -96,7 +99,6 @@ pub enum EcCommands {
9699
GetSimpleVersion = 0x3E17,
97100
/// GetActiveChargePdChip
98101
GetActiveChargePdChip = 0x3E18,
99-
100102
/// Set UEFI App mode
101103
UefiAppMode = 0x3E19,
102104
/// Get UEFI APP Button status
@@ -110,8 +112,13 @@ pub enum EcCommands {
110112
GetGpuPcie = 0x3E1E,
111113
/// Set gpu bay serial and program structure
112114
ProgramGpuEeprom = 0x3E1F,
115+
FpControl = 0x3E20,
116+
GetCutoffStatus = 0x3E21,
117+
GetApThrottleStatus = 0x3E22,
113118
/// Get PD port state from Cypress PD controller
114119
GetPdPortState = 0x3E23,
120+
BatteryExtender = 0x3E24,
121+
WakeOnLan = 0x3E25,
115122
/// Read board ID of specific ADC channel
116123
ReadBoardId = 0x3E26,
117124
}

framework_lib/src/chromium_ec/commands.rs

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,18 @@ impl EcRequest<EcResponseFlashNotify> for EcRequestFlashNotify {
11301130
}
11311131
}
11321132

1133+
#[repr(C, packed)]
1134+
pub struct EcRequestSetApRebootDelay {
1135+
/// Range 1 - 180 seconds
1136+
pub delay: u8,
1137+
}
1138+
1139+
impl EcRequest<()> for EcRequestSetApRebootDelay {
1140+
fn command_id() -> EcCommands {
1141+
EcCommands::SetApRebootDelay
1142+
}
1143+
}
1144+
11331145
#[repr(C, packed)]
11341146
pub struct KeyboardMatrixMap {
11351147
pub row: u8,
@@ -1149,12 +1161,26 @@ pub struct EcResponseUpdateKeyboardMatrix {
11491161
pub scan_update: [KeyboardMatrixMap; 32],
11501162
}
11511163

1152-
impl EcRequest<EcResponseUpdateKeyboardMatrix> for EcRequestUpdateKeyboardMatrix {
1164+
impl EcRequest<()> for EcRequestUpdateKeyboardMatrix {
11531165
fn command_id() -> EcCommands {
11541166
EcCommands::UpdateKeyboardMatrix
11551167
}
11561168
}
11571169

1170+
#[repr(C, packed)]
1171+
pub struct EcRequestVProControl {}
1172+
1173+
#[repr(C, packed)]
1174+
pub struct EcResponseVProControl {
1175+
pub vpro_on: u8,
1176+
}
1177+
1178+
impl EcRequest<EcResponseVProControl> for EcRequestVProControl {
1179+
fn command_id() -> EcCommands {
1180+
EcCommands::VProControl
1181+
}
1182+
}
1183+
11581184
#[repr(C, packed)]
11591185
pub struct EcRequestChassisOpenCheck {}
11601186

@@ -1731,3 +1757,43 @@ impl EcRequest<EcResponseReadBoardId> for EcRequestReadBoardId {
17311757
EcCommands::ReadBoardId
17321758
}
17331759
}
1760+
1761+
#[repr(C, packed)]
1762+
pub struct EcRequestFingerprintControl {
1763+
pub enable: u8,
1764+
}
1765+
1766+
impl EcRequest<()> for EcRequestFingerprintControl {
1767+
fn command_id() -> EcCommands {
1768+
EcCommands::FpControl
1769+
}
1770+
}
1771+
1772+
#[repr(C, packed)]
1773+
pub struct EcRequestGetCutoffStatus {}
1774+
1775+
#[repr(C, packed)]
1776+
pub struct EcResponseGetCutoffStatus {
1777+
pub status: u8,
1778+
}
1779+
1780+
impl EcRequest<EcResponseGetCutoffStatus> for EcRequestGetCutoffStatus {
1781+
fn command_id() -> EcCommands {
1782+
EcCommands::GetCutoffStatus
1783+
}
1784+
}
1785+
1786+
#[repr(C, packed)]
1787+
pub struct EcRequestGetApThrottleStatus {}
1788+
1789+
#[repr(C, packed)]
1790+
pub struct EcResponseGetApThrottleStatus {
1791+
pub soft_ap_throttle: u8,
1792+
pub hard_ap_throttle: u8,
1793+
}
1794+
1795+
impl EcRequest<EcResponseGetApThrottleStatus> for EcRequestGetApThrottleStatus {
1796+
fn command_id() -> EcCommands {
1797+
EcCommands::GetApThrottleStatus
1798+
}
1799+
}

0 commit comments

Comments
 (0)