Date: Mon, 29 Jul 2019 16:01:08 -0600 From: Ian Lepore <ian@freebsd.org> To: Filippo Valsorda <filippo@ml.filippo.io>, freebsd-arm@freebsd.org Subject: Re: PWM fan control on Helios4 (Marvell ARMADA 388) Message-ID: <8d00e4a213c93826c3e4d25c58126d22ab20fd33.camel@freebsd.org> In-Reply-To: <5dfec78c-9a41-4e01-8834-ec0178f1ac9d@www.fastmail.com> References: <5dfec78c-9a41-4e01-8834-ec0178f1ac9d@www.fastmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2019-07-29 at 21:49 +0200, Filippo Valsorda wrote: > I am running FreeBSD 12.0-GENERIC-350203 on the Helios4, a Marvell > ARMADA 388 board. > > The device tree has two PWM GPIO fans > > https://github.com/Artox/crochet/blob/4d40896f182ad704e23dd55c31290f5859145483/board/Clearfog/files/armada-388-helios4.dts#L133-L141 > > but it doesn't look like the OS can see them at all, and they spin at > full speed. Here's the full sysctl. > > https://gist.github.com/FiloSottile/5a44f2fd0bacb44b4120b1f5c6828583 > > Interestingly, the Linux DTS has different pwms parameters, but I > couldn't find documentation on what they are. > > https://github.com/torvalds/linux/blob/2a11c76e5301dddefcb618dac04f74e6314df6bc/arch/arm/boot/dts/armada-388-helios4.dts#L123 > > The Helios4 PWM circuits seem very well documented, at least. > > https://wiki.kobol.io/pwm/ > > I would like to be able to slow the fans down. Runtime changes or > adaptive behavior are a plus, but I'd be also happy with setting them > at > a fixed duty cycle. > > What docs should I look at? Has anyone tried this? What are my > options, > short of a hardware controller? > > Thank you, > Filippo > > (Please keep me CC'd.) It looks like the news is mostly bad... based on that dts source (and what's in our tree from the latest import), the pwm-fan stuff relies on the marvell gpio driver being able to use the hardware's "blink mode" as a sort of poor man's PWM controller. It doesn't look like the freebsd marvell gpio driver has any code to support that (probably since it hasn't been touched by anyone since Sheevaplug was leading- edge hardware). I just had a quick look at the reference manual for the 388 SOC, and it looks like adding PWM support to the gpio driver would be more than trivial, and less than rocket science. It looks like it would be fun, but I don't have any hardware for testing it if I were to try. If the gpio driver did pwm, then the next problem is actually controlling fans with it. You could easily use the pwm(8) command line utility to manually control them. It would also be possible to rig up some userland scripting to periodically query temperature and control the fans from userland. Doing all that properly in-kernel would take a bunch more work that we have little or no current driver support for. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8d00e4a213c93826c3e4d25c58126d22ab20fd33.camel>