Expand description
Embedded Controller (EC) driver for x86.
Provides direct access to the ACPI Embedded Controller via I/O ports 0x62 (data) and 0x66 (command/status). Used for temperature reading, fan control, and battery management on laptops (ThinkPad X13, etc.).
Reference: ACPI Embedded Controller Interface Specification 1.0a
Constantsยง
- EC_
CMD_ ๐QUERY - EC_
CMD_ ๐READ - EC commands.
- EC_
CMD_ ๐WRITE - EC_
DATA_ ๐PORT - EC data port (read/write data bytes).
- EC_
SC_ ๐PORT - EC command/status port (write commands, read status).
- EC_
STATUS_ ๐IBF - EC_
STATUS_ ๐OBF - EC status register bits.
- EC_
STATUS_ ๐SCI - EC_
TIMEOUT ๐ - Maximum number of retries when waiting for EC to become ready.
Staticsยง
- EC_
AVAILABLE ๐ - Whether the EC was detected and initialized successfully.
- EC_LOCK ๐
- Serialize all EC access to prevent interleaved command/data sequences.
Functionsยง
- ec_
query ๐ โ - Query the EC for a pending event. Returns the event byte (Query ID).
- ec_
read_ ๐ โbyte - Read a single byte from an EC register.
- ec_
wait_ ๐ibf - Wait for the EC input buffer to be empty (ready to accept a write).
- ec_
wait_ ๐obf - Wait for the EC output buffer to become full (data available to read).
- ec_
write_ ๐ โbyte - Write a single byte to an EC register.
- has_
sci_ event - Check if there is a pending SCI event in the EC.
- init
- Detect and initialize the Embedded Controller.
- is_
available - Returns whether the EC was detected.
- query_
event - Query a pending EC event (SCI). Returns the query byte.
- read
- Read a byte from an EC register.
- write
- Write a byte to an EC register.