Skip to content

Commit 59b0de8

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

2 files changed

Lines changed: 83 additions & 9 deletions

File tree

framework_lib/src/chromium_ec/command.rs

Lines changed: 16 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,6 +112,12 @@ 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,
118+
PdPortState = 0x3E23,
119+
BatteryExtender = 0x3E24,
120+
WakeOnLan = 0x3E25,
113121
/// Read board ID of specific ADC channel
114122
ReadBoardId = 0x3E26,
115123
}

framework_lib/src/chromium_ec/commands.rs

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,18 @@ impl EcRequest<EcResponseFlashNotify> for EcRequestFlashNotify {
11201120
}
11211121
}
11221122

1123+
#[repr(C, packed)]
1124+
pub struct EcRequestSetApRebootDelay {
1125+
/// Range 1 - 180 seconds
1126+
pub delay: u8,
1127+
}
1128+
1129+
impl EcRequest<()> for EcRequestSetApRebootDelay {
1130+
fn command_id() -> EcCommands {
1131+
EcCommands::SetApRebootDelay
1132+
}
1133+
}
1134+
11231135
#[repr(C, packed)]
11241136
pub struct KeyboardMatrixMap {
11251137
pub row: u8,
@@ -1139,12 +1151,26 @@ pub struct EcResponseUpdateKeyboardMatrix {
11391151
pub scan_update: [KeyboardMatrixMap; 32],
11401152
}
11411153

1142-
impl EcRequest<EcResponseUpdateKeyboardMatrix> for EcRequestUpdateKeyboardMatrix {
1154+
impl EcRequest<()> for EcRequestUpdateKeyboardMatrix {
11431155
fn command_id() -> EcCommands {
11441156
EcCommands::UpdateKeyboardMatrix
11451157
}
11461158
}
11471159

1160+
#[repr(C, packed)]
1161+
pub struct EcRequestVProControl {}
1162+
1163+
#[repr(C, packed)]
1164+
pub struct EcResponseVProControl {
1165+
pub vpro_on: u8,
1166+
}
1167+
1168+
impl EcRequest<EcResponseVProControl> for EcRequestVProControl {
1169+
fn command_id() -> EcCommands {
1170+
EcCommands::VProControl
1171+
}
1172+
}
1173+
11481174
#[repr(C, packed)]
11491175
pub struct EcRequestChassisOpenCheck {}
11501176

@@ -1694,3 +1720,43 @@ impl EcRequest<EcResponseReadBoardId> for EcRequestReadBoardId {
16941720
EcCommands::ReadBoardId
16951721
}
16961722
}
1723+
1724+
#[repr(C, packed)]
1725+
pub struct EcRequestFingerprintControl {
1726+
pub enable: u8,
1727+
}
1728+
1729+
impl EcRequest<()> for EcRequestFingerprintControl {
1730+
fn command_id() -> EcCommands {
1731+
EcCommands::FpControl
1732+
}
1733+
}
1734+
1735+
#[repr(C, packed)]
1736+
pub struct EcRequestGetCutoffStatus {}
1737+
1738+
#[repr(C, packed)]
1739+
pub struct EcResponseGetCutoffStatus {
1740+
pub status: u8,
1741+
}
1742+
1743+
impl EcRequest<EcResponseGetCutoffStatus> for EcRequestGetCutoffStatus {
1744+
fn command_id() -> EcCommands {
1745+
EcCommands::GetCutoffStatus
1746+
}
1747+
}
1748+
1749+
#[repr(C, packed)]
1750+
pub struct EcRequestGetApThrottleStatus {}
1751+
1752+
#[repr(C, packed)]
1753+
pub struct EcResponseGetApThrottleStatus {
1754+
pub soft_ap_throttle: u8,
1755+
pub hard_ap_throttle: u8,
1756+
}
1757+
1758+
impl EcRequest<EcResponseGetApThrottleStatus> for EcRequestGetApThrottleStatus {
1759+
fn command_id() -> EcCommands {
1760+
EcCommands::GetApThrottleStatus
1761+
}
1762+
}

0 commit comments

Comments
 (0)