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