ds1621 5.9 KB

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