Add ACPI I2C-HID quirk carriers
This commit is contained in:
@@ -17,6 +17,7 @@ filesystem_size = 768
|
|||||||
# Red Bear OS branding and host utilities.
|
# Red Bear OS branding and host utilities.
|
||||||
redbear-release = {}
|
redbear-release = {}
|
||||||
redbear-hwutils = {}
|
redbear-hwutils = {}
|
||||||
|
redbear-quirks = {}
|
||||||
|
|
||||||
# Redox-native netctl tooling.
|
# Redox-native netctl tooling.
|
||||||
redbear-netctl = {}
|
redbear-netctl = {}
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
# 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:
|
||||||
|
|
||||||
|
- `acpid` has AML evaluation and a scheme surface for tables, AML symbols, DMI, power,
|
||||||
|
reboot, and PCI registration.
|
||||||
|
- `hwd` already recognizes `PNP0C50` as `I2C HID` during ACPI probe, but only as a label.
|
||||||
|
- `amlserde` can already carry raw AML buffers and the relevant opregion kinds.
|
||||||
|
|
||||||
|
What is missing:
|
||||||
|
|
||||||
|
- no decoded `_CRS` resource parser for ACPI devices
|
||||||
|
- no `/scheme/acpi/...` API for decoded `I2cSerialBus`, `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.c`
|
||||||
|
- `build/linux-kernel-cache/linux-7.0/drivers/hid/i2c-hid/i2c-hid-core.c`
|
||||||
|
- `build/linux-kernel-cache/linux-7.0/drivers/i2c/i2c-core-acpi.c`
|
||||||
|
- `build/linux-kernel-cache/linux-7.0/drivers/acpi/resource.c`
|
||||||
|
- `build/linux-kernel-cache/linux-7.0/drivers/mfd/intel-lpss-pci.c`
|
||||||
|
- `build/linux-kernel-cache/linux-7.0/drivers/mfd/intel-lpss-acpi.c`
|
||||||
|
- `build/linux-kernel-cache/linux-7.0/drivers/i2c/busses/i2c-designware-amdpsp.c`
|
||||||
|
- `build/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 `i2cd` scheme / 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-HID` on 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 `_DSM` using 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:
|
||||||
|
|
||||||
|
- `_STA` gating before bind
|
||||||
|
- `_INI` where required
|
||||||
|
- `_PS0` / `_PS3` best-effort device power transitions
|
||||||
|
- `GpioInt` and `GpioIo` semantics 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 `_CRS` parsing 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
|
||||||
|
|
||||||
|
## Immediate Next Steps
|
||||||
|
|
||||||
|
1. land `_CRS` decoding in `acpid`
|
||||||
|
2. expose decoded resources under `/scheme/acpi`
|
||||||
|
3. validate decoded `I2cSerialBus` and GPIO/IRQ data on real hardware logs
|
||||||
|
4. introduce the minimal native I2C userspace substrate
|
||||||
|
5. implement Intel LPSS controller ownership
|
||||||
|
6. implement `i2c-hidd`
|
||||||
@@ -12,4 +12,5 @@ cp "${COOKBOOK_SOURCE}/quirks.d/20-usb.toml" "${COOKBOOK_STAGE}/etc/quirks.d/20-
|
|||||||
cp "${COOKBOOK_SOURCE}/quirks.d/30-net.toml" "${COOKBOOK_STAGE}/etc/quirks.d/30-net.toml"
|
cp "${COOKBOOK_SOURCE}/quirks.d/30-net.toml" "${COOKBOOK_STAGE}/etc/quirks.d/30-net.toml"
|
||||||
cp "${COOKBOOK_SOURCE}/quirks.d/40-storage.toml" "${COOKBOOK_STAGE}/etc/quirks.d/40-storage.toml"
|
cp "${COOKBOOK_SOURCE}/quirks.d/40-storage.toml" "${COOKBOOK_STAGE}/etc/quirks.d/40-storage.toml"
|
||||||
cp "${COOKBOOK_SOURCE}/quirks.d/50-system.toml" "${COOKBOOK_STAGE}/etc/quirks.d/50-system.toml"
|
cp "${COOKBOOK_SOURCE}/quirks.d/50-system.toml" "${COOKBOOK_STAGE}/etc/quirks.d/50-system.toml"
|
||||||
|
cp "${COOKBOOK_SOURCE}/quirks.d/60-i2c-hid.toml" "${COOKBOOK_STAGE}/etc/quirks.d/60-i2c-hid.toml"
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# I2C-HID recovery quirks.
|
||||||
|
#
|
||||||
|
# These are intentionally narrow. They are only for known platforms where
|
||||||
|
# generic ACPI recovery plus normal probe retries still are not enough.
|
||||||
|
#
|
||||||
|
# Matching is exact. At least one DMI or ACPI field must be present.
|
||||||
|
# Actions only run on probe failure, and i2c-hidd applies at most one extra
|
||||||
|
# quirk-driven retry for each read mode.
|
||||||
|
#
|
||||||
|
# Supported match keys:
|
||||||
|
# sys_vendor, board_vendor, board_name, board_version,
|
||||||
|
# product_name, product_version, bios_version,
|
||||||
|
# acpi_path, acpi_hid, acpi_cid
|
||||||
|
#
|
||||||
|
# Supported action keys:
|
||||||
|
# gpio_io_index zero-based index into device GpioIo resources
|
||||||
|
# drive_high pulse active-high when true, active-low when false
|
||||||
|
# hold_ms active pulse duration, default 20
|
||||||
|
# settle_ms post-restore delay, default 60
|
||||||
|
# require_initial_level only run if the GPIO currently matches this level
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# [[i2c_hid_quirk]]
|
||||||
|
# match.sys_vendor = "Example Vendor"
|
||||||
|
# match.product_name = "Example Laptop 13"
|
||||||
|
# match.acpi_hid = "ELAN0000"
|
||||||
|
#
|
||||||
|
# [[i2c_hid_quirk.probe_failure_action]]
|
||||||
|
# gpio_io_index = 0
|
||||||
|
# drive_high = false
|
||||||
|
# hold_ms = 25
|
||||||
|
# settle_ms = 120
|
||||||
|
# require_initial_level = true
|
||||||
@@ -29,9 +29,14 @@ cp -v \
|
|||||||
|
|
||||||
# Drivers that are built on all architectures, and NOT in drivers-initfs
|
# Drivers that are built on all architectures, and NOT in drivers-initfs
|
||||||
BINS=(
|
BINS=(
|
||||||
|
gpiod
|
||||||
|
intel-gpiod
|
||||||
|
amd-mp2-i2cd
|
||||||
e1000d
|
e1000d
|
||||||
ihdad
|
ihdad
|
||||||
ihdgd
|
ihdgd
|
||||||
|
i2c-hidd
|
||||||
|
intel-lpss-i2cd
|
||||||
ixgbed
|
ixgbed
|
||||||
pcid
|
pcid
|
||||||
pcid-spawner
|
pcid-spawner
|
||||||
@@ -47,6 +52,7 @@ BINS=(
|
|||||||
virtio-gpud
|
virtio-gpud
|
||||||
virtio-netd
|
virtio-netd
|
||||||
xhcid
|
xhcid
|
||||||
|
i2cd
|
||||||
inputd
|
inputd
|
||||||
redoxerd
|
redoxerd
|
||||||
)
|
)
|
||||||
@@ -71,7 +77,7 @@ export CARGO_PROFILE_RELEASE_PANIC=abort
|
|||||||
$(for bin in "${BINS[@]}"; do echo "-p" "${bin}"; done)
|
$(for bin in "${BINS[@]}"; do echo "-p" "${bin}"; done)
|
||||||
for bin in "${BINS[@]}"
|
for bin in "${BINS[@]}"
|
||||||
do
|
do
|
||||||
if [[ "${bin}" == "inputd" || "${bin}" == "pcid" || "${bin}" == "pcid-spawner" || "${bin}" == "redoxerd" ]]; then
|
if [[ "${bin}" == "gpiod" || "${bin}" == "intel-gpiod" || "${bin}" == "i2cd" || "${bin}" == "inputd" || "${bin}" == "pcid" || "${bin}" == "pcid-spawner" || "${bin}" == "redoxerd" ]]; then
|
||||||
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_STAGE}/usr/bin"
|
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_STAGE}/usr/bin"
|
||||||
else
|
else
|
||||||
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_STAGE}/usr/lib/drivers"
|
cp -v "target/${TARGET}/${build_type}/${bin}" "${COOKBOOK_STAGE}/usr/lib/drivers"
|
||||||
|
|||||||
Reference in New Issue
Block a user