ds1621 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. Kernel driver ds1621
  2. ====================
  3. Supported chips:
  4. * Dallas Semiconductor / Maxim Integrated DS1621
  5. Prefix: 'ds1621'
  6. Addresses scanned: none
  7. Datasheet: Publicly available from www.maximintegrated.com
  8. * Dallas Semiconductor DS1625
  9. Prefix: 'ds1625'
  10. Addresses scanned: none
  11. Datasheet: Publicly available from www.datasheetarchive.com
  12. * Maxim Integrated DS1631
  13. Prefix: 'ds1631'
  14. Addresses scanned: none
  15. Datasheet: Publicly available from www.maximintegrated.com
  16. * Maxim Integrated DS1721
  17. Prefix: 'ds1721'
  18. Addresses scanned: none
  19. Datasheet: Publicly available from www.maximintegrated.com
  20. * Maxim Integrated DS1731
  21. Prefix: 'ds1731'
  22. Addresses scanned: none
  23. Datasheet: Publicly available from www.maximintegrated.com
  24. Authors:
  25. Christian W. Zuckschwerdt <zany@triq.net>
  26. valuable contributions by Jan M. Sendler <sendler@sendler.de>
  27. ported to 2.6 by Aurelien Jarno <aurelien@aurel32.net>
  28. with the help of Jean Delvare <jdelvare@suse.de>
  29. Module Parameters
  30. ------------------
  31. * polarity int
  32. Output's polarity: 0 = active high, 1 = active low
  33. Description
  34. -----------
  35. The DS1621 is a (one instance) digital thermometer and thermostat. It has
  36. both high and low temperature limits which can be user defined (i.e.
  37. programmed into non-volatile on-chip registers). Temperature range is -55
  38. degree Celsius to +125 in 0.5 increments. You may convert this into a
  39. Fahrenheit range of -67 to +257 degrees with 0.9 steps. If polarity
  40. parameter is not provided, original value is used.
  41. As for the thermostat, behavior can also be programmed using the polarity
  42. toggle. On the one hand ("heater"), the thermostat output of the chip,
  43. Tout, will trigger when the low limit temperature is met or underrun and
  44. stays high until the high limit is met or exceeded. On the other hand
  45. ("cooler"), vice versa. That way "heater" equals "active low", whereas
  46. "conditioner" equals "active high". Please note that the DS1621 data sheet
  47. is somewhat misleading in this point since setting the polarity bit does
  48. not simply invert Tout.
  49. A second thing is that, during extensive testing, Tout showed a tolerance
  50. of up to +/- 0.5 degrees even when compared against precise temperature
  51. readings. Be sure to have a high vs. low temperature limit gap of al least
  52. 1.0 degree Celsius to avoid Tout "bouncing", though!
  53. The alarm bits are set when the high or low limits are met or exceeded and
  54. are reset by the module as soon as the respective temperature ranges are
  55. left.
  56. The alarm registers are in no way suitable to find out about the actual
  57. status of Tout. They will only tell you about its history, whether or not
  58. any of the limits have ever been met or exceeded since last power-up or
  59. reset. Be aware: When testing, it showed that the status of Tout can change
  60. with neither of the alarms set.
  61. Since there is no version or vendor identification register, there is
  62. no unique identification for these devices. Therefore, explicit device
  63. instantiation is required for correct device identification and functionality
  64. (one device per address in this address range: 0x48..0x4f).
  65. The DS1625 is pin compatible and functionally equivalent with the DS1621,
  66. but the DS1621 is meant to replace it. The DS1631, DS1721, and DS1731 are
  67. also pin compatible with the DS1621 and provide multi-resolution support.
  68. Additionally, the DS1721 data sheet says the temperature flags (THF and TLF)
  69. are used internally, however, these flags do get set and cleared as the actual
  70. temperature crosses the min or max settings (which by default are set to 75
  71. and 80 degrees respectively).
  72. Temperature Conversion:
  73. -----------------------
  74. DS1621 - 750ms (older devices may take up to 1000ms)
  75. DS1625 - 500ms
  76. DS1631 - 93ms..750ms for 9..12 bits resolution, respectively.
  77. DS1721 - 93ms..750ms for 9..12 bits resolution, respectively.
  78. DS1731 - 93ms..750ms for 9..12 bits resolution, respectively.
  79. Note:
  80. On the DS1621, internal access to non-volatile registers may last for 10ms
  81. or less (unverified on the other devices).
  82. Temperature Accuracy:
  83. ---------------------
  84. DS1621: +/- 0.5 degree Celsius (from 0 to +70 degrees)
  85. DS1625: +/- 0.5 degree Celsius (from 0 to +70 degrees)
  86. DS1631: +/- 0.5 degree Celsius (from 0 to +70 degrees)
  87. DS1721: +/- 1.0 degree Celsius (from -10 to +85 degrees)
  88. DS1731: +/- 1.0 degree Celsius (from -10 to +85 degrees)
  89. Note:
  90. Please refer to the device datasheets for accuracy at other temperatures.
  91. Temperature Resolution:
  92. -----------------------
  93. As mentioned above, the DS1631, DS1721, and DS1731 provide multi-resolution
  94. support, which is achieved via the R0 and R1 config register bits, where:
  95. R0..R1
  96. ------
  97. 0 0 => 9 bits, 0.5 degrees Celcius
  98. 1 0 => 10 bits, 0.25 degrees Celcius
  99. 0 1 => 11 bits, 0.125 degrees Celcius
  100. 1 1 => 12 bits, 0.0625 degrees Celcius
  101. Note:
  102. At initial device power-on, the default resolution is set to 12-bits.
  103. The resolution mode for the DS1631, DS1721, or DS1731 can be changed from
  104. userspace, via the device 'update_interval' sysfs attribute. This attribute
  105. will normalize the range of input values to the device maximum resolution
  106. values defined in the datasheet as follows:
  107. Resolution Conversion Time Input Range
  108. (C/LSB) (msec) (msec)
  109. ------------------------------------------------
  110. 0.5 93.75 0....94
  111. 0.25 187.5 95...187
  112. 0.125 375 188..375
  113. 0.0625 750 376..infinity
  114. ------------------------------------------------
  115. The following examples show how the 'update_interval' attribute can be
  116. used to change the conversion time:
  117. $ cat update_interval
  118. 750
  119. $ cat temp1_input
  120. 22062
  121. $
  122. $ echo 300 > update_interval
  123. $ cat update_interval
  124. 375
  125. $ cat temp1_input
  126. 22125
  127. $
  128. $ echo 150 > update_interval
  129. $ cat update_interval
  130. 188
  131. $ cat temp1_input
  132. 22250
  133. $
  134. $ echo 1 > update_interval
  135. $ cat update_interval
  136. 94
  137. $ cat temp1_input
  138. 22000
  139. $
  140. $ echo 1000 > update_interval
  141. $ cat update_interval
  142. 750
  143. $ cat temp1_input
  144. 22062
  145. $
  146. As shown, the ds1621 driver automatically adjusts the 'update_interval'
  147. user input, via a step function. Reading back the 'update_interval' value
  148. after a write operation provides the conversion time used by the device.
  149. Mathematically, the resolution can be derived from the conversion time
  150. via the following function:
  151. g(x) = 0.5 * [minimum_conversion_time/x]
  152. where:
  153. -> 'x' = the output from 'update_interval'
  154. -> 'g(x)' = the resolution in degrees C per LSB.
  155. -> 93.75ms = minimum conversion time