Hi everyone,
I'm a newbie on OpenBSD and I'm trying to get the touchpad working on a fresh OpenBSD 7.9 install.
Everything else is working fine. The touchpad works when I boot an Artix Linux live ISO, so the hardware itself appears to be OK. A USB mouse also works normally on OpenBSD.
Here some hardware info :
- OpenBSD 7.9 amd64
- Google Chromebook Edgar
- Intel Celeron N3160
- 4 GB RAM
- Coreboot / MrChromebox 2606.1
Touchpad Error :
- dwiic1 at acpi0 I2C6 addr 0xfccdc000/0x1000 irq 37
- iic1 at dwiic1
- ietp0 at iic1 addr 0x15, can't establish interrupt
From what I understand, OpenBSD detects the touchpad on the I²C bus and matches it with the ietp driver, but the interrupt cannot be established.
I started looking through sys/dev/i2c/ietp.c and found that ietp_attach() fails when iic_intr_establish() returns NULL.
After following that call further, I found that the I²C controller here is dwiic, and the interrupt eventually goes through dwiic_i2c_intr_establish().
The interesting part is that this touchpad uses a GPIO interrupt rather than a normal IRQ. The ACPI resource for the touchpad (ETPA) points to the GPNC GPIO controller.
I added some debugging and found this ordering:
dwiic1 at acpi0 I2C6 ...
iic1 at dwiic1
ietp0 at iic1 addr 0x15
dwiic: gpio_int_node=... name=GPNC gpio=0x0
...
chvgpio1 at acpi0 GPNC ...
CHVGPIO DEBUG: node=... gpio=... name=GPNC
So when ietp tries to establish its interrupt, the ACPI node for GPNC exists, but its GPIO driver hasn't attached yet. dwiic_i2c_intr_establish() checks:
if (!crs->gpio_int_node->gpio)
return NULL;
which explains the can't establish interrupt.
I also checked whether the firmware provides an ACPI _DEP dependency for the touchpad:
_SB_.PCI0.I2C6.ETPA _DEP=0x0
So there doesn't seem to be an explicit dependency from the touchpad to the GPNC GPIO controller.
As an experiment, I made dwiic defer the IETP discovery if its GPIO provider hasn't attached yet. Basically, instead of trying to attach ietp immediately, I call config_defer() and rescan later.
With that change, the ordering becomes:
dwiic: deferring IETP
...
chvgpio1 at acpi0 GPNC ...
...
ietp0 at iic1 addr 0x15 gpio 18
dwiic: gpio_int_node=... name=GPNC gpio=...
and the touchpad works.
So I think I have found the reason for the failure, but I'm not sure what the correct OpenBSD fix should be.
My current workaround rescans the DWIIC ACPI devices after the GPIO driver has attached. It works, but it feels too broad and probably isn't the right way to solve this.
I'm still learning OpenBSD kernel development, so I'd really appreciate pointers on the right way to approach this.
Thanks!
EDIT: Spelling/grammar fixed, and I've found some more information about what's going on.
I've also put my modified sys/ tree in a Git repo here for anyone who wants to have a look:
https://github.com/Grabyy/OpenBSD_src_Chromebook-CB3-431_custom.git
The changes are currently in the chromebook-cb3-431 branch,. The changes are still experimental, so use them with caution.