sound: add cloning with devfs
[dragonfly.git] / sys / dev / sound / pcm / mixer.c
blob1f55f4caf954dbabd4a9e6dfea76fbb1da1da22d
1 /*-
2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
26 * $FreeBSD: src/sys/dev/sound/pcm/mixer.c,v 1.43.2.5 2007/05/13 20:53:39 ariff Exp $
27 * $DragonFly: src/sys/dev/sound/pcm/mixer.c,v 1.18 2007/06/22 21:41:16 corecode Exp $
30 #include <dev/sound/pcm/sound.h>
31 #include <dev/sound/pcm/dsp.h>
33 #include "mixer_if.h"
35 SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/mixer.c,v 1.18 2007/06/22 21:41:16 corecode Exp $");
37 MALLOC_DEFINE(M_MIXER, "mixer", "mixer");
39 #define MIXER_NAMELEN 16
40 struct snd_mixer {
41 KOBJ_FIELDS;
42 const char *type;
43 void *devinfo;
44 int busy;
45 int hwvol_muted;
46 int hwvol_mixer;
47 int hwvol_step;
48 device_t dev;
49 u_int32_t hwvol_mute_level;
50 u_int32_t devs;
51 u_int32_t recdevs;
52 u_int32_t recsrc;
53 u_int16_t level[32];
54 u_int8_t parent[32];
55 u_int32_t child[32];
56 u_int8_t realdev[32];
57 char name[MIXER_NAMELEN];
58 sndlock_t lock;
61 static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVICES] = {
62 [SOUND_MIXER_VOLUME] = 75,
63 [SOUND_MIXER_BASS] = 50,
64 [SOUND_MIXER_TREBLE] = 50,
65 [SOUND_MIXER_SYNTH] = 75,
66 [SOUND_MIXER_PCM] = 75,
67 [SOUND_MIXER_SPEAKER] = 75,
68 [SOUND_MIXER_LINE] = 75,
69 [SOUND_MIXER_MIC] = 0,
70 [SOUND_MIXER_CD] = 75,
71 [SOUND_MIXER_IGAIN] = 0,
72 [SOUND_MIXER_LINE1] = 75,
73 [SOUND_MIXER_VIDEO] = 75,
74 [SOUND_MIXER_RECLEV] = 0,
75 [SOUND_MIXER_OGAIN] = 50,
76 [SOUND_MIXER_MONITOR] = 75,
79 static char* snd_mixernames[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
81 static d_open_t mixer_open;
82 static d_close_t mixer_close;
84 static struct dev_ops mixer_cdevsw = {
85 { "mixer", SND_CDEV_MAJOR, D_TRACKCLOSE },
86 /* .d_flags = D_TRACKCLOSE | D_NEEDGIANT, */
87 .d_open = mixer_open,
88 .d_close = mixer_close,
89 .d_ioctl = mixer_ioctl,
92 #ifdef USING_DEVFS
93 static eventhandler_tag mixer_ehtag;
94 #endif
96 static struct cdev *
97 mixer_get_devt(device_t dev)
99 struct snddev_info *snddev;
101 snddev = device_get_softc(dev);
103 return snddev->mixer_dev;
106 #ifdef SND_DYNSYSCTL
107 static int
108 mixer_lookup(char *devname)
110 int i;
112 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
113 if (strncmp(devname, snd_mixernames[i],
114 strlen(snd_mixernames[i])) == 0)
115 return i;
116 return -1;
118 #endif
121 * Always called with mixer->lock held.
123 static int
124 mixer_set_softpcmvol(struct snd_mixer *mixer, struct snddev_info *d,
125 unsigned left, unsigned right)
127 struct snddev_channel *sce;
128 struct pcm_channel *ch;
130 snd_mtxunlock(mixer->lock);
131 SLIST_FOREACH(sce, &d->channels, link) {
132 ch = sce->channel;
133 CHN_LOCK(ch);
134 if (ch->direction == PCMDIR_PLAY &&
135 (ch->feederflags & (1 << FEEDER_VOLUME)))
136 chn_setvolume(ch, left, right);
137 CHN_UNLOCK(ch);
139 snd_mtxlock(mixer->lock);
140 return 0;
143 static int
144 mixer_set(struct snd_mixer *m, unsigned dev, unsigned lev)
146 struct snddev_info *d;
147 unsigned l, r, tl, tr;
148 u_int32_t parent = SOUND_MIXER_NONE, child = 0;
149 u_int32_t realdev;
150 int i;
152 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES ||
153 (0 == (m->devs & (1 << dev))))
154 return -1;
156 l = min((lev & 0x00ff), 100);
157 r = min(((lev & 0xff00) >> 8), 100);
158 realdev = m->realdev[dev];
160 d = device_get_softc(m->dev);
161 if (d == NULL)
162 return -1;
164 /* TODO: recursive handling */
165 parent = m->parent[dev];
166 if (parent >= SOUND_MIXER_NRDEVICES)
167 parent = SOUND_MIXER_NONE;
168 if (parent == SOUND_MIXER_NONE)
169 child = m->child[dev];
171 if (parent != SOUND_MIXER_NONE) {
172 tl = (l * (m->level[parent] & 0x00ff)) / 100;
173 tr = (r * ((m->level[parent] & 0xff00) >> 8)) / 100;
174 if (dev == SOUND_MIXER_PCM && (d->flags & SD_F_SOFTPCMVOL))
175 mixer_set_softpcmvol(m, d, tl, tr);
176 else if (realdev != SOUND_MIXER_NONE &&
177 MIXER_SET(m, realdev, tl, tr) < 0)
178 return -1;
179 } else if (child != 0) {
180 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
181 if (!(child & (1 << i)) || m->parent[i] != dev)
182 continue;
183 realdev = m->realdev[i];
184 tl = (l * (m->level[i] & 0x00ff)) / 100;
185 tr = (r * ((m->level[i] & 0xff00) >> 8)) / 100;
186 if (i == SOUND_MIXER_PCM && (d->flags & SD_F_SOFTPCMVOL))
187 mixer_set_softpcmvol(m, d, tl, tr);
188 else if (realdev != SOUND_MIXER_NONE)
189 MIXER_SET(m, realdev, tl, tr);
191 realdev = m->realdev[dev];
192 if (realdev != SOUND_MIXER_NONE &&
193 MIXER_SET(m, realdev, l, r) < 0)
194 return -1;
195 } else {
196 if (dev == SOUND_MIXER_PCM && (d->flags & SD_F_SOFTPCMVOL))
197 mixer_set_softpcmvol(m, d, l, r);
198 else if (realdev != SOUND_MIXER_NONE &&
199 MIXER_SET(m, realdev, l, r) < 0)
200 return -1;
203 m->level[dev] = l | (r << 8);
205 return 0;
208 static int
209 mixer_get(struct snd_mixer *mixer, int dev)
211 if ((dev < SOUND_MIXER_NRDEVICES) && (mixer->devs & (1 << dev)))
212 return mixer->level[dev];
213 else return -1;
216 static int
217 mixer_setrecsrc(struct snd_mixer *mixer, u_int32_t src)
219 src &= mixer->recdevs;
220 if (src == 0)
221 src = SOUND_MASK_MIC;
222 mixer->recsrc = MIXER_SETRECSRC(mixer, src);
223 return 0;
226 static int
227 mixer_getrecsrc(struct snd_mixer *mixer)
229 return mixer->recsrc;
232 void
233 mix_setdevs(struct snd_mixer *m, u_int32_t v)
235 struct snddev_info *d;
236 int i;
238 if (m == NULL)
239 return;
241 d = device_get_softc(m->dev);
242 if (d != NULL && (d->flags & SD_F_SOFTPCMVOL))
243 v |= SOUND_MASK_PCM;
244 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
245 if (m->parent[i] < SOUND_MIXER_NRDEVICES)
246 v |= 1 << m->parent[i];
247 v |= m->child[i];
249 m->devs = v;
252 void
253 mix_setrecdevs(struct snd_mixer *m, u_int32_t v)
255 m->recdevs = v;
258 void
259 mix_setparentchild(struct snd_mixer *m, u_int32_t parent, u_int32_t childs)
261 u_int32_t mask = 0;
262 int i;
264 if (m == NULL || parent >= SOUND_MIXER_NRDEVICES)
265 return;
266 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
267 if (i == parent)
268 continue;
269 if (childs & (1 << i)) {
270 mask |= 1 << i;
271 if (m->parent[i] < SOUND_MIXER_NRDEVICES)
272 m->child[m->parent[i]] &= ~(1 << i);
273 m->parent[i] = parent;
274 m->child[i] = 0;
277 mask &= ~(1 << parent);
278 m->child[parent] = mask;
281 void
282 mix_setrealdev(struct snd_mixer *m, u_int32_t dev, u_int32_t realdev)
284 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES ||
285 !(realdev == SOUND_MIXER_NONE || realdev < SOUND_MIXER_NRDEVICES))
286 return;
287 m->realdev[dev] = realdev;
290 u_int32_t
291 mix_getparent(struct snd_mixer *m, u_int32_t dev)
293 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES)
294 return SOUND_MIXER_NONE;
295 return m->parent[dev];
298 u_int32_t
299 mix_getchild(struct snd_mixer *m, u_int32_t dev)
301 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES)
302 return 0;
303 return m->child[dev];
306 u_int32_t
307 mix_getdevs(struct snd_mixer *m)
309 return m->devs;
312 u_int32_t
313 mix_getrecdevs(struct snd_mixer *m)
315 return m->recdevs;
318 void *
319 mix_getdevinfo(struct snd_mixer *m)
321 return m->devinfo;
325 mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
327 struct snddev_info *snddev;
328 struct snd_mixer *m;
329 u_int16_t v;
330 struct cdev *pdev;
331 int i, unit, val;
333 m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO);
334 ksnprintf(m->name, MIXER_NAMELEN, "%s:mixer", device_get_nameunit(dev));
335 m->lock = snd_mtxcreate(m->name, "pcm mixer");
336 m->type = cls->name;
337 m->devinfo = devinfo;
338 m->busy = 0;
339 m->dev = dev;
340 for (i = 0; i < 32; i++) {
341 m->parent[i] = SOUND_MIXER_NONE;
342 m->child[i] = 0;
343 m->realdev[i] = i;
346 if (MIXER_INIT(m))
347 goto bad;
349 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
350 v = snd_mixerdefaults[i];
352 if (resource_int_value(device_get_name(dev),
353 device_get_unit(dev), snd_mixernames[i], &val) == 0) {
354 if (val >= 0 && val <= 100) {
355 v = (u_int16_t) val;
359 snd_mtxlock(m->lock);
360 mixer_set(m, i, v | (v << 8));
361 snd_mtxunlock(m->lock);
364 mixer_setrecsrc(m, SOUND_MASK_MIC);
366 unit = device_get_unit(dev);
367 pdev = make_dev(&mixer_cdevsw, PCMMKMINOR(unit, 0),
368 UID_ROOT, GID_WHEEL, 0666, "mixer%d", unit);
369 reference_dev(pdev);
370 pdev->si_drv1 = m;
371 snddev = device_get_softc(dev);
372 snddev->mixer_dev = pdev;
374 if (bootverbose) {
375 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
376 if (!(m->devs & (1 << i)))
377 continue;
378 if (m->realdev[i] != i) {
379 device_printf(dev, "Mixer \"%s\" -> \"%s\":",
380 snd_mixernames[i],
381 (m->realdev[i] < SOUND_MIXER_NRDEVICES) ?
382 snd_mixernames[m->realdev[i]] : "none");
383 } else {
384 device_printf(dev, "Mixer \"%s\":",
385 snd_mixernames[i]);
387 if (m->parent[i] < SOUND_MIXER_NRDEVICES)
388 kprintf(" parent=\"%s\"",
389 snd_mixernames[m->parent[i]]);
390 if (m->child[i] != 0)
391 kprintf(" child=0x%08x", m->child[i]);
392 kprintf("\n");
394 if (snddev->flags & SD_F_SOFTPCMVOL)
395 device_printf(dev, "Soft PCM mixer ENABLED\n");
398 return 0;
400 bad:
401 snd_mtxfree(m->lock);
402 kobj_delete((kobj_t)m, M_MIXER);
403 return -1;
407 mixer_uninit(device_t dev)
409 int i;
410 int unit;
411 struct snddev_info *d;
412 struct snd_mixer *m;
413 struct cdev *pdev;
415 d = device_get_softc(dev);
416 pdev = mixer_get_devt(dev);
417 if (d == NULL || pdev == NULL || pdev->si_drv1 == NULL)
418 return EBADF;
419 m = pdev->si_drv1;
420 snd_mtxlock(m->lock);
422 if (m->busy) {
423 snd_mtxunlock(m->lock);
424 return EBUSY;
427 pdev->si_drv1 = NULL;
428 release_dev(pdev);
429 unit = device_get_unit(dev);
430 dev_ops_remove_minor(&mixer_cdevsw, /*-1, */PCMMKMINOR(unit, 0));
432 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
433 mixer_set(m, i, 0);
435 mixer_setrecsrc(m, SOUND_MASK_MIC);
437 MIXER_UNINIT(m);
439 snd_mtxunlock(m->lock);
440 snd_mtxfree(m->lock);
441 kobj_delete((kobj_t)m, M_MIXER);
443 d->mixer_dev = NULL;
445 return 0;
449 mixer_reinit(device_t dev)
451 struct snd_mixer *m;
452 struct cdev *pdev;
453 int i;
455 pdev = mixer_get_devt(dev);
456 m = pdev->si_drv1;
457 snd_mtxlock(m->lock);
459 i = MIXER_REINIT(m);
460 if (i) {
461 snd_mtxunlock(m->lock);
462 return i;
465 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
466 mixer_set(m, i, m->level[i]);
468 mixer_setrecsrc(m, m->recsrc);
469 snd_mtxunlock(m->lock);
471 return 0;
474 #ifdef SND_DYNSYSCTL
475 static int
476 sysctl_hw_snd_hwvol_mixer(SYSCTL_HANDLER_ARGS)
478 char devname[32];
479 int error, dev;
480 struct snd_mixer *m;
482 m = oidp->oid_arg1;
483 snd_mtxlock(m->lock);
484 strncpy(devname, snd_mixernames[m->hwvol_mixer], sizeof(devname));
485 snd_mtxunlock(m->lock);
486 error = sysctl_handle_string(oidp, &devname[0], sizeof(devname), req);
487 snd_mtxlock(m->lock);
488 if (error == 0 && req->newptr != NULL) {
489 dev = mixer_lookup(devname);
490 if (dev == -1) {
491 snd_mtxunlock(m->lock);
492 return EINVAL;
494 else if (dev != m->hwvol_mixer) {
495 m->hwvol_mixer = dev;
496 m->hwvol_muted = 0;
499 snd_mtxunlock(m->lock);
500 return error;
502 #endif
505 mixer_hwvol_init(device_t dev)
507 struct snd_mixer *m;
508 struct cdev *pdev;
510 pdev = mixer_get_devt(dev);
511 m = pdev->si_drv1;
513 m->hwvol_mixer = SOUND_MIXER_VOLUME;
514 m->hwvol_step = 5;
515 #ifdef SND_DYNSYSCTL
516 SYSCTL_ADD_INT(snd_sysctl_tree(dev), SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
517 OID_AUTO, "hwvol_step", CTLFLAG_RW, &m->hwvol_step, 0, "");
518 SYSCTL_ADD_PROC(snd_sysctl_tree(dev), SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
519 OID_AUTO, "hwvol_mixer", CTLTYPE_STRING | CTLFLAG_RW, m, 0,
520 sysctl_hw_snd_hwvol_mixer, "A", "");
521 #endif
522 return 0;
525 void
526 mixer_hwvol_mute(device_t dev)
528 struct snd_mixer *m;
529 struct cdev *pdev;
531 pdev = mixer_get_devt(dev);
532 m = pdev->si_drv1;
533 snd_mtxlock(m->lock);
534 if (m->hwvol_muted) {
535 m->hwvol_muted = 0;
536 mixer_set(m, m->hwvol_mixer, m->hwvol_mute_level);
537 } else {
538 m->hwvol_muted++;
539 m->hwvol_mute_level = mixer_get(m, m->hwvol_mixer);
540 mixer_set(m, m->hwvol_mixer, 0);
542 snd_mtxunlock(m->lock);
545 void
546 mixer_hwvol_step(device_t dev, int left_step, int right_step)
548 struct snd_mixer *m;
549 int level, left, right;
550 struct cdev *pdev;
552 pdev = mixer_get_devt(dev);
553 m = pdev->si_drv1;
554 snd_mtxlock(m->lock);
555 if (m->hwvol_muted) {
556 m->hwvol_muted = 0;
557 level = m->hwvol_mute_level;
558 } else
559 level = mixer_get(m, m->hwvol_mixer);
560 if (level != -1) {
561 left = level & 0xff;
562 right = level >> 8;
563 left += left_step * m->hwvol_step;
564 if (left < 0)
565 left = 0;
566 right += right_step * m->hwvol_step;
567 if (right < 0)
568 right = 0;
569 mixer_set(m, m->hwvol_mixer, left | right << 8);
571 snd_mtxunlock(m->lock);
574 /* ----------------------------------------------------------------------- */
576 static int
577 vchanvolume(cdev_t i_dev, int write, int *volume, int *ret,
578 struct thread *td)
580 struct snddev_info *d;
581 void *cookie;
582 struct pcm_channel *ch;
583 int vol_left, vol_right;
585 crit_enter();
586 d = dsp_get_info(i_dev);
587 if (d == NULL) {
588 crit_exit();
589 return 0;
592 * We search for a vchan which is owned by the current process.
594 for (cookie = NULL; (ch = pcm_chn_iterate(d, &cookie)) != NULL;)
595 if (ch->flags & CHN_F_VIRTUAL &&
596 ch->pid == td->td_proc->p_pid)
597 break;
599 if (ch == NULL) {
600 crit_exit();
601 return 0;
604 if (write) {
605 vol_left = min(*volume & 0x00ff, 100);
606 vol_right = min((*volume & 0xff00) >> 8, 100);
607 *ret = chn_setvolume(ch, vol_left, vol_right);
608 } else {
609 *volume = ch->volume;
610 *ret = 0;
612 crit_exit();
613 return 1;
616 /* ----------------------------------------------------------------------- */
618 static int
619 mixer_open(struct dev_open_args *ap)
621 struct cdev *i_dev = ap->a_head.a_dev;
622 struct snd_mixer *m;
624 m = i_dev->si_drv1;
625 snd_mtxlock(m->lock);
627 m->busy++;
629 snd_mtxunlock(m->lock);
630 return 0;
633 static int
634 mixer_close(struct dev_close_args *ap)
636 struct cdev *i_dev = ap->a_head.a_dev;
637 struct snd_mixer *m;
639 m = i_dev->si_drv1;
640 snd_mtxlock(m->lock);
642 if (!m->busy) {
643 snd_mtxunlock(m->lock);
644 return EBADF;
646 m->busy--;
648 snd_mtxunlock(m->lock);
649 return 0;
653 mixer_ioctl(struct dev_ioctl_args *ap)
655 struct cdev *i_dev = ap->a_head.a_dev;
656 u_long cmd = ap->a_cmd;
657 caddr_t arg = ap->a_data;
658 int mode = ap->a_fflag;
659 struct snd_mixer *m;
660 int ret, *arg_i = (int *)arg;
661 int v = -1, j = cmd & 0xff;
663 m = i_dev->si_drv1;
665 if (m == NULL)
666 return EBADF;
669 * If we are handling PCM, maybe the app really wants to
670 * set its vchan, and fails to use the correct fd.
672 if (j == SOUND_MIXER_PCM) {
673 if (vchanvolume(i_dev,
674 (cmd & MIXER_WRITE(0)) == MIXER_WRITE(0),
675 (int *)arg, &ret, curthread))
676 return ret;
677 /* else proceed as usual */
680 snd_mtxlock(m->lock);
681 if (mode != -1 && !m->busy) {
682 snd_mtxunlock(m->lock);
683 return EBADF;
686 if ((cmd & MIXER_WRITE(0)) == MIXER_WRITE(0)) {
687 if (j == SOUND_MIXER_RECSRC)
688 ret = mixer_setrecsrc(m, *arg_i);
689 else
690 ret = mixer_set(m, j, *arg_i);
691 snd_mtxunlock(m->lock);
692 return (ret == 0)? 0 : ENXIO;
695 if ((cmd & MIXER_READ(0)) == MIXER_READ(0)) {
696 switch (j) {
697 case SOUND_MIXER_DEVMASK:
698 case SOUND_MIXER_CAPS:
699 case SOUND_MIXER_STEREODEVS:
700 v = mix_getdevs(m);
701 break;
703 case SOUND_MIXER_RECMASK:
704 v = mix_getrecdevs(m);
705 break;
707 case SOUND_MIXER_RECSRC:
708 v = mixer_getrecsrc(m);
709 break;
711 default:
712 v = mixer_get(m, j);
714 *arg_i = v;
715 snd_mtxunlock(m->lock);
716 return (v != -1)? 0 : ENXIO;
718 snd_mtxunlock(m->lock);
719 return ENXIO;
722 #ifdef USING_DEVFS
723 static void
724 mixer_clone(void *arg, struct ucred *cred, char *name, int namelen,
725 struct cdev **dev)
727 struct snddev_info *sd;
729 if (*dev != NULL)
730 return;
731 if (strcmp(name, "mixer") == 0) {
732 sd = devclass_get_softc(pcm_devclass, snd_unit);
733 if (sd != NULL && sd->mixer_dev != NULL) {
734 *dev = sd->mixer_dev;
735 dev_ref(*dev);
740 static void
741 mixer_sysinit(void *p)
743 mixer_ehtag = EVENTHANDLER_REGISTER(dev_clone, mixer_clone, 0, 1000);
746 static void
747 mixer_sysuninit(void *p)
749 if (mixer_ehtag != NULL)
750 EVENTHANDLER_DEREGISTER(dev_clone, mixer_ehtag);
753 SYSINIT(mixer_sysinit, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, mixer_sysinit, NULL);
754 SYSUNINIT(mixer_sysuninit, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, mixer_sysuninit, NULL);
755 #endif