Lines Matching +full:0 +full:m
44 &mixer_bypass, 0,
86 [SOUND_MIXER_IGAIN] = 0,
125 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) in mixer_lookup()
127 strlen(snd_mixernames[i])) == 0) in mixer_lookup()
133 if ((y) != 0) \
135 } while (0)
138 if ((y) != 0) \
140 } while (0)
143 mixer_set_softpcmvol(struct snd_mixer *m, struct snddev_info *d, in mixer_set_softpcmvol() argument
152 if (mtx_owned(m->lock)) in mixer_set_softpcmvol()
155 dropmtx = 0; in mixer_set_softpcmvol()
157 if (!(d->flags & SD_F_MPSAFE) || mtx_owned(d->lock) != 0) in mixer_set_softpcmvol()
158 acquiremtx = 0; in mixer_set_softpcmvol()
169 MIXER_SET_UNLOCK(m, dropmtx); in mixer_set_softpcmvol()
182 MIXER_SET_LOCK(m, dropmtx); in mixer_set_softpcmvol()
184 return (0); in mixer_set_softpcmvol()
188 mixer_set_eq(struct snd_mixer *m, struct snddev_info *d, in mixer_set_eq() argument
205 if (mtx_owned(m->lock)) in mixer_set_eq()
208 dropmtx = 0; in mixer_set_eq()
210 if (!(d->flags & SD_F_MPSAFE) || mtx_owned(d->lock) != 0) in mixer_set_eq()
211 acquiremtx = 0; in mixer_set_eq()
222 MIXER_SET_UNLOCK(m, dropmtx); in mixer_set_eq()
234 MIXER_SET_LOCK(m, dropmtx); in mixer_set_eq()
236 return (0); in mixer_set_eq()
240 mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev) in mixer_set() argument
244 u_int32_t parent = SOUND_MIXER_NONE, child = 0; in mixer_set()
248 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES || in mixer_set()
249 (0 == (m->devs & (1 << dev)))) in mixer_set()
252 l = min((lev & 0x00ff), 100); in mixer_set()
253 r = min(((lev & 0xff00) >> 8), 100); in mixer_set()
254 realdev = m->realdev[dev]; in mixer_set()
256 d = device_get_softc(m->dev); in mixer_set()
261 if (!(d->flags & SD_F_MPSAFE) && mtx_owned(m->lock) != 0) in mixer_set()
264 dropmtx = 0; in mixer_set()
268 m->level_muted[dev] = l | (r << 8); in mixer_set()
269 return (0); in mixer_set()
271 MIXER_SET_UNLOCK(m, dropmtx); in mixer_set()
274 parent = m->parent[dev]; in mixer_set()
278 child = m->child[dev]; in mixer_set()
281 tl = (l * (m->level[parent] & 0x00ff)) / 100; in mixer_set()
282 tr = (r * ((m->level[parent] & 0xff00) >> 8)) / 100; in mixer_set()
284 (void)mixer_set_softpcmvol(m, d, tl, tr); in mixer_set()
286 MIXER_SET(m, realdev, tl, tr) < 0) { in mixer_set()
287 MIXER_SET_LOCK(m, dropmtx); in mixer_set()
290 } else if (child != 0) { in mixer_set()
291 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mixer_set()
292 if (!(child & (1 << i)) || m->parent[i] != dev) in mixer_set()
294 realdev = m->realdev[i]; in mixer_set()
295 tl = (l * (m->level[i] & 0x00ff)) / 100; in mixer_set()
296 tr = (r * ((m->level[i] & 0xff00) >> 8)) / 100; in mixer_set()
299 (void)mixer_set_softpcmvol(m, d, tl, tr); in mixer_set()
301 MIXER_SET(m, realdev, tl, tr); in mixer_set()
303 realdev = m->realdev[dev]; in mixer_set()
305 MIXER_SET(m, realdev, l, r) < 0) { in mixer_set()
306 MIXER_SET_LOCK(m, dropmtx); in mixer_set()
311 (void)mixer_set_softpcmvol(m, d, l, r); in mixer_set()
314 (void)mixer_set_eq(m, d, dev, (l + r) >> 1); in mixer_set()
316 MIXER_SET(m, realdev, l, r) < 0) { in mixer_set()
317 MIXER_SET_LOCK(m, dropmtx); in mixer_set()
322 MIXER_SET_LOCK(m, dropmtx); in mixer_set()
324 m->level[dev] = l | (r << 8); in mixer_set()
325 m->modify_counter++; in mixer_set()
327 return (0); in mixer_set()
353 for (int i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mix_setmutedevs()
358 mixer_set(mixer, i, 0, 0); in mix_setmutedevs()
360 mixer_set(mixer, i, 0, mixer->level_muted[i]); in mix_setmutedevs()
375 if (!(d->flags & SD_F_MPSAFE) && mtx_owned(mixer->lock) != 0) in mixer_setrecsrc()
378 dropmtx = 0; in mixer_setrecsrc()
380 if (src == 0) in mixer_setrecsrc()
382 if (src == 0) in mixer_setrecsrc()
384 if (src == 0) in mixer_setrecsrc()
386 if (src == 0 && mixer->recdevs != 0) in mixer_setrecsrc()
395 return 0; in mixer_setrecsrc()
416 * @param m mixer context container thing
418 * @retval 0 success
423 mixer_get_recroute(struct snd_mixer *m, int *route) in mixer_get_recroute() argument
427 cnt = 0; in mixer_get_recroute()
429 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mixer_get_recroute()
431 if ((1 << i) == m->recsrc) in mixer_get_recroute()
433 if ((1 << i) & m->recdevs) in mixer_get_recroute()
441 return 0; in mixer_get_recroute()
451 * @param m mixer context container thing
453 * @retval 0 success(?)
458 mixer_set_recroute(struct snd_mixer *m, int route) in mixer_set_recroute() argument
462 ret = 0; in mixer_set_recroute()
463 cnt = 0; in mixer_set_recroute()
465 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mixer_set_recroute()
466 if ((1 << i) & m->recdevs) { in mixer_set_recroute()
476 ret = mixer_setrecsrc(m, (1 << i)); in mixer_set_recroute()
482 mix_setdevs(struct snd_mixer *m, u_int32_t v) in mix_setdevs() argument
487 if (m == NULL) in mix_setdevs()
490 d = device_get_softc(m->dev); in mix_setdevs()
495 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mix_setdevs()
496 if (m->parent[i] < SOUND_MIXER_NRDEVICES) in mix_setdevs()
497 v |= 1 << m->parent[i]; in mix_setdevs()
498 v |= m->child[i]; in mix_setdevs()
500 m->devs = v; in mix_setdevs()
513 * numbers. (Ex: a system might have 0 => 'vol', 1 => 'cd', 2 => 'line',
518 * @param m mixer device context container thing
522 mix_setrecdevs(struct snd_mixer *m, u_int32_t v) in mix_setrecdevs() argument
528 ei = &m->enuminfo; in mix_setrecdevs()
530 nvalues = 0; in mix_setrecdevs()
531 nwrote = 0; in mix_setrecdevs()
535 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mix_setrecdevs()
551 if ((nleft <= 0) || (nvalues >= OSS_ENUM_MAXVALUE)) { in mix_setrecdevs()
552 device_printf(m->dev, in mix_setrecdevs()
554 device_printf(m->dev, in mix_setrecdevs()
568 m->recdevs = v; in mix_setrecdevs()
572 mix_setparentchild(struct snd_mixer *m, u_int32_t parent, u_int32_t childs) in mix_setparentchild() argument
574 u_int32_t mask = 0; in mix_setparentchild()
577 if (m == NULL || parent >= SOUND_MIXER_NRDEVICES) in mix_setparentchild()
579 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mix_setparentchild()
584 if (m->parent[i] < SOUND_MIXER_NRDEVICES) in mix_setparentchild()
585 m->child[m->parent[i]] &= ~(1 << i); in mix_setparentchild()
586 m->parent[i] = parent; in mix_setparentchild()
587 m->child[i] = 0; in mix_setparentchild()
591 m->child[parent] = mask; in mix_setparentchild()
595 mix_setrealdev(struct snd_mixer *m, u_int32_t dev, u_int32_t realdev) in mix_setrealdev() argument
597 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES || in mix_setrealdev()
600 m->realdev[dev] = realdev; in mix_setrealdev()
604 mix_getparent(struct snd_mixer *m, u_int32_t dev) in mix_getparent() argument
606 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES) in mix_getparent()
608 return m->parent[dev]; in mix_getparent()
612 mix_getchild(struct snd_mixer *m, u_int32_t dev) in mix_getchild() argument
614 if (m == NULL || dev >= SOUND_MIXER_NRDEVICES) in mix_getchild()
615 return 0; in mix_getchild()
616 return m->child[dev]; in mix_getchild()
620 mix_getdevs(struct snd_mixer *m) in mix_getdevs() argument
622 return m->devs; in mix_getdevs()
626 mix_getmutedevs(struct snd_mixer *m) in mix_getmutedevs() argument
628 return m->mutedevs; in mix_getmutedevs()
632 mix_getrecdevs(struct snd_mixer *m) in mix_getrecdevs() argument
634 return m->recdevs; in mix_getrecdevs()
638 mix_getdevinfo(struct snd_mixer *m) in mix_getdevinfo() argument
640 return m->devinfo; in mix_getdevinfo()
647 struct snd_mixer *m; in mixer_obj_create() local
656 m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO); in mixer_obj_create()
657 snprintf(m->name, sizeof(m->name), "%s:mixer", in mixer_obj_create()
660 strlcat(m->name, ":", sizeof(m->name)); in mixer_obj_create()
661 strlcat(m->name, desc, sizeof(m->name)); in mixer_obj_create()
663 m->lock = snd_mtxcreate(m->name, (type == MIXER_TYPE_PRIMARY) ? in mixer_obj_create()
665 m->type = type; in mixer_obj_create()
666 m->devinfo = devinfo; in mixer_obj_create()
667 m->busy = 0; in mixer_obj_create()
668 m->dev = dev; in mixer_obj_create()
669 for (i = 0; i < nitems(m->parent); i++) { in mixer_obj_create()
670 m->parent[i] = SOUND_MIXER_NONE; in mixer_obj_create()
671 m->child[i] = 0; in mixer_obj_create()
672 m->realdev[i] = i; in mixer_obj_create()
675 if (MIXER_INIT(m)) { in mixer_obj_create()
676 snd_mtxlock(m->lock); in mixer_obj_create()
677 snd_mtxfree(m->lock); in mixer_obj_create()
678 kobj_delete((kobj_t)m, M_MIXER); in mixer_obj_create()
682 return (m); in mixer_obj_create()
686 mixer_delete(struct snd_mixer *m) in mixer_delete() argument
688 KASSERT(m != NULL, ("NULL snd_mixer")); in mixer_delete()
689 KASSERT(m->type == MIXER_TYPE_SECONDARY, in mixer_delete()
690 ("%s(): illegal mixer type=%d", __func__, m->type)); in mixer_delete()
694 MIXER_UNINIT(m); in mixer_delete()
696 snd_mtxfree(m->lock); in mixer_delete()
697 kobj_delete((kobj_t)m, M_MIXER); in mixer_delete()
699 return (0); in mixer_delete()
712 struct snd_mixer *m; in mixer_init() local
724 if (resource_int_value(name, unit, "eq", &val) == 0 && in mixer_init()
725 val != 0) { in mixer_init()
731 snddev->eqpreamp = 0; in mixer_init()
734 m = mixer_obj_create(dev, cls, devinfo, MIXER_TYPE_PRIMARY, NULL); in mixer_init()
735 if (m == NULL) in mixer_init()
738 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mixer_init()
742 &val) == 0) { in mixer_init()
743 if (val >= 0 && val <= 100) { in mixer_init()
748 mixer_set(m, i, 0, v | (v << 8)); in mixer_init()
751 mixer_setrecsrc(m, 0); /* Set default input. */ in mixer_init()
755 pdev->si_drv1 = m; in mixer_init()
759 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mixer_init()
760 if (!(m->devs & (1 << i))) in mixer_init()
762 if (m->realdev[i] != i) { in mixer_init()
765 (m->realdev[i] < SOUND_MIXER_NRDEVICES) ? in mixer_init()
766 snd_mixernames[m->realdev[i]] : "none"); in mixer_init()
771 if (m->parent[i] < SOUND_MIXER_NRDEVICES) in mixer_init()
773 snd_mixernames[m->parent[i]]); in mixer_init()
774 if (m->child[i] != 0) in mixer_init()
775 printf(" child=0x%08x", m->child[i]); in mixer_init()
784 return (0); in mixer_init()
792 struct snd_mixer *m; in mixer_uninit() local
800 m = pdev->si_drv1; in mixer_uninit()
801 KASSERT(m != NULL, ("NULL snd_mixer")); in mixer_uninit()
802 KASSERT(m->type == MIXER_TYPE_PRIMARY, in mixer_uninit()
803 ("%s(): illegal mixer type=%d", __func__, m->type)); in mixer_uninit()
808 snd_mtxlock(m->lock); in mixer_uninit()
810 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) in mixer_uninit()
811 mixer_set(m, i, 0, 0); in mixer_uninit()
813 mixer_setrecsrc(m, SOUND_MASK_MIC); in mixer_uninit()
815 snd_mtxunlock(m->lock); in mixer_uninit()
819 MIXER_UNINIT(m); in mixer_uninit()
821 snd_mtxfree(m->lock); in mixer_uninit()
822 kobj_delete((kobj_t)m, M_MIXER); in mixer_uninit()
826 return 0; in mixer_uninit()
832 struct snd_mixer *m; in mixer_reinit() local
837 m = pdev->si_drv1; in mixer_reinit()
838 snd_mtxlock(m->lock); in mixer_reinit()
840 i = MIXER_REINIT(m); in mixer_reinit()
842 snd_mtxunlock(m->lock); in mixer_reinit()
846 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { in mixer_reinit()
847 if (m->mutedevs & (1 << i)) in mixer_reinit()
848 mixer_set(m, i, 0, 0); in mixer_reinit()
850 mixer_set(m, i, 0, m->level[i]); in mixer_reinit()
853 mixer_setrecsrc(m, m->recsrc); in mixer_reinit()
854 snd_mtxunlock(m->lock); in mixer_reinit()
856 return 0; in mixer_reinit()
864 struct snd_mixer *m; in sysctl_hw_snd_hwvol_mixer() local
866 m = oidp->oid_arg1; in sysctl_hw_snd_hwvol_mixer()
867 snd_mtxlock(m->lock); in sysctl_hw_snd_hwvol_mixer()
868 strlcpy(devname, snd_mixernames[m->hwvol_mixer], sizeof(devname)); in sysctl_hw_snd_hwvol_mixer()
869 snd_mtxunlock(m->lock); in sysctl_hw_snd_hwvol_mixer()
870 error = sysctl_handle_string(oidp, &devname[0], sizeof(devname), req); in sysctl_hw_snd_hwvol_mixer()
871 snd_mtxlock(m->lock); in sysctl_hw_snd_hwvol_mixer()
872 if (error == 0 && req->newptr != NULL) { in sysctl_hw_snd_hwvol_mixer()
875 snd_mtxunlock(m->lock); in sysctl_hw_snd_hwvol_mixer()
878 m->hwvol_mixer = dev; in sysctl_hw_snd_hwvol_mixer()
881 snd_mtxunlock(m->lock); in sysctl_hw_snd_hwvol_mixer()
888 struct snd_mixer *m; in mixer_hwvol_init() local
892 m = pdev->si_drv1; in mixer_hwvol_init()
894 m->hwvol_mixer = SOUND_MIXER_VOLUME; in mixer_hwvol_init()
895 m->hwvol_step = 5; in mixer_hwvol_init()
898 OID_AUTO, "hwvol_step", CTLFLAG_RWTUN, &m->hwvol_step, 0, ""); in mixer_hwvol_init()
902 m, 0, sysctl_hw_snd_hwvol_mixer, "A", ""); in mixer_hwvol_init()
903 return 0; in mixer_hwvol_init()
907 mixer_hwvol_mute_locked(struct snd_mixer *m) in mixer_hwvol_mute_locked() argument
909 mix_setmutedevs(m, m->mutedevs ^ (1 << m->hwvol_mixer)); in mixer_hwvol_mute_locked()
915 struct snd_mixer *m; in mixer_hwvol_mute() local
919 m = pdev->si_drv1; in mixer_hwvol_mute()
920 snd_mtxlock(m->lock); in mixer_hwvol_mute()
921 mixer_hwvol_mute_locked(m); in mixer_hwvol_mute()
922 snd_mtxunlock(m->lock); in mixer_hwvol_mute()
926 mixer_hwvol_step_locked(struct snd_mixer *m, int left_step, int right_step) in mixer_hwvol_step_locked() argument
930 level = mixer_get(m, m->hwvol_mixer); in mixer_hwvol_step_locked()
933 left = level & 0xff; in mixer_hwvol_step_locked()
934 right = (level >> 8) & 0xff; in mixer_hwvol_step_locked()
935 left += left_step * m->hwvol_step; in mixer_hwvol_step_locked()
936 if (left < 0) in mixer_hwvol_step_locked()
937 left = 0; in mixer_hwvol_step_locked()
940 right += right_step * m->hwvol_step; in mixer_hwvol_step_locked()
941 if (right < 0) in mixer_hwvol_step_locked()
942 right = 0; in mixer_hwvol_step_locked()
946 mixer_set(m, m->hwvol_mixer, m->mutedevs, left | right << 8); in mixer_hwvol_step_locked()
953 struct snd_mixer *m; in mixer_hwvol_step() local
957 m = pdev->si_drv1; in mixer_hwvol_step()
958 snd_mtxlock(m->lock); in mixer_hwvol_step()
959 mixer_hwvol_step_locked(m, left_step, right_step); in mixer_hwvol_step()
960 snd_mtxunlock(m->lock); in mixer_hwvol_step()
964 mixer_busy(struct snd_mixer *m) in mixer_busy() argument
966 KASSERT(m != NULL, ("NULL snd_mixer")); in mixer_busy()
968 return (m->busy); in mixer_busy()
972 mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right) in mix_set() argument
976 KASSERT(m != NULL, ("NULL snd_mixer")); in mix_set()
978 snd_mtxlock(m->lock); in mix_set()
979 ret = mixer_set(m, dev, m->mutedevs, left | (right << 8)); in mix_set()
980 snd_mtxunlock(m->lock); in mix_set()
982 return ((ret != 0) ? ENXIO : 0); in mix_set()
986 mix_get(struct snd_mixer *m, u_int dev) in mix_get() argument
990 KASSERT(m != NULL, ("NULL snd_mixer")); in mix_get()
992 snd_mtxlock(m->lock); in mix_get()
993 ret = mixer_get(m, dev); in mix_get()
994 snd_mtxunlock(m->lock); in mix_get()
1000 mix_setrecsrc(struct snd_mixer *m, u_int32_t src) in mix_setrecsrc() argument
1004 KASSERT(m != NULL, ("NULL snd_mixer")); in mix_setrecsrc()
1006 snd_mtxlock(m->lock); in mix_setrecsrc()
1007 ret = mixer_setrecsrc(m, src); in mix_setrecsrc()
1008 snd_mtxunlock(m->lock); in mix_setrecsrc()
1010 return ((ret != 0) ? ENXIO : 0); in mix_setrecsrc()
1014 mix_getrecsrc(struct snd_mixer *m) in mix_getrecsrc() argument
1018 KASSERT(m != NULL, ("NULL snd_mixer")); in mix_getrecsrc()
1020 snd_mtxlock(m->lock); in mix_getrecsrc()
1021 ret = mixer_getrecsrc(m); in mix_getrecsrc()
1022 snd_mtxunlock(m->lock); in mix_getrecsrc()
1028 mix_get_type(struct snd_mixer *m) in mix_get_type() argument
1030 KASSERT(m != NULL, ("NULL snd_mixer")); in mix_get_type()
1032 return (m->type); in mix_get_type()
1036 mix_get_dev(struct snd_mixer *m) in mix_get_dev() argument
1038 KASSERT(m != NULL, ("NULL snd_mixer")); in mix_get_dev()
1040 return (m->dev); in mix_get_dev()
1049 struct snd_mixer *m; in mixer_open() local
1054 m = i_dev->si_drv1; in mixer_open()
1055 d = device_get_softc(m->dev); in mixer_open()
1061 snd_mtxlock(m->lock); in mixer_open()
1062 m->busy = 1; in mixer_open()
1063 snd_mtxunlock(m->lock); in mixer_open()
1065 return (0); in mixer_open()
1072 struct snd_mixer *m; in mixer_close() local
1078 m = i_dev->si_drv1; in mixer_close()
1079 d = device_get_softc(m->dev); in mixer_close()
1085 snd_mtxlock(m->lock); in mixer_close()
1086 ret = (m->busy == 0) ? EBADF : 0; in mixer_close()
1087 m->busy = 0; in mixer_close()
1088 snd_mtxunlock(m->lock); in mixer_close()
1098 struct snd_mixer *m; in mixer_ioctl_channel() local
1106 m = dev->si_drv1; in mixer_ioctl_channel()
1107 d = device_get_softc(m->dev); in mixer_ioctl_channel()
1108 j = cmd & 0xff; in mixer_ioctl_channel()
1165 (cmd & ~0xff) == MIXER_READ(0)) { in mixer_ioctl_channel()
1166 snd_mtxlock(m->lock); in mixer_ioctl_channel()
1167 *(int *)arg = mix_getdevs(m); in mixer_ioctl_channel()
1168 snd_mtxunlock(m->lock); in mixer_ioctl_channel()
1173 ret = 0; in mixer_ioctl_channel()
1183 if ((cmd & ~0xff) == MIXER_WRITE(0)) { in mixer_ioctl_channel()
1186 left = *(int *)arg & 0x7f; in mixer_ioctl_channel()
1187 right = (*(int *)arg >> 8) & 0x7f; in mixer_ioctl_channel()
1190 } else if ((cmd & ~0xff) == MIXER_READ(0)) { in mixer_ioctl_channel()
1198 return (0); in mixer_ioctl_channel()
1220 if (mixer_bypass != 0 && (d->flags & SD_F_VPC)) in mixer_ioctl()
1235 mixer_mixerinfo(struct snd_mixer *m, mixer_info *mi) in mixer_mixerinfo() argument
1238 strlcpy(mi->id, m->name, sizeof(mi->id)); in mixer_mixerinfo()
1239 strlcpy(mi->name, device_get_desc(m->dev), sizeof(mi->name)); in mixer_mixerinfo()
1240 mi->modify_counter = m->modify_counter; in mixer_mixerinfo()
1251 struct snd_mixer *m; in mixer_ioctl_cmd() local
1253 int v = -1, j = cmd & 0xff; in mixer_ioctl_cmd()
1263 return (0); in mixer_ioctl_cmd()
1280 m = i_dev->si_drv1; in mixer_ioctl_cmd()
1282 if (m == NULL) in mixer_ioctl_cmd()
1285 snd_mtxlock(m->lock); in mixer_ioctl_cmd()
1286 if (from == MIXER_CMD_CDEV && !m->busy) { in mixer_ioctl_cmd()
1287 snd_mtxunlock(m->lock); in mixer_ioctl_cmd()
1292 bcopy((void *)&m->enuminfo, arg, sizeof(oss_mixer_enuminfo)); in mixer_ioctl_cmd()
1293 ret = 0; in mixer_ioctl_cmd()
1296 ret = mixer_get_recroute(m, arg_i); in mixer_ioctl_cmd()
1299 ret = mixer_set_recroute(m, *arg_i); in mixer_ioctl_cmd()
1303 ret = 0; in mixer_ioctl_cmd()
1306 mixer_mixerinfo(m, (mixer_info *)arg); in mixer_ioctl_cmd()
1307 ret = 0; in mixer_ioctl_cmd()
1310 if ((cmd & ~0xff) == MIXER_WRITE(0)) { in mixer_ioctl_cmd()
1313 ret = mixer_setrecsrc(m, *arg_i); in mixer_ioctl_cmd()
1316 mix_setmutedevs(m, *arg_i); in mixer_ioctl_cmd()
1317 ret = 0; in mixer_ioctl_cmd()
1320 ret = mixer_set(m, j, m->mutedevs, *arg_i); in mixer_ioctl_cmd()
1323 snd_mtxunlock(m->lock); in mixer_ioctl_cmd()
1324 return ((ret == 0) ? 0 : ENXIO); in mixer_ioctl_cmd()
1326 if ((cmd & ~0xff) == MIXER_READ(0)) { in mixer_ioctl_cmd()
1331 v = mix_getdevs(m); in mixer_ioctl_cmd()
1334 v = mix_getmutedevs(m); in mixer_ioctl_cmd()
1337 v = mix_getrecdevs(m); in mixer_ioctl_cmd()
1340 v = mixer_getrecsrc(m); in mixer_ioctl_cmd()
1343 v = mixer_get(m, j); in mixer_ioctl_cmd()
1347 snd_mtxunlock(m->lock); in mixer_ioctl_cmd()
1348 return ((v != -1) ? 0 : ENXIO); in mixer_ioctl_cmd()
1351 snd_mtxunlock(m->lock); in mixer_ioctl_cmd()
1364 if (strcmp(name, "mixer") == 0) { in mixer_clone()
1381 mixer_ehtag = EVENTHANDLER_REGISTER(dev_clone, mixer_clone, 0, 1000); in mixer_sysinit()
1424 * @retval 0 success
1430 struct snd_mixer *m; in mixer_oss_mixerinfo() local
1441 m = NULL; in mixer_oss_mixerinfo()
1447 for (i = 0; pcm_devclass != NULL && in mixer_oss_mixerinfo()
1453 return (0); in mixer_oss_mixerinfo()
1473 return (0); in mixer_oss_mixerinfo()
1476 m = d->mixer_dev->si_drv1; in mixer_oss_mixerinfo()
1477 mtx_lock(m->lock); in mixer_oss_mixerinfo()
1489 strlcpy(mi->name, m->name, sizeof(mi->name)); in mixer_oss_mixerinfo()
1490 mi->modify_counter = m->modify_counter; in mixer_oss_mixerinfo()
1494 * a pcm and mixer devices, so this is hardcoded to 0. in mixer_oss_mixerinfo()
1496 mi->port_number = 0; in mixer_oss_mixerinfo()
1514 * From 4Front: "magic is usually 0. However some in mixer_oss_mixerinfo()
1520 mi->enabled = device_is_attached(m->dev) ? 1 : 0; in mixer_oss_mixerinfo()
1523 * currently MIXER_CAP_VIRTUAL, which I'm not sure we in mixer_oss_mixerinfo()
1535 * determine which mixer should be the default, with 0 in mixer_oss_mixerinfo()
1540 * devices use 0 because they will never be the in mixer_oss_mixerinfo()
1549 mtx_unlock(m->lock); in mixer_oss_mixerinfo()
1553 return (0); in mixer_oss_mixerinfo()
1564 mixer_get_lock(struct snd_mixer *m) in mixer_get_lock() argument
1566 if (m->lock == NULL) { in mixer_get_lock()
1569 return (m->lock); in mixer_get_lock()
1573 mix_get_locked(struct snd_mixer *m, u_int dev, int *pleft, int *pright) in mix_get_locked() argument
1577 level = mixer_get(m, dev); in mix_get_locked()
1578 if (level < 0) { in mix_get_locked()
1583 *pleft = level & 0xFF; in mix_get_locked()
1584 *pright = (level >> 8) & 0xFF; in mix_get_locked()
1586 return (0); in mix_get_locked()
1590 mix_set_locked(struct snd_mixer *m, u_int dev, int left, int right) in mix_set_locked() argument
1594 level = (left & 0xFF) | ((right & 0xFF) << 8); in mix_set_locked()
1596 return (mixer_set(m, dev, m->mutedevs, level)); in mix_set_locked()