Skip to main content

Module ec

Module ec 

Source
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.