Subject: Driver for Analog Devices ADT7467 environmental controller - found
To: Allen Briggs <briggs@ninthwonder.com>
From: Michael <macallan18@earthlink.net>
List: port-macppc
Date: 12/15/2004 10:12:31
Hello,

Now I have a working prototype of the sysctl stuff - with the driver properly attached you can now change the threshold temperatures by:
sysctl machdep.adt7467cX.tempX 
( temp0-temp2 correspond to thermal sensor 0-2 reported to envsys )
So, with sysctl -w machdep.adt7467c0.temp1=50 I just set the max. CPU temperature to 50C and the fan spun up almost immediately ( and apparently at maximum speed , the reported CPU temperature was 54C, it slowed down when reaching 50C )
You can set temperatures between 30C and 85C ( 85C is what OF programs. I didn't choose the unit, that's what gets written into the chip's registers ) - other values will trigger EINVAL. Setting it too high would permit overheating and we don't want people to shoot themselves into their feet, at least not if they could damage their computers when doing so :)

I had to bend sysctl quite a bit to do what I wanted - I needed to store a pointer to a softc and a register number in a node...

Anyway, a testkernel which works on my iBook G4 can be found here:
http://macallan.homeunix.org:6704/stuff/BSD/netbsd_iBook_G4.bz2
it /may/ work on other machines too. This one will spew some debug output ( about sysctl node creation and such ), I'll post a patch ( will be pretty big - 3 new drivers ( uni-n and deq don't do much more than attaching, adt7467c is the driver for the environmental controller ), changes to two others (snapper and ki2n) ) when I'm done cleaning it up a bit.

btw. the sysctl(9) man page need work, it's very hard to read if you don't have the faintest idea how it works - at least some general introduction would be nice, I had to do a lot of trial-and-error work.

have fun
Michael