1*7ebd8b66SMauro Carvalho ChehabKernel driver ds1621 2*7ebd8b66SMauro Carvalho Chehab==================== 3*7ebd8b66SMauro Carvalho Chehab 4*7ebd8b66SMauro Carvalho ChehabSupported chips: 5*7ebd8b66SMauro Carvalho Chehab 6*7ebd8b66SMauro Carvalho Chehab * Dallas Semiconductor / Maxim Integrated DS1621 7*7ebd8b66SMauro Carvalho Chehab 8*7ebd8b66SMauro Carvalho Chehab Prefix: 'ds1621' 9*7ebd8b66SMauro Carvalho Chehab 10*7ebd8b66SMauro Carvalho Chehab Addresses scanned: none 11*7ebd8b66SMauro Carvalho Chehab 12*7ebd8b66SMauro Carvalho Chehab Datasheet: Publicly available from www.maximintegrated.com 13*7ebd8b66SMauro Carvalho Chehab 14*7ebd8b66SMauro Carvalho Chehab * Dallas Semiconductor DS1625 15*7ebd8b66SMauro Carvalho Chehab 16*7ebd8b66SMauro Carvalho Chehab Prefix: 'ds1625' 17*7ebd8b66SMauro Carvalho Chehab 18*7ebd8b66SMauro Carvalho Chehab Addresses scanned: none 19*7ebd8b66SMauro Carvalho Chehab 20*7ebd8b66SMauro Carvalho Chehab Datasheet: Publicly available from www.datasheetarchive.com 21*7ebd8b66SMauro Carvalho Chehab 22*7ebd8b66SMauro Carvalho Chehab * Maxim Integrated DS1631 23*7ebd8b66SMauro Carvalho Chehab 24*7ebd8b66SMauro Carvalho Chehab Prefix: 'ds1631' 25*7ebd8b66SMauro Carvalho Chehab 26*7ebd8b66SMauro Carvalho Chehab Addresses scanned: none 27*7ebd8b66SMauro Carvalho Chehab 28*7ebd8b66SMauro Carvalho Chehab Datasheet: Publicly available from www.maximintegrated.com 29*7ebd8b66SMauro Carvalho Chehab 30*7ebd8b66SMauro Carvalho Chehab * Maxim Integrated DS1721 31*7ebd8b66SMauro Carvalho Chehab 32*7ebd8b66SMauro Carvalho Chehab Prefix: 'ds1721' 33*7ebd8b66SMauro Carvalho Chehab 34*7ebd8b66SMauro Carvalho Chehab Addresses scanned: none 35*7ebd8b66SMauro Carvalho Chehab 36*7ebd8b66SMauro Carvalho Chehab Datasheet: Publicly available from www.maximintegrated.com 37*7ebd8b66SMauro Carvalho Chehab 38*7ebd8b66SMauro Carvalho Chehab * Maxim Integrated DS1731 39*7ebd8b66SMauro Carvalho Chehab 40*7ebd8b66SMauro Carvalho Chehab Prefix: 'ds1731' 41*7ebd8b66SMauro Carvalho Chehab 42*7ebd8b66SMauro Carvalho Chehab Addresses scanned: none 43*7ebd8b66SMauro Carvalho Chehab 44*7ebd8b66SMauro Carvalho Chehab Datasheet: Publicly available from www.maximintegrated.com 45*7ebd8b66SMauro Carvalho Chehab 46*7ebd8b66SMauro Carvalho ChehabAuthors: 47*7ebd8b66SMauro Carvalho Chehab - Christian W. Zuckschwerdt <zany@triq.net> 48*7ebd8b66SMauro Carvalho Chehab - valuable contributions by Jan M. Sendler <sendler@sendler.de> 49*7ebd8b66SMauro Carvalho Chehab - ported to 2.6 by Aurelien Jarno <aurelien@aurel32.net> 50*7ebd8b66SMauro Carvalho Chehab with the help of Jean Delvare <jdelvare@suse.de> 51*7ebd8b66SMauro Carvalho Chehab 52*7ebd8b66SMauro Carvalho ChehabModule Parameters 53*7ebd8b66SMauro Carvalho Chehab------------------ 54*7ebd8b66SMauro Carvalho Chehab 55*7ebd8b66SMauro Carvalho Chehab* polarity int 56*7ebd8b66SMauro Carvalho Chehab Output's polarity: 57*7ebd8b66SMauro Carvalho Chehab 58*7ebd8b66SMauro Carvalho Chehab * 0 = active high, 59*7ebd8b66SMauro Carvalho Chehab * 1 = active low 60*7ebd8b66SMauro Carvalho Chehab 61*7ebd8b66SMauro Carvalho ChehabDescription 62*7ebd8b66SMauro Carvalho Chehab----------- 63*7ebd8b66SMauro Carvalho Chehab 64*7ebd8b66SMauro Carvalho ChehabThe DS1621 is a (one instance) digital thermometer and thermostat. It has 65*7ebd8b66SMauro Carvalho Chehabboth high and low temperature limits which can be user defined (i.e. 66*7ebd8b66SMauro Carvalho Chehabprogrammed into non-volatile on-chip registers). Temperature range is -55 67*7ebd8b66SMauro Carvalho Chehabdegree Celsius to +125 in 0.5 increments. You may convert this into a 68*7ebd8b66SMauro Carvalho ChehabFahrenheit range of -67 to +257 degrees with 0.9 steps. If polarity 69*7ebd8b66SMauro Carvalho Chehabparameter is not provided, original value is used. 70*7ebd8b66SMauro Carvalho Chehab 71*7ebd8b66SMauro Carvalho ChehabAs for the thermostat, behavior can also be programmed using the polarity 72*7ebd8b66SMauro Carvalho Chehabtoggle. On the one hand ("heater"), the thermostat output of the chip, 73*7ebd8b66SMauro Carvalho ChehabTout, will trigger when the low limit temperature is met or underrun and 74*7ebd8b66SMauro Carvalho Chehabstays high until the high limit is met or exceeded. On the other hand 75*7ebd8b66SMauro Carvalho Chehab("cooler"), vice versa. That way "heater" equals "active low", whereas 76*7ebd8b66SMauro Carvalho Chehab"conditioner" equals "active high". Please note that the DS1621 data sheet 77*7ebd8b66SMauro Carvalho Chehabis somewhat misleading in this point since setting the polarity bit does 78*7ebd8b66SMauro Carvalho Chehabnot simply invert Tout. 79*7ebd8b66SMauro Carvalho Chehab 80*7ebd8b66SMauro Carvalho ChehabA second thing is that, during extensive testing, Tout showed a tolerance 81*7ebd8b66SMauro Carvalho Chehabof up to +/- 0.5 degrees even when compared against precise temperature 82*7ebd8b66SMauro Carvalho Chehabreadings. Be sure to have a high vs. low temperature limit gap of al least 83*7ebd8b66SMauro Carvalho Chehab1.0 degree Celsius to avoid Tout "bouncing", though! 84*7ebd8b66SMauro Carvalho Chehab 85*7ebd8b66SMauro Carvalho ChehabThe alarm bits are set when the high or low limits are met or exceeded and 86*7ebd8b66SMauro Carvalho Chehabare reset by the module as soon as the respective temperature ranges are 87*7ebd8b66SMauro Carvalho Chehableft. 88*7ebd8b66SMauro Carvalho Chehab 89*7ebd8b66SMauro Carvalho ChehabThe alarm registers are in no way suitable to find out about the actual 90*7ebd8b66SMauro Carvalho Chehabstatus of Tout. They will only tell you about its history, whether or not 91*7ebd8b66SMauro Carvalho Chehabany of the limits have ever been met or exceeded since last power-up or 92*7ebd8b66SMauro Carvalho Chehabreset. Be aware: When testing, it showed that the status of Tout can change 93*7ebd8b66SMauro Carvalho Chehabwith neither of the alarms set. 94*7ebd8b66SMauro Carvalho Chehab 95*7ebd8b66SMauro Carvalho ChehabSince there is no version or vendor identification register, there is 96*7ebd8b66SMauro Carvalho Chehabno unique identification for these devices. Therefore, explicit device 97*7ebd8b66SMauro Carvalho Chehabinstantiation is required for correct device identification and functionality 98*7ebd8b66SMauro Carvalho Chehab(one device per address in this address range: 0x48..0x4f). 99*7ebd8b66SMauro Carvalho Chehab 100*7ebd8b66SMauro Carvalho ChehabThe DS1625 is pin compatible and functionally equivalent with the DS1621, 101*7ebd8b66SMauro Carvalho Chehabbut the DS1621 is meant to replace it. The DS1631, DS1721, and DS1731 are 102*7ebd8b66SMauro Carvalho Chehabalso pin compatible with the DS1621 and provide multi-resolution support. 103*7ebd8b66SMauro Carvalho Chehab 104*7ebd8b66SMauro Carvalho ChehabAdditionally, the DS1721 data sheet says the temperature flags (THF and TLF) 105*7ebd8b66SMauro Carvalho Chehabare used internally, however, these flags do get set and cleared as the actual 106*7ebd8b66SMauro Carvalho Chehabtemperature crosses the min or max settings (which by default are set to 75 107*7ebd8b66SMauro Carvalho Chehaband 80 degrees respectively). 108*7ebd8b66SMauro Carvalho Chehab 109*7ebd8b66SMauro Carvalho ChehabTemperature Conversion 110*7ebd8b66SMauro Carvalho Chehab---------------------- 111*7ebd8b66SMauro Carvalho Chehab 112*7ebd8b66SMauro Carvalho Chehab- DS1621 - 750ms (older devices may take up to 1000ms) 113*7ebd8b66SMauro Carvalho Chehab- DS1625 - 500ms 114*7ebd8b66SMauro Carvalho Chehab- DS1631 - 93ms..750ms for 9..12 bits resolution, respectively. 115*7ebd8b66SMauro Carvalho Chehab- DS1721 - 93ms..750ms for 9..12 bits resolution, respectively. 116*7ebd8b66SMauro Carvalho Chehab- DS1731 - 93ms..750ms for 9..12 bits resolution, respectively. 117*7ebd8b66SMauro Carvalho Chehab 118*7ebd8b66SMauro Carvalho ChehabNote: 119*7ebd8b66SMauro Carvalho ChehabOn the DS1621, internal access to non-volatile registers may last for 10ms 120*7ebd8b66SMauro Carvalho Chehabor less (unverified on the other devices). 121*7ebd8b66SMauro Carvalho Chehab 122*7ebd8b66SMauro Carvalho ChehabTemperature Accuracy 123*7ebd8b66SMauro Carvalho Chehab-------------------- 124*7ebd8b66SMauro Carvalho Chehab 125*7ebd8b66SMauro Carvalho Chehab- DS1621: +/- 0.5 degree Celsius (from 0 to +70 degrees) 126*7ebd8b66SMauro Carvalho Chehab- DS1625: +/- 0.5 degree Celsius (from 0 to +70 degrees) 127*7ebd8b66SMauro Carvalho Chehab- DS1631: +/- 0.5 degree Celsius (from 0 to +70 degrees) 128*7ebd8b66SMauro Carvalho Chehab- DS1721: +/- 1.0 degree Celsius (from -10 to +85 degrees) 129*7ebd8b66SMauro Carvalho Chehab- DS1731: +/- 1.0 degree Celsius (from -10 to +85 degrees) 130*7ebd8b66SMauro Carvalho Chehab 131*7ebd8b66SMauro Carvalho Chehab.. Note:: 132*7ebd8b66SMauro Carvalho Chehab 133*7ebd8b66SMauro Carvalho Chehab Please refer to the device datasheets for accuracy at other temperatures. 134*7ebd8b66SMauro Carvalho Chehab 135*7ebd8b66SMauro Carvalho ChehabTemperature Resolution: 136*7ebd8b66SMauro Carvalho Chehab----------------------- 137*7ebd8b66SMauro Carvalho ChehabAs mentioned above, the DS1631, DS1721, and DS1731 provide multi-resolution 138*7ebd8b66SMauro Carvalho Chehabsupport, which is achieved via the R0 and R1 config register bits, where: 139*7ebd8b66SMauro Carvalho Chehab 140*7ebd8b66SMauro Carvalho ChehabR0..R1 141*7ebd8b66SMauro Carvalho Chehab------ 142*7ebd8b66SMauro Carvalho Chehab 143*7ebd8b66SMauro Carvalho Chehab== == =============================== 144*7ebd8b66SMauro Carvalho ChehabR0 R1 145*7ebd8b66SMauro Carvalho Chehab== == =============================== 146*7ebd8b66SMauro Carvalho Chehab 0 0 9 bits, 0.5 degrees Celsius 147*7ebd8b66SMauro Carvalho Chehab 1 0 10 bits, 0.25 degrees Celsius 148*7ebd8b66SMauro Carvalho Chehab 0 1 11 bits, 0.125 degrees Celsius 149*7ebd8b66SMauro Carvalho Chehab 1 1 12 bits, 0.0625 degrees Celsius 150*7ebd8b66SMauro Carvalho Chehab== == =============================== 151*7ebd8b66SMauro Carvalho Chehab 152*7ebd8b66SMauro Carvalho Chehab.. Note:: 153*7ebd8b66SMauro Carvalho Chehab 154*7ebd8b66SMauro Carvalho Chehab At initial device power-on, the default resolution is set to 12-bits. 155*7ebd8b66SMauro Carvalho Chehab 156*7ebd8b66SMauro Carvalho ChehabThe resolution mode for the DS1631, DS1721, or DS1731 can be changed from 157*7ebd8b66SMauro Carvalho Chehabuserspace, via the device 'update_interval' sysfs attribute. This attribute 158*7ebd8b66SMauro Carvalho Chehabwill normalize the range of input values to the device maximum resolution 159*7ebd8b66SMauro Carvalho Chehabvalues defined in the datasheet as follows: 160*7ebd8b66SMauro Carvalho Chehab 161*7ebd8b66SMauro Carvalho Chehab============= ================== =============== 162*7ebd8b66SMauro Carvalho ChehabResolution Conversion Time Input Range 163*7ebd8b66SMauro Carvalho Chehab (C/LSB) (msec) (msec) 164*7ebd8b66SMauro Carvalho Chehab============= ================== =============== 165*7ebd8b66SMauro Carvalho Chehab0.5 93.75 0....94 166*7ebd8b66SMauro Carvalho Chehab0.25 187.5 95...187 167*7ebd8b66SMauro Carvalho Chehab0.125 375 188..375 168*7ebd8b66SMauro Carvalho Chehab0.0625 750 376..infinity 169*7ebd8b66SMauro Carvalho Chehab============= ================== =============== 170*7ebd8b66SMauro Carvalho Chehab 171*7ebd8b66SMauro Carvalho ChehabThe following examples show how the 'update_interval' attribute can be 172*7ebd8b66SMauro Carvalho Chehabused to change the conversion time:: 173*7ebd8b66SMauro Carvalho Chehab 174*7ebd8b66SMauro Carvalho Chehab $ cat update_interval 175*7ebd8b66SMauro Carvalho Chehab 750 176*7ebd8b66SMauro Carvalho Chehab $ cat temp1_input 177*7ebd8b66SMauro Carvalho Chehab 22062 178*7ebd8b66SMauro Carvalho Chehab $ 179*7ebd8b66SMauro Carvalho Chehab $ echo 300 > update_interval 180*7ebd8b66SMauro Carvalho Chehab $ cat update_interval 181*7ebd8b66SMauro Carvalho Chehab 375 182*7ebd8b66SMauro Carvalho Chehab $ cat temp1_input 183*7ebd8b66SMauro Carvalho Chehab 22125 184*7ebd8b66SMauro Carvalho Chehab $ 185*7ebd8b66SMauro Carvalho Chehab $ echo 150 > update_interval 186*7ebd8b66SMauro Carvalho Chehab $ cat update_interval 187*7ebd8b66SMauro Carvalho Chehab 188 188*7ebd8b66SMauro Carvalho Chehab $ cat temp1_input 189*7ebd8b66SMauro Carvalho Chehab 22250 190*7ebd8b66SMauro Carvalho Chehab $ 191*7ebd8b66SMauro Carvalho Chehab $ echo 1 > update_interval 192*7ebd8b66SMauro Carvalho Chehab $ cat update_interval 193*7ebd8b66SMauro Carvalho Chehab 94 194*7ebd8b66SMauro Carvalho Chehab $ cat temp1_input 195*7ebd8b66SMauro Carvalho Chehab 22000 196*7ebd8b66SMauro Carvalho Chehab $ 197*7ebd8b66SMauro Carvalho Chehab $ echo 1000 > update_interval 198*7ebd8b66SMauro Carvalho Chehab $ cat update_interval 199*7ebd8b66SMauro Carvalho Chehab 750 200*7ebd8b66SMauro Carvalho Chehab $ cat temp1_input 201*7ebd8b66SMauro Carvalho Chehab 22062 202*7ebd8b66SMauro Carvalho Chehab $ 203*7ebd8b66SMauro Carvalho Chehab 204*7ebd8b66SMauro Carvalho ChehabAs shown, the ds1621 driver automatically adjusts the 'update_interval' 205*7ebd8b66SMauro Carvalho Chehabuser input, via a step function. Reading back the 'update_interval' value 206*7ebd8b66SMauro Carvalho Chehabafter a write operation provides the conversion time used by the device. 207*7ebd8b66SMauro Carvalho Chehab 208*7ebd8b66SMauro Carvalho ChehabMathematically, the resolution can be derived from the conversion time 209*7ebd8b66SMauro Carvalho Chehabvia the following function: 210*7ebd8b66SMauro Carvalho Chehab 211*7ebd8b66SMauro Carvalho Chehab g(x) = 0.5 * [minimum_conversion_time/x] 212*7ebd8b66SMauro Carvalho Chehab 213*7ebd8b66SMauro Carvalho Chehabwhere: 214*7ebd8b66SMauro Carvalho Chehab 215*7ebd8b66SMauro Carvalho Chehab - 'x' = the output from 'update_interval' 216*7ebd8b66SMauro Carvalho Chehab - 'g(x)' = the resolution in degrees C per LSB. 217*7ebd8b66SMauro Carvalho Chehab - 93.75ms = minimum conversion time 218