DragonFly BSD
DragonFly kernel List (threaded) for 2010-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

fanctl: sysctl hw.sensors lm(4) fan-controlling patch for DragonFly

From: Constantine Aleksandrovich Murenin <C++@xxxxxx>
Date: Tue, 23 Mar 2010 02:22:23 -0400


It is my pleasure to finally announce the availability of the port of the fan-controlling prototype/hack from OpenBSD to DragonFly BSD, which allows interested users to monitor and control the speed of the fans connected to popular Winbond Super I/O Hardware Monitors.

The patch is a direct port of the patch that was written for OpenBSD and published for BSDCan 2009 in 2009-05-08 on the tech@openbsd.org mailing list, and supports the following chips, as shown by their lm(4) dmesg name:

* W83627HF (chip only provides the manual PWM mode, fully supported)
* W83627THF / W83637HF (manual and thermal cruise modes are supported)
* W83627EHF / W83627DHG (manual and thermal cruise, PWM/DC supported)

The list above identifies 3 families, with the latter family having the most functionality.

Note that Winbond often shares the Hardware Monitor Chip ID between Super I/O solutions that may be marked differently on the Super I/O chip itself, so in practicality, each family includes more than the one or two chips outlined above.

If you know you have a Winbond Super I/O chip similar to the ones mentioned above, but the lm(4) driver never probed successfully on DragonFly, then please note that since recently we have a new wbsio(4) driver in DragonFly, which allows the lm(4) attachment on non-standard ports (e.g. non-0x290 port). The wbsio(4) is now also available as a module, which, when loaded, will automatically configure lm(4), whether a module or in-kernel, at the proper address. The wbsio(4) driver will also be more specific as to which Winbond Super I/O device and revision your mainboard has.

I will describe the functionality of the latter family, W83627EHF and W83627DHG, which has the most features, and some parts of which will not be applicable to the earlier families.

The percent{0,1,2,3} sensors provide a summary of what the current settings of the chip are. The value shows the current duty cycle, whereas the description specifies whether the PWM or the DC mode is currently activated, and what kind of controlling is being done: Manual, Thermal Cruise, Fan Speed Cruise or Smart Fan III.

If you change any of the percent{0,1,2,3} sensors (integer values only), the chip will automatically go from whatever mode on that specific fan output was, to the Manual mode, with the duty cycle set to the value that you specify.

If you want to go into the Thermal Cruise mode, simply set the value of one of the temp sensors that have a "Target" in their description to the target temperature that you desire. In Thermal Cruise mode, you could also modify the Start-up and Stop duty cycle of the fan, and, of course, the target temperature tolerance.

PWM/DC mode setting is done by switching the indicators between 0 and 1. The description of the indicator indicates which mode is currently active for which fan. If your fan doesn't seem to stop at all with one mode, try the other.

I'd like to warn users that many motherboards are terribly miswired as far as fan-controlling is concerned, so please don't be surprised if the controlling doesn't seem to affect the speed of the fans, or if one control affects the speed of multiple fans etc.

Please note that should you wish to reset any settings that you have programmed your Winbond Super I/O Hardware Monitor with, you may wish to power your system off (obviously, the system may not necessarily go off if you simply `shutdown -p now` or press the soft power button on the front of your PC).

More details and the presentation materials are available on my website dedicated to the fan control project:


This work has recently been presented at AsiaBSDCon 2010 in Tokyo, Japan, and I'd like to thank Hiroki Sato for the wonderful conference that he brings about!

This patch is also available in my git repository on leaf (git://leaf.dragonflybsd.org/~cnst/dragonfly.git), in the fanctl and fanctl201003 branches.

Please test. In your report, please include the name and brand of the board, the full dmesg, sysctl hw.sensors output before making any changes, and a report of your experience as appropriate. Don't be shy.

Some testing suggestions to see if your system can actually control the fans through the lm(4) driver (don't forget to save the whole sensors tree to recall what the defaults were before issuing this):

%sysctl hw.sensors.lm0.percent{0,1,2,3}=0 && echo manually stop the fans
%sysctl hw.sensors.lm0.percent{0,1,2,3}=100 && echo manually max the fans

You can also try this, provided temp{3,4,5,6} have Target in their description:

%sysctl hw.sensors.lm0.temp{3,4,5,6}=65 && echo automatically stop the fans
%sysctl hw.sensors.lm0.temp{3,4,5,6}=24 && echo automatically max the fans

To log the changes in the temperature when doing the above tests:

sh -c "while(true)do tcsh -c 'sysctl -n hw.sensors.lm0.{percent{0,1,2,3},{temp,fan}{0,1,2}}'|xargs;sleep 3;done"

Do note again that in many cases only the setting of one of the respective fan control pins may actually be affecting all of the fans on your system. Please be kind enough to report any findings.

Best regards, Constantine.

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]