2 * OSS emulation layer for the mixer interface
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <sound/driver.h>
23 #include <linux/init.h>
24 #include <linux/smp_lock.h>
25 #include <linux/slab.h>
26 #include <linux/time.h>
27 #include <sound/core.h>
28 #include <sound/minors.h>
29 #include <sound/control.h>
30 #include <sound/info.h>
31 #include <sound/mixer_oss.h>
32 #include <linux/soundcard.h>
34 #define OSS_ALSAEMULVER _SIOR ('M', 249, int)
36 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
37 MODULE_DESCRIPTION("Mixer OSS emulation for ALSA.");
38 MODULE_LICENSE("GPL");
39 MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MIXER);
41 static int snd_mixer_oss_open(struct inode *inode, struct file *file)
43 int cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
45 snd_mixer_oss_file_t *fmixer;
48 if ((card = snd_cards[cardnum]) == NULL)
50 if (card->mixer_oss == NULL)
52 err = snd_card_file_add(card, file);
55 fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL);
57 snd_card_file_remove(card, file);
61 fmixer->mixer = card->mixer_oss;
62 file->private_data = fmixer;
63 if (!try_module_get(card->module)) {
65 snd_card_file_remove(card, file);
71 static int snd_mixer_oss_release(struct inode *inode, struct file *file)
73 snd_mixer_oss_file_t *fmixer;
75 if (file->private_data) {
76 fmixer = (snd_mixer_oss_file_t *) file->private_data;
77 module_put(fmixer->card->module);
78 snd_card_file_remove(fmixer->card, file);
84 static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer,
85 mixer_info __user *_info)
87 snd_card_t *card = fmixer->card;
88 snd_mixer_oss_t *mixer = fmixer->mixer;
89 struct mixer_info info;
91 memset(&info, 0, sizeof(info));
92 strlcpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id));
93 strlcpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name));
94 info.modify_counter = card->mixer_oss_change_count;
95 if (copy_to_user(_info, &info, sizeof(info)))
100 static int snd_mixer_oss_info_obsolete(snd_mixer_oss_file_t *fmixer,
101 _old_mixer_info __user *_info)
103 snd_card_t *card = fmixer->card;
104 snd_mixer_oss_t *mixer = fmixer->mixer;
105 _old_mixer_info info;
107 memset(&info, 0, sizeof(info));
108 strlcpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id));
109 strlcpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name));
110 if (copy_to_user(_info, &info, sizeof(info)))
115 static int snd_mixer_oss_caps(snd_mixer_oss_file_t *fmixer)
117 snd_mixer_oss_t *mixer = fmixer->mixer;
122 if (mixer->get_recsrc && mixer->put_recsrc)
123 result |= SOUND_CAP_EXCL_INPUT;
127 static int snd_mixer_oss_devmask(snd_mixer_oss_file_t *fmixer)
129 snd_mixer_oss_t *mixer = fmixer->mixer;
130 snd_mixer_oss_slot_t *pslot;
135 for (chn = 0; chn < 31; chn++) {
136 pslot = &mixer->slots[chn];
137 if (pslot->put_volume || pslot->put_recsrc)
143 static int snd_mixer_oss_stereodevs(snd_mixer_oss_file_t *fmixer)
145 snd_mixer_oss_t *mixer = fmixer->mixer;
146 snd_mixer_oss_slot_t *pslot;
151 for (chn = 0; chn < 31; chn++) {
152 pslot = &mixer->slots[chn];
153 if (pslot->put_volume && pslot->stereo)
159 static int snd_mixer_oss_recmask(snd_mixer_oss_file_t *fmixer)
161 snd_mixer_oss_t *mixer = fmixer->mixer;
166 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */
167 result = mixer->mask_recsrc;
169 snd_mixer_oss_slot_t *pslot;
171 for (chn = 0; chn < 31; chn++) {
172 pslot = &mixer->slots[chn];
173 if (pslot->put_recsrc)
180 static int snd_mixer_oss_get_recsrc(snd_mixer_oss_file_t *fmixer)
182 snd_mixer_oss_t *mixer = fmixer->mixer;
187 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */
189 if ((err = mixer->get_recsrc(fmixer, &result)) < 0)
191 result = 1 << result;
193 snd_mixer_oss_slot_t *pslot;
195 for (chn = 0; chn < 31; chn++) {
196 pslot = &mixer->slots[chn];
197 if (pslot->get_recsrc) {
199 pslot->get_recsrc(fmixer, pslot, &active);
205 return mixer->oss_recsrc = result;
208 static int snd_mixer_oss_set_recsrc(snd_mixer_oss_file_t *fmixer, int recsrc)
210 snd_mixer_oss_t *mixer = fmixer->mixer;
211 snd_mixer_oss_slot_t *pslot;
217 if (mixer->get_recsrc && mixer->put_recsrc) { /* exclusive input */
218 if (recsrc & ~mixer->oss_recsrc)
219 recsrc &= ~mixer->oss_recsrc;
220 mixer->put_recsrc(fmixer, ffz(~recsrc));
221 mixer->get_recsrc(fmixer, &result);
222 result = 1 << result;
224 for (chn = 0; chn < 31; chn++) {
225 pslot = &mixer->slots[chn];
226 if (pslot->put_recsrc) {
227 active = (recsrc & (1 << chn)) ? 1 : 0;
228 pslot->put_recsrc(fmixer, pslot, active);
232 for (chn = 0; chn < 31; chn++) {
233 pslot = &mixer->slots[chn];
234 if (pslot->get_recsrc) {
236 pslot->get_recsrc(fmixer, pslot, &active);
245 static int snd_mixer_oss_get_volume(snd_mixer_oss_file_t *fmixer, int slot)
247 snd_mixer_oss_t *mixer = fmixer->mixer;
248 snd_mixer_oss_slot_t *pslot;
249 int result = 0, left, right;
251 if (mixer == NULL || slot > 30)
253 pslot = &mixer->slots[slot];
254 left = pslot->volume[0];
255 right = pslot->volume[1];
256 if (pslot->get_volume)
257 result = pslot->get_volume(fmixer, pslot, &left, &right);
260 snd_assert(left >= 0 && left <= 100, return -EIO);
261 snd_assert(right >= 0 && right <= 100, return -EIO);
263 pslot->volume[0] = left;
264 pslot->volume[1] = right;
265 result = (left & 0xff) | ((right & 0xff) << 8);
270 static int snd_mixer_oss_set_volume(snd_mixer_oss_file_t *fmixer,
271 int slot, int volume)
273 snd_mixer_oss_t *mixer = fmixer->mixer;
274 snd_mixer_oss_slot_t *pslot;
275 int result = 0, left = volume & 0xff, right = (volume >> 8) & 0xff;
277 if (mixer == NULL || slot > 30)
279 pslot = &mixer->slots[slot];
286 if (pslot->put_volume)
287 result = pslot->put_volume(fmixer, pslot, left, right);
290 pslot->volume[0] = left;
291 pslot->volume[1] = right;
292 return (left & 0xff) | ((right & 0xff) << 8);
295 static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd, unsigned long arg)
297 void __user *argp = (void __user *)arg;
298 int __user *p = argp;
301 snd_assert(fmixer != NULL, return -ENXIO);
302 if (((cmd >> 8) & 0xff) == 'M') {
304 case SOUND_MIXER_INFO:
305 return snd_mixer_oss_info(fmixer, argp);
306 case SOUND_OLD_MIXER_INFO:
307 return snd_mixer_oss_info_obsolete(fmixer, argp);
308 case SOUND_MIXER_WRITE_RECSRC:
309 if (get_user(tmp, p))
311 tmp = snd_mixer_oss_set_recsrc(fmixer, tmp);
314 return put_user(tmp, p);
316 return put_user(SNDRV_OSS_VERSION, p);
317 case OSS_ALSAEMULVER:
318 return put_user(1, p);
319 case SOUND_MIXER_READ_DEVMASK:
320 tmp = snd_mixer_oss_devmask(fmixer);
323 return put_user(tmp, p);
324 case SOUND_MIXER_READ_STEREODEVS:
325 tmp = snd_mixer_oss_stereodevs(fmixer);
328 return put_user(tmp, p);
329 case SOUND_MIXER_READ_RECMASK:
330 tmp = snd_mixer_oss_recmask(fmixer);
333 return put_user(tmp, p);
334 case SOUND_MIXER_READ_CAPS:
335 tmp = snd_mixer_oss_caps(fmixer);
338 return put_user(tmp, p);
339 case SOUND_MIXER_READ_RECSRC:
340 tmp = snd_mixer_oss_get_recsrc(fmixer);
343 return put_user(tmp, p);
347 if (get_user(tmp, p))
349 tmp = snd_mixer_oss_set_volume(fmixer, cmd & 0xff, tmp);
352 return put_user(tmp, p);
353 } else if (cmd & SIOC_OUT) {
354 tmp = snd_mixer_oss_get_volume(fmixer, cmd & 0xff);
357 return put_user(tmp, p);
362 /* FIXME: need to unlock BKL to allow preemption */
363 static int snd_mixer_oss_ioctl(struct inode *inode, struct file *file,
364 unsigned int cmd, unsigned long arg)
367 /* FIXME: need to unlock BKL to allow preemption */
369 err = snd_mixer_oss_ioctl1((snd_mixer_oss_file_t *) file->private_data, cmd, arg);
374 int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long arg)
376 snd_mixer_oss_file_t fmixer;
378 snd_assert(card != NULL, return -ENXIO);
379 if (card->mixer_oss == NULL)
381 memset(&fmixer, 0, sizeof(fmixer));
383 fmixer.mixer = card->mixer_oss;
384 return snd_mixer_oss_ioctl1(&fmixer, cmd, arg);
391 static struct file_operations snd_mixer_oss_f_ops =
393 .owner = THIS_MODULE,
394 .open = snd_mixer_oss_open,
395 .release = snd_mixer_oss_release,
396 .ioctl = snd_mixer_oss_ioctl,
399 static snd_minor_t snd_mixer_oss_reg =
402 .f_ops = &snd_mixer_oss_f_ops,
409 static long snd_mixer_oss_conv(long val, long omin, long omax, long nmin, long nmax)
411 long orange = omax - omin, nrange = nmax - nmin;
415 return ((nrange * (val - omin)) + (orange / 2)) / orange + nmin;
418 /* convert from alsa native to oss values (0-100) */
419 static long snd_mixer_oss_conv1(long val, long min, long max, int *old)
421 if (val == snd_mixer_oss_conv(*old, 0, 100, min, max))
423 return snd_mixer_oss_conv(val, min, max, 0, 100);
426 /* convert from oss to alsa native values */
427 static long snd_mixer_oss_conv2(long val, long min, long max)
429 return snd_mixer_oss_conv(val, 0, 100, min, max);
433 static void snd_mixer_oss_recsrce_set(snd_card_t *card, int slot)
435 snd_mixer_oss_t *mixer = card->mixer_oss;
437 mixer->mask_recsrc |= 1 << slot;
440 static int snd_mixer_oss_recsrce_get(snd_card_t *card, int slot)
442 snd_mixer_oss_t *mixer = card->mixer_oss;
443 if (mixer && (mixer->mask_recsrc & (1 << slot)))
449 #define SNDRV_MIXER_OSS_SIGNATURE 0x65999250
451 #define SNDRV_MIXER_OSS_ITEM_GLOBAL 0
452 #define SNDRV_MIXER_OSS_ITEM_GSWITCH 1
453 #define SNDRV_MIXER_OSS_ITEM_GROUTE 2
454 #define SNDRV_MIXER_OSS_ITEM_GVOLUME 3
455 #define SNDRV_MIXER_OSS_ITEM_PSWITCH 4
456 #define SNDRV_MIXER_OSS_ITEM_PROUTE 5
457 #define SNDRV_MIXER_OSS_ITEM_PVOLUME 6
458 #define SNDRV_MIXER_OSS_ITEM_CSWITCH 7
459 #define SNDRV_MIXER_OSS_ITEM_CROUTE 8
460 #define SNDRV_MIXER_OSS_ITEM_CVOLUME 9
461 #define SNDRV_MIXER_OSS_ITEM_CAPTURE 10
463 #define SNDRV_MIXER_OSS_ITEM_COUNT 11
465 #define SNDRV_MIXER_OSS_PRESENT_GLOBAL (1<<0)
466 #define SNDRV_MIXER_OSS_PRESENT_GSWITCH (1<<1)
467 #define SNDRV_MIXER_OSS_PRESENT_GROUTE (1<<2)
468 #define SNDRV_MIXER_OSS_PRESENT_GVOLUME (1<<3)
469 #define SNDRV_MIXER_OSS_PRESENT_PSWITCH (1<<4)
470 #define SNDRV_MIXER_OSS_PRESENT_PROUTE (1<<5)
471 #define SNDRV_MIXER_OSS_PRESENT_PVOLUME (1<<6)
472 #define SNDRV_MIXER_OSS_PRESENT_CSWITCH (1<<7)
473 #define SNDRV_MIXER_OSS_PRESENT_CROUTE (1<<8)
474 #define SNDRV_MIXER_OSS_PRESENT_CVOLUME (1<<9)
475 #define SNDRV_MIXER_OSS_PRESENT_CAPTURE (1<<10)
478 unsigned int signature;
479 unsigned int present;
480 unsigned int channels;
481 unsigned int numid[SNDRV_MIXER_OSS_ITEM_COUNT];
482 unsigned int capture_item;
483 struct snd_mixer_oss_assign_table *assigned;
484 unsigned int allocated: 1;
487 #define ID_UNKNOWN ((unsigned int)-1)
489 static snd_kcontrol_t *snd_mixer_oss_test_id(snd_mixer_oss_t *mixer, const char *name, int index)
491 snd_card_t * card = mixer->card;
492 snd_ctl_elem_id_t id;
494 memset(&id, 0, sizeof(id));
495 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
496 strcpy(id.name, name);
498 return snd_ctl_find_id(card, &id);
501 static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer,
502 snd_mixer_oss_slot_t *pslot,
504 int *left, int *right)
506 snd_ctl_elem_info_t *uinfo;
507 snd_ctl_elem_value_t *uctl;
508 snd_kcontrol_t *kctl;
509 snd_card_t *card = fmixer->card;
511 if (numid == ID_UNKNOWN)
513 down_read(&card->controls_rwsem);
514 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) {
515 up_read(&card->controls_rwsem);
518 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
519 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
520 if (uinfo == NULL || uctl == NULL)
522 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
523 snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc);
524 snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, return);
525 *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]);
526 if (uinfo->count > 1)
527 *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]);
529 up_read(&card->controls_rwsem);
534 static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer,
535 snd_mixer_oss_slot_t *pslot,
537 int *left, int *right,
540 snd_ctl_elem_info_t *uinfo;
541 snd_ctl_elem_value_t *uctl;
542 snd_kcontrol_t *kctl;
543 snd_card_t *card = fmixer->card;
545 if (numid == ID_UNKNOWN)
547 down_read(&card->controls_rwsem);
548 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) {
549 up_read(&card->controls_rwsem);
552 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
553 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
554 if (uinfo == NULL || uctl == NULL)
556 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
557 snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc);
558 if (!uctl->value.integer.value[0]) {
560 if (uinfo->count == 1)
563 if (uinfo->count > 1 && !uctl->value.integer.value[route ? 3 : 1])
566 up_read(&card->controls_rwsem);
571 static int snd_mixer_oss_get_volume1(snd_mixer_oss_file_t *fmixer,
572 snd_mixer_oss_slot_t *pslot,
573 int *left, int *right)
575 struct slot *slot = (struct slot *)pslot->private_data;
577 *left = *right = 100;
578 if (slot->present & SNDRV_MIXER_OSS_PRESENT_PVOLUME) {
579 snd_mixer_oss_get_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right);
580 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) {
581 snd_mixer_oss_get_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right);
582 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) {
583 snd_mixer_oss_get_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GLOBAL], left, right);
585 if (slot->present & SNDRV_MIXER_OSS_PRESENT_PSWITCH) {
586 snd_mixer_oss_get_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PSWITCH], left, right, 0);
587 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GSWITCH) {
588 snd_mixer_oss_get_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GSWITCH], left, right, 0);
589 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_PROUTE) {
590 snd_mixer_oss_get_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PROUTE], left, right, 1);
591 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GROUTE) {
592 snd_mixer_oss_get_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GROUTE], left, right, 1);
597 static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer,
598 snd_mixer_oss_slot_t *pslot,
602 snd_ctl_elem_info_t *uinfo;
603 snd_ctl_elem_value_t *uctl;
604 snd_kcontrol_t *kctl;
605 snd_card_t *card = fmixer->card;
608 if (numid == ID_UNKNOWN)
610 down_read(&card->controls_rwsem);
611 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL)
613 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
614 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
615 if (uinfo == NULL || uctl == NULL)
617 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
618 snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, return);
619 uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max);
620 if (uinfo->count > 1)
621 uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max);
622 snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc);
624 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
626 up_read(&card->controls_rwsem);
631 static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer,
632 snd_mixer_oss_slot_t *pslot,
637 snd_ctl_elem_info_t *uinfo;
638 snd_ctl_elem_value_t *uctl;
639 snd_kcontrol_t *kctl;
640 snd_card_t *card = fmixer->card;
643 if (numid == ID_UNKNOWN)
645 down_read(&card->controls_rwsem);
646 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) {
647 up_read(&fmixer->card->controls_rwsem);
650 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
651 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
652 if (uinfo == NULL || uctl == NULL)
654 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
655 if (uinfo->count > 1) {
656 uctl->value.integer.value[0] = left > 0 ? 1 : 0;
657 uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0;
659 uctl->value.integer.value[1] =
660 uctl->value.integer.value[2] = 0;
663 uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0;
665 snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc);
667 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
669 up_read(&card->controls_rwsem);
674 static int snd_mixer_oss_put_volume1(snd_mixer_oss_file_t *fmixer,
675 snd_mixer_oss_slot_t *pslot,
678 struct slot *slot = (struct slot *)pslot->private_data;
680 if (slot->present & SNDRV_MIXER_OSS_PRESENT_PVOLUME) {
681 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right);
682 if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME)
683 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right);
684 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) {
685 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right);
686 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) {
687 snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GLOBAL], left, right);
690 if (slot->present & SNDRV_MIXER_OSS_PRESENT_PSWITCH)
691 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PSWITCH], left, right, 0);
692 if (slot->present & SNDRV_MIXER_OSS_PRESENT_GSWITCH)
693 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GSWITCH], left, right, 0);
694 if (slot->present & SNDRV_MIXER_OSS_PRESENT_PROUTE)
695 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PROUTE], left, right, 1);
696 if (slot->present & SNDRV_MIXER_OSS_PRESENT_GROUTE)
697 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GROUTE], left, right, 1);
699 if (slot->present & SNDRV_MIXER_OSS_PRESENT_PSWITCH) {
700 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PSWITCH], left, right, 0);
701 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GSWITCH) {
702 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GSWITCH], left, right, 0);
703 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_PROUTE) {
704 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PROUTE], left, right, 1);
705 } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GROUTE) {
706 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GROUTE], left, right, 1);
712 static int snd_mixer_oss_get_recsrc1_sw(snd_mixer_oss_file_t *fmixer,
713 snd_mixer_oss_slot_t *pslot,
716 struct slot *slot = (struct slot *)pslot->private_data;
720 snd_mixer_oss_get_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CSWITCH], &left, &right, 0);
721 *active = (left || right) ? 1 : 0;
725 static int snd_mixer_oss_get_recsrc1_route(snd_mixer_oss_file_t *fmixer,
726 snd_mixer_oss_slot_t *pslot,
729 struct slot *slot = (struct slot *)pslot->private_data;
733 snd_mixer_oss_get_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CROUTE], &left, &right, 1);
734 *active = (left || right) ? 1 : 0;
738 static int snd_mixer_oss_put_recsrc1_sw(snd_mixer_oss_file_t *fmixer,
739 snd_mixer_oss_slot_t *pslot,
742 struct slot *slot = (struct slot *)pslot->private_data;
744 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CSWITCH], active, active, 0);
748 static int snd_mixer_oss_put_recsrc1_route(snd_mixer_oss_file_t *fmixer,
749 snd_mixer_oss_slot_t *pslot,
752 struct slot *slot = (struct slot *)pslot->private_data;
754 snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CROUTE], active, active, 1);
758 static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int *active_index)
760 snd_card_t *card = fmixer->card;
761 snd_mixer_oss_t *mixer = fmixer->mixer;
762 snd_kcontrol_t *kctl;
763 snd_mixer_oss_slot_t *pslot;
765 snd_ctl_elem_info_t *uinfo;
766 snd_ctl_elem_value_t *uctl;
769 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
770 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
771 if (uinfo == NULL || uctl == NULL) {
775 down_read(&card->controls_rwsem);
776 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
777 snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock);
778 snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock);
779 snd_runtime_check(!(err = kctl->get(kctl, uctl)), goto __unlock);
780 for (idx = 0; idx < 32; idx++) {
781 if (!(mixer->mask_recsrc & (1 << idx)))
783 pslot = &mixer->slots[idx];
784 slot = (struct slot *)pslot->private_data;
785 if (slot->signature != SNDRV_MIXER_OSS_SIGNATURE)
787 if (!(slot->present & SNDRV_MIXER_OSS_PRESENT_CAPTURE))
789 if (slot->capture_item == uctl->value.enumerated.item[0]) {
796 up_read(&card->controls_rwsem);
802 static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int active_index)
804 snd_card_t *card = fmixer->card;
805 snd_mixer_oss_t *mixer = fmixer->mixer;
806 snd_kcontrol_t *kctl;
807 snd_mixer_oss_slot_t *pslot;
808 struct slot *slot = NULL;
809 snd_ctl_elem_info_t *uinfo;
810 snd_ctl_elem_value_t *uctl;
814 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
815 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
816 if (uinfo == NULL || uctl == NULL) {
820 down_read(&card->controls_rwsem);
821 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
822 snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock);
823 snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock);
824 for (idx = 0; idx < 32; idx++) {
825 if (!(mixer->mask_recsrc & (1 << idx)))
827 pslot = &mixer->slots[idx];
828 slot = (struct slot *)pslot->private_data;
829 if (slot->signature != SNDRV_MIXER_OSS_SIGNATURE)
831 if (!(slot->present & SNDRV_MIXER_OSS_PRESENT_CAPTURE))
833 if (idx == active_index)
837 snd_runtime_check(slot != NULL, goto __unlock);
838 for (idx = 0; idx < uinfo->count; idx++)
839 uctl->value.enumerated.item[idx] = slot->capture_item;
840 snd_runtime_check((err = kctl->put(kctl, uctl)) >= 0, );
842 snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
845 up_read(&card->controls_rwsem);
851 struct snd_mixer_oss_assign_table {
857 static int snd_mixer_oss_build_test(snd_mixer_oss_t *mixer, struct slot *slot, const char *name, int index, int item)
859 snd_ctl_elem_info_t info;
860 snd_kcontrol_t *kcontrol;
861 snd_card_t *card = mixer->card;
864 down_read(&card->controls_rwsem);
865 kcontrol = snd_mixer_oss_test_id(mixer, name, index);
866 if (kcontrol == NULL) {
867 up_read(&card->controls_rwsem);
870 if ((err = kcontrol->info(kcontrol, &info)) < 0) {
871 up_read(&card->controls_rwsem);
874 slot->numid[item] = kcontrol->id.numid;
875 up_read(&card->controls_rwsem);
876 if (info.count > slot->channels)
877 slot->channels = info.count;
878 slot->present |= 1 << item;
882 static void snd_mixer_oss_slot_free(snd_mixer_oss_slot_t *chn)
884 struct slot *p = (struct slot *)chn->private_data;
886 if (p->allocated && p->assigned) {
887 kfree(p->assigned->name);
894 static void mixer_slot_clear(snd_mixer_oss_slot_t *rslot)
896 int idx = rslot->number; /* remember this */
897 if (rslot->private_free)
898 rslot->private_free(rslot);
899 memset(rslot, 0, sizeof(*rslot));
904 * build an OSS mixer element.
905 * ptr_allocated means the entry is dynamically allocated (change via proc file).
906 * when replace_old = 1, the old entry is replaced with the new one.
908 static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct snd_mixer_oss_assign_table *ptr, int ptr_allocated, int replace_old)
912 snd_kcontrol_t *kctl;
913 snd_mixer_oss_slot_t *rslot;
916 /* check if already assigned */
917 if (mixer->slots[ptr->oss_id].get_volume && ! replace_old)
920 memset(&slot, 0, sizeof(slot));
921 memset(slot.numid, 0xff, sizeof(slot.numid)); /* ID_UNKNOWN */
922 if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index,
923 SNDRV_MIXER_OSS_ITEM_GLOBAL))
925 sprintf(str, "%s Switch", ptr->name);
926 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
927 SNDRV_MIXER_OSS_ITEM_GSWITCH))
929 sprintf(str, "%s Route", ptr->name);
930 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
931 SNDRV_MIXER_OSS_ITEM_GROUTE))
933 sprintf(str, "%s Volume", ptr->name);
934 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
935 SNDRV_MIXER_OSS_ITEM_GVOLUME))
937 sprintf(str, "%s Playback Switch", ptr->name);
938 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
939 SNDRV_MIXER_OSS_ITEM_PSWITCH))
941 sprintf(str, "%s Playback Route", ptr->name);
942 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
943 SNDRV_MIXER_OSS_ITEM_PROUTE))
945 sprintf(str, "%s Playback Volume", ptr->name);
946 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
947 SNDRV_MIXER_OSS_ITEM_PVOLUME))
949 sprintf(str, "%s Capture Switch", ptr->name);
950 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
951 SNDRV_MIXER_OSS_ITEM_CSWITCH))
953 sprintf(str, "%s Capture Route", ptr->name);
954 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
955 SNDRV_MIXER_OSS_ITEM_CROUTE))
957 sprintf(str, "%s Capture Volume", ptr->name);
958 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
959 SNDRV_MIXER_OSS_ITEM_CVOLUME))
961 down_read(&mixer->card->controls_rwsem);
962 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) {
963 snd_ctl_elem_info_t uinfo;
965 memset(&uinfo, 0, sizeof(uinfo));
966 if (kctl->info(kctl, &uinfo)) {
967 up_read(&mixer->card->controls_rwsem);
970 strcpy(str, ptr->name);
971 if (!strcmp(str, "Master"))
973 if (!strcmp(str, "Master Mono"))
974 strcpy(str, "Mix Mono");
975 slot.capture_item = 0;
976 if (!strcmp(uinfo.value.enumerated.name, str)) {
977 slot.present |= SNDRV_MIXER_OSS_PRESENT_CAPTURE;
979 for (slot.capture_item = 1; slot.capture_item < uinfo.value.enumerated.items; slot.capture_item++) {
980 uinfo.value.enumerated.item = slot.capture_item;
981 if (kctl->info(kctl, &uinfo)) {
982 up_read(&mixer->card->controls_rwsem);
985 if (!strcmp(uinfo.value.enumerated.name, str)) {
986 slot.present |= SNDRV_MIXER_OSS_PRESENT_CAPTURE;
992 up_read(&mixer->card->controls_rwsem);
993 if (slot.present != 0) {
994 pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL);
995 snd_runtime_check(pslot != NULL, return -ENOMEM);
997 pslot->signature = SNDRV_MIXER_OSS_SIGNATURE;
998 pslot->assigned = ptr;
999 pslot->allocated = ptr_allocated;
1000 rslot = &mixer->slots[ptr->oss_id];
1001 mixer_slot_clear(rslot);
1002 rslot->stereo = slot.channels > 1 ? 1 : 0;
1003 rslot->get_volume = snd_mixer_oss_get_volume1;
1004 rslot->put_volume = snd_mixer_oss_put_volume1;
1005 /* note: ES18xx have both Capture Source and XX Capture Volume !!! */
1006 if (slot.present & SNDRV_MIXER_OSS_PRESENT_CSWITCH) {
1007 rslot->get_recsrc = snd_mixer_oss_get_recsrc1_sw;
1008 rslot->put_recsrc = snd_mixer_oss_put_recsrc1_sw;
1009 } else if (slot.present & SNDRV_MIXER_OSS_PRESENT_CROUTE) {
1010 rslot->get_recsrc = snd_mixer_oss_get_recsrc1_route;
1011 rslot->put_recsrc = snd_mixer_oss_put_recsrc1_route;
1012 } else if (slot.present & SNDRV_MIXER_OSS_PRESENT_CAPTURE) {
1013 mixer->mask_recsrc |= 1 << ptr->oss_id;
1015 rslot->private_data = pslot;
1016 rslot->private_free = snd_mixer_oss_slot_free;
1024 #define MIXER_VOL(name) [SOUND_MIXER_##name] = #name
1025 static char *oss_mixer_names[SNDRV_OSS_MAX_MIXERS] = {
1043 MIXER_VOL(DIGITAL1),
1044 MIXER_VOL(DIGITAL2),
1045 MIXER_VOL(DIGITAL3),
1047 MIXER_VOL(PHONEOUT),
1057 static void snd_mixer_oss_proc_read(snd_info_entry_t *entry,
1058 snd_info_buffer_t * buffer)
1060 snd_mixer_oss_t *mixer = entry->private_data;
1063 down(&mixer->reg_mutex);
1064 for (i = 0; i < SNDRV_OSS_MAX_MIXERS; i++) {
1067 if (! oss_mixer_names[i])
1069 p = (struct slot *)mixer->slots[i].private_data;
1070 snd_iprintf(buffer, "%s ", oss_mixer_names[i]);
1071 if (p && p->assigned)
1072 snd_iprintf(buffer, "\"%s\" %d\n",
1074 p->assigned->index);
1076 snd_iprintf(buffer, "\"\" 0\n");
1078 up(&mixer->reg_mutex);
1081 static void snd_mixer_oss_proc_write(snd_info_entry_t *entry,
1082 snd_info_buffer_t * buffer)
1084 snd_mixer_oss_t *mixer = entry->private_data;
1085 char line[128], str[32], idxstr[16], *cptr;
1087 struct snd_mixer_oss_assign_table *tbl;
1090 while (!snd_info_get_line(buffer, line, sizeof(line))) {
1091 cptr = snd_info_get_str(str, line, sizeof(str));
1092 for (ch = 0; ch < SNDRV_OSS_MAX_MIXERS; ch++)
1093 if (oss_mixer_names[ch] && strcmp(oss_mixer_names[ch], str) == 0)
1095 if (ch >= SNDRV_OSS_MAX_MIXERS) {
1096 snd_printk(KERN_ERR "mixer_oss: invalid OSS volume '%s'\n", str);
1099 cptr = snd_info_get_str(str, cptr, sizeof(str));
1101 /* remove the entry */
1102 down(&mixer->reg_mutex);
1103 mixer_slot_clear(&mixer->slots[ch]);
1104 up(&mixer->reg_mutex);
1107 snd_info_get_str(idxstr, cptr, sizeof(idxstr));
1108 idx = simple_strtoul(idxstr, NULL, 10);
1109 if (idx >= 0x4000) { /* too big */
1110 snd_printk(KERN_ERR "mixer_oss: invalid index %d\n", idx);
1113 down(&mixer->reg_mutex);
1114 slot = (struct slot *)mixer->slots[ch].private_data;
1115 if (slot && slot->assigned &&
1116 slot->assigned->index == idx && ! strcmp(slot->assigned->name, str))
1119 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
1121 snd_printk(KERN_ERR "mixer_oss: no memory\n");
1125 tbl->name = snd_kmalloc_strdup(str, GFP_KERNEL);
1131 if (snd_mixer_oss_build_input(mixer, tbl, 1, 1) <= 0) {
1136 up(&mixer->reg_mutex);
1140 static void snd_mixer_oss_proc_init(snd_mixer_oss_t *mixer)
1142 snd_info_entry_t *entry;
1144 entry = snd_info_create_card_entry(mixer->card, "oss_mixer",
1145 mixer->card->proc_root);
1148 entry->content = SNDRV_INFO_CONTENT_TEXT;
1149 entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
1150 entry->c.text.read_size = 8192;
1151 entry->c.text.read = snd_mixer_oss_proc_read;
1152 entry->c.text.write_size = 8192;
1153 entry->c.text.write = snd_mixer_oss_proc_write;
1154 entry->private_data = mixer;
1155 if (snd_info_register(entry) < 0) {
1156 snd_info_free_entry(entry);
1159 mixer->proc_entry = entry;
1162 static void snd_mixer_oss_proc_done(snd_mixer_oss_t *mixer)
1164 if (mixer->proc_entry) {
1165 snd_info_unregister(mixer->proc_entry);
1166 mixer->proc_entry = NULL;
1170 static void snd_mixer_oss_build(snd_mixer_oss_t *mixer)
1172 static struct snd_mixer_oss_assign_table table[] = {
1173 { SOUND_MIXER_VOLUME, "Master", 0 },
1174 { SOUND_MIXER_VOLUME, "Front", 0 }, /* fallback */
1175 { SOUND_MIXER_BASS, "Tone Control - Bass", 0 },
1176 { SOUND_MIXER_TREBLE, "Tone Control - Treble", 0 },
1177 { SOUND_MIXER_SYNTH, "Synth", 0 },
1178 { SOUND_MIXER_SYNTH, "FM", 0 }, /* fallback */
1179 { SOUND_MIXER_SYNTH, "Music", 0 }, /* fallback */
1180 { SOUND_MIXER_PCM, "PCM", 0 },
1181 { SOUND_MIXER_SPEAKER, "PC Speaker", 0 },
1182 { SOUND_MIXER_LINE, "Line", 0 },
1183 { SOUND_MIXER_MIC, "Mic", 0 },
1184 { SOUND_MIXER_CD, "CD", 0 },
1185 { SOUND_MIXER_IMIX, "Monitor Mix", 0 },
1186 { SOUND_MIXER_ALTPCM, "PCM", 1 },
1187 { SOUND_MIXER_ALTPCM, "Headphone", 0 }, /* fallback */
1188 { SOUND_MIXER_ALTPCM, "Wave", 0 }, /* fallback */
1189 { SOUND_MIXER_RECLEV, "-- nothing --", 0 },
1190 { SOUND_MIXER_IGAIN, "Capture", 0 },
1191 { SOUND_MIXER_OGAIN, "Playback", 0 },
1192 { SOUND_MIXER_LINE1, "Aux", 0 },
1193 { SOUND_MIXER_LINE2, "Aux", 1 },
1194 { SOUND_MIXER_LINE3, "Aux", 2 },
1195 { SOUND_MIXER_DIGITAL1, "Digital", 0 },
1196 { SOUND_MIXER_DIGITAL1, "IEC958", 0 }, /* fallback */
1197 { SOUND_MIXER_DIGITAL1, "IEC958 Optical", 0 }, /* fallback */
1198 { SOUND_MIXER_DIGITAL1, "IEC958 Coaxial", 0 }, /* fallback */
1199 { SOUND_MIXER_DIGITAL2, "Digital", 1 },
1200 { SOUND_MIXER_DIGITAL3, "Digital", 2 },
1201 { SOUND_MIXER_PHONEIN, "Phone", 0 },
1202 { SOUND_MIXER_PHONEOUT, "Master Mono", 0 },
1203 { SOUND_MIXER_PHONEOUT, "Phone", 0 }, /* fallback */
1204 { SOUND_MIXER_VIDEO, "Video", 0 },
1205 { SOUND_MIXER_RADIO, "Radio", 0 },
1206 { SOUND_MIXER_MONITOR, "Monitor", 0 }
1210 for (idx = 0; idx < ARRAY_SIZE(table); idx++)
1211 snd_mixer_oss_build_input(mixer, &table[idx], 0, 0);
1212 if (mixer->mask_recsrc) {
1213 mixer->get_recsrc = snd_mixer_oss_get_recsrc2;
1214 mixer->put_recsrc = snd_mixer_oss_put_recsrc2;
1222 static int snd_mixer_oss_free1(void *private)
1224 snd_mixer_oss_t *mixer = private;
1228 snd_assert(mixer != NULL, return -ENXIO);
1230 snd_assert(mixer == card->mixer_oss, return -ENXIO);
1231 card->mixer_oss = NULL;
1232 for (idx = 0; idx < SNDRV_OSS_MAX_MIXERS; idx++) {
1233 snd_mixer_oss_slot_t *chn = &mixer->slots[idx];
1234 if (chn->private_free)
1235 chn->private_free(chn);
1241 static int snd_mixer_oss_notify_handler(snd_card_t * card, int cmd)
1243 snd_mixer_oss_t *mixer;
1245 if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) {
1249 mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL);
1252 init_MUTEX(&mixer->reg_mutex);
1253 sprintf(name, "mixer%i%i", card->number, 0);
1254 if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER,
1258 snd_printk("unable to register OSS mixer device %i:%i\n", card->number, 0);
1262 mixer->oss_dev_alloc = 1;
1264 if (*card->mixername)
1265 strlcpy(mixer->name, card->mixername, sizeof(mixer->name));
1267 strlcpy(mixer->name, name, sizeof(mixer->name));
1268 #ifdef SNDRV_OSS_INFO_DEV_MIXERS
1269 snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIXERS,
1273 for (idx = 0; idx < SNDRV_OSS_MAX_MIXERS; idx++)
1274 mixer->slots[idx].number = idx;
1275 card->mixer_oss = mixer;
1276 snd_mixer_oss_build(mixer);
1277 snd_mixer_oss_proc_init(mixer);
1278 } else if (cmd == SND_MIXER_OSS_NOTIFY_DISCONNECT) {
1279 mixer = card->mixer_oss;
1280 if (mixer == NULL || !mixer->oss_dev_alloc)
1282 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, mixer->card, 0);
1283 mixer->oss_dev_alloc = 0;
1285 mixer = card->mixer_oss;
1288 #ifdef SNDRV_OSS_INFO_DEV_MIXERS
1289 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_MIXERS, mixer->card->number);
1291 if (mixer->oss_dev_alloc)
1292 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, mixer->card, 0);
1293 snd_mixer_oss_proc_done(mixer);
1294 return snd_mixer_oss_free1(mixer);
1299 static int __init alsa_mixer_oss_init(void)
1303 snd_mixer_oss_notify_callback = snd_mixer_oss_notify_handler;
1304 for (idx = 0; idx < SNDRV_CARDS; idx++) {
1306 snd_mixer_oss_notify_handler(snd_cards[idx], SND_MIXER_OSS_NOTIFY_REGISTER);
1311 static void __exit alsa_mixer_oss_exit(void)
1315 snd_mixer_oss_notify_callback = NULL;
1316 for (idx = 0; idx < SNDRV_CARDS; idx++) {
1318 snd_mixer_oss_notify_handler(snd_cards[idx], SND_MIXER_OSS_NOTIFY_FREE);
1322 module_init(alsa_mixer_oss_init)
1323 module_exit(alsa_mixer_oss_exit)
1325 EXPORT_SYMBOL(snd_mixer_oss_ioctl_card);