Re: new gpioleds driver
On Thu, Sep 16, 2021 at 11:12:50AM +0200, Mark Kettenis wrote: > > Date: Thu, 16 Sep 2021 06:12:39 + > > From: Klemens Nanni > > > > On 3 September 2021 20:16:33 GMT+05:00, Klemens Nanni > > wrote: > > >Here is a tiny driver enabling machines such as the Pinebook Pro to > > >indicate power, it is intentionally minimal and does not expose anything > > >via sysctl(8)/sensorsd(8) or gpioctl(8). > > > > > >This is helpful for machines where graphics, keyboard and/or serial > > >console have problems and people tend to debug things at various > > >stages, e.g. a green LED now tells me that we reached the kernel. > > > > > >Once arm64 has suspend/resume we can indicate that as well. > > > > > >Feedback? OK? > > > > Ping. > > Two small nits below. With those fixed, ok kettenis@ Thanks. I'll commit the diff below after the tree is unlocked (now with "first appeared in OpenBSD 7.1" in in the manual as well). Index: share/man/man4/gpioleds.4 === RCS file: share/man/man4/gpioleds.4 diff -N share/man/man4/gpioleds.4 --- /dev/null 1 Jan 1970 00:00:00 - +++ share/man/man4/gpioleds.4 24 Sep 2021 22:24:41 - @@ -0,0 +1,45 @@ +.\"$OpenBSD: $ +.\" +.\" Copyright (c) 2021 Klemens Nanni +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: September 03 2021 $ +.Dt GPIOLEDS 4 +.Os +.Sh NAME +.Nm gpioleds +.Nd GPIO LEDs +.Sh SYNOPSIS +.Cd "gpioleds* at fdt?" +.Sh DESCRIPTION +The +.Nm +driver provides support for LEDs connected to GPIO pins. +.Pp +Currently, LEDs are only set to their default state, +e.g. to indicate the power status of the system. +.Sh SEE ALSO +.Xr gpio 4 , +.Xr intro 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 7.1 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Klemens Nanni Aq Mt k...@openbsd.org . Index: share/man/man4/Makefile === RCS file: /cvs/src/share/man/man4/Makefile,v retrieving revision 1.806 diff -u -p -r1.806 Makefile --- share/man/man4/Makefile 4 Sep 2021 12:11:45 - 1.806 +++ share/man/man4/Makefile 24 Sep 2021 22:22:10 - @@ -36,7 +36,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 fanpwr.4 fd.4 fdc.4 fec.4 fido.4 fins.4 fintek.4 fms.4 fusbtc.4 \ fuse.4 fxp.4 \ gdt.4 gentbi.4 gem.4 gfrtc.4 gif.4 glenv.4 glkgpio.4 gpio.4 gpiodcf.4 \ - gpioiic.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ + gpioiic.4 gpioleds.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ hds.4 hiclock.4 hidwusb.4 hifn.4 hil.4 hilid.4 hilkbd.4 hilms.4 \ hireset.4 hitemp.4 hme.4 hotplug.4 hsq.4 \ hvn.4 hvs.4 hyperv.4 \ Index: sys/dev/fdt/gpioleds.c === RCS file: sys/dev/fdt/gpioleds.c diff -N sys/dev/fdt/gpioleds.c --- /dev/null 1 Jan 1970 00:00:00 - +++ sys/dev/fdt/gpioleds.c 24 Sep 2021 22:24:07 - @@ -0,0 +1,102 @@ +/* $OpenBSD: $ */ +/* + * Copyright (c) 2021 Klemens Nanni + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +struct gpioleds_softc { + struct devicesc_dev; + int sc_node; +}; + +intgpioleds_match(struct device *, void *, void *); +void gpioleds_attach(struct device *, struct device *, void *); + +struct cfattach gpioleds_ca = { + sizeof (struct gpioleds_softc), gpioleds_match, gpioleds_attach +}; + +struct cf
Re: new gpioleds driver
> Date: Thu, 16 Sep 2021 06:12:39 + > From: Klemens Nanni > > On 3 September 2021 20:16:33 GMT+05:00, Klemens Nanni > wrote: > >Here is a tiny driver enabling machines such as the Pinebook Pro to > >indicate power, it is intentionally minimal and does not expose anything > >via sysctl(8)/sensorsd(8) or gpioctl(8). > > > >This is helpful for machines where graphics, keyboard and/or serial > >console have problems and people tend to debug things at various > >stages, e.g. a green LED now tells me that we reached the kernel. > > > >Once arm64 has suspend/resume we can indicate that as well. > > > >Feedback? OK? > > Ping. Two small nits below. With those fixed, ok kettenis@ > >diff 3a5fa1afe4fc417b263a9d7363eaa933acbf5f2c refs/heads/master > >blob - b597911b8f43a730799bbe34290843f3429c6958 > >blob + eec643f20e0feae7d4a4930f7d30575cffc25913 > >--- distrib/sets/lists/man/mi > >+++ distrib/sets/lists/man/mi > >@@ -1415,6 +1415,7 @@ > > ./usr/share/man/man4/gpio.4 > > ./usr/share/man/man4/gpiodcf.4 > > ./usr/share/man/man4/gpioiic.4 > >+./usr/share/man/man4/gpioleds.4 > > ./usr/share/man/man4/gpioow.4 > > ./usr/share/man/man4/graphaudio.4 > > ./usr/share/man/man4/gre.4 > >blob - 1541bb05749defd67419b07460def0f4065cbfce > >blob + bb62c44d32f152ecf64aa77d60a1a5a3454d3968 > >--- share/man/man4/Makefile > >+++ share/man/man4/Makefile > >@@ -36,7 +36,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \ > > fanpwr.4 fd.4 fdc.4 fec.4 fido.4 fins.4 fintek.4 fms.4 fusbtc.4 \ > > fuse.4 fxp.4 \ > > gdt.4 gentbi.4 gem.4 gfrtc.4 gif.4 glenv.4 glkgpio.4 gpio.4 gpiodcf.4 \ > >-gpioiic.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ > >+gpioiic.4 gpioleds.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ > > hds.4 hiclock.4 hidwusb.4 hifn.4 hil.4 hilid.4 hilkbd.4 hilms.4 \ > > hireset.4 hitemp.4 hme.4 hotplug.4 hsq.4 \ > > hvn.4 hvs.4 hyperv.4 \ > >blob - /dev/null > >blob + 5338437382ce25842ac833cfb847d8fe08e90e6d (mode 644) > >--- /dev/null > >+++ share/man/man4/gpioleds.4 > >@@ -0,0 +1,45 @@ > >+.\" $OpenBSD: $ > >+.\" > >+.\" Copyright (c) 2021 Klemens Nanni > >+.\" > >+.\" Permission to use, copy, modify, and distribute this software for any > >+.\" purpose with or without fee is hereby granted, provided that the above > >+.\" copyright notice and this permission notice appear in all copies. > >+.\" > >+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > >+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > >+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > >+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > >+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > >+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > >+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > >+.\" > >+.Dd $Mdocdate: September 03 2021 $ > >+.Dt GPIOLEDS 4 > >+.Os > >+.Sh NAME > >+.Nm gpioleds > >+.Nd GPIO LEDs > >+.Sh SYNOPSIS > >+.Cd "gpioleds* at fdt?" > >+.Sh DESCRIPTION > >+The > >+.Nm > >+driver provides support for LEDs connected to GPIO pins. > >+.Pp > >+Currently, LEDs are only set to their default state, > >+e.g. to indicate the power status of the system. > >+.Sh SEE ALSO > >+.Xr gpio 4 , > >+.Xr intro 4 > >+.Sh HISTORY > >+The > >+.Nm > >+driver first appeared in > >+.Ox 7.0 . > >+.Sh AUTHORS > >+.An -nosplit > >+The > >+.Nm > >+driver was written by > >+.An Klemens Nanni Aq Mt k...@openbsd.org . > >blob - 3e6591124cad872771cd68599761c26981d185d8 > >blob + d3c3afb621f20013dc2475b4d87bd959e4127c9d > >--- sys/arch/arm64/conf/GENERIC > >+++ sys/arch/arm64/conf/GENERIC > >@@ -131,6 +131,8 @@ amdgpu* at pci? > > drm*at amdgpu? > > wsdisplay* at amdgpu? > > > >+gpioleds* at fdt? > >+ > > # Apple > > apldart*at fdt? > > apldog* at fdt? early 1 > >blob - 3b23523493a12c8b8091f9744561c6bcbb685751 > >blob + f749803b07408179ddc090d484ed4f79bfcb52a7 > >--- sys/dev/fdt/files.fdt > >+++ sys/dev/fdt/files.fdt > >@@ -588,3 +588,7 @@ file dev/fdt/cwfg.c cwfg > > device dapmic > > attach dapmic at i2c > > filedev/fdt/dapmic.cdapmic > >+ > >+device gpioleds > >+attach gpioleds at fdt > >+filedev/fdt/gpioleds.c gpioleds > >blob - /dev/null > >blob + f5ad5e7b6220f3d20b129fe26f8ada2d63eb5909 (mode 644) > >--- /dev/null > >+++ sys/dev/fdt/gpioleds.c > >@@ -0,0 +1,102 @@ > >+/* $OpenBSD: $ */ > >+/* > >+ * Copyright (c) 2021 Klemens Nanni > >+ * > >+ * Permission to use, copy, modify, and distribute this software for any > >+ * purpose with or without fee is hereby granted, provided that the above > >+ * copyright notice and this permission notice appear in all copies. > >+ * > >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Re: new gpioleds driver
On 3 September 2021 20:16:33 GMT+05:00, Klemens Nanni wrote: >Here is a tiny driver enabling machines such as the Pinebook Pro to >indicate power, it is intentionally minimal and does not expose anything >via sysctl(8)/sensorsd(8) or gpioctl(8). > >This is helpful for machines where graphics, keyboard and/or serial >console have problems and people tend to debug things at various >stages, e.g. a green LED now tells me that we reached the kernel. > >Once arm64 has suspend/resume we can indicate that as well. > >Feedback? OK? Ping. >diff 3a5fa1afe4fc417b263a9d7363eaa933acbf5f2c refs/heads/master >blob - b597911b8f43a730799bbe34290843f3429c6958 >blob + eec643f20e0feae7d4a4930f7d30575cffc25913 >--- distrib/sets/lists/man/mi >+++ distrib/sets/lists/man/mi >@@ -1415,6 +1415,7 @@ > ./usr/share/man/man4/gpio.4 > ./usr/share/man/man4/gpiodcf.4 > ./usr/share/man/man4/gpioiic.4 >+./usr/share/man/man4/gpioleds.4 > ./usr/share/man/man4/gpioow.4 > ./usr/share/man/man4/graphaudio.4 > ./usr/share/man/man4/gre.4 >blob - 1541bb05749defd67419b07460def0f4065cbfce >blob + bb62c44d32f152ecf64aa77d60a1a5a3454d3968 >--- share/man/man4/Makefile >+++ share/man/man4/Makefile >@@ -36,7 +36,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \ > fanpwr.4 fd.4 fdc.4 fec.4 fido.4 fins.4 fintek.4 fms.4 fusbtc.4 \ > fuse.4 fxp.4 \ > gdt.4 gentbi.4 gem.4 gfrtc.4 gif.4 glenv.4 glkgpio.4 gpio.4 gpiodcf.4 \ >- gpioiic.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ >+ gpioiic.4 gpioleds.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ > hds.4 hiclock.4 hidwusb.4 hifn.4 hil.4 hilid.4 hilkbd.4 hilms.4 \ > hireset.4 hitemp.4 hme.4 hotplug.4 hsq.4 \ > hvn.4 hvs.4 hyperv.4 \ >blob - /dev/null >blob + 5338437382ce25842ac833cfb847d8fe08e90e6d (mode 644) >--- /dev/null >+++ share/man/man4/gpioleds.4 >@@ -0,0 +1,45 @@ >+.\" $OpenBSD: $ >+.\" >+.\" Copyright (c) 2021 Klemens Nanni >+.\" >+.\" Permission to use, copy, modify, and distribute this software for any >+.\" purpose with or without fee is hereby granted, provided that the above >+.\" copyright notice and this permission notice appear in all copies. >+.\" >+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+.\" >+.Dd $Mdocdate: September 03 2021 $ >+.Dt GPIOLEDS 4 >+.Os >+.Sh NAME >+.Nm gpioleds >+.Nd GPIO LEDs >+.Sh SYNOPSIS >+.Cd "gpioleds* at fdt?" >+.Sh DESCRIPTION >+The >+.Nm >+driver provides support for LEDs connected to GPIO pins. >+.Pp >+Currently, LEDs are only set to their default state, >+e.g. to indicate the power status of the system. >+.Sh SEE ALSO >+.Xr gpio 4 , >+.Xr intro 4 >+.Sh HISTORY >+The >+.Nm >+driver first appeared in >+.Ox 7.0 . >+.Sh AUTHORS >+.An -nosplit >+The >+.Nm >+driver was written by >+.An Klemens Nanni Aq Mt k...@openbsd.org . >blob - 3e6591124cad872771cd68599761c26981d185d8 >blob + d3c3afb621f20013dc2475b4d87bd959e4127c9d >--- sys/arch/arm64/conf/GENERIC >+++ sys/arch/arm64/conf/GENERIC >@@ -131,6 +131,8 @@ amdgpu*at pci? > drm* at amdgpu? > wsdisplay*at amdgpu? > >+gpioleds* at fdt? >+ > # Apple > apldart* at fdt? > apldog* at fdt? early 1 >blob - 3b23523493a12c8b8091f9744561c6bcbb685751 >blob + f749803b07408179ddc090d484ed4f79bfcb52a7 >--- sys/dev/fdt/files.fdt >+++ sys/dev/fdt/files.fdt >@@ -588,3 +588,7 @@ file dev/fdt/cwfg.c cwfg > devicedapmic > attachdapmic at i2c > file dev/fdt/dapmic.cdapmic >+ >+devicegpioleds >+attachgpioleds at fdt >+file dev/fdt/gpioleds.c gpioleds >blob - /dev/null >blob + f5ad5e7b6220f3d20b129fe26f8ada2d63eb5909 (mode 644) >--- /dev/null >+++ sys/dev/fdt/gpioleds.c >@@ -0,0 +1,102 @@ >+/*$OpenBSD: $ */ >+/* >+ * Copyright (c) 2021 Klemens Nanni >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTW
Re: new gpioleds driver
On Fri, Sep 03, 2021 at 01:14:04PM -0700, Tomasz Bielecki wrote: > Just a quick confirmation that this works fine. I'm running -current > with a bunch of local patches to get the fb console, reset and power > off working on Pinebook Pro and with patched u-boot 2021.10-rc1 this > makes the led turn from orange to green around the time rkdrm takes > over the display. Thanks! Sounds good :-) I never saw any of the LEDs work unless I booted non-OpenBSD mixtures of OS and bootloader/firmware.
Re: new gpioleds driver
On Fri, Sep 3, 2021 at 8:18 AM Klemens Nanni wrote: > > Here is a tiny driver enabling machines such as the Pinebook Pro to > indicate power, it is intentionally minimal and does not expose anything > via sysctl(8)/sensorsd(8) or gpioctl(8). > > This is helpful for machines where graphics, keyboard and/or serial > console have problems and people tend to debug things at various > stages, e.g. a green LED now tells me that we reached the kernel. > > Once arm64 has suspend/resume we can indicate that as well. > > Feedback? OK? Just a quick confirmation that this works fine. I'm running -current with a bunch of local patches to get the fb console, reset and power off working on Pinebook Pro and with patched u-boot 2021.10-rc1 this makes the led turn from orange to green around the time rkdrm takes over the display. Thanks! Tomasz
new gpioleds driver
Here is a tiny driver enabling machines such as the Pinebook Pro to indicate power, it is intentionally minimal and does not expose anything via sysctl(8)/sensorsd(8) or gpioctl(8). This is helpful for machines where graphics, keyboard and/or serial console have problems and people tend to debug things at various stages, e.g. a green LED now tells me that we reached the kernel. Once arm64 has suspend/resume we can indicate that as well. Feedback? OK? diff 3a5fa1afe4fc417b263a9d7363eaa933acbf5f2c refs/heads/master blob - b597911b8f43a730799bbe34290843f3429c6958 blob + eec643f20e0feae7d4a4930f7d30575cffc25913 --- distrib/sets/lists/man/mi +++ distrib/sets/lists/man/mi @@ -1415,6 +1415,7 @@ ./usr/share/man/man4/gpio.4 ./usr/share/man/man4/gpiodcf.4 ./usr/share/man/man4/gpioiic.4 +./usr/share/man/man4/gpioleds.4 ./usr/share/man/man4/gpioow.4 ./usr/share/man/man4/graphaudio.4 ./usr/share/man/man4/gre.4 blob - 1541bb05749defd67419b07460def0f4065cbfce blob + bb62c44d32f152ecf64aa77d60a1a5a3454d3968 --- share/man/man4/Makefile +++ share/man/man4/Makefile @@ -36,7 +36,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \ fanpwr.4 fd.4 fdc.4 fec.4 fido.4 fins.4 fintek.4 fms.4 fusbtc.4 \ fuse.4 fxp.4 \ gdt.4 gentbi.4 gem.4 gfrtc.4 gif.4 glenv.4 glkgpio.4 gpio.4 gpiodcf.4 \ - gpioiic.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ + gpioiic.4 gpioleds.4 gpioow.4 graphaudio.4 gre.4 gscsio.4 \ hds.4 hiclock.4 hidwusb.4 hifn.4 hil.4 hilid.4 hilkbd.4 hilms.4 \ hireset.4 hitemp.4 hme.4 hotplug.4 hsq.4 \ hvn.4 hvs.4 hyperv.4 \ blob - /dev/null blob + 5338437382ce25842ac833cfb847d8fe08e90e6d (mode 644) --- /dev/null +++ share/man/man4/gpioleds.4 @@ -0,0 +1,45 @@ +.\"$OpenBSD: $ +.\" +.\" Copyright (c) 2021 Klemens Nanni +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: September 03 2021 $ +.Dt GPIOLEDS 4 +.Os +.Sh NAME +.Nm gpioleds +.Nd GPIO LEDs +.Sh SYNOPSIS +.Cd "gpioleds* at fdt?" +.Sh DESCRIPTION +The +.Nm +driver provides support for LEDs connected to GPIO pins. +.Pp +Currently, LEDs are only set to their default state, +e.g. to indicate the power status of the system. +.Sh SEE ALSO +.Xr gpio 4 , +.Xr intro 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 7.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Klemens Nanni Aq Mt k...@openbsd.org . blob - 3e6591124cad872771cd68599761c26981d185d8 blob + d3c3afb621f20013dc2475b4d87bd959e4127c9d --- sys/arch/arm64/conf/GENERIC +++ sys/arch/arm64/conf/GENERIC @@ -131,6 +131,8 @@ amdgpu* at pci? drm* at amdgpu? wsdisplay* at amdgpu? +gpioleds* at fdt? + # Apple apldart* at fdt? apldog*at fdt? early 1 blob - 3b23523493a12c8b8091f9744561c6bcbb685751 blob + f749803b07408179ddc090d484ed4f79bfcb52a7 --- sys/dev/fdt/files.fdt +++ sys/dev/fdt/files.fdt @@ -588,3 +588,7 @@ filedev/fdt/cwfg.c cwfg device dapmic attach dapmic at i2c file dev/fdt/dapmic.cdapmic + +device gpioleds +attach gpioleds at fdt +file dev/fdt/gpioleds.c gpioleds blob - /dev/null blob + f5ad5e7b6220f3d20b129fe26f8ada2d63eb5909 (mode 644) --- /dev/null +++ sys/dev/fdt/gpioleds.c @@ -0,0 +1,102 @@ +/* $OpenBSD: $ */ +/* + * Copyright (c) 2021 Klemens Nanni + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +struct gpioleds_softc { + struct devicesc_dev; +