Re: intr notification when a gpio changes?

"Bjoern A. Zeeb" <[email protected]> Sun, 14 Jun 2026 23:21:53 +0000 (UTC)
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
On Sun, 14 Jun 2026, Ahmad Khalifa wrote:

> On Mon Jun 15, 2026 at 2:05 AM +0300, Sulev-Madis Silber wrote:
>> On June 15, 2026 1:53:11 AM GMT+03:00, Ahmad Khalifa <[email protected]> wrote:
>>> On Mon Jun 15, 2026 at 12:28 AM +0300, Bjoern A. Zeeb wrote:
>>>> Hi,
>>>>
>>>> sorry for asking here but I figured most knowledgeable people will be here.
>>>>
>>>> I need to be able from a kernel driver to get a notification if a gpio
>>>> pin changes.
>>>>
>>>> I believe to understand that from userspace GPIOSETCONFIG can do the job,
>>>> but what's in-kernel API I am looking for?
>>>
>>> You can call gpio_alloc_intr_resource to get an interrupt resource, then
>>> use bus_setup_intr like normal to setup an interrupt.
>>>
>>> Note that this only works on INTRNG platforms currently. There are no
>>> GPIO interrupts on amd64.
>>>
>>> sys/dev/gpio/gpioaei.c is a good example of setting up GPIO interrupts.
>>>
>>>>
>>>> /bz
>>>
>>
>>
>> let me hop on this wagon. what is the userland option to watch gpios? i'm talking about something that could run shell scripts. ot be opened as some device that outputs events
>>
>> from 10 years ago i modified someone's c example for that
>>
>> could be nice addon to gpioctl. of course if i'm blind and it's there, point me to it
>
> No way to do it with gpioctl AFAIK, but there's tools/test/gpioevents in
> src.

I do not know what happened to https://wiki.freebsd.org/SummerOfCode2018Projects/UserSpaceGPIOinterrupts ?

-- 
Bjoern A. Zeeb                                                     r15:7