Re: userspace gpio interrupts / input-output control

From: Sulev-Madis Silber <freebsd-current-freebsd-org111_at_ketas.si.pri.ee>
Date: Tue, 18 Aug 2026 09:26:59 UTC

On August 17, 2026 11:22:00 PM GMT+03:00, Matthew Grooms <mgrooms@shrew.net> wrote:
>On 8/17/26 15:06, Ruslan Zalata wrote:
>> Thanks Matt. That's on FreeBSD, I suppose? Would like to have this type of service on x86 mini-PCs. :)
>> 
>> ---
>> Regards,
>> Ruslan
>> 
>> On 2026-08-18 00:08, Matthew Grooms wrote:
>>> On 8/16/26 12:13, Ruslan Zalata wrote:
>>>> Hello Sulev-Madis,
>>>> 
>>>> What's your target platform ?
>>>> 
>>>> I recently discovered that GPIO interrupts are not supported in "GPIO Bus" driver on x86 platforms because of lack of INTRNG support (simply not implemented). I found a 6-year old diff D26407 from avg@ to add this functionally which stuck on review because of some unsolved issues. I renewed avg's patch so it could be applied to -current and posted for review (D57968) again, but it did get much traction too. So, if you are interested in getting GPIO interrupts on x86/amd64 - no luck till gpiobus driver is "fixed". No ideas about arm and others.
>>>> 
>>> Just as a reference point, I use the gpio interrupt support on rpi4
>>> hosts to track things like water flow for feed systems in an
>>> industrial farm environment. Seems to work quite well. 
>
>Yup. I have 10x rpi4b systems running FreeBSD 14 in production, They run a custom farm automation controller I wrote a while back in c++. The demo code that accompanied the original gpio interrupt patch was used as a reference for that specific feature. Not sure that code ever made it into the source tree.
>
>-Matthew
>
>PS: Maybe try not to top post on the list.
>
>

that's what i'm talking about!!!

i want to play with water using allwinners. so a 32/64bit arms not really limited to that tho

i resorted to llm code generation because i couldn't find an example

the resulting "FreeBSD userland GPIO interrupt watcher with trailing-edge debounce." could be written by humans too. in fact they once did. i found scattered code from somewhere

all i had was 12 year old gpio interrupt code i modified (iirc i debounced in perl) and a test in tree which i found when i grepped a tree for strings

i apparently still haven't learned more c and i turn those c forked children which stdin/out/err i watch in perl using poe/anyevent

it seems to run well with lot of room to spare on nowadays socs

i wish the examples or simple code would be somewhere i can find it

i think i got my 2026-updated gpio-fu (back) but what about others

so 12y ago i didn't contribute it in and nobody else did either. maybe it should be done now

there's nothing gpio related in examples it seems, i went there quite early

so unsure how i'm going to complete my task. but then i want to share it

was told it's trivial. well it's trivial after you learned it