PC Engines APU2 Leds control

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

PC Engines APU2 Leds control

Sacha
Dear all,

I'm enjoying OpenBSD on PC Engines hardwares called APU2:
https://www.pcengines.ch/apu2.htm

There is 3 led, which could be very usefull to deliver informations to
the endusers, but I never could control them with OpenBSD /o\

Is any way to make it work ?

On PCEngines forum I got the following answer:

>You cannot control the GPIOs on J20, because those are are driven by
a NCT5104D and wbsio(4) only supports hardware monitoring.
>The LEDs OTOH are on GPIOs of the AMD FCH. I am not a hardware guy, and
OpenBSD seems to have a lot of drivers which attach - but probably none
for those GPIOs.
>If you want to dig deeper, there is AMD documentation for the FCH and
also a linux driver called "amd-fch-gpio"

>Update: There seems to be somebody, who worked on this a while ago on
OpenBSD: https://marc.info/?l=openbsd-tech&m=155355977613046


Sacha.

Reply | Threaded
Open this post in threaded view
|

Re: PC Engines APU2 Leds control

Raimo Niskanen-7
I solved this problem a while ago using
    https://github.com/pcengines/apu_gpio_lib
since gpio(4), that they linked to, only seems to work for APU1.
I have no such device mentioned in dmesg(8) on my APU2,
and gpioctl(8) says all /dev/gpio? devices are not configured.

OpenBSD does not allow direct memory access in default securelevel(7),
so I wrote a small daemon that I start from rc.securelevel(8) which
reads one byte commands from a fifo to control the leds.

In my case ifstated(8) writes to the fifo to show status.
This solution works just fine for me.

Unfortunately the code is in a lousy state build-wise, so I need to clean
it up and for example create a pull request for PCEngines' repository
to add this daemon as an OpenBSD example.  Even if they would not
accept a pull request it would be published my GitHub account...

/ Raimo Niskanen


On Fri, May 08, 2020 at 09:43:38PM +0200, Sacha wrote:

> Dear all,
>
> I'm enjoying OpenBSD on PC Engines hardwares called APU2:
> https://www.pcengines.ch/apu2.htm
>
> There is 3 led, which could be very usefull to deliver informations to
> the endusers, but I never could control them with OpenBSD /o\
>
> Is any way to make it work ?
>
> On PCEngines forum I got the following answer:
>
> >You cannot control the GPIOs on J20, because those are are driven by
> a NCT5104D and wbsio(4) only supports hardware monitoring.
> >The LEDs OTOH are on GPIOs of the AMD FCH. I am not a hardware guy, and
> OpenBSD seems to have a lot of drivers which attach - but probably none
> for those GPIOs.
> >If you want to dig deeper, there is AMD documentation for the FCH and
> also a linux driver called "amd-fch-gpio"
>
> >Update: There seems to be somebody, who worked on this a while ago on
> OpenBSD: https://marc.info/?l=openbsd-tech&m=155355977613046
>
>
> Sacha.

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply | Threaded
Open this post in threaded view
|

Re: PC Engines APU2 Leds control

Raimo Niskanen-7
I have now made a pull request for an example on PC Engines'
qpu_gpio_lib GitHub repository of my LED server solution:

    https://github.com/pcengines/apu_gpio_lib/pull/4

Maybe it should use unveil(2) and pledge(2), if I manage to figure out how
to use them...

/ Raimo Niskanen



On Wed, Feb 17, 2021 at 11:53:31AM +0100, Raimo Niskanen wrote:

> I solved this problem a while ago using
>     https://github.com/pcengines/apu_gpio_lib
> since gpio(4), that they linked to, only seems to work for APU1.
> I have no such device mentioned in dmesg(8) on my APU2,
> and gpioctl(8) says all /dev/gpio? devices are not configured.
>
> OpenBSD does not allow direct memory access in default securelevel(7),
> so I wrote a small daemon that I start from rc.securelevel(8) which
> reads one byte commands from a fifo to control the leds.
>
> In my case ifstated(8) writes to the fifo to show status.
> This solution works just fine for me.
>
> Unfortunately the code is in a lousy state build-wise, so I need to clean
> it up and for example create a pull request for PCEngines' repository
> to add this daemon as an OpenBSD example.  Even if they would not
> accept a pull request it would be published my GitHub account...
>
> / Raimo Niskanen
>
>
> On Fri, May 08, 2020 at 09:43:38PM +0200, Sacha wrote:
> > Dear all,
> >
> > I'm enjoying OpenBSD on PC Engines hardwares called APU2:
> > https://www.pcengines.ch/apu2.htm
> >
> > There is 3 led, which could be very usefull to deliver informations to
> > the endusers, but I never could control them with OpenBSD /o\
> >
> > Is any way to make it work ?
> >
> > On PCEngines forum I got the following answer:
> >
> > >You cannot control the GPIOs on J20, because those are are driven by
> > a NCT5104D and wbsio(4) only supports hardware monitoring.
> > >The LEDs OTOH are on GPIOs of the AMD FCH. I am not a hardware guy, and
> > OpenBSD seems to have a lot of drivers which attach - but probably none
> > for those GPIOs.
> > >If you want to dig deeper, there is AMD documentation for the FCH and
> > also a linux driver called "amd-fch-gpio"
> >
> > >Update: There seems to be somebody, who worked on this a while ago on
> > OpenBSD: https://marc.info/?l=openbsd-tech&m=155355977613046
> >
> >
> > Sacha.
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB