apple_smc_fan.c revision 1.3 1 1.1 riastrad /* $NetBSD: apple_smc_fan.c,v 1.3 2014/04/01 17:48:52 riastradh Exp $ */
2 1.1 riastrad
3 1.1 riastrad /*
4 1.1 riastrad * Apple System Management Controller: Fans
5 1.1 riastrad */
6 1.1 riastrad
7 1.1 riastrad /*-
8 1.1 riastrad * Copyright (c) 2013 The NetBSD Foundation, Inc.
9 1.1 riastrad * All rights reserved.
10 1.1 riastrad *
11 1.1 riastrad * This code is derived from software contributed to The NetBSD Foundation
12 1.1 riastrad * by Taylor R. Campbell.
13 1.1 riastrad *
14 1.1 riastrad * Redistribution and use in source and binary forms, with or without
15 1.1 riastrad * modification, are permitted provided that the following conditions
16 1.1 riastrad * are met:
17 1.1 riastrad * 1. Redistributions of source code must retain the above copyright
18 1.1 riastrad * notice, this list of conditions and the following disclaimer.
19 1.1 riastrad * 2. Redistributions in binary form must reproduce the above copyright
20 1.1 riastrad * notice, this list of conditions and the following disclaimer in the
21 1.1 riastrad * documentation and/or other materials provided with the distribution.
22 1.1 riastrad *
23 1.1 riastrad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 1.1 riastrad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 1.1 riastrad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 1.1 riastrad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27 1.1 riastrad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.1 riastrad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.1 riastrad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 1.1 riastrad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 1.1 riastrad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 1.1 riastrad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 1.1 riastrad * POSSIBILITY OF SUCH DAMAGE.
34 1.1 riastrad */
35 1.1 riastrad
36 1.1 riastrad #include <sys/cdefs.h>
37 1.1 riastrad __KERNEL_RCSID(0, "$NetBSD: apple_smc_fan.c,v 1.3 2014/04/01 17:48:52 riastradh Exp $");
38 1.1 riastrad
39 1.1 riastrad #include <sys/types.h>
40 1.1 riastrad #include <sys/param.h>
41 1.1 riastrad #include <sys/device.h>
42 1.1 riastrad #include <sys/kmem.h>
43 1.2 riastrad #include <sys/module.h>
44 1.1 riastrad #if 0 /* XXX sysctl */
45 1.1 riastrad #include <sys/sysctl.h>
46 1.1 riastrad #endif
47 1.1 riastrad #include <sys/systm.h>
48 1.1 riastrad
49 1.1 riastrad #include <dev/ic/apple_smc.h>
50 1.1 riastrad
51 1.1 riastrad #include <dev/sysmon/sysmonvar.h>
52 1.1 riastrad
53 1.1 riastrad #define APPLE_SMC_NFANS_KEY "FNum"
54 1.1 riastrad
55 1.1 riastrad static const struct fan_sensor {
56 1.1 riastrad const char *fs_name;
57 1.1 riastrad const char *fs_key_suffix;
58 1.1 riastrad } fan_sensors[] = {
59 1.1 riastrad { "actual", "Ac" },
60 1.1 riastrad { "minimum", "Mn" },
61 1.1 riastrad { "maximum", "Mx" },
62 1.1 riastrad { "safe", "Sf" },
63 1.1 riastrad { "target", "Tg" },
64 1.1 riastrad };
65 1.1 riastrad
66 1.1 riastrad struct apple_smc_fan_softc {
67 1.1 riastrad device_t sc_dev;
68 1.1 riastrad struct apple_smc_tag *sc_smc;
69 1.1 riastrad struct sysmon_envsys *sc_sme;
70 1.1 riastrad uint8_t sc_nfans;
71 1.1 riastrad struct {
72 1.1 riastrad struct {
73 1.1 riastrad struct apple_smc_key *sensor_key;
74 1.1 riastrad struct envsys_data sensor_data;
75 1.1 riastrad } sensors[__arraycount(fan_sensors)];
76 1.1 riastrad } *sc_fans;
77 1.1 riastrad
78 1.1 riastrad #if 0 /* XXX sysctl */
79 1.1 riastrad struct sysctllog *sc_sysctl_log;
80 1.1 riastrad const struct sysctlnode *sc_sysctl_node;
81 1.1 riastrad #endif
82 1.1 riastrad };
83 1.1 riastrad
84 1.1 riastrad struct fan_desc {
85 1.1 riastrad uint8_t fd_type;
86 1.1 riastrad uint8_t fd_zone;
87 1.1 riastrad uint8_t fd_location;
88 1.1 riastrad uint8_t fd_reserved0;
89 1.1 riastrad char fd_name[12];
90 1.1 riastrad } __packed;
91 1.1 riastrad
92 1.1 riastrad static int apple_smc_fan_match(device_t, cfdata_t, void *);
93 1.1 riastrad static void apple_smc_fan_attach(device_t, device_t, void *);
94 1.1 riastrad static int apple_smc_fan_detach(device_t, int);
95 1.1 riastrad static int apple_smc_fan_attach_sensors(struct apple_smc_fan_softc *);
96 1.1 riastrad static void apple_smc_fan_attach_sensor(struct apple_smc_fan_softc *,
97 1.1 riastrad uint8_t, const char *, uint8_t);
98 1.1 riastrad static void apple_smc_fan_refresh(struct sysmon_envsys *,
99 1.1 riastrad struct envsys_data *);
100 1.1 riastrad static void apple_smc_fan_release_keys(struct apple_smc_fan_softc *);
101 1.1 riastrad #if 0 /* XXX sysctl */
102 1.1 riastrad static int apple_smc_fan_sysctl_setup(struct apple_smc_fan_softc *);
103 1.1 riastrad static void apple_smc_fan_sysctl_setup_1(struct apple_smc_tag *,
104 1.1 riastrad uint8_t);
105 1.1 riastrad #endif
106 1.1 riastrad
107 1.1 riastrad CFATTACH_DECL_NEW(apple_smc_fan, sizeof(struct apple_smc_fan_softc),
108 1.1 riastrad apple_smc_fan_match, apple_smc_fan_attach, apple_smc_fan_detach, NULL);
109 1.1 riastrad
110 1.1 riastrad static int
111 1.1 riastrad apple_smc_fan_match(device_t parent, cfdata_t match, void *aux)
112 1.1 riastrad {
113 1.1 riastrad const struct apple_smc_attach_args *asa = aux;
114 1.1 riastrad struct apple_smc_key *nfans_key;
115 1.1 riastrad uint8_t nfans;
116 1.1 riastrad int rv = 0;
117 1.1 riastrad int error;
118 1.1 riastrad
119 1.1 riastrad error = apple_smc_named_key(asa->asa_smc, APPLE_SMC_NFANS_KEY,
120 1.1 riastrad APPLE_SMC_TYPE_UINT8, &nfans_key);
121 1.1 riastrad if (error)
122 1.1 riastrad goto out0;
123 1.1 riastrad
124 1.1 riastrad error = apple_smc_read_key_1(asa->asa_smc, nfans_key, &nfans);
125 1.1 riastrad if (error)
126 1.1 riastrad goto out1;
127 1.1 riastrad
128 1.1 riastrad if (nfans > 0)
129 1.1 riastrad rv = 1;
130 1.1 riastrad
131 1.1 riastrad out1: apple_smc_release_key(asa->asa_smc, nfans_key);
132 1.1 riastrad out0: return rv;
133 1.1 riastrad }
134 1.1 riastrad
135 1.1 riastrad static void
136 1.1 riastrad apple_smc_fan_attach(device_t parent, device_t self, void *aux)
137 1.1 riastrad {
138 1.1 riastrad struct apple_smc_fan_softc *sc = device_private(self);
139 1.1 riastrad const struct apple_smc_attach_args *asa = aux;
140 1.1 riastrad struct apple_smc_key *nfans_key;
141 1.1 riastrad int error;
142 1.1 riastrad
143 1.1 riastrad aprint_normal(": Apple SMC fan sensors\n");
144 1.1 riastrad
145 1.1 riastrad sc->sc_dev = self;
146 1.1 riastrad sc->sc_smc = asa->asa_smc;
147 1.1 riastrad
148 1.1 riastrad error = apple_smc_named_key(sc->sc_smc, APPLE_SMC_NFANS_KEY,
149 1.1 riastrad APPLE_SMC_TYPE_UINT8, &nfans_key);
150 1.1 riastrad if (error)
151 1.1 riastrad goto out0;
152 1.1 riastrad
153 1.1 riastrad error = apple_smc_read_key_1(sc->sc_smc, nfans_key, &sc->sc_nfans);
154 1.1 riastrad if (error)
155 1.1 riastrad goto out1;
156 1.1 riastrad
157 1.1 riastrad if (sc->sc_nfans == 0) { /* XXX */
158 1.1 riastrad aprint_error_dev(self, "no fans\n");
159 1.1 riastrad goto out1;
160 1.1 riastrad }
161 1.1 riastrad
162 1.1 riastrad /* Must fit in a single decimal digit. */
163 1.1 riastrad if (sc->sc_nfans >= 10) {
164 1.1 riastrad aprint_error_dev(self, "too many fans: %"PRIu8"\n",
165 1.1 riastrad sc->sc_nfans);
166 1.1 riastrad sc->sc_nfans = 9;
167 1.1 riastrad }
168 1.1 riastrad
169 1.1 riastrad #if 0 /* XXX sysctl */
170 1.1 riastrad error = apple_smc_fan_sysctl_setup(sc);
171 1.1 riastrad if (error)
172 1.1 riastrad goto fail0;
173 1.1 riastrad #endif
174 1.1 riastrad
175 1.1 riastrad error = apple_smc_fan_attach_sensors(sc);
176 1.1 riastrad if (error)
177 1.1 riastrad goto fail1;
178 1.1 riastrad
179 1.1 riastrad goto out1;
180 1.1 riastrad
181 1.1 riastrad #if 0
182 1.1 riastrad fail2:
183 1.1 riastrad apple_smc_fan_detach_sensors(sc);
184 1.1 riastrad #endif
185 1.1 riastrad
186 1.1 riastrad fail1:
187 1.1 riastrad #if 0 /* XXX sysctl */
188 1.1 riastrad sysctl_teardown(&sc->sc_sysctl_log);
189 1.1 riastrad fail0:
190 1.1 riastrad #endif
191 1.1 riastrad
192 1.1 riastrad out1: apple_smc_release_key(sc->sc_smc, nfans_key);
193 1.1 riastrad out0: return;
194 1.1 riastrad }
195 1.1 riastrad
196 1.1 riastrad static int
197 1.1 riastrad apple_smc_fan_detach(device_t self, int flags)
198 1.1 riastrad {
199 1.1 riastrad struct apple_smc_fan_softc *sc = device_private(self);
200 1.1 riastrad
201 1.1 riastrad if (sc->sc_sme != NULL) {
202 1.1 riastrad sysmon_envsys_unregister(sc->sc_sme);
203 1.1 riastrad sc->sc_sme = NULL;
204 1.1 riastrad
205 1.1 riastrad KASSERT(sc->sc_fans != NULL);
206 1.1 riastrad KASSERT(sc->sc_nfans > 0);
207 1.1 riastrad KASSERT(sc->sc_nfans < 10);
208 1.1 riastrad
209 1.1 riastrad apple_smc_fan_release_keys(sc);
210 1.1 riastrad kmem_free(sc->sc_fans,
211 1.1 riastrad (sizeof(sc->sc_fans[0]) * sc->sc_nfans));
212 1.1 riastrad sc->sc_fans = NULL;
213 1.1 riastrad sc->sc_nfans = 0;
214 1.1 riastrad }
215 1.1 riastrad
216 1.1 riastrad #if 0 /* XXX sysctl */
217 1.1 riastrad sysctl_teardown(&sc->sc_sysctl_log);
218 1.1 riastrad #endif
219 1.1 riastrad
220 1.1 riastrad return 0;
221 1.1 riastrad }
222 1.1 riastrad
223 1.1 riastrad static int
224 1.1 riastrad apple_smc_fan_attach_sensors(struct apple_smc_fan_softc *sc)
225 1.1 riastrad {
226 1.1 riastrad uint8_t fan, sensor;
227 1.1 riastrad char fan_desc_key_name[4 + 1];
228 1.1 riastrad struct apple_smc_key *fan_desc_key;
229 1.1 riastrad struct fan_desc fan_desc;
230 1.1 riastrad char name[sizeof(fan_desc.fd_name) + 1];
231 1.1 riastrad int error;
232 1.1 riastrad
233 1.1 riastrad sc->sc_sme = sysmon_envsys_create();
234 1.1 riastrad sc->sc_sme->sme_name = device_xname(sc->sc_dev);
235 1.1 riastrad sc->sc_sme->sme_cookie = sc;
236 1.1 riastrad sc->sc_sme->sme_refresh = apple_smc_fan_refresh;
237 1.1 riastrad
238 1.1 riastrad CTASSERT(10 <= (SIZE_MAX / sizeof(sc->sc_fans[0])));
239 1.1 riastrad sc->sc_fans = kmem_zalloc((sizeof(sc->sc_fans[0]) * sc->sc_nfans),
240 1.1 riastrad KM_SLEEP);
241 1.1 riastrad
242 1.1 riastrad for (fan = 0; fan < sc->sc_nfans; fan++) {
243 1.1 riastrad (void)snprintf(fan_desc_key_name, sizeof fan_desc_key_name,
244 1.1 riastrad "F%"PRIu8"ID", fan);
245 1.1 riastrad KASSERT(4 == strlen(fan_desc_key_name));
246 1.1 riastrad
247 1.1 riastrad error = apple_smc_named_key(sc->sc_smc, fan_desc_key_name,
248 1.1 riastrad APPLE_SMC_TYPE_FANDESC, &fan_desc_key);
249 1.1 riastrad if (error) {
250 1.1 riastrad aprint_error_dev(sc->sc_dev,
251 1.1 riastrad "error identifying fan %"PRIu8": %d\n",
252 1.1 riastrad fan, error);
253 1.1 riastrad continue;
254 1.1 riastrad }
255 1.1 riastrad
256 1.1 riastrad error = apple_smc_read_key(sc->sc_smc, fan_desc_key, &fan_desc,
257 1.1 riastrad sizeof fan_desc);
258 1.1 riastrad if (error) {
259 1.1 riastrad aprint_error_dev(sc->sc_dev,
260 1.1 riastrad "error identifying fan %"PRIu8": %d\n",
261 1.1 riastrad fan, error);
262 1.1 riastrad continue;
263 1.1 riastrad }
264 1.1 riastrad
265 1.1 riastrad /*
266 1.1 riastrad * XXX Do more with the fan description...
267 1.1 riastrad */
268 1.1 riastrad
269 1.1 riastrad (void)memcpy(name, fan_desc.fd_name, sizeof(fan_desc.fd_name));
270 1.1 riastrad name[sizeof(fan_desc.fd_name)] = 0;
271 1.1 riastrad
272 1.1 riastrad for (sensor = 0; sensor < __arraycount(fan_sensors); sensor++)
273 1.1 riastrad apple_smc_fan_attach_sensor(sc, fan, name, sensor);
274 1.1 riastrad
275 1.1 riastrad #if 0 /* XXX sysctl */
276 1.1 riastrad apple_smc_fan_sysctl_setup_1(sc, fan);
277 1.1 riastrad #endif
278 1.1 riastrad }
279 1.1 riastrad
280 1.1 riastrad error = sysmon_envsys_register(sc->sc_sme);
281 1.1 riastrad if (error)
282 1.1 riastrad goto fail;
283 1.1 riastrad
284 1.1 riastrad error = 0;
285 1.1 riastrad goto out;
286 1.1 riastrad
287 1.1 riastrad fail: sysmon_envsys_destroy(sc->sc_sme);
288 1.1 riastrad sc->sc_sme = NULL;
289 1.1 riastrad out: return error;
290 1.1 riastrad }
291 1.1 riastrad
292 1.1 riastrad static void
293 1.1 riastrad apple_smc_fan_attach_sensor(struct apple_smc_fan_softc *sc, uint8_t fan,
294 1.1 riastrad const char *name, uint8_t sensor)
295 1.1 riastrad {
296 1.1 riastrad char key_name[4 + 1];
297 1.1 riastrad struct apple_smc_key **keyp;
298 1.1 riastrad struct envsys_data *edata;
299 1.1 riastrad int error;
300 1.1 riastrad
301 1.1 riastrad KASSERT(fan < sc->sc_nfans);
302 1.1 riastrad KASSERT(sensor < __arraycount(fan_sensors));
303 1.1 riastrad
304 1.1 riastrad keyp = &sc->sc_fans[fan].sensors[sensor].sensor_key;
305 1.1 riastrad (void)snprintf(key_name, sizeof key_name, "F%d%s",
306 1.1 riastrad (int)sensor, fan_sensors[sensor].fs_key_suffix);
307 1.1 riastrad KASSERT(strlen(key_name) == 4);
308 1.1 riastrad error = apple_smc_named_key(sc->sc_smc, key_name, APPLE_SMC_TYPE_FPE2,
309 1.1 riastrad keyp);
310 1.1 riastrad if (error)
311 1.1 riastrad goto fail0;
312 1.1 riastrad
313 1.1 riastrad edata = &sc->sc_fans[fan].sensors[sensor].sensor_data;
314 1.1 riastrad edata->units = ENVSYS_SFANRPM;
315 1.1 riastrad edata->state = ENVSYS_SINVALID;
316 1.1 riastrad edata->flags = ENVSYS_FHAS_ENTROPY;
317 1.1 riastrad (void)snprintf(edata->desc, sizeof(edata->desc), "fan %s %s speed",
318 1.1 riastrad name, fan_sensors[sensor].fs_name);
319 1.1 riastrad
320 1.1 riastrad error = sysmon_envsys_sensor_attach(sc->sc_sme, edata);
321 1.1 riastrad if (error)
322 1.1 riastrad goto fail1;
323 1.1 riastrad
324 1.1 riastrad return;
325 1.1 riastrad
326 1.1 riastrad fail1: apple_smc_release_key(sc->sc_smc, *keyp);
327 1.1 riastrad fail0: *keyp = NULL;
328 1.1 riastrad aprint_error_dev(sc->sc_dev,
329 1.1 riastrad "failed to attach fan %s %s speed sensor: %d\n",
330 1.1 riastrad name, fan_sensors[sensor].fs_name, error);
331 1.1 riastrad }
332 1.1 riastrad
333 1.1 riastrad static void
334 1.1 riastrad apple_smc_fan_refresh(struct sysmon_envsys *sme, struct envsys_data *edata)
335 1.1 riastrad {
336 1.1 riastrad struct apple_smc_fan_softc *sc = sme->sme_cookie;
337 1.1 riastrad uint8_t fan, sensor;
338 1.1 riastrad struct apple_smc_key *key;
339 1.1 riastrad uint16_t rpm;
340 1.1 riastrad int error;
341 1.1 riastrad
342 1.1 riastrad CTASSERT(10 <= (SIZE_MAX / __arraycount(fan_sensors)));
343 1.1 riastrad KASSERT(sc->sc_nfans < 10);
344 1.1 riastrad if (edata->sensor >= (sc->sc_nfans * __arraycount(fan_sensors))) {
345 1.1 riastrad aprint_error_dev(sc->sc_dev, "unknown sensor %"PRIu32"\n",
346 1.1 riastrad edata->sensor);
347 1.1 riastrad return;
348 1.1 riastrad }
349 1.1 riastrad
350 1.1 riastrad fan = (edata->sensor / __arraycount(fan_sensors));
351 1.1 riastrad sensor = (edata->sensor % __arraycount(fan_sensors));
352 1.1 riastrad
353 1.1 riastrad KASSERT(fan < sc->sc_nfans);
354 1.1 riastrad KASSERT(sensor < __arraycount(fan_sensors));
355 1.1 riastrad KASSERT(edata == &sc->sc_fans[fan].sensors[sensor].sensor_data);
356 1.1 riastrad
357 1.1 riastrad /*
358 1.1 riastrad * If we're refreshing, this sensor got attached, so we ought
359 1.1 riastrad * to have a sensor key.
360 1.1 riastrad */
361 1.1 riastrad key = sc->sc_fans[fan].sensors[sensor].sensor_key;
362 1.1 riastrad KASSERT(key != NULL);
363 1.1 riastrad
364 1.1 riastrad error = apple_smc_read_key_2(sc->sc_smc, key, &rpm);
365 1.1 riastrad if (error) {
366 1.1 riastrad aprint_error_dev(sc->sc_dev,
367 1.1 riastrad "failed to read fan %d %s speed: %d\n",
368 1.1 riastrad fan, fan_sensors[sensor].fs_name, error);
369 1.1 riastrad edata->state = ENVSYS_SINVALID;
370 1.1 riastrad return;
371 1.1 riastrad }
372 1.1 riastrad
373 1.1 riastrad edata->value_cur = rpm;
374 1.1 riastrad edata->state = ENVSYS_SVALID;
375 1.1 riastrad }
376 1.1 riastrad
377 1.1 riastrad static void
378 1.1 riastrad apple_smc_fan_release_keys(struct apple_smc_fan_softc *sc)
379 1.1 riastrad {
380 1.1 riastrad uint8_t fan, sensor;
381 1.1 riastrad
382 1.1 riastrad for (fan = 0; fan < sc->sc_nfans; fan++) {
383 1.1 riastrad for (sensor = 0;
384 1.1 riastrad sensor < __arraycount(fan_sensors);
385 1.1 riastrad sensor++) {
386 1.1 riastrad struct apple_smc_key **const keyp =
387 1.1 riastrad &sc->sc_fans[fan].sensors[sensor].sensor_key;
388 1.1 riastrad if (*keyp != NULL) {
389 1.1 riastrad apple_smc_release_key(sc->sc_smc, *keyp);
390 1.1 riastrad *keyp = NULL;
391 1.1 riastrad }
392 1.1 riastrad }
393 1.1 riastrad }
394 1.1 riastrad }
395 1.1 riastrad
396 1.1 riastrad #if 0 /* XXX sysctl */
397 1.1 riastrad static int
398 1.1 riastrad apple_smc_fan_sysctl_setup(struct apple_smc_fan_softc *sc)
399 1.1 riastrad {
400 1.1 riastrad ...
401 1.1 riastrad }
402 1.1 riastrad
403 1.1 riastrad static void
404 1.1 riastrad apple_smc_fan_sysctl_setup_1(struct apple_smc_fan_softc *sc, uint8_t fan)
405 1.1 riastrad {
406 1.1 riastrad }
407 1.1 riastrad #endif
408 1.2 riastrad
409 1.2 riastrad MODULE(MODULE_CLASS_DRIVER, apple_smc_fan, "apple_smc");
410 1.2 riastrad
411 1.2 riastrad #ifdef _MODULE
412 1.2 riastrad #include "ioconf.c"
413 1.2 riastrad #endif
414 1.2 riastrad
415 1.2 riastrad static int
416 1.2 riastrad apple_smc_fan_modcmd(modcmd_t cmd, void *arg __unused)
417 1.2 riastrad {
418 1.2 riastrad int error;
419 1.2 riastrad
420 1.2 riastrad switch (cmd) {
421 1.2 riastrad case MODULE_CMD_INIT:
422 1.2 riastrad #ifdef _MODULE
423 1.2 riastrad error = config_init_component(cfdriver_ioconf_apple_smc_fan,
424 1.2 riastrad cfattach_ioconf_apple_smc_fan,
425 1.2 riastrad cfdata_ioconf_apple_smc_fan);
426 1.3 riastrad if (error)
427 1.2 riastrad return error;
428 1.2 riastrad #endif
429 1.2 riastrad return 0;
430 1.2 riastrad
431 1.2 riastrad case MODULE_CMD_FINI:
432 1.2 riastrad #ifdef _MODULE
433 1.2 riastrad error = config_fini_component(cfdriver_ioconf_apple_smc_fan,
434 1.2 riastrad cfattach_ioconf_apple_smc_fan,
435 1.2 riastrad cfdata_ioconf_apple_smc_fan);
436 1.2 riastrad if (error)
437 1.2 riastrad return error;
438 1.2 riastrad #endif
439 1.2 riastrad return 0;
440 1.2 riastrad
441 1.2 riastrad default:
442 1.2 riastrad return ENOTTY;
443 1.2 riastrad }
444 1.2 riastrad }
445