xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/lm73.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver lm73
2*4882a593Smuzhiyun==================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * Texas Instruments LM73
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun    Prefix: 'lm73'
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Addresses scanned: I2C 0x48, 0x49, 0x4a, 0x4c, 0x4d, and 0x4e
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: Publicly available at the Texas Instruments website
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun	       https://www.ti.com/product/lm73
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunAuthor: Guillaume Ligneul <guillaume.ligneul@gmail.com>
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunDocumentation: Chris Verges <kg4ysn@gmail.com>
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunDescription
23*4882a593Smuzhiyun-----------
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe LM73 is a digital temperature sensor.  All temperature values are
26*4882a593Smuzhiyungiven in degrees Celsius.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunMeasurement Resolution Support
29*4882a593Smuzhiyun------------------------------
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunThe LM73 supports four resolutions, defined in terms of degrees C per
32*4882a593SmuzhiyunLSB: 0.25, 0.125, 0.0625, and 0.3125.  Changing the resolution mode
33*4882a593Smuzhiyunaffects the conversion time of the LM73's analog-to-digital converter.
34*4882a593SmuzhiyunFrom userspace, the desired resolution can be specified as a function of
35*4882a593Smuzhiyunconversion time via the 'update_interval' sysfs attribute for the
36*4882a593Smuzhiyundevice.  This attribute will normalize ranges of input values to the
37*4882a593Smuzhiyunmaximum times defined for the resolution in the datasheet.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun    ============= ============= ============
40*4882a593Smuzhiyun    Resolution    Conv. Time    Input Range
41*4882a593Smuzhiyun    (C/LSB)       (msec)        (msec)
42*4882a593Smuzhiyun    ============= ============= ============
43*4882a593Smuzhiyun    0.25          14             0..14
44*4882a593Smuzhiyun    0.125         28            15..28
45*4882a593Smuzhiyun    0.0625        56            29..56
46*4882a593Smuzhiyun    0.03125       112           57..infinity
47*4882a593Smuzhiyun    ============= ============= ============
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunThe following examples show how the 'update_interval' attribute can be
50*4882a593Smuzhiyunused to change the conversion time::
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun    $ echo 0 > update_interval
53*4882a593Smuzhiyun    $ cat update_interval
54*4882a593Smuzhiyun    14
55*4882a593Smuzhiyun    $ cat temp1_input
56*4882a593Smuzhiyun    24250
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun    $ echo 22 > update_interval
59*4882a593Smuzhiyun    $ cat update_interval
60*4882a593Smuzhiyun    28
61*4882a593Smuzhiyun    $ cat temp1_input
62*4882a593Smuzhiyun    24125
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun    $ echo 56 > update_interval
65*4882a593Smuzhiyun    $ cat update_interval
66*4882a593Smuzhiyun    56
67*4882a593Smuzhiyun    $ cat temp1_input
68*4882a593Smuzhiyun    24062
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun    $ echo 85 > update_interval
71*4882a593Smuzhiyun    $ cat update_interval
72*4882a593Smuzhiyun    112
73*4882a593Smuzhiyun    $ cat temp1_input
74*4882a593Smuzhiyun    24031
75*4882a593Smuzhiyun
76*4882a593SmuzhiyunAs shown here, the lm73 driver automatically adjusts any user input for
77*4882a593Smuzhiyun'update_interval' via a step function.  Reading back the
78*4882a593Smuzhiyun'update_interval' value after a write operation will confirm the
79*4882a593Smuzhiyunconversion time actively in use.
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunMathematically, the resolution can be derived from the conversion time
82*4882a593Smuzhiyunvia the following function:
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun   g(x) = 0.250 * [log(x/14) / log(2)]
85*4882a593Smuzhiyun
86*4882a593Smuzhiyunwhere 'x' is the output from 'update_interval' and 'g(x)' is the
87*4882a593Smuzhiyunresolution in degrees C per LSB.
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunAlarm Support
90*4882a593Smuzhiyun-------------
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunThe LM73 features a simple over-temperature alarm mechanism.  This
93*4882a593Smuzhiyunfeature is exposed via the sysfs attributes.
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunThe attributes 'temp1_max_alarm' and 'temp1_min_alarm' are flags
96*4882a593Smuzhiyunprovided by the LM73 that indicate whether the measured temperature has
97*4882a593Smuzhiyunpassed the 'temp1_max' and 'temp1_min' thresholds, respectively.  These
98*4882a593Smuzhiyunvalues _must_ be read to clear the registers on the LM73.
99