6.5 KiB
ACPI I2C / I2C-HID Implementation Plan
Goal
Implement a real laptop-class ACPI I2C stack for Red Bear OS, with I2C-HID via ACPI
as the first user-visible deliverable. This is required for modern touchpads, keyboards,
and other embedded input devices that are no longer exposed via PS/2.
The shortest correct path is:
ACPI _CRS decode -> I2C controller ownership -> I2C bus API/scheme -> i2c-hidd ->
inputd integration
This work must be treated as bare-metal boot-critical substrate, not as optional polish.
Current State
What already exists:
acpidhas AML evaluation and a scheme surface for tables, AML symbols, DMI, power, reboot, and PCI registration.hwdalready recognizesPNP0C50asI2C HIDduring ACPI probe, but only as a label.amlserdecan already carry raw AML buffers and the relevant opregion kinds.
What is missing:
- no decoded
_CRSresource parser for ACPI devices - no
/scheme/acpi/...API for decodedI2cSerialBus,GpioInt,GpioIo, or IRQ data - no native I2C controller subsystem
- no native I2C controller drivers for Intel LPSS / AMD laptop paths
- no
i2c-hidd - no completed input path for laptop-class ACPI-attached keyboards and touchpads
Reference Carriers In Local Tree
These Linux sources are reference carriers only. They should guide design and descriptor semantics, but should not be transliterated blindly.
build/linux-kernel-cache/linux-7.0/drivers/hid/i2c-hid/i2c-hid-acpi.cbuild/linux-kernel-cache/linux-7.0/drivers/hid/i2c-hid/i2c-hid-core.cbuild/linux-kernel-cache/linux-7.0/drivers/i2c/i2c-core-acpi.cbuild/linux-kernel-cache/linux-7.0/drivers/acpi/resource.cbuild/linux-kernel-cache/linux-7.0/drivers/mfd/intel-lpss-pci.cbuild/linux-kernel-cache/linux-7.0/drivers/mfd/intel-lpss-acpi.cbuild/linux-kernel-cache/linux-7.0/drivers/i2c/busses/i2c-designware-amdpsp.cbuild/linux-kernel-cache/linux-7.0/drivers/i2c/busses/i2c-amd-mp2-pci.c
Execution Order
Phase A: ACPI _CRS substrate
Deliverables:
- add decoded ACPI resource support in
acpid - expose decoded device resources through
/scheme/acpi - support at minimum:
- IRQ
- Extended IRQ
- GPIO interrupt
- GPIO I/O
I2cSerialBus
Acceptance:
- a consumer can query decoded resources for a device path without reimplementing AML resource decoding
- known laptop devices show valid controller link, slave address, and interrupt metadata
Phase B: Native I2C substrate
Deliverables:
- add a small
i2cdscheme / API - support controller registration, transfers, and per-device addressing
- keep scope tight; do not clone Linux I2C core complexity
Acceptance:
- a userspace daemon can open an adapter and issue I2C transfers using a stable Red Bear API
Phase C: Intel laptop controller path
Deliverables:
- add Intel LPSS / Serial IO I2C controller ownership first
Why first:
- this is the most common modern Intel laptop path for touchpads and keyboards
- it directly unblocks
I2C-HIDon many real machines
Acceptance:
- at least one Intel bare-metal laptop registers a usable I2C adapter from ACPI-described hardware
Phase D: i2c-hidd
Deliverables:
- bind ACPI
PNP0C50/ACPI0C50 - evaluate
_DSMusing the HID-over-I2C GUID to retrieve the HID descriptor address - fetch HID descriptor and report descriptor via I2C
- stream input reports into
inputd
Acceptance:
- at least one laptop touchpad or keyboard produces usable events
Phase E: AMD controller path
Deliverables:
- add AMD laptop-class I2C controller support
- likely DesignWare / MP2 mediated paths depending on platform
Acceptance:
- at least one AMD laptop reaches a functioning internal input device through ACPI I2C
Phase F: Remaining ACPI I2C functions
Deliverables:
_STAgating before bind_INIwhere required_PS0/_PS3best-effort device power transitionsGpioIntandGpioIosemantics for reset, wake, and power sequencing_S0W/ wake-capable handling where hardware requires it- GenericSerialBus / SMBus opregion support only where firmware actually needs it
Acceptance:
- runtime bring-up no longer depends on USB or PS/2 fallback for supported laptops
Design Rules
- prefer a small, explicit Red Bear userspace API over Linux-core emulation
- decode ACPI resources once in
acpid; do not duplicate_CRSparsing in every consumer - make controller ownership data-driven through decoded ACPI resources where possible
- keep laptop input as a boot-resilience feature, not a desktop-only feature
- treat Intel and AMD laptops as equal-priority hardware targets
Other Boot-Relevant I2C Device Classes
I2C-HID is the first and most important I2C deliverable, but it is not the only I2C-related
surface that can matter during boot on modern bare metal.
Highest priority after I2C-HID
- GPIO expanders used to expose reset, enable, interrupt, or wake lines for input devices
- platform-specific I2C controller companions that gate access to the actual
I2C-HIDdevice
These are not always directly user-visible as "devices", but they are boot-relevant whenever the keyboard/touchpad path depends on them.
Sometimes boot-relevant
- USB-C / UCSI / PD related I2C-attached endpoints on platforms where a USB-C attached keyboard or dock path is firmware-mediated and not available without those services
- embedded controller-adjacent I2C peripherals that gate keyboard/touchpad power or wake routing
These should be treated as platform-dependent bring-up work, not as universal phase-1 targets.
Not first-order blockers for reaching login
- sensors (accelerometer, gyro, ambient light)
- battery / charger / fuel-gauge devices
- camera-side I2C devices
- most audio codecs and amplifier control devices
- thermal and fan-adjacent I2C sensors
These matter for full laptop support, but they do not outrank keyboard/touchpad bring-up for live boot and recovery.
Boot Priority Order
For boot-to-login on modern laptops, the correct priority is:
I2C-HIDkeyboards and touchpads- any GPIO-expander or companion I2C devices required to make those devices usable
- platform-specific USB-C / UCSI I2C surfaces only on machines that actually depend on them for input availability
- all other I2C-attached peripherals
Immediate Next Steps
- land
_CRSdecoding inacpid - expose decoded resources under
/scheme/acpi - validate decoded
I2cSerialBusand GPIO/IRQ data on real hardware logs - introduce the minimal native I2C userspace substrate
- implement Intel LPSS controller ownership
- implement
i2c-hidd