Skip to content

Conversation

@avg-I
Copy link
Contributor

@avg-I avg-I commented Jun 19, 2020

This is a draft pull request just to show what I am working on.
Maybe I'll get some advise on the code.
Maybe the code will be useful as an example for some other work.

At the moment there is no support for GPIO interrupts on x86, but there is
some work in progress.
This change shows how to obtain GPIO interrupt configuration from ACPI
and to set up scuh an interrupt in a consumer driver.
The GPIO side of things will probably have some changes as the work
progresses. The ACPI related code is probably fine already.

At the moment there is no support for GPIO interrupts on x86, but there is
some work in progress.
This change shows how to obtain GPIO interrupt configuration from ACPI
and to set up scuh an interrupt in a consumer driver.
The GPIO side of things will probably have some changes as the work
progresses.  The ACPI related code is probably fine already.
@wulf7
Copy link
Owner

wulf7 commented Jun 19, 2020

Awesome! That is great to know that a work on support for GPIO interrupts on x86 is started! Thank you!

I'll try to write GPIO controller driver for KabyLake to test your changes as now I gets 'ACPI provides GPIO interrupt, but controller is not attached' message on kldload. But anyway, if you feel that your work is ready for wide testing, I'll accept it and poke port mantainer to update it too. Polling mode became a most evil bug in iichid.c since Greg V caught out-of spec command which kills most of touchpads.

P.S. Although it looks very hackish to steal interrupts from other device driver, it is perfectly OK for out-of-tree iichid. Do you have any work planned to entirely move GPIO interrupt support code to GPIO controller drivers?
P.S.2. opt_platform.h should be added to SRCS in Makefile. otherwise compilation fails with /usr/src/sys/dev/gpio/gpiobusvar.h:35:10: fatal error: 'opt_platform.h' file not found message
P.S.3. There is DragonflyBSD GPIO driver with support of interrupting that I was going to use as starting point if I would have GPIO work started: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/bus/gpio/gpio_acpi/gpio_acpi.c , https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/bus/gpio/gpio_intel/gpio_intel.c . But now it looks like you re-implemented chunks that could be copy-pasted.

@aokblast
Copy link

Awesome! That is great to know that a work on support for GPIO interrupts on x86 is started! Thank you!

I'll try to write GPIO controller driver for KabyLake to test your changes as now I gets 'ACPI provides GPIO interrupt, but controller is not attached' message on kldload. But anyway, if you feel that your work is ready for wide testing, I'll accept it and poke port mantainer to update it too. Polling mode became a most evil bug in iichid.c since Greg V caught out-of spec command which kills most of touchpads.

P.S. Although it looks very hackish to steal interrupts from other device driver, it is perfectly OK for out-of-tree iichid. Do you have any work planned to entirely move GPIO interrupt support code to GPIO controller drivers? P.S.2. opt_platform.h should be added to SRCS in Makefile. otherwise compilation fails with /usr/src/sys/dev/gpio/gpiobusvar.h:35:10: fatal error: 'opt_platform.h' file not found message P.S.3. There is DragonflyBSD GPIO driver with support of interrupting that I was going to use as starting point if I would have GPIO work started: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/bus/gpio/gpio_acpi/gpio_acpi.c , https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/bus/gpio/gpio_intel/gpio_intel.c . But now it looks like you re-implemented chunks that could be copy-pasted.

Hello wulf. Are you currently working on intelgpio driver? If not, can I take over this part? Thanks!

@wulf7
Copy link
Owner

wulf7 commented Sep 17, 2025

Hello wulf. Are you currently working on intelgpio driver? If not, can I take over this part? Thanks!

Hi, currently no. Intel GPIO is complex. It uses different MMIO registers layout for every chipset version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants