xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/max197.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver max197
2*4882a593Smuzhiyun====================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunAuthor:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunSupported chips:
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun  * Maxim MAX197
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Prefix: 'max197'
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX197.pdf
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun  * Maxim MAX199
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    Prefix: 'max199'
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX199.pdf
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunDescription
23*4882a593Smuzhiyun-----------
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe A/D converters MAX197, and MAX199 are both 8-Channel, Multi-Range, 5V,
26*4882a593Smuzhiyun12-Bit DAS with 8+4 Bus Interface and Fault Protection.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunThe available ranges for the MAX197 are {0,-5V} to 5V, and {0,-10V} to 10V,
29*4882a593Smuzhiyunwhile they are {0,-2V} to 2V, and {0,-4V} to 4V on the MAX199.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunPlatform data
32*4882a593Smuzhiyun-------------
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunThe MAX197 platform data (defined in linux/platform_data/max197.h) should be
35*4882a593Smuzhiyunfilled with a pointer to a conversion function, defined like::
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun    int convert(u8 ctrl);
38*4882a593Smuzhiyun
39*4882a593Smuzhiyunctrl is the control byte to write to start a new conversion.
40*4882a593SmuzhiyunOn success, the function must return the 12-bit raw value read from the chip,
41*4882a593Smuzhiyunor a negative error code otherwise.
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunControl byte format:
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun======= ========== ============================================
46*4882a593SmuzhiyunBit     Name       Description
47*4882a593Smuzhiyun7,6     PD1,PD0    Clock and Power-Down modes
48*4882a593Smuzhiyun5       ACQMOD     Internal or External Controlled Acquisition
49*4882a593Smuzhiyun4       RNG        Full-scale voltage magnitude at the input
50*4882a593Smuzhiyun3       BIP        Unipolar or Bipolar conversion mode
51*4882a593Smuzhiyun2,1,0   A2,A1,A0   Channel
52*4882a593Smuzhiyun======= ========== ============================================
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunSysfs interface
55*4882a593Smuzhiyun---------------
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun  ============== ==============================================================
58*4882a593Smuzhiyun  in[0-7]_input  The conversion value for the corresponding channel.
59*4882a593Smuzhiyun		 RO
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun  in[0-7]_min    The lower limit (in mV) for the corresponding channel.
62*4882a593Smuzhiyun		 For the MAX197, it will be adjusted to -10000, -5000, or 0.
63*4882a593Smuzhiyun		 For the MAX199, it will be adjusted to -4000, -2000, or 0.
64*4882a593Smuzhiyun		 RW
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun  in[0-7]_max    The higher limit (in mV) for the corresponding channel.
67*4882a593Smuzhiyun		 For the MAX197, it will be adjusted to 0, 5000, or 10000.
68*4882a593Smuzhiyun		 For the MAX199, it will be adjusted to 0, 2000, or 4000.
69*4882a593Smuzhiyun		 RW
70*4882a593Smuzhiyun  ============== ==============================================================
71