sdtemp.c revision 1.21.10.1 1 /* $NetBSD: sdtemp.c,v 1.21.10.1 2013/08/28 23:59:25 rmind Exp $ */
2
3 /*
4 * Copyright (c) 2009 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Goyette.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.21.10.1 2013/08/28 23:59:25 rmind Exp $");
34
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/kmem.h>
38 #include <sys/device.h>
39 #include <sys/kernel.h>
40 #include <sys/endian.h>
41 #include <sys/module.h>
42
43 #include <dev/sysmon/sysmonvar.h>
44
45 #include <dev/i2c/i2cvar.h>
46 #include <dev/i2c/sdtemp_reg.h>
47
48 struct sdtemp_softc {
49 device_t sc_dev;
50 i2c_tag_t sc_tag;
51 int sc_address;
52
53 struct sysmon_envsys *sc_sme;
54 envsys_data_t *sc_sensor;
55 sysmon_envsys_lim_t sc_deflims;
56 uint32_t sc_defprops;
57 int sc_resolution;
58 uint16_t sc_capability;
59 };
60
61 static int sdtemp_match(device_t, cfdata_t, void *);
62 static void sdtemp_attach(device_t, device_t, void *);
63 static int sdtemp_detach(device_t, int);
64
65 CFATTACH_DECL_NEW(sdtemp, sizeof(struct sdtemp_softc),
66 sdtemp_match, sdtemp_attach, sdtemp_detach, NULL);
67
68 static void sdtemp_refresh(struct sysmon_envsys *, envsys_data_t *);
69 static void sdtemp_get_limits(struct sysmon_envsys *, envsys_data_t *,
70 sysmon_envsys_lim_t *, uint32_t *);
71 static void sdtemp_set_limits(struct sysmon_envsys *, envsys_data_t *,
72 sysmon_envsys_lim_t *, uint32_t *);
73 #ifdef NOT_YET
74 static int sdtemp_read_8(struct sdtemp_softc *, uint8_t, uint8_t *);
75 static int sdtemp_write_8(struct sdtemp_softc *, uint8_t, uint8_t);
76 #endif /* NOT YET */
77 static int sdtemp_read_16(struct sdtemp_softc *, uint8_t, uint16_t *);
78 static int sdtemp_write_16(struct sdtemp_softc *, uint8_t, uint16_t);
79 static uint32_t sdtemp_decode_temp(struct sdtemp_softc *, uint16_t);
80 static bool sdtemp_pmf_suspend(device_t, const pmf_qual_t *);
81 static bool sdtemp_pmf_resume(device_t, const pmf_qual_t *);
82
83 struct sdtemp_dev_entry {
84 const uint16_t sdtemp_mfg_id;
85 const uint16_t sdtemp_devrev;
86 const uint16_t sdtemp_mask;
87 const uint8_t sdtemp_resolution;
88 const char *sdtemp_desc;
89 };
90
91 /* Convert sysmon_envsys uKelvin value to simple degC */
92
93 #define __UK2C(uk) (((uk) - 273150000) / 1000000)
94
95 /*
96 * List of devices known to conform to JEDEC JC42.4
97 *
98 * NOTE: A non-negative value for resolution indicates that the sensor
99 * resolution is fixed at that number of fractional bits; a negative
100 * value indicates that the sensor needs to be configured. In either
101 * case, trip-point registers are fixed at two-bit (0.25C) resolution.
102 */
103 static const struct sdtemp_dev_entry
104 sdtemp_dev_table[] = {
105 { MAXIM_MANUFACTURER_ID, MAX_6604_DEVICE_ID, MAX_6604_MASK, 3,
106 "Maxim MAX6604" },
107 { MCP_MANUFACTURER_ID, MCP_9805_DEVICE_ID, MCP_9805_MASK, 2,
108 "Microchip Tech MCP9805/MCP9843" },
109 { MCP_MANUFACTURER_ID, MCP_98243_DEVICE_ID, MCP_98243_MASK, -4,
110 "Microchip Tech MCP98243" },
111 { MCP_MANUFACTURER_ID, MCP_98242_DEVICE_ID, MCP_98242_MASK, -4,
112 "Microchip Tech MCP98242" },
113 { ADT_MANUFACTURER_ID, ADT_7408_DEVICE_ID, ADT_7408_MASK, 4,
114 "Analog Devices ADT7408" },
115 { NXP_MANUFACTURER_ID, NXP_SE98_DEVICE_ID, NXP_SE98_MASK, 3,
116 "NXP Semiconductors SE97B/SE98" },
117 { NXP_MANUFACTURER_ID, NXP_SE97_DEVICE_ID, NXP_SE97_MASK, 3,
118 "NXP Semiconductors SE97" },
119 { STTS_MANUFACTURER_ID, STTS_424E_DEVICE_ID, STTS_424E_MASK, 2,
120 "STmicroelectronics STTS424E" },
121 { STTS_MANUFACTURER_ID, STTS_424_DEVICE_ID, STTS_424_MASK, 2,
122 "STmicroelectronics STTS424" },
123 { CAT_MANUFACTURER_ID, CAT_34TS02_DEVICE_ID, CAT_34TS02_MASK, 4,
124 "Catalyst CAT34TS02/CAT6095" },
125 { IDT_MANUFACTURER_ID, IDT_TS3000B3_DEVICE_ID, IDT_TS3000B3_MASK, 4,
126 "Integrated Device Technology TS3000B3/TSE2002B3" },
127 { 0, 0, 0, 2, "Unknown" }
128 };
129
130 static int
131 sdtemp_lookup(uint16_t mfg, uint16_t devrev)
132 {
133 int i;
134
135 for (i = 0; sdtemp_dev_table[i].sdtemp_mfg_id; i++) {
136 if (mfg != sdtemp_dev_table[i].sdtemp_mfg_id)
137 continue;
138 if ((devrev & sdtemp_dev_table[i].sdtemp_mask) ==
139 sdtemp_dev_table[i].sdtemp_devrev)
140 break;
141 }
142
143 return i;
144 }
145
146 static int
147 sdtemp_match(device_t parent, cfdata_t cf, void *aux)
148 {
149 struct i2c_attach_args *ia = aux;
150 uint16_t mfgid, devid;
151 struct sdtemp_softc sc;
152 int i, error;
153
154 sc.sc_tag = ia->ia_tag;
155 sc.sc_address = ia->ia_addr;
156
157 if ((ia->ia_addr & SDTEMP_ADDRMASK) != SDTEMP_ADDR)
158 return 0;
159
160 /* Verify that we can read the manufacturer ID & Device ID */
161 iic_acquire_bus(sc.sc_tag, 0);
162 error = sdtemp_read_16(&sc, SDTEMP_REG_MFG_ID, &mfgid) |
163 sdtemp_read_16(&sc, SDTEMP_REG_DEV_REV, &devid);
164 iic_release_bus(sc.sc_tag, 0);
165
166 if (error)
167 return 0;
168
169 i = sdtemp_lookup(mfgid, devid);
170 if (sdtemp_dev_table[i].sdtemp_mfg_id == 0) {
171 aprint_debug("sdtemp: No match for mfg 0x%04x dev 0x%02x "
172 "rev 0x%02x at address 0x%02x\n", mfgid, devid >> 8,
173 devid & 0xff, sc.sc_address);
174 return 0;
175 }
176
177 return 1;
178 }
179
180 static void
181 sdtemp_attach(device_t parent, device_t self, void *aux)
182 {
183 struct sdtemp_softc *sc = device_private(self);
184 struct i2c_attach_args *ia = aux;
185 uint16_t mfgid, devid;
186 int i, error;
187
188 sc->sc_tag = ia->ia_tag;
189 sc->sc_address = ia->ia_addr;
190 sc->sc_dev = self;
191
192 iic_acquire_bus(sc->sc_tag, 0);
193 if ((error = sdtemp_read_16(sc, SDTEMP_REG_MFG_ID, &mfgid)) != 0 ||
194 (error = sdtemp_read_16(sc, SDTEMP_REG_DEV_REV, &devid)) != 0) {
195 iic_release_bus(sc->sc_tag, 0);
196 aprint_error(": attach error %d\n", error);
197 return;
198 }
199 i = sdtemp_lookup(mfgid, devid);
200 sc->sc_resolution =
201 sdtemp_dev_table[i].sdtemp_resolution;
202
203 aprint_naive(": Temp Sensor\n");
204 aprint_normal(": %s Temp Sensor\n", sdtemp_dev_table[i].sdtemp_desc);
205
206 if (sdtemp_dev_table[i].sdtemp_mfg_id == 0)
207 aprint_debug_dev(self,
208 "mfg 0x%04x dev 0x%02x rev 0x%02x at addr 0x%02x\n",
209 mfgid, devid >> 8, devid & 0xff, ia->ia_addr);
210
211 /*
212 * Alarm capability is required; if not present, this is likely
213 * not a real sdtemp device.
214 */
215 error = sdtemp_read_16(sc, SDTEMP_REG_CAPABILITY, &sc->sc_capability);
216 if (error != 0 || (sc->sc_capability & SDTEMP_CAP_HAS_ALARM) == 0) {
217 iic_release_bus(sc->sc_tag, 0);
218 aprint_error_dev(self,
219 "required alarm capability not present!\n");
220 return;
221 }
222 /* Set the configuration to defaults. */
223 error = sdtemp_write_16(sc, SDTEMP_REG_CONFIG, 0);
224 if (error != 0) {
225 iic_release_bus(sc->sc_tag, 0);
226 aprint_error_dev(self, "error %d writing config register\n",
227 error);
228 return;
229 }
230 /* If variable resolution, set to max */
231 if (sc->sc_resolution < 0) {
232 sc->sc_resolution = ~sc->sc_resolution;
233 error = sdtemp_write_16(sc, SDTEMP_REG_RESOLUTION,
234 sc->sc_resolution & 0x3);
235 if (error != 0) {
236 iic_release_bus(sc->sc_tag, 0);
237 aprint_error_dev(self,
238 "error %d writing resolution register\n", error);
239 return;
240 } else
241 sc->sc_resolution++;
242 }
243 iic_release_bus(sc->sc_tag, 0);
244
245 /* Hook us into the sysmon_envsys subsystem */
246 sc->sc_sme = sysmon_envsys_create();
247 sc->sc_sme->sme_name = device_xname(self);
248 sc->sc_sme->sme_cookie = sc;
249 sc->sc_sme->sme_refresh = sdtemp_refresh;
250 sc->sc_sme->sme_get_limits = sdtemp_get_limits;
251 sc->sc_sme->sme_set_limits = sdtemp_set_limits;
252
253 sc->sc_sensor = kmem_zalloc(sizeof(envsys_data_t), KM_NOSLEEP);
254 if (!sc->sc_sensor) {
255 aprint_error_dev(self, "unable to allocate sc_sensor\n");
256 goto bad2;
257 }
258
259 /* Initialize sensor data. */
260 sc->sc_sensor->units = ENVSYS_STEMP;
261 sc->sc_sensor->state = ENVSYS_SINVALID;
262 sc->sc_sensor->flags |= ENVSYS_FMONLIMITS;
263 (void)strlcpy(sc->sc_sensor->desc, device_xname(self),
264 sizeof(sc->sc_sensor->desc));
265 snprintf(sc->sc_sensor->desc, sizeof(sc->sc_sensor->desc),
266 "DIMM %d temperature", sc->sc_address - SDTEMP_ADDR);
267
268 /* Now attach the sensor */
269 if (sysmon_envsys_sensor_attach(sc->sc_sme, sc->sc_sensor)) {
270 aprint_error_dev(self, "unable to attach sensor\n");
271 goto bad;
272 }
273
274 /* Register the device */
275 error = sysmon_envsys_register(sc->sc_sme);
276 if (error) {
277 aprint_error_dev(self, "error %d registering with sysmon\n",
278 error);
279 goto bad;
280 }
281
282 if (!pmf_device_register(self, sdtemp_pmf_suspend, sdtemp_pmf_resume))
283 aprint_error_dev(self, "couldn't establish power handler\n");
284
285 /* Retrieve and display hardware monitor limits */
286 sdtemp_get_limits(sc->sc_sme, sc->sc_sensor, &sc->sc_deflims,
287 &sc->sc_defprops);
288 aprint_normal_dev(self, "Hardware limits: ");
289 i = 0;
290 if (sc->sc_defprops & PROP_WARNMIN) {
291 aprint_normal("low %dC",
292 __UK2C(sc->sc_deflims.sel_warnmin));
293 i++;
294 }
295 if (sc->sc_defprops & PROP_WARNMAX) {
296 aprint_normal("%shigh %dC ", (i)?", ":"",
297 __UK2C(sc->sc_deflims.sel_warnmax));
298 i++;
299 }
300 if (sc->sc_defprops & PROP_CRITMAX) {
301 aprint_normal("%scritical %dC ", (i)?", ":"",
302 __UK2C(sc->sc_deflims.sel_critmax));
303 i++;
304 }
305 aprint_normal("%s\n", (i)?"":"none set");
306
307 return;
308
309 bad:
310 kmem_free(sc->sc_sensor, sizeof(envsys_data_t));
311 bad2:
312 sysmon_envsys_destroy(sc->sc_sme);
313 }
314
315 static int
316 sdtemp_detach(device_t self, int flags)
317 {
318 struct sdtemp_softc *sc = device_private(self);
319
320 pmf_device_deregister(self);
321
322 if (sc->sc_sme)
323 sysmon_envsys_unregister(sc->sc_sme);
324 if (sc->sc_sensor)
325 kmem_free(sc->sc_sensor, sizeof(envsys_data_t));
326
327 return 0;
328 }
329
330 /* Retrieve current limits from device, and encode in uKelvins */
331 static void
332 sdtemp_get_limits(struct sysmon_envsys *sme, envsys_data_t *edata,
333 sysmon_envsys_lim_t *limits, uint32_t *props)
334 {
335 struct sdtemp_softc *sc = sme->sme_cookie;
336 uint16_t lim;
337
338 *props = 0;
339 iic_acquire_bus(sc->sc_tag, 0);
340 if (sdtemp_read_16(sc, SDTEMP_REG_LOWER_LIM, &lim) == 0 && lim != 0) {
341 limits->sel_warnmin = sdtemp_decode_temp(sc, lim);
342 *props |= PROP_WARNMIN;
343 }
344 if (sdtemp_read_16(sc, SDTEMP_REG_UPPER_LIM, &lim) == 0 && lim != 0) {
345 limits->sel_warnmax = sdtemp_decode_temp(sc, lim);
346 *props |= PROP_WARNMAX;
347 }
348 if (sdtemp_read_16(sc, SDTEMP_REG_CRIT_LIM, &lim) == 0 && lim != 0) {
349 limits->sel_critmax = sdtemp_decode_temp(sc, lim);
350 *props |= PROP_CRITMAX;
351 }
352 iic_release_bus(sc->sc_tag, 0);
353 if (*props != 0)
354 *props |= PROP_DRIVER_LIMITS;
355 }
356
357 /* Send current limit values to the device */
358 static void
359 sdtemp_set_limits(struct sysmon_envsys *sme, envsys_data_t *edata,
360 sysmon_envsys_lim_t *limits, uint32_t *props)
361 {
362 uint16_t val;
363 struct sdtemp_softc *sc = sme->sme_cookie;
364
365 if (limits == NULL) {
366 limits = &sc->sc_deflims;
367 props = &sc->sc_defprops;
368 }
369 iic_acquire_bus(sc->sc_tag, 0);
370 if (*props & PROP_WARNMIN) {
371 val = __UK2C(limits->sel_warnmin);
372 (void)sdtemp_write_16(sc, SDTEMP_REG_LOWER_LIM,
373 (val << 4) & SDTEMP_TEMP_MASK);
374 }
375 if (*props & PROP_WARNMAX) {
376 val = __UK2C(limits->sel_warnmax);
377 (void)sdtemp_write_16(sc, SDTEMP_REG_UPPER_LIM,
378 (val << 4) & SDTEMP_TEMP_MASK);
379 }
380 if (*props & PROP_CRITMAX) {
381 val = __UK2C(limits->sel_critmax);
382 (void)sdtemp_write_16(sc, SDTEMP_REG_CRIT_LIM,
383 (val << 4) & SDTEMP_TEMP_MASK);
384 }
385 iic_release_bus(sc->sc_tag, 0);
386
387 /*
388 * If at least one limit is set that we can handle, and no
389 * limits are set that we cannot handle, tell sysmon that
390 * the driver will take care of monitoring the limits!
391 */
392 if (*props & (PROP_CRITMIN | PROP_BATTCAP | PROP_BATTWARN))
393 *props &= ~PROP_DRIVER_LIMITS;
394 else if (*props & PROP_LIMITS)
395 *props |= PROP_DRIVER_LIMITS;
396 else
397 *props &= ~PROP_DRIVER_LIMITS;
398 }
399
400 #ifdef NOT_YET /* All registers on these sensors are 16-bits */
401
402 /* Read a 8-bit value from a register */
403 static int
404 sdtemp_read_8(struct sdtemp_softc *sc, uint8_t reg, uint8_t *valp)
405 {
406 int error;
407
408 error = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
409 sc->sc_address, ®, 1, valp, sizeof(*valp), 0);
410
411 return error;
412 }
413
414 static int
415 sdtemp_write_8(struct sdtemp_softc *sc, uint8_t reg, uint8_t val)
416 {
417 return iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
418 sc->sc_address, ®, 1, &val, sizeof(val), 0);
419 }
420 #endif /* NOT_YET */
421
422 /* Read a 16-bit value from a register */
423 static int
424 sdtemp_read_16(struct sdtemp_softc *sc, uint8_t reg, uint16_t *valp)
425 {
426 int error;
427
428 error = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
429 sc->sc_address, ®, 1, valp, sizeof(*valp), 0);
430 if (error)
431 return error;
432
433 *valp = be16toh(*valp);
434
435 return 0;
436 }
437
438 static int
439 sdtemp_write_16(struct sdtemp_softc *sc, uint8_t reg, uint16_t val)
440 {
441 uint16_t temp;
442
443 temp = htobe16(val);
444 return iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
445 sc->sc_address, ®, 1, &temp, sizeof(temp), 0);
446 }
447
448 static uint32_t
449 sdtemp_decode_temp(struct sdtemp_softc *sc, uint16_t temp)
450 {
451 uint32_t val;
452 int32_t stemp;
453
454 /* Get only the temperature bits */
455 temp &= SDTEMP_TEMP_MASK;
456
457 /* If necessary, extend the sign bit */
458 if ((sc->sc_capability & SDTEMP_CAP_WIDER_RANGE) &&
459 (temp & SDTEMP_TEMP_NEGATIVE))
460 temp |= SDTEMP_TEMP_SIGN_EXT;
461
462 /* Mask off only bits valid within current resolution */
463 temp &= ~(0xf >> sc->sc_resolution);
464
465 /* Treat as signed and extend to 32-bits */
466 stemp = (int16_t)temp;
467
468 /* Now convert from 0.0625 (1/16) deg C increments to microKelvins */
469 val = (stemp * 62500) + 273150000;
470
471 return val;
472 }
473
474 static void
475 sdtemp_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
476 {
477 struct sdtemp_softc *sc = sme->sme_cookie;
478 uint16_t val;
479 int error;
480
481 iic_acquire_bus(sc->sc_tag, 0);
482 error = sdtemp_read_16(sc, SDTEMP_REG_AMBIENT_TEMP, &val);
483 iic_release_bus(sc->sc_tag, 0);
484
485 if (error) {
486 edata->state = ENVSYS_SINVALID;
487 return;
488 }
489
490 edata->value_cur = sdtemp_decode_temp(sc, val);
491
492 /* Now check for limits */
493 if ((edata->upropset & PROP_DRIVER_LIMITS) == 0)
494 edata->state = ENVSYS_SVALID;
495 else if ((val & SDTEMP_ABOVE_CRIT) &&
496 (edata->upropset & PROP_CRITMAX))
497 edata->state = ENVSYS_SCRITOVER;
498 else if ((val & SDTEMP_ABOVE_UPPER) &&
499 (edata->upropset & PROP_WARNMAX))
500 edata->state = ENVSYS_SWARNOVER;
501 else if ((val & SDTEMP_BELOW_LOWER) &&
502 (edata->upropset & PROP_WARNMIN))
503 edata->state = ENVSYS_SWARNUNDER;
504 else
505 edata->state = ENVSYS_SVALID;
506 }
507
508 /*
509 * power management functions
510 *
511 * We go into "shutdown" mode at suspend time, and return to normal
512 * mode upon resume. This reduces power consumption by disabling
513 * the A/D converter.
514 */
515
516 static bool
517 sdtemp_pmf_suspend(device_t dev, const pmf_qual_t *qual)
518 {
519 struct sdtemp_softc *sc = device_private(dev);
520 int error;
521 uint16_t config;
522
523 iic_acquire_bus(sc->sc_tag, 0);
524 error = sdtemp_read_16(sc, SDTEMP_REG_CONFIG, &config);
525 if (error == 0) {
526 config |= SDTEMP_CONFIG_SHUTDOWN_MODE;
527 error = sdtemp_write_16(sc, SDTEMP_REG_CONFIG, config);
528 }
529 iic_release_bus(sc->sc_tag, 0);
530 return (error == 0);
531 }
532
533 static bool
534 sdtemp_pmf_resume(device_t dev, const pmf_qual_t *qual)
535 {
536 struct sdtemp_softc *sc = device_private(dev);
537 int error;
538 uint16_t config;
539
540 iic_acquire_bus(sc->sc_tag, 0);
541 error = sdtemp_read_16(sc, SDTEMP_REG_CONFIG, &config);
542 if (error == 0) {
543 config &= ~SDTEMP_CONFIG_SHUTDOWN_MODE;
544 error = sdtemp_write_16(sc, SDTEMP_REG_CONFIG, config);
545 }
546 iic_release_bus(sc->sc_tag, 0);
547 return (error == 0);
548 }
549
550 MODULE(MODULE_CLASS_DRIVER, sdtemp, "iic");
551
552 #ifdef _MODULE
553 #include "ioconf.c"
554 #endif
555
556 static int
557 sdtemp_modcmd(modcmd_t cmd, void *opaque)
558 {
559 int error = 0;
560
561 switch (cmd) {
562 case MODULE_CMD_INIT:
563 #ifdef _MODULE
564 error = config_init_component(cfdriver_ioconf_sdtemp,
565 cfattach_ioconf_sdtemp, cfdata_ioconf_sdtemp);
566 #endif
567 return error;
568 case MODULE_CMD_FINI:
569 #ifdef _MODULE
570 error = config_fini_component(cfdriver_ioconf_sdtemp,
571 cfattach_ioconf_sdtemp, cfdata_ioconf_sdtemp);
572 #endif
573 return error;
574 default:
575 return ENOTTY;
576 }
577 }
578