xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/smsc47b397.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver smsc47b397
2*4882a593Smuzhiyun========================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * SMSC LPC47B397-NC
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun  * SMSC SCH5307-NS
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun  * SMSC SCH5317
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Prefix: 'smsc47b397'
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun    Addresses scanned: none, address read from Super I/O config space
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun    Datasheet: In this file
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunAuthors:
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun       - Mark M. Hoffman <mhoffman@lightlink.com>
21*4882a593Smuzhiyun       - Utilitek Systems, Inc.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunNovember 23, 2004
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe following specification describes the SMSC LPC47B397-NC [1]_ sensor chip
26*4882a593Smuzhiyun(for which there is no public datasheet available). This document was
27*4882a593Smuzhiyunprovided by Craig Kelly (In-Store Broadcast Network) and edited/corrected
28*4882a593Smuzhiyunby Mark M. Hoffman <mhoffman@lightlink.com>.
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun.. [1] And SMSC SCH5307-NS and SCH5317, which have different device IDs but are
31*4882a593Smuzhiyun       otherwise compatible.
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun-------------------------------------------------------------------------
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunMethods for detecting the HP SIO and reading the thermal data on a dc7100
36*4882a593Smuzhiyun-------------------------------------------------------------------------
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunThe thermal information on the dc7100 is contained in the SIO Hardware Monitor
39*4882a593Smuzhiyun(HWM). The information is accessed through an index/data pair. The index/data
40*4882a593Smuzhiyunpair is located at the HWM Base Address + 0 and the HWM Base Address + 1. The
41*4882a593SmuzhiyunHWM Base address can be obtained from Logical Device 8, registers 0x60 (MSB)
42*4882a593Smuzhiyunand 0x61 (LSB). Currently we are using 0x480 for the HWM Base Address and
43*4882a593Smuzhiyun0x480 and 0x481 for the index/data pair.
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunReading temperature information.
46*4882a593SmuzhiyunThe temperature information is located in the following registers:
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun=============== ======= =======================================================
49*4882a593SmuzhiyunTemp1		0x25	(Currently, this reflects the CPU temp on all systems).
50*4882a593SmuzhiyunTemp2		0x26
51*4882a593SmuzhiyunTemp3		0x27
52*4882a593SmuzhiyunTemp4		0x80
53*4882a593Smuzhiyun=============== ======= =======================================================
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunProgramming Example
56*4882a593SmuzhiyunThe following is an example of how to read the HWM temperature registers::
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun	MOV	DX,480H
59*4882a593Smuzhiyun	MOV	AX,25H
60*4882a593Smuzhiyun	OUT	DX,AL
61*4882a593Smuzhiyun	MOV	DX,481H
62*4882a593Smuzhiyun	IN	AL,DX
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunAL contains the data in hex, the temperature in Celsius is the decimal
65*4882a593Smuzhiyunequivalent.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunEx: If AL contains 0x2A, the temperature is 42 degrees C.
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunReading tach information.
70*4882a593SmuzhiyunThe fan speed information is located in the following registers:
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun=============== ======= ======= =================================
73*4882a593Smuzhiyun		LSB	MSB
74*4882a593SmuzhiyunTach1		0x28	0x29	(Currently, this reflects the CPU
75*4882a593Smuzhiyun				fan speed on all systems).
76*4882a593SmuzhiyunTach2		0x2A	0x2B
77*4882a593SmuzhiyunTach3		0x2C	0x2D
78*4882a593SmuzhiyunTach4		0x2E	0x2F
79*4882a593Smuzhiyun=============== ======= ======= =================================
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun.. Important::
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun	Reading the tach LSB locks the tach MSB.
84*4882a593Smuzhiyun	The LSB Must be read first.
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunHow to convert the tach reading to RPM
87*4882a593Smuzhiyun--------------------------------------
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunThe tach reading (TCount) is given by: (Tach MSB * 256) + (Tach LSB)
90*4882a593SmuzhiyunThe SIO counts the number of 90kHz (11.111us) pulses per revolution.
91*4882a593SmuzhiyunRPM = 60/(TCount * 11.111us)
92*4882a593Smuzhiyun
93*4882a593SmuzhiyunExample::
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun	Reg 0x28 = 0x9B
96*4882a593Smuzhiyun	Reg 0x29 = 0x08
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunTCount = 0x89B = 2203
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunRPM = 60 / (2203 * 11.11111 E-6) = 2451 RPM
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunObtaining the SIO version.
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunConfiguration Sequence
105*4882a593Smuzhiyun----------------------
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunTo program the configuration registers, the following sequence must be followed:
108*4882a593Smuzhiyun1. Enter Configuration Mode
109*4882a593Smuzhiyun2. Configure the Configuration Registers
110*4882a593Smuzhiyun3. Exit Configuration Mode.
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunEnter Configuration Mode
113*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^
114*4882a593Smuzhiyun
115*4882a593SmuzhiyunTo place the chip into the Configuration State The config key (0x55) is written
116*4882a593Smuzhiyunto the CONFIG PORT (0x2E).
117*4882a593Smuzhiyun
118*4882a593SmuzhiyunConfiguration Mode
119*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^
120*4882a593Smuzhiyun
121*4882a593SmuzhiyunIn configuration mode, the INDEX PORT is located at the CONFIG PORT address and
122*4882a593Smuzhiyunthe DATA PORT is at INDEX PORT address + 1.
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunThe desired configuration registers are accessed in two steps:
125*4882a593Smuzhiyun
126*4882a593Smuzhiyuna.	Write the index of the Logical Device Number Configuration Register
127*4882a593Smuzhiyun	(i.e., 0x07) to the INDEX PORT and then write the number of the
128*4882a593Smuzhiyun	desired logical device to the DATA PORT.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyunb.	Write the address of the desired configuration register within the
131*4882a593Smuzhiyun	logical device to the INDEX PORT and then write or read the config-
132*4882a593Smuzhiyun	uration register through the DATA PORT.
133*4882a593Smuzhiyun
134*4882a593SmuzhiyunNote:
135*4882a593Smuzhiyun	If accessing the Global Configuration Registers, step (a) is not required.
136*4882a593Smuzhiyun
137*4882a593SmuzhiyunExit Configuration Mode
138*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunTo exit the Configuration State the write 0xAA to the CONFIG PORT (0x2E).
141*4882a593SmuzhiyunThe chip returns to the RUN State.  (This is important).
142*4882a593Smuzhiyun
143*4882a593SmuzhiyunProgramming Example
144*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^
145*4882a593Smuzhiyun
146*4882a593SmuzhiyunThe following is an example of how to read the SIO Device ID located at 0x20:
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun	; ENTER CONFIGURATION MODE
149*4882a593Smuzhiyun	MOV	DX,02EH
150*4882a593Smuzhiyun	MOV	AX,055H
151*4882a593Smuzhiyun	OUT	DX,AL
152*4882a593Smuzhiyun	; GLOBAL CONFIGURATION  REGISTER
153*4882a593Smuzhiyun	MOV	DX,02EH
154*4882a593Smuzhiyun	MOV	AL,20H
155*4882a593Smuzhiyun	OUT	DX,AL
156*4882a593Smuzhiyun	; READ THE DATA
157*4882a593Smuzhiyun	MOV	DX,02FH
158*4882a593Smuzhiyun	IN	AL,DX
159*4882a593Smuzhiyun	; EXIT CONFIGURATION MODE
160*4882a593Smuzhiyun	MOV	DX,02EH
161*4882a593Smuzhiyun	MOV	AX,0AAH
162*4882a593Smuzhiyun	OUT	DX,AL
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThe registers of interest for identifying the SIO on the dc7100 are Device ID
165*4882a593Smuzhiyun(0x20) and Device Rev  (0x21).
166*4882a593Smuzhiyun
167*4882a593SmuzhiyunThe Device ID will read 0x6F (0x81 for SCH5307-NS, and 0x85 for SCH5317)
168*4882a593SmuzhiyunThe Device Rev currently reads 0x01
169*4882a593Smuzhiyun
170*4882a593SmuzhiyunObtaining the HWM Base Address
171*4882a593Smuzhiyun------------------------------
172*4882a593Smuzhiyun
173*4882a593SmuzhiyunThe following is an example of how to read the HWM Base Address located in
174*4882a593SmuzhiyunLogical Device 8::
175*4882a593Smuzhiyun
176*4882a593Smuzhiyun	; ENTER CONFIGURATION MODE
177*4882a593Smuzhiyun	MOV	DX,02EH
178*4882a593Smuzhiyun	MOV	AX,055H
179*4882a593Smuzhiyun	OUT	DX,AL
180*4882a593Smuzhiyun	; CONFIGURE REGISTER CRE0,
181*4882a593Smuzhiyun	; LOGICAL DEVICE 8
182*4882a593Smuzhiyun	MOV	DX,02EH
183*4882a593Smuzhiyun	MOV	AL,07H
184*4882a593Smuzhiyun	OUT	DX,AL ;Point to LD# Config Reg
185*4882a593Smuzhiyun	MOV	DX,02FH
186*4882a593Smuzhiyun	MOV	AL, 08H
187*4882a593Smuzhiyun	OUT	DX,AL;Point to Logical Device 8
188*4882a593Smuzhiyun	;
189*4882a593Smuzhiyun	MOV	DX,02EH
190*4882a593Smuzhiyun	MOV	AL,60H
191*4882a593Smuzhiyun	OUT	DX,AL	; Point to HWM Base Addr MSB
192*4882a593Smuzhiyun	MOV	DX,02FH
193*4882a593Smuzhiyun	IN	AL,DX	; Get MSB of HWM Base Addr
194*4882a593Smuzhiyun	; EXIT CONFIGURATION MODE
195*4882a593Smuzhiyun	MOV	DX,02EH
196*4882a593Smuzhiyun	MOV	AX,0AAH
197*4882a593Smuzhiyun	OUT	DX,AL
198