Lines Matching full:mixer
3 * OSS emulation layer for the mixer interface
23 MODULE_DESCRIPTION("Mixer OSS emulation for ALSA.");
57 fmixer->mixer = card->mixer_oss; in snd_mixer_oss_open()
86 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_info() local
90 strlcpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id)); in snd_mixer_oss_info()
91 strlcpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name)); in snd_mixer_oss_info()
102 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_info_obsolete() local
106 strlcpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id)); in snd_mixer_oss_info_obsolete()
107 strlcpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name)); in snd_mixer_oss_info_obsolete()
115 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_caps() local
118 if (mixer == NULL) in snd_mixer_oss_caps()
120 if (mixer->get_recsrc && mixer->put_recsrc) in snd_mixer_oss_caps()
127 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_devmask() local
131 if (mixer == NULL) in snd_mixer_oss_devmask()
134 pslot = &mixer->slots[chn]; in snd_mixer_oss_devmask()
143 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_stereodevs() local
147 if (mixer == NULL) in snd_mixer_oss_stereodevs()
150 pslot = &mixer->slots[chn]; in snd_mixer_oss_stereodevs()
159 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_recmask() local
162 if (mixer == NULL) in snd_mixer_oss_recmask()
164 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */ in snd_mixer_oss_recmask()
165 result = mixer->mask_recsrc; in snd_mixer_oss_recmask()
170 pslot = &mixer->slots[chn]; in snd_mixer_oss_recmask()
180 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_get_recsrc() local
183 if (mixer == NULL) in snd_mixer_oss_get_recsrc()
185 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */ in snd_mixer_oss_get_recsrc()
188 if ((err = mixer->get_recsrc(fmixer, &index)) < 0) in snd_mixer_oss_get_recsrc()
195 pslot = &mixer->slots[chn]; in snd_mixer_oss_get_recsrc()
204 return mixer->oss_recsrc = result; in snd_mixer_oss_get_recsrc()
209 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_set_recsrc() local
215 if (mixer == NULL) in snd_mixer_oss_set_recsrc()
217 if (mixer->get_recsrc && mixer->put_recsrc) { /* exclusive input */ in snd_mixer_oss_set_recsrc()
218 if (recsrc & ~mixer->oss_recsrc) in snd_mixer_oss_set_recsrc()
219 recsrc &= ~mixer->oss_recsrc; in snd_mixer_oss_set_recsrc()
220 mixer->put_recsrc(fmixer, ffz(~recsrc)); in snd_mixer_oss_set_recsrc()
221 mixer->get_recsrc(fmixer, &index); in snd_mixer_oss_set_recsrc()
225 pslot = &mixer->slots[chn]; in snd_mixer_oss_set_recsrc()
233 pslot = &mixer->slots[chn]; in snd_mixer_oss_set_recsrc()
247 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_get_volume() local
251 if (mixer == NULL || slot > 30) in snd_mixer_oss_get_volume()
253 pslot = &mixer->slots[slot]; in snd_mixer_oss_get_volume()
275 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_set_volume() local
279 if (mixer == NULL || slot > 30) in snd_mixer_oss_set_volume()
281 pslot = &mixer->slots[slot]; in snd_mixer_oss_set_volume()
380 fmixer.mixer = card->mixer_oss; in snd_mixer_oss_ioctl_card()
441 struct snd_mixer_oss *mixer = card->mixer_oss;
442 if (mixer)
443 mixer->mask_recsrc |= 1 << slot;
448 struct snd_mixer_oss *mixer = card->mixer_oss;
449 if (mixer && (mixer->mask_recsrc & (1 << slot)))
495 static struct snd_kcontrol *snd_mixer_oss_test_id(struct snd_mixer_oss *mixer, const char *name, in… in snd_mixer_oss_test_id() argument
497 struct snd_card *card = mixer->card; in snd_mixer_oss_test_id()
792 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_get_recsrc2() local
807 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); in snd_mixer_oss_get_recsrc2()
817 if (!(mixer->mask_recsrc & (1 << idx))) in snd_mixer_oss_get_recsrc2()
819 pslot = &mixer->slots[idx]; in snd_mixer_oss_get_recsrc2()
842 struct snd_mixer_oss *mixer = fmixer->mixer; in snd_mixer_oss_put_recsrc2() local
858 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); in snd_mixer_oss_put_recsrc2()
866 if (!(mixer->mask_recsrc & (1 << idx))) in snd_mixer_oss_put_recsrc2()
868 pslot = &mixer->slots[idx]; in snd_mixer_oss_put_recsrc2()
900 static int snd_mixer_oss_build_test(struct snd_mixer_oss *mixer, struct slot *slot, const char *nam… in snd_mixer_oss_build_test() argument
904 struct snd_card *card = mixer->card; in snd_mixer_oss_build_test()
908 kcontrol = snd_mixer_oss_test_id(mixer, name, index); in snd_mixer_oss_build_test()
955 static int snd_mixer_oss_build_test_all(struct snd_mixer_oss *mixer, in snd_mixer_oss_build_test_all() argument
962 err = snd_mixer_oss_build_test(mixer, slot, ptr->name, ptr->index, in snd_mixer_oss_build_test_all()
967 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
972 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
977 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
982 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
987 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
992 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
997 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
1002 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
1007 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index, in snd_mixer_oss_build_test_all()
1016 * build an OSS mixer element.
1020 static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, in snd_mixer_oss_build_input() argument
1031 if (mixer->slots[ptr->oss_id].get_volume && ! replace_old) in snd_mixer_oss_build_input()
1036 if (snd_mixer_oss_build_test_all(mixer, ptr, &slot)) in snd_mixer_oss_build_input()
1038 down_read(&mixer->card->controls_rwsem); in snd_mixer_oss_build_input()
1039 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { in snd_mixer_oss_build_input()
1044 up_read(&mixer->card->controls_rwsem); in snd_mixer_oss_build_input()
1049 up_read(&mixer->card->controls_rwsem); in snd_mixer_oss_build_input()
1065 up_read(&mixer->card->controls_rwsem); in snd_mixer_oss_build_input()
1077 up_read(&mixer->card->controls_rwsem); in snd_mixer_oss_build_input()
1086 rslot = &mixer->slots[ptr->oss_id]; in snd_mixer_oss_build_input()
1099 mixer->mask_recsrc |= 1 << ptr->oss_id; in snd_mixer_oss_build_input()
1147 struct snd_mixer_oss *mixer = entry->private_data; in snd_mixer_oss_proc_read() local
1150 mutex_lock(&mixer->reg_mutex); in snd_mixer_oss_proc_read()
1156 p = (struct slot *)mixer->slots[i].private_data; in snd_mixer_oss_proc_read()
1165 mutex_unlock(&mixer->reg_mutex); in snd_mixer_oss_proc_read()
1171 struct snd_mixer_oss *mixer = entry->private_data; in snd_mixer_oss_proc_write() local
1192 mutex_lock(&mixer->reg_mutex); in snd_mixer_oss_proc_write()
1193 mixer_slot_clear(&mixer->slots[ch]); in snd_mixer_oss_proc_write()
1194 mutex_unlock(&mixer->reg_mutex); in snd_mixer_oss_proc_write()
1203 mutex_lock(&mixer->reg_mutex); in snd_mixer_oss_proc_write()
1204 slot = (struct slot *)mixer->slots[ch].private_data; in snd_mixer_oss_proc_write()
1219 if (snd_mixer_oss_build_input(mixer, tbl, 1, 1) <= 0) { in snd_mixer_oss_proc_write()
1224 mutex_unlock(&mixer->reg_mutex); in snd_mixer_oss_proc_write()
1228 static void snd_mixer_oss_proc_init(struct snd_mixer_oss *mixer) in snd_mixer_oss_proc_init() argument
1232 entry = snd_info_create_card_entry(mixer->card, "oss_mixer", in snd_mixer_oss_proc_init()
1233 mixer->card->proc_root); in snd_mixer_oss_proc_init()
1240 entry->private_data = mixer; in snd_mixer_oss_proc_init()
1245 mixer->proc_entry = entry; in snd_mixer_oss_proc_init()
1248 static void snd_mixer_oss_proc_done(struct snd_mixer_oss *mixer) in snd_mixer_oss_proc_done() argument
1250 snd_info_free_entry(mixer->proc_entry); in snd_mixer_oss_proc_done()
1251 mixer->proc_entry = NULL; in snd_mixer_oss_proc_done()
1258 static void snd_mixer_oss_build(struct snd_mixer_oss *mixer) in snd_mixer_oss_build() argument
1303 snd_mixer_oss_build_input(mixer, &table[idx], 0, 0); in snd_mixer_oss_build()
1304 if (mixer->mask_recsrc) { in snd_mixer_oss_build()
1305 mixer->get_recsrc = snd_mixer_oss_get_recsrc2; in snd_mixer_oss_build()
1306 mixer->put_recsrc = snd_mixer_oss_put_recsrc2; in snd_mixer_oss_build()
1316 struct snd_mixer_oss *mixer = private; in snd_mixer_oss_free1() local
1320 if (!mixer) in snd_mixer_oss_free1()
1322 card = mixer->card; in snd_mixer_oss_free1()
1323 if (snd_BUG_ON(mixer != card->mixer_oss)) in snd_mixer_oss_free1()
1327 struct snd_mixer_oss_slot *chn = &mixer->slots[idx]; in snd_mixer_oss_free1()
1331 kfree(mixer); in snd_mixer_oss_free1()
1337 struct snd_mixer_oss *mixer; in snd_mixer_oss_notify_handler() local
1342 mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL); in snd_mixer_oss_notify_handler()
1343 if (mixer == NULL) in snd_mixer_oss_notify_handler()
1345 mutex_init(&mixer->reg_mutex); in snd_mixer_oss_notify_handler()
1350 "unable to register OSS mixer device %i:%i\n", in snd_mixer_oss_notify_handler()
1352 kfree(mixer); in snd_mixer_oss_notify_handler()
1355 mixer->oss_dev_alloc = 1; in snd_mixer_oss_notify_handler()
1356 mixer->card = card; in snd_mixer_oss_notify_handler()
1358 strlcpy(mixer->name, card->mixername, sizeof(mixer->name)); in snd_mixer_oss_notify_handler()
1360 snprintf(mixer->name, sizeof(mixer->name), in snd_mixer_oss_notify_handler()
1361 "mixer%i", card->number); in snd_mixer_oss_notify_handler()
1365 mixer->name); in snd_mixer_oss_notify_handler()
1368 mixer->slots[idx].number = idx; in snd_mixer_oss_notify_handler()
1369 card->mixer_oss = mixer; in snd_mixer_oss_notify_handler()
1370 snd_mixer_oss_build(mixer); in snd_mixer_oss_notify_handler()
1371 snd_mixer_oss_proc_init(mixer); in snd_mixer_oss_notify_handler()
1373 mixer = card->mixer_oss; in snd_mixer_oss_notify_handler()
1374 if (mixer == NULL) in snd_mixer_oss_notify_handler()
1376 if (mixer->oss_dev_alloc) { in snd_mixer_oss_notify_handler()
1378 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_MIXERS, mixer->card->number); in snd_mixer_oss_notify_handler()
1380 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, mixer->card, 0); in snd_mixer_oss_notify_handler()
1381 mixer->oss_dev_alloc = 0; in snd_mixer_oss_notify_handler()
1385 snd_mixer_oss_proc_done(mixer); in snd_mixer_oss_notify_handler()
1386 return snd_mixer_oss_free1(mixer); in snd_mixer_oss_notify_handler()