| 1 | Sensors chip driver for MAXIM MAX6650 / MAX6651 fan controllers |
|---|
| 2 | =============================================================== |
|---|
| 3 | |
|---|
| 4 | Chip notes |
|---|
| 5 | ---------- |
|---|
| 6 | |
|---|
| 7 | The MAX6651 is a fan controller. It has two distinct functions: |
|---|
| 8 | |
|---|
| 9 | 1) Speed control, with feedback, for a single fan. The code can write |
|---|
| 10 | to a register requesting that the fan run at a certain speed, and the |
|---|
| 11 | chip will adjust the fan voltage until it reaches that speed. This |
|---|
| 12 | is called "closed loop" mode in the datasheet. |
|---|
| 13 | |
|---|
| 14 | 2) Speed measurement (tachometers) for up to four fans, including the |
|---|
| 15 | controlled one. |
|---|
| 16 | |
|---|
| 17 | The MAX6650 is similar but only has one measurement tachometer. |
|---|
| 18 | |
|---|
| 19 | Both chips have a few general purpose i/o pins, some of which can be |
|---|
| 20 | configured to have special functions. At the time of writing an overview |
|---|
| 21 | of the chip, with links to the datasheet, can be seen at: |
|---|
| 22 | |
|---|
| 23 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2296/ln/en |
|---|
| 24 | |
|---|
| 25 | If that has moved searching for MAX6650 from Maxim's home page should |
|---|
| 26 | work. |
|---|
| 27 | |
|---|
| 28 | Driver state |
|---|
| 29 | ------------ |
|---|
| 30 | |
|---|
| 31 | Currently the driver provides the following entries in /proc/sys/ |
|---|
| 32 | dev/sensors/max6650-xxx/: |
|---|
| 33 | |
|---|
| 34 | fan1 through fan4 (read only): the current measured fan speeds, in |
|---|
| 35 | rpm. |
|---|
| 36 | |
|---|
| 37 | speed (read/write): when written, sets the chip to closed loop mode and |
|---|
| 38 | sets the configured speed, in rpm, to the value written. When read returns |
|---|
| 39 | the configured speed, again in rpm. |
|---|
| 40 | |
|---|
| 41 | xdump (read only): returns all of the chip register values, except the |
|---|
| 42 | tachometers. Used for debug, and should probably go away or be conditionally |
|---|
| 43 | compiled. |
|---|
| 44 | |
|---|
| 45 | The MAX665x uses byte wide registers with various scaling factors and |
|---|
| 46 | some more or less complex equations (in the datasheet) relating register |
|---|
| 47 | values to real world values. The driver takes care of all of this. |
|---|
| 48 | |
|---|
| 49 | Note that the measured speed ("fan1") never exactly matches the set speed |
|---|
| 50 | ("speed") because of the coarse resolution of the underlying registers. |
|---|
| 51 | |
|---|
| 52 | Assumptions |
|---|
| 53 | ----------- |
|---|
| 54 | |
|---|
| 55 | The driver assumes that: |
|---|
| 56 | |
|---|
| 57 | o The MAX665x is running from its internal 254 kHz clock, not an |
|---|
| 58 | external clock. |
|---|
| 59 | |
|---|
| 60 | o The monitored fans produce two pulses per rotation (This same |
|---|
| 61 | assumption is made by Maxim throughout the datasheet.) |
|---|
| 62 | |
|---|
| 63 | o The tachometer count time (register 0x16) has been configured suitably |
|---|
| 64 | for the fans in use, perhaps by some boot code. The driver reads this |
|---|
| 65 | register to compute rpm, but never writes to it. |
|---|
| 66 | |
|---|
| 67 | o The speed controller prescale (low three bits of register 0x04) has |
|---|
| 68 | been configured suitably for the fans in use, perhaps by some boot |
|---|
| 69 | code. The driver reads these bits to compute rpm, but never changes |
|---|
| 70 | them. |
|---|
| 71 | |
|---|
| 72 | The driver currently never reads or writes any other configuration |
|---|
| 73 | (gpio config, alarms, 5V/12V setting). |
|---|
| 74 | |
|---|
| 75 | Bugs |
|---|
| 76 | ---- |
|---|
| 77 | |
|---|
| 78 | o The driver assumes too much: it should be possible to set more of the |
|---|
| 79 | configuration dynamically instead of assuming that some other code has |
|---|
| 80 | done it. |
|---|
| 81 | |
|---|
| 82 | o It does not differentiate between a MAX6650 and a MAX6651, as I can |
|---|
| 83 | see no obvious way to do this. It has only been tested with a MAX6651 |
|---|
| 84 | so if anyone gets a board with a MAX6650 to test with maybe something |
|---|
| 85 | will be revealed, such as the three missing tachometer registers |
|---|
| 86 | returning all ones or something. (OK, so maybe I should have called |
|---|
| 87 | this driver max6651, and ignored the max6650 totally...) |
|---|
| 88 | |
|---|
| 89 | o The /proc names don't match the standards in doc/developers/proc, |
|---|
| 90 | as this chip doesn't map well to other fan controllers, |
|---|
| 91 | |
|---|
| 92 | Detection notes |
|---|
| 93 | --------------- |
|---|
| 94 | |
|---|
| 95 | The module will autodetect the presence of a max6650 or max6651 at any |
|---|
| 96 | of the four possible I2C addresses for these devices. There is no ID |
|---|
| 97 | register, but there are several registers with all zero bits at the |
|---|
| 98 | high end. The driver checks that all of these are in fact zero before |
|---|
| 99 | declaring the chip to be a MAX6650/1. |
|---|
| 100 | |
|---|
| 101 | sensors-detect |
|---|
| 102 | -------------- |
|---|
| 103 | |
|---|
| 104 | Support for MAX6650/1 has been added to sensors-detect. It has been |
|---|
| 105 | tested as correctly detecting a MAX6651 at I2C address 0x1B. Like the |
|---|
| 106 | driver, it cannot yet distinguish a MAX6650 and MAX6651. |
|---|
| 107 | |
|---|
| 108 | prog/sensors |
|---|
| 109 | ------------ |
|---|
| 110 | |
|---|
| 111 | Initial read-only support has been added to the "sensors" program. |
|---|
| 112 | |
|---|
| 113 | Testing |
|---|
| 114 | ------- |
|---|
| 115 | |
|---|
| 116 | The driver and associated programs have been tested under Linux 2.4.18 |
|---|
| 117 | running on an embedded Intel XScale processor (actually an IXP425 running |
|---|
| 118 | in big-endian mode) with a MAX6651 chip. |
|---|
| 119 | |
|---|
| 120 | Author |
|---|
| 121 | ------ |
|---|
| 122 | |
|---|
| 123 | John Morris (john.morris@spirentcom.com) |
|---|
| 124 | |
|---|
| 125 | |
|---|