Re: intr notification when a gpio changes?
Sulev-Madis Silber <[email protected]> Mon, 15 Jun 2026 02:36:54 +0300
| Newsgroups | gmane.os.freebsd.devel.arm |
|---|---|
| Message-ID | <[email protected]> |
On June 15, 2026 2:21:53 AM GMT+03:00, "Bjoern A=2E Zeeb" <bzeeb-lists@lis= ts=2Ezabbadoz=2Enet> wrote: >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 <ahmadkhalifa570@= gmail=2Ecom> wrote: >>>> On Mon Jun 15, 2026 at 12:28 AM +0300, Bjoern A=2E Zeeb wrote: >>>>> Hi, >>>>>=20 >>>>> sorry for asking here but I figured most knowledgeable people will b= e here=2E >>>>>=20 >>>>> I need to be able from a kernel driver to get a notification if a gp= io >>>>> pin changes=2E >>>>>=20 >>>>> I believe to understand that from userspace GPIOSETCONFIG can do the= job, >>>>> but what's in-kernel API I am looking for? >>>>=20 >>>> You can call gpio_alloc_intr_resource to get an interrupt resource, t= hen >>>> use bus_setup_intr like normal to setup an interrupt=2E >>>>=20 >>>> Note that this only works on INTRNG platforms currently=2E There are = no >>>> GPIO interrupts on amd64=2E >>>>=20 >>>> sys/dev/gpio/gpioaei=2Ec is a good example of setting up GPIO interru= pts=2E >>>>=20 >>>>>=20 >>>>> /bz >>>>=20 >>>=20 >>>=20 >>> let me hop on this wagon=2E what is the userland option to watch gpios= ? i'm talking about something that could run shell scripts=2E ot be opened = as some device that outputs events >>>=20 >>> from 10 years ago i modified someone's c example for that >>>=20 >>> could be nice addon to gpioctl=2E of course if i'm blind and it's ther= e, point me to it >>=20 >> No way to do it with gpioctl AFAIK, but there's tools/test/gpioevents i= n >> src=2E > >I do not know what happened to https://wiki=2Efreebsd=2Eorg/SummerOfCode2= 018Projects/UserSpaceGPIOinterrupts ? > yeah my <http://ketas=2Esi=2Epri=2Eee/bbb/bbb-poe-daemon/util/gpio-intr-kqueue=2Ec= > and <http://ketas=2Esi=2Epri=2Eee/bbb/bbb-poe-daemon/util/gpio-irq-event=2Ec> probably came from somewhere there=2E it's from loos@=2E it worked=2E but = not in tree anywhere? maybe it should be somewhere=2E i don't know where it= will belong nor do i know what's the best way=2E those files are literally= 12 years old=2E i haven't looked into bugzilla but i would not be surprise= d if some code is in there too, sitting half way implemented=2E anyway i ha= ve interest in userspace gpiowatch=2E could be both polling and interrupt= =2E the interrupts would be preferred=2E but i understand that it's support= depends on certain fragile hw supports and be limited on pins or their cou= nt=2E or that's how i understand this=2E maybe kernel created devices could= work=2E or maybe forked listening procs=2E i realize that this is slower b= ut it's a start