ds1621 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 <khali@linux-fr.org>
  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. Temperature conversion of the DS1621 takes up to 1000ms; internal access to
  62. non-volatile registers may last for 10ms or below.
  63. The DS1625 is pin compatible and functionally equivalent with the DS1621,
  64. but the DS1621 is meant to replace it. The DS1631, DS1721, and DS1731 are
  65. also pin compatible with the DS1621, but provide multi-resolution support.
  66. Since there is no version or vendor identification register, there is
  67. no unique identification for these devices. Therefore, explicit device
  68. instantiation is required for correct device identification and functionality.
  69. And, for correct identification and operation, each device must be
  70. explicitly instantiated, one device per address, in this address
  71. range: 0x48..0x4f.
  72. The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0
  73. degree Celsius (from -10 to +85 degrees), a minimum/maximum alarm default
  74. setting of 75 and 80 degrees, and a maximum conversion time of 750ms.
  75. In addition, the DS1721 supports four resolution settings from 9 to 12 bits
  76. (defined in degrees C per LSB: 0.5, 0.25, 0.125, and 0.0625, respectively),
  77. that are set at device power on to the highest resolution: 12-bits.
  78. One additional note about the ds1721 is that although the data sheet says
  79. the temperature flags (THF and TLF) are used internally, these flags do
  80. get set and cleared as the actual temperature crosses the min or max settings.
  81. The DS1631 and DS1731 are pin compatible with the DS1621 and feature compatible
  82. with the DS1721. However, the DS1631 accuracy is +/- 0.5 degree Celsius (from 0
  83. to +70 degrees), while the DS1731 accuracy is +/-1 degree Celsius (from -10 to
  84. +85 degrees).
  85. The resolution mode for the DS1631, DS1721, or DS1731 can be changed from
  86. userspace, via the device 'update_interval' sysfs attribute. This attribute
  87. will normalize the range of input values to the device maximum resolution
  88. values defined in the datasheet as follows:
  89. Resolution Conversion Time Input Range
  90. (C/LSB) (msec) (msec)
  91. --------------------------------------------
  92. 0.5 93.75 0....94
  93. 0.25 187.5 95...187
  94. 0.125 375 188..375
  95. 0.0625 750 376..infinity
  96. --------------------------------------
  97. The following examples show how the 'update_interval' attribute can be
  98. used to change the conversion time:
  99. $ cat update_interval
  100. 750
  101. $ cat temp1_input
  102. 22062
  103. $
  104. $ echo 300 > update_interval
  105. $ cat update_interval
  106. 375
  107. $ cat temp1_input
  108. 22125
  109. $
  110. $ echo 150 > update_interval
  111. $ cat update_interval
  112. 188
  113. $ cat temp1_input
  114. 22250
  115. $
  116. $ echo 1 > update_interval
  117. $ cat update_interval
  118. 94
  119. $ cat temp1_input
  120. 22000
  121. $
  122. $ echo 1000 > update_interval
  123. $ cat update_interval
  124. 750
  125. $ cat temp1_input
  126. 22062
  127. $
  128. As shown, the ds1621 driver automatically adjusts the 'update_interval'
  129. user input, via a step function. Reading back the 'update_interval' value
  130. after a write operation provides the conversion time used by the device.
  131. Mathematically, the resolution can be derived from the conversion time
  132. via the following function:
  133. g(x) = 0.5 * [minimum_conversion_time/x]
  134. where:
  135. -> 'x' = the output from 'update_interval'
  136. -> 'g(x)' = the resolution in degrees C per LSB.
  137. -> 93.75ms = minimum conversion time