smsc.c revision 1.2.2.2 1 1.2.2.2 mjf /* $NetBSD: smsc.c,v 1.2.2.2 2007/07/11 20:06:31 mjf Exp $ */
2 1.2.2.2 mjf
3 1.2.2.2 mjf /*-
4 1.2.2.2 mjf * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 1.2.2.2 mjf * All rights reserved.
6 1.2.2.2 mjf *
7 1.2.2.2 mjf * This code is derived from software contributed to The NetBSD Foundation
8 1.2.2.2 mjf * by Brett Lymn.
9 1.2.2.2 mjf *
10 1.2.2.2 mjf * Redistribution and use in source and binary forms, with or without
11 1.2.2.2 mjf * modification, are permitted provided that the following conditions
12 1.2.2.2 mjf * are met:
13 1.2.2.2 mjf * 1. Redistributions of source code must retain the above copyright
14 1.2.2.2 mjf * notice, this list of conditions and the following disclaimer.
15 1.2.2.2 mjf * 2. Redistributions in binary form must reproduce the above copyright
16 1.2.2.2 mjf * notice, this list of conditions and the following disclaimer in the
17 1.2.2.2 mjf * documentation and/or other materials provided with the distribution.
18 1.2.2.2 mjf * 3. All advertising materials mentioning features or use of this software
19 1.2.2.2 mjf * must display the following acknowledgement:
20 1.2.2.2 mjf * This product includes software developed by the NetBSD
21 1.2.2.2 mjf * Foundation, Inc. and its contributors.
22 1.2.2.2 mjf * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.2.2.2 mjf * contributors may be used to endorse or promote products derived
24 1.2.2.2 mjf * from this software without specific prior written permission.
25 1.2.2.2 mjf *
26 1.2.2.2 mjf * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.2.2.2 mjf * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.2.2.2 mjf * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.2.2.2 mjf * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.2.2.2 mjf * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.2.2.2 mjf * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.2.2.2 mjf * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.2.2.2 mjf * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.2.2.2 mjf * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.2.2.2 mjf * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.2.2.2 mjf * POSSIBILITY OF SUCH DAMAGE.
37 1.2.2.2 mjf */
38 1.2.2.2 mjf
39 1.2.2.2 mjf /*
40 1.2.2.2 mjf * This is a driver for the Standard Microsystems Corp (SMSC)
41 1.2.2.2 mjf * LPC47B397 "super i/o" chip. This driver only handles the environment
42 1.2.2.2 mjf * monitoring capabilities of the chip, the other functions will be
43 1.2.2.2 mjf * probed/matched as "normal" PC hardware devices (serial ports, fdc, so on).
44 1.2.2.2 mjf * SMSC has not deigned to release a datasheet for this particular chip
45 1.2.2.2 mjf * (though they do for others they make) so this driver was written from
46 1.2.2.2 mjf * information contained in the comment block for the Linux driver.
47 1.2.2.2 mjf */
48 1.2.2.2 mjf
49 1.2.2.2 mjf #include <sys/cdefs.h>
50 1.2.2.2 mjf __KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.2.2.2 2007/07/11 20:06:31 mjf Exp $");
51 1.2.2.2 mjf
52 1.2.2.2 mjf #include <sys/param.h>
53 1.2.2.2 mjf #include <sys/systm.h>
54 1.2.2.2 mjf #include <sys/kernel.h>
55 1.2.2.2 mjf #include <sys/malloc.h>
56 1.2.2.2 mjf #include <sys/proc.h>
57 1.2.2.2 mjf #include <sys/device.h>
58 1.2.2.2 mjf #include <sys/conf.h>
59 1.2.2.2 mjf #include <sys/time.h>
60 1.2.2.2 mjf
61 1.2.2.2 mjf #include <machine/bus.h>
62 1.2.2.2 mjf
63 1.2.2.2 mjf #include <dev/isa/isareg.h>
64 1.2.2.2 mjf #include <dev/isa/isavar.h>
65 1.2.2.2 mjf
66 1.2.2.2 mjf #include <dev/sysmon/sysmonvar.h>
67 1.2.2.2 mjf
68 1.2.2.2 mjf #include <dev/isa/smscvar.h>
69 1.2.2.2 mjf
70 1.2.2.2 mjf #include <machine/intr.h>
71 1.2.2.2 mjf
72 1.2.2.2 mjf #if defined(LMDEBUG)
73 1.2.2.2 mjf #define DPRINTF(x) do { printf x; } while (0)
74 1.2.2.2 mjf #else
75 1.2.2.2 mjf #define DPRINTF(x)
76 1.2.2.2 mjf #endif
77 1.2.2.2 mjf
78 1.2.2.2 mjf int smsc_probe(struct device *, struct cfdata *, void *);
79 1.2.2.2 mjf void smsc_attach(struct device *, struct device *, void *);
80 1.2.2.2 mjf static uint8_t smsc_readreg(struct smsc_softc *, int);
81 1.2.2.2 mjf /*static void smsc_writereg(struct smsc_softc *, int, int);*/
82 1.2.2.2 mjf void smsc_setup(struct smsc_softc *);
83 1.2.2.2 mjf
84 1.2.2.2 mjf static int smsc_gtredata(struct sysmon_envsys *, envsys_data_t *);
85 1.2.2.2 mjf
86 1.2.2.2 mjf CFATTACH_DECL(smsc, sizeof(struct smsc_softc),
87 1.2.2.2 mjf smsc_probe, smsc_attach, NULL, NULL);
88 1.2.2.2 mjf
89 1.2.2.2 mjf struct smsc_sysmon {
90 1.2.2.2 mjf struct sysmon_envsys sme;
91 1.2.2.2 mjf struct smsc_softc *sc;
92 1.2.2.2 mjf envsys_data_t smsc_sensor[];
93 1.2.2.2 mjf };
94 1.2.2.2 mjf
95 1.2.2.2 mjf /*
96 1.2.2.2 mjf * Probe for the SMSC Super I/O chip
97 1.2.2.2 mjf */
98 1.2.2.2 mjf int
99 1.2.2.2 mjf smsc_probe(struct device *parent, struct cfdata *match, void *aux)
100 1.2.2.2 mjf {
101 1.2.2.2 mjf bus_space_handle_t ioh;
102 1.2.2.2 mjf struct isa_attach_args *ia = aux;
103 1.2.2.2 mjf int rv;
104 1.2.2.2 mjf uint8_t cr;
105 1.2.2.2 mjf
106 1.2.2.2 mjf /* Must supply an address */
107 1.2.2.2 mjf if (ia->ia_nio < 1)
108 1.2.2.2 mjf return 0;
109 1.2.2.2 mjf
110 1.2.2.2 mjf if (ISA_DIRECT_CONFIG(ia))
111 1.2.2.2 mjf return 0;
112 1.2.2.2 mjf
113 1.2.2.2 mjf if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
114 1.2.2.2 mjf return 0;
115 1.2.2.2 mjf
116 1.2.2.2 mjf if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, 2, 0, &ioh))
117 1.2.2.2 mjf return 0;
118 1.2.2.2 mjf
119 1.2.2.2 mjf /* To get the device ID we must enter config mode... */
120 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_START);
121 1.2.2.2 mjf
122 1.2.2.2 mjf /* Then select the device id register */
123 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_DEVICE_ID);
124 1.2.2.2 mjf
125 1.2.2.2 mjf /* Finally, read the id from the chip */
126 1.2.2.2 mjf cr = bus_space_read_1(ia->ia_iot, ioh, SMSC_DATA);
127 1.2.2.2 mjf
128 1.2.2.2 mjf /* Exit config mode, apparently this is important to do */
129 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_END);
130 1.2.2.2 mjf
131 1.2.2.2 mjf if (cr == SMSC_ID)
132 1.2.2.2 mjf rv = 1;
133 1.2.2.2 mjf else
134 1.2.2.2 mjf rv = 0;
135 1.2.2.2 mjf
136 1.2.2.2 mjf DPRINTF(("smsc: rv = %d, cr = %x\n", rv, cr));
137 1.2.2.2 mjf
138 1.2.2.2 mjf bus_space_unmap(ia->ia_iot, ioh, 2);
139 1.2.2.2 mjf
140 1.2.2.2 mjf if (rv) {
141 1.2.2.2 mjf ia->ia_nio = 1;
142 1.2.2.2 mjf ia->ia_io[0].ir_size = 2;
143 1.2.2.2 mjf
144 1.2.2.2 mjf ia->ia_niomem = 0;
145 1.2.2.2 mjf ia->ia_nirq = 0;
146 1.2.2.2 mjf ia->ia_ndrq = 0;
147 1.2.2.2 mjf }
148 1.2.2.2 mjf
149 1.2.2.2 mjf return rv;
150 1.2.2.2 mjf }
151 1.2.2.2 mjf
152 1.2.2.2 mjf /*
153 1.2.2.2 mjf * Get the base address for the monitoring registers and set up the
154 1.2.2.2 mjf * env sysmon framework.
155 1.2.2.2 mjf */
156 1.2.2.2 mjf void
157 1.2.2.2 mjf smsc_attach(struct device *parent, struct device *self, void *aux)
158 1.2.2.2 mjf {
159 1.2.2.2 mjf struct smsc_softc *smsc_sc = (void *)self;
160 1.2.2.2 mjf struct isa_attach_args *ia = aux;
161 1.2.2.2 mjf bus_space_handle_t ioh;
162 1.2.2.2 mjf uint8_t rev, msb, lsb;
163 1.2.2.2 mjf unsigned address;
164 1.2.2.2 mjf
165 1.2.2.2 mjf smsc_sc->smsc_iot = ia->ia_iot;
166 1.2.2.2 mjf
167 1.2.2.2 mjf /* To attach we need to find the actual i/o register space,
168 1.2.2.2 mjf map the base registers in first. */
169 1.2.2.2 mjf if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, 2, 0,
170 1.2.2.2 mjf &ioh)) {
171 1.2.2.2 mjf aprint_error(": can't map base i/o space\n");
172 1.2.2.2 mjf return;
173 1.2.2.2 mjf }
174 1.2.2.2 mjf
175 1.2.2.2 mjf /* Enter config mode. */
176 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_START);
177 1.2.2.2 mjf
178 1.2.2.2 mjf /* While we have the base registers mapped, grab the chip revision */
179 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_DEVICE_REVISION);
180 1.2.2.2 mjf rev = bus_space_read_1(ia->ia_iot, ioh, SMSC_DATA);
181 1.2.2.2 mjf
182 1.2.2.2 mjf /* Select the correct logical device */
183 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_LOGICAL_DEV_SEL);
184 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_DATA, SMSC_LOGICAL_DEVICE);
185 1.2.2.2 mjf
186 1.2.2.2 mjf /* Read the base address for the registers. */
187 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_IO_BASE_MSB);
188 1.2.2.2 mjf msb = bus_space_read_1(ia->ia_iot, ioh, SMSC_DATA);
189 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_IO_BASE_LSB);
190 1.2.2.2 mjf lsb = bus_space_read_1(ia->ia_iot, ioh, SMSC_DATA);
191 1.2.2.2 mjf address = (msb << 8) | lsb;
192 1.2.2.2 mjf
193 1.2.2.2 mjf /* Exit config mode */
194 1.2.2.2 mjf bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_END);
195 1.2.2.2 mjf
196 1.2.2.2 mjf bus_space_unmap(ia->ia_iot, ioh, 2);
197 1.2.2.2 mjf
198 1.2.2.2 mjf /* Map the i/o space for the registers. */
199 1.2.2.2 mjf if (bus_space_map(ia->ia_iot, address, 2, 0, &smsc_sc->smsc_ioh)) {
200 1.2.2.2 mjf aprint_error(": can't map register i/o space\n");
201 1.2.2.2 mjf return;
202 1.2.2.2 mjf }
203 1.2.2.2 mjf
204 1.2.2.2 mjf aprint_normal(": monitor registers at 0x%04x (rev. %u)\n",
205 1.2.2.2 mjf address, rev);
206 1.2.2.2 mjf
207 1.2.2.2 mjf smsc_setup(smsc_sc);
208 1.2.2.2 mjf }
209 1.2.2.2 mjf
210 1.2.2.2 mjf
211 1.2.2.2 mjf /*
212 1.2.2.2 mjf * Read the value of the given register
213 1.2.2.2 mjf */
214 1.2.2.2 mjf static uint8_t
215 1.2.2.2 mjf smsc_readreg(struct smsc_softc *sc, int reg)
216 1.2.2.2 mjf {
217 1.2.2.2 mjf bus_space_write_1(sc->smsc_iot, sc->smsc_ioh, SMSC_ADDR, reg);
218 1.2.2.2 mjf return bus_space_read_1(sc->smsc_iot, sc->smsc_ioh, SMSC_DATA);
219 1.2.2.2 mjf }
220 1.2.2.2 mjf
221 1.2.2.2 mjf
222 1.2.2.2 mjf /*
223 1.2.2.2 mjf * Write the given value to the given register - here just for completeness
224 1.2.2.2 mjf * it is unused in the current code.
225 1.2.2.2 mjf
226 1.2.2.2 mjf static void
227 1.2.2.2 mjf smsc_writereg (struct smsc_softc *sc, int reg, int val)
228 1.2.2.2 mjf {
229 1.2.2.2 mjf bus_space_write_1(sc->smsc_iot, sc->smsc_ioh, SMSC_ADDR, reg);
230 1.2.2.2 mjf bus_space_write_1(sc->smsc_iot, sc->smsc_ioh, SMSC_DATA, val);
231 1.2.2.2 mjf } */
232 1.2.2.2 mjf
233 1.2.2.2 mjf /* convert temperature read from the chip to micro kelvin */
234 1.2.2.2 mjf static inline int
235 1.2.2.2 mjf smsc_temp2muk(uint8_t t)
236 1.2.2.2 mjf {
237 1.2.2.2 mjf int temp=t;
238 1.2.2.2 mjf
239 1.2.2.2 mjf return temp * 1000000 + 273150000U;
240 1.2.2.2 mjf }
241 1.2.2.2 mjf
242 1.2.2.2 mjf /*
243 1.2.2.2 mjf * convert register value read from chip into rpm using:
244 1.2.2.2 mjf *
245 1.2.2.2 mjf * RPM = 60/(Count * 11.111us)
246 1.2.2.2 mjf *
247 1.2.2.2 mjf * 1/1.1111us = 90kHz
248 1.2.2.2 mjf *
249 1.2.2.2 mjf */
250 1.2.2.2 mjf static inline int
251 1.2.2.2 mjf smsc_reg2rpm(unsigned int r)
252 1.2.2.2 mjf {
253 1.2.2.2 mjf unsigned long rpm;
254 1.2.2.2 mjf
255 1.2.2.2 mjf if (r == 0x0)
256 1.2.2.2 mjf return 0;
257 1.2.2.2 mjf
258 1.2.2.2 mjf rpm = (90000 * 60) / ((unsigned long) r);
259 1.2.2.2 mjf return (int) rpm;
260 1.2.2.2 mjf }
261 1.2.2.2 mjf
262 1.2.2.2 mjf /* min and max temperatures in uK */
263 1.2.2.2 mjf #define SMSC_MIN_TEMP_UK ((-127 * 1000000) + 273150000)
264 1.2.2.2 mjf #define SMSC_MAX_TEMP_UK ((127 * 1000000) + 273150000)
265 1.2.2.2 mjf
266 1.2.2.2 mjf /*
267 1.2.2.2 mjf * Set up the environment monitoring framework for all the devices
268 1.2.2.2 mjf * that we monitor.
269 1.2.2.2 mjf */
270 1.2.2.2 mjf void
271 1.2.2.2 mjf smsc_setup(struct smsc_softc *sc)
272 1.2.2.2 mjf {
273 1.2.2.2 mjf struct smsc_sysmon *datap;
274 1.2.2.2 mjf int error, i;
275 1.2.2.2 mjf char label[8];
276 1.2.2.2 mjf envsys_data_t *edata;
277 1.2.2.2 mjf
278 1.2.2.2 mjf datap = malloc(sizeof(struct sysmon_envsys) + SMSC_MAX_SENSORS *
279 1.2.2.2 mjf sizeof(envsys_data_t) + sizeof(void *),
280 1.2.2.2 mjf M_DEVBUF, M_WAITOK | M_ZERO);
281 1.2.2.2 mjf
282 1.2.2.2 mjf for (i = 0; i < 4; i++) {
283 1.2.2.2 mjf edata = &datap->smsc_sensor[i];
284 1.2.2.2 mjf sprintf(label, "Temp-%d", i + 1);
285 1.2.2.2 mjf strlcpy(edata->desc, label, sizeof(edata->desc));
286 1.2.2.2 mjf edata->units = ENVSYS_STEMP;
287 1.2.2.2 mjf edata->sensor = i;
288 1.2.2.2 mjf edata->state = ENVSYS_SVALID;
289 1.2.2.2 mjf switch (i) {
290 1.2.2.2 mjf case 0:
291 1.2.2.2 mjf sc->regs[i] = SMSC_TEMP1;
292 1.2.2.2 mjf break;
293 1.2.2.2 mjf
294 1.2.2.2 mjf case 1:
295 1.2.2.2 mjf sc->regs[i] = SMSC_TEMP2;
296 1.2.2.2 mjf break;
297 1.2.2.2 mjf
298 1.2.2.2 mjf case 2:
299 1.2.2.2 mjf sc->regs[i] = SMSC_TEMP3;
300 1.2.2.2 mjf break;
301 1.2.2.2 mjf
302 1.2.2.2 mjf case 3:
303 1.2.2.2 mjf sc->regs[i] = SMSC_TEMP4;
304 1.2.2.2 mjf break;
305 1.2.2.2 mjf }
306 1.2.2.2 mjf
307 1.2.2.2 mjf }
308 1.2.2.2 mjf
309 1.2.2.2 mjf for (i = 4; i < SMSC_MAX_SENSORS; i++) {
310 1.2.2.2 mjf edata = &datap->smsc_sensor[i];
311 1.2.2.2 mjf sprintf(label, "Fan-%d", i - 3);
312 1.2.2.2 mjf strlcpy(edata->desc, label, sizeof(edata->desc));
313 1.2.2.2 mjf edata->units = ENVSYS_SFANRPM;
314 1.2.2.2 mjf edata->sensor = i;
315 1.2.2.2 mjf edata->units = ENVSYS_SFANRPM;
316 1.2.2.2 mjf edata->state = ENVSYS_SVALID;
317 1.2.2.2 mjf
318 1.2.2.2 mjf switch (i) {
319 1.2.2.2 mjf case 4:
320 1.2.2.2 mjf sc->regs[i] = SMSC_FAN1_LSB;
321 1.2.2.2 mjf break;
322 1.2.2.2 mjf
323 1.2.2.2 mjf case 5:
324 1.2.2.2 mjf sc->regs[i] = SMSC_FAN2_LSB;
325 1.2.2.2 mjf break;
326 1.2.2.2 mjf
327 1.2.2.2 mjf case 6:
328 1.2.2.2 mjf sc->regs[i] = SMSC_FAN3_LSB;
329 1.2.2.2 mjf break;
330 1.2.2.2 mjf
331 1.2.2.2 mjf case 7:
332 1.2.2.2 mjf sc->regs[i] = SMSC_FAN4_LSB;
333 1.2.2.2 mjf break;
334 1.2.2.2 mjf
335 1.2.2.2 mjf default:
336 1.2.2.2 mjf aprint_error(": more fans than expected");
337 1.2.2.2 mjf break;
338 1.2.2.2 mjf }
339 1.2.2.2 mjf }
340 1.2.2.2 mjf
341 1.2.2.2 mjf sc->smsc_sysmon = &datap->sme;
342 1.2.2.2 mjf datap->sme.sme_nsensors = SMSC_MAX_SENSORS;
343 1.2.2.2 mjf datap->sme.sme_sensor_data = datap->smsc_sensor;
344 1.2.2.2 mjf datap->sme.sme_name = sc->sc_dev.dv_xname;
345 1.2.2.2 mjf datap->sme.sme_cookie = sc;
346 1.2.2.2 mjf datap->sme.sme_gtredata = smsc_gtredata;
347 1.2.2.2 mjf
348 1.2.2.2 mjf if ((error = sysmon_envsys_register(&datap->sme)) != 0) {
349 1.2.2.2 mjf aprint_error("%s: unable to register with sysmon (%d)\n",
350 1.2.2.2 mjf sc->sc_dev.dv_xname, error);
351 1.2.2.2 mjf return;
352 1.2.2.2 mjf }
353 1.2.2.2 mjf
354 1.2.2.2 mjf }
355 1.2.2.2 mjf
356 1.2.2.2 mjf /*
357 1.2.2.2 mjf * Get the data for the requested sensor, update the sysmon structure
358 1.2.2.2 mjf * with the retrieved value.
359 1.2.2.2 mjf */
360 1.2.2.2 mjf static int
361 1.2.2.2 mjf smsc_gtredata(struct sysmon_envsys *sme, envsys_data_t *edata)
362 1.2.2.2 mjf {
363 1.2.2.2 mjf struct smsc_softc *sc = sme->sme_cookie;
364 1.2.2.2 mjf int i, reg;
365 1.2.2.2 mjf unsigned int rpm;
366 1.2.2.2 mjf uint8_t msb, lsb;
367 1.2.2.2 mjf
368 1.2.2.2 mjf i = edata->sensor;
369 1.2.2.2 mjf reg = sc->regs[i];
370 1.2.2.2 mjf
371 1.2.2.2 mjf switch (edata->units) {
372 1.2.2.2 mjf case ENVSYS_STEMP:
373 1.2.2.2 mjf edata->value_cur = smsc_temp2muk(smsc_readreg(sc, reg));
374 1.2.2.2 mjf break;
375 1.2.2.2 mjf
376 1.2.2.2 mjf case ENVSYS_SFANRPM:
377 1.2.2.2 mjf /* reading lsb first locks msb... */
378 1.2.2.2 mjf lsb = smsc_readreg(sc, reg);
379 1.2.2.2 mjf msb = smsc_readreg(sc, reg + 1); /* XXX note explicit
380 1.2.2.2 mjf assumption that msb is
381 1.2.2.2 mjf the next register along */
382 1.2.2.2 mjf rpm = (msb << 8) | lsb;
383 1.2.2.2 mjf edata->value_cur = smsc_reg2rpm(rpm);
384 1.2.2.2 mjf break;
385 1.2.2.2 mjf }
386 1.2.2.2 mjf
387 1.2.2.2 mjf edata->state = ENVSYS_SVALID;
388 1.2.2.2 mjf return 0;
389 1.2.2.2 mjf }
390