Sensors chip driver for MAXIM MAX6650 / MAX6651 fan controllers =============================================================== Chip notes ---------- The MAX6551 is a fan controller. It has two distinct functions: 1) Speed control, with feedback, for a single fan. The code can write to a register requesting that the fan run at a certain speed, and the chip will adjust the fan voltage until it reaches that speed. This is called "closed loop" mode in the datasheet. 2) Speed measurement (tachometers) for up to four fans, including the controlled one. The MAX6550 is similar but only has one measurement tachometer. Both chips have a few general purpose i/o pins, some of which can be configured to have special functions. At the time of writing an overview of the chip, with links to the datasheet, can be seen at: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2296/ln/en If that has moved searching for MAX6550 from Maxim's home page should work. Driver state ------------ Currently the driver provides the following entries in /proc/sys/ dev/sensors/max6650-xxx/: fan1 through fan4 (read only): the current measured fan speeds, in rpm. speed (read/write): when written, sets the chip to closed loop mode and sets the configured speed, in rpm, to the value written. When read returns the configured speed, again in rpm. xdump (read only): returns all of the chip register values, except the tachometers. Used for debug, and should probably go away or be conditionally compiled. The MAX665x uses byte wide registers with various scaling factors and some more or less complex equations (in the datasheet) relating register values to real world values. The driver takes care of all of this. Note that the measured speed ("fan1") never exactly matches the set speed ("speed") because of the coarse resolution of the underlying registers. Assumptions ----------- The driver assumes that: o The MAX665x is running from its internal 254 kHz clock, not an external clock. o The monitored fans produce two pulses per rotation (This same assumption is made by Maxim throughout the datasheet.) o The tachometer count time (register 0x16) has been configured suitably for the fans in use, perhaps by some boot code. The driver reads this register to compute rpm, but never writes to it. o The speed controller prescale (low three bits of register 0x04) has been configured suitably for the fans in use, perhaps by some boot code. The driver reads these bits to compute rpm, but never changes them. The driver currently never reads or writes any other configuration (gpio config, alarms, 5V/12V setting). Bugs ---- o The driver assumes too much: it should be possible to set more of the configuration dynamically instead of assuming that some other code has done it. o It does not differentiate between a MAX6550 and a MAX6551, as I can see no obvious way to do this. It has only been tested with a MAX6551 so if anyone gets a board with a MAX6550 to test with maybe something will be revealed, such as the three missing tachometer registers returning all ones or something. (OK, so maybe I should have called this driver max6651, and ignored the max6650 totally...) o The /proc names don't match the standards in doc/developers/proc, as this chip doesn't map well to other fan controllers, Detection notes --------------- The module will autodetect the presence of a max6650 or max6651 at any of the four possible I2C addresses for these devices. There is no ID register, but there are several registers with all zero bits at the high end. The driver checks that all of these are in fact zero before declaring the chip to be a MAX6550/1. sensors-detect -------------- Support for MAX6650/1 has been added to sensors-detect. It has been tested as correctly detecting a MAX6551 at I2C address 0x1B. Like the driver, it cannot yet distinguish a MAX6650 and MAX6651. prog/sensors ------------ Initial read-only support has been added to the "sensors" program. Testing ------- The driver and associated programs have been tested under Linux 2.4.18 running on an embedded Intel XScale processor (actually an IXP425 running in big-endian mode) with a MAX6651 chip. Author ------ John Morris (john.morris@spirentcom.com)