Lines Matching refs:epcm

26 	struct snd_emu10k1_pcm *epcm;  in snd_emu10k1_pcm_interrupt()  local
28 if ((epcm = voice->epcm) == NULL) in snd_emu10k1_pcm_interrupt()
30 if (epcm->substream == NULL) in snd_emu10k1_pcm_interrupt()
35 epcm->substream->runtime->hw->pointer(emu, epcm->substream), in snd_emu10k1_pcm_interrupt()
36 snd_pcm_lib_period_bytes(epcm->substream), in snd_emu10k1_pcm_interrupt()
37 snd_pcm_lib_buffer_bytes(epcm->substream)); in snd_emu10k1_pcm_interrupt()
39 snd_pcm_period_elapsed(epcm->substream); in snd_emu10k1_pcm_interrupt()
82 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_efx_playback_pointer() local
85 if (!epcm->running) in snd_emu10k1_efx_playback_pointer()
87 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->voices[0]->number) & 0x00ffffff; in snd_emu10k1_efx_playback_pointer()
89 ptr -= epcm->ccca_start_addr; in snd_emu10k1_efx_playback_pointer()
95 static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voices) in snd_emu10k1_pcm_channel_alloc() argument
99 if (epcm->voices[1] != NULL && voices < 2) { in snd_emu10k1_pcm_channel_alloc()
100 snd_emu10k1_voice_free(epcm->emu, epcm->voices[1]); in snd_emu10k1_pcm_channel_alloc()
101 epcm->voices[1] = NULL; in snd_emu10k1_pcm_channel_alloc()
104 if (epcm->voices[i] == NULL) in snd_emu10k1_pcm_channel_alloc()
110 for (i = 0; i < ARRAY_SIZE(epcm->voices); i++) { in snd_emu10k1_pcm_channel_alloc()
111 if (epcm->voices[i]) { in snd_emu10k1_pcm_channel_alloc()
112 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); in snd_emu10k1_pcm_channel_alloc()
113 epcm->voices[i] = NULL; in snd_emu10k1_pcm_channel_alloc()
116 err = snd_emu10k1_voice_alloc(epcm->emu, in snd_emu10k1_pcm_channel_alloc()
117 epcm->type == PLAYBACK_EMUVOICE ? EMU10K1_PCM : EMU10K1_EFX, in snd_emu10k1_pcm_channel_alloc()
119 &epcm->voices[0]); in snd_emu10k1_pcm_channel_alloc()
123 epcm->voices[0]->epcm = epcm; in snd_emu10k1_pcm_channel_alloc()
126 epcm->voices[i] = &epcm->emu->voices[epcm->voices[0]->number + i]; in snd_emu10k1_pcm_channel_alloc()
127 epcm->voices[i]->epcm = epcm; in snd_emu10k1_pcm_channel_alloc()
130 if (epcm->extra == NULL) { in snd_emu10k1_pcm_channel_alloc()
131 err = snd_emu10k1_voice_alloc(epcm->emu, in snd_emu10k1_pcm_channel_alloc()
132 epcm->type == PLAYBACK_EMUVOICE ? EMU10K1_PCM : EMU10K1_EFX, in snd_emu10k1_pcm_channel_alloc()
134 &epcm->extra); in snd_emu10k1_pcm_channel_alloc()
142 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); in snd_emu10k1_pcm_channel_alloc()
143 epcm->voices[i] = NULL; in snd_emu10k1_pcm_channel_alloc()
147 epcm->extra->epcm = epcm; in snd_emu10k1_pcm_channel_alloc()
148 epcm->extra->interrupt = snd_emu10k1_pcm_interrupt; in snd_emu10k1_pcm_channel_alloc()
275 struct snd_pcm_substream *substream = evoice->epcm->substream; in snd_emu10k1_pcm_init_voice()
318 evoice->epcm->ccca_start_addr = start_addr + ccis; in snd_emu10k1_pcm_init_voice()
398 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_hw_params() local
402 if ((err = snd_emu10k1_pcm_channel_alloc(epcm, params_channels(hw_params))) < 0) in snd_emu10k1_playback_hw_params()
415 if (epcm->memblk != NULL) in snd_emu10k1_playback_hw_params()
416 snd_emu10k1_free_pages(emu, epcm->memblk); in snd_emu10k1_playback_hw_params()
417 epcm->memblk = snd_emu10k1_alloc_pages(emu, substream); in snd_emu10k1_playback_hw_params()
418 epcm->start_addr = 0; in snd_emu10k1_playback_hw_params()
419 if (! epcm->memblk) in snd_emu10k1_playback_hw_params()
421 mapped = ((struct snd_emu10k1_memblk *)epcm->memblk)->mapped_page; in snd_emu10k1_playback_hw_params()
424 epcm->start_addr = mapped << PAGE_SHIFT; in snd_emu10k1_playback_hw_params()
433 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_playback_hw_free() local
437 epcm = runtime->private_data; in snd_emu10k1_playback_hw_free()
438 if (epcm->extra) { in snd_emu10k1_playback_hw_free()
439 snd_emu10k1_voice_free(epcm->emu, epcm->extra); in snd_emu10k1_playback_hw_free()
440 epcm->extra = NULL; in snd_emu10k1_playback_hw_free()
442 if (epcm->voices[1]) { in snd_emu10k1_playback_hw_free()
443 snd_emu10k1_voice_free(epcm->emu, epcm->voices[1]); in snd_emu10k1_playback_hw_free()
444 epcm->voices[1] = NULL; in snd_emu10k1_playback_hw_free()
446 if (epcm->voices[0]) { in snd_emu10k1_playback_hw_free()
447 snd_emu10k1_voice_free(epcm->emu, epcm->voices[0]); in snd_emu10k1_playback_hw_free()
448 epcm->voices[0] = NULL; in snd_emu10k1_playback_hw_free()
450 if (epcm->memblk) { in snd_emu10k1_playback_hw_free()
451 snd_emu10k1_free_pages(emu, epcm->memblk); in snd_emu10k1_playback_hw_free()
452 epcm->memblk = NULL; in snd_emu10k1_playback_hw_free()
453 epcm->start_addr = 0; in snd_emu10k1_playback_hw_free()
463 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_efx_playback_hw_free() local
468 epcm = runtime->private_data; in snd_emu10k1_efx_playback_hw_free()
469 if (epcm->extra) { in snd_emu10k1_efx_playback_hw_free()
470 snd_emu10k1_voice_free(epcm->emu, epcm->extra); in snd_emu10k1_efx_playback_hw_free()
471 epcm->extra = NULL; in snd_emu10k1_efx_playback_hw_free()
474 if (epcm->voices[i]) { in snd_emu10k1_efx_playback_hw_free()
475 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); in snd_emu10k1_efx_playback_hw_free()
476 epcm->voices[i] = NULL; in snd_emu10k1_efx_playback_hw_free()
479 if (epcm->memblk) { in snd_emu10k1_efx_playback_hw_free()
480 snd_emu10k1_free_pages(emu, epcm->memblk); in snd_emu10k1_efx_playback_hw_free()
481 epcm->memblk = NULL; in snd_emu10k1_efx_playback_hw_free()
482 epcm->start_addr = 0; in snd_emu10k1_efx_playback_hw_free()
492 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_prepare() local
495 start_addr = epcm->start_addr; in snd_emu10k1_playback_prepare()
502 snd_emu10k1_pcm_init_voice(emu, 1, 1, epcm->extra, in snd_emu10k1_playback_prepare()
504 start_addr = epcm->start_addr; in snd_emu10k1_playback_prepare()
505 end_addr = epcm->start_addr + snd_pcm_lib_buffer_bytes(substream); in snd_emu10k1_playback_prepare()
506 snd_emu10k1_pcm_init_voice(emu, 1, 0, epcm->voices[0], in snd_emu10k1_playback_prepare()
509 if (epcm->voices[1]) in snd_emu10k1_playback_prepare()
510 snd_emu10k1_pcm_init_voice(emu, 0, 0, epcm->voices[1], in snd_emu10k1_playback_prepare()
520 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_efx_playback_prepare() local
525 start_addr = epcm->start_addr; in snd_emu10k1_efx_playback_prepare()
526 end_addr = epcm->start_addr + snd_pcm_lib_buffer_bytes(substream); in snd_emu10k1_efx_playback_prepare()
533 snd_emu10k1_pcm_init_voice(emu, 1, 1, epcm->extra, in snd_emu10k1_efx_playback_prepare()
537 snd_emu10k1_pcm_init_voice(emu, 1, 0, epcm->voices[0], in snd_emu10k1_efx_playback_prepare()
543 snd_emu10k1_pcm_init_voice(emu, 0, 0, epcm->voices[i], in snd_emu10k1_efx_playback_prepare()
576 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_capture_prepare() local
580 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, 0); in snd_emu10k1_capture_prepare()
581 switch (epcm->type) { in snd_emu10k1_capture_prepare()
595 snd_emu10k1_ptr_write(emu, epcm->capture_ba_reg, 0, runtime->dma_addr); in snd_emu10k1_capture_prepare()
596 epcm->capture_bufsize = snd_pcm_lib_buffer_bytes(substream); in snd_emu10k1_capture_prepare()
597 epcm->capture_bs_val = 0; in snd_emu10k1_capture_prepare()
599 if (capture_period_sizes[idx] == epcm->capture_bufsize) { in snd_emu10k1_capture_prepare()
600 epcm->capture_bs_val = idx + 1; in snd_emu10k1_capture_prepare()
604 if (epcm->capture_bs_val == 0) { in snd_emu10k1_capture_prepare()
606 epcm->capture_bs_val++; in snd_emu10k1_capture_prepare()
608 if (epcm->type == CAPTURE_AC97ADC) { in snd_emu10k1_capture_prepare()
609 epcm->capture_cr_val = emu->audigy ? A_ADCCR_LCHANENABLE : ADCCR_LCHANENABLE; in snd_emu10k1_capture_prepare()
611 epcm->capture_cr_val |= emu->audigy ? A_ADCCR_RCHANENABLE : ADCCR_RCHANENABLE; in snd_emu10k1_capture_prepare()
612 epcm->capture_cr_val |= emu->audigy ? in snd_emu10k1_capture_prepare()
626 runtime = evoice->epcm->substream->runtime; in snd_emu10k1_playback_invalidate_cache()
665 substream = evoice->epcm->substream; in snd_emu10k1_playback_prepare_voice()
687 substream = evoice->epcm->substream; in snd_emu10k1_playback_trigger_voice()
697 if (master || evoice->epcm->type == PLAYBACK_EFX) in snd_emu10k1_playback_trigger_voice()
721 struct snd_emu10k1_pcm *epcm, in snd_emu10k1_playback_mangle_extra() argument
731 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->extra->number); in snd_emu10k1_playback_mangle_extra()
733 ptr |= epcm->ccca_start_addr + period_pos; in snd_emu10k1_playback_mangle_extra()
734 snd_emu10k1_ptr_write(emu, CCCA, epcm->extra->number, ptr); in snd_emu10k1_playback_mangle_extra()
742 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_trigger() local
754 snd_emu10k1_playback_invalidate_cache(emu, 1, epcm->extra); /* do we need this? */ in snd_emu10k1_playback_trigger()
755 snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[0]); in snd_emu10k1_playback_trigger()
760 snd_emu10k1_playback_mangle_extra(emu, epcm, substream, runtime); in snd_emu10k1_playback_trigger()
762 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix); in snd_emu10k1_playback_trigger()
763 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix); in snd_emu10k1_playback_trigger()
764 snd_emu10k1_playback_prepare_voice(emu, epcm->extra, 1, 1, NULL); in snd_emu10k1_playback_trigger()
765 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[0], 1, 0); in snd_emu10k1_playback_trigger()
766 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[1], 0, 0); in snd_emu10k1_playback_trigger()
767 snd_emu10k1_playback_trigger_voice(emu, epcm->extra, 1, 1); in snd_emu10k1_playback_trigger()
768 epcm->running = 1; in snd_emu10k1_playback_trigger()
773 epcm->running = 0; in snd_emu10k1_playback_trigger()
774 snd_emu10k1_playback_stop_voice(emu, epcm->voices[0]); in snd_emu10k1_playback_trigger()
775 snd_emu10k1_playback_stop_voice(emu, epcm->voices[1]); in snd_emu10k1_playback_trigger()
776 snd_emu10k1_playback_stop_voice(emu, epcm->extra); in snd_emu10k1_playback_trigger()
791 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_capture_trigger() local
799 outl(epcm->capture_ipr, emu->port + IPR); in snd_emu10k1_capture_trigger()
800 snd_emu10k1_intr_enable(emu, epcm->capture_inte); in snd_emu10k1_capture_trigger()
805 switch (epcm->type) { in snd_emu10k1_capture_trigger()
807 snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); in snd_emu10k1_capture_trigger()
811 snd_emu10k1_ptr_write(emu, A_FXWC1, 0, epcm->capture_cr_val); in snd_emu10k1_capture_trigger()
812 snd_emu10k1_ptr_write(emu, A_FXWC2, 0, epcm->capture_cr_val2); in snd_emu10k1_capture_trigger()
815 epcm->capture_cr_val, in snd_emu10k1_capture_trigger()
816 epcm->capture_cr_val2); in snd_emu10k1_capture_trigger()
818 snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val); in snd_emu10k1_capture_trigger()
823 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, epcm->capture_bs_val); in snd_emu10k1_capture_trigger()
824 epcm->running = 1; in snd_emu10k1_capture_trigger()
825 epcm->first_ptr = 1; in snd_emu10k1_capture_trigger()
829 epcm->running = 0; in snd_emu10k1_capture_trigger()
830 snd_emu10k1_intr_disable(emu, epcm->capture_inte); in snd_emu10k1_capture_trigger()
831 outl(epcm->capture_ipr, emu->port + IPR); in snd_emu10k1_capture_trigger()
832 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, 0); in snd_emu10k1_capture_trigger()
833 switch (epcm->type) { in snd_emu10k1_capture_trigger()
859 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_pointer() local
862 if (!epcm->running) in snd_emu10k1_playback_pointer()
864 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->voices[0]->number) & 0x00ffffff; in snd_emu10k1_playback_pointer()
867 ptr -= epcm->ccca_start_addr; in snd_emu10k1_playback_pointer()
870 if (ptr < epcm->ccca_start_addr) in snd_emu10k1_playback_pointer()
871 ptr += runtime->buffer_size - epcm->ccca_start_addr; in snd_emu10k1_playback_pointer()
873 ptr -= epcm->ccca_start_addr; in snd_emu10k1_playback_pointer()
893 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_efx_playback_trigger() local
902 snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[i]); in snd_emu10k1_efx_playback_trigger()
904 snd_emu10k1_playback_invalidate_cache(emu, 1, epcm->extra); in snd_emu10k1_efx_playback_trigger()
908 snd_emu10k1_playback_prepare_voice(emu, epcm->extra, 1, 1, NULL); in snd_emu10k1_efx_playback_trigger()
909 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 0, 0, in snd_emu10k1_efx_playback_trigger()
912 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[i], 0, 0, in snd_emu10k1_efx_playback_trigger()
914 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[0], 0, 0); in snd_emu10k1_efx_playback_trigger()
915 snd_emu10k1_playback_trigger_voice(emu, epcm->extra, 1, 1); in snd_emu10k1_efx_playback_trigger()
917 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[i], 0, 0); in snd_emu10k1_efx_playback_trigger()
918 epcm->running = 1; in snd_emu10k1_efx_playback_trigger()
923 epcm->running = 0; in snd_emu10k1_efx_playback_trigger()
925 snd_emu10k1_playback_stop_voice(emu, epcm->voices[i]); in snd_emu10k1_efx_playback_trigger()
927 snd_emu10k1_playback_stop_voice(emu, epcm->extra); in snd_emu10k1_efx_playback_trigger()
942 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_capture_pointer() local
945 if (!epcm->running) in snd_emu10k1_capture_pointer()
947 if (epcm->first_ptr) { in snd_emu10k1_capture_pointer()
949 epcm->first_ptr = 0; in snd_emu10k1_capture_pointer()
951 ptr = snd_emu10k1_ptr_read(emu, epcm->capture_idx_reg, 0) & 0x0000ffff; in snd_emu10k1_capture_pointer()
1071 mix->epcm = NULL; in snd_emu10k1_efx_playback_close()
1080 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_efx_playback_open() local
1085 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); in snd_emu10k1_efx_playback_open()
1086 if (epcm == NULL) in snd_emu10k1_efx_playback_open()
1088 epcm->emu = emu; in snd_emu10k1_efx_playback_open()
1089 epcm->type = PLAYBACK_EFX; in snd_emu10k1_efx_playback_open()
1090 epcm->substream = substream; in snd_emu10k1_efx_playback_open()
1094 runtime->private_data = epcm; in snd_emu10k1_efx_playback_open()
1104 mix->epcm = epcm; in snd_emu10k1_efx_playback_open()
1113 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_playback_open() local
1118 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); in snd_emu10k1_playback_open()
1119 if (epcm == NULL) in snd_emu10k1_playback_open()
1121 epcm->emu = emu; in snd_emu10k1_playback_open()
1122 epcm->type = PLAYBACK_EMUVOICE; in snd_emu10k1_playback_open()
1123 epcm->substream = substream; in snd_emu10k1_playback_open()
1124 runtime->private_data = epcm; in snd_emu10k1_playback_open()
1128 kfree(epcm); in snd_emu10k1_playback_open()
1132 kfree(epcm); in snd_emu10k1_playback_open()
1141 kfree(epcm); in snd_emu10k1_playback_open()
1151 mix->epcm = epcm; in snd_emu10k1_playback_open()
1161 mix->epcm = NULL; in snd_emu10k1_playback_close()
1170 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_capture_open() local
1172 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); in snd_emu10k1_capture_open()
1173 if (epcm == NULL) in snd_emu10k1_capture_open()
1175 epcm->emu = emu; in snd_emu10k1_capture_open()
1176 epcm->type = CAPTURE_AC97ADC; in snd_emu10k1_capture_open()
1177 epcm->substream = substream; in snd_emu10k1_capture_open()
1178 epcm->capture_ipr = IPR_ADCBUFFULL|IPR_ADCBUFHALFFULL; in snd_emu10k1_capture_open()
1179 epcm->capture_inte = INTE_ADCBUFENABLE; in snd_emu10k1_capture_open()
1180 epcm->capture_ba_reg = ADCBA; in snd_emu10k1_capture_open()
1181 epcm->capture_bs_reg = ADCBS; in snd_emu10k1_capture_open()
1182 epcm->capture_idx_reg = emu->audigy ? A_ADCIDX : ADCIDX; in snd_emu10k1_capture_open()
1183 runtime->private_data = epcm; in snd_emu10k1_capture_open()
1205 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_capture_mic_open() local
1208 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); in snd_emu10k1_capture_mic_open()
1209 if (epcm == NULL) in snd_emu10k1_capture_mic_open()
1211 epcm->emu = emu; in snd_emu10k1_capture_mic_open()
1212 epcm->type = CAPTURE_AC97MIC; in snd_emu10k1_capture_mic_open()
1213 epcm->substream = substream; in snd_emu10k1_capture_mic_open()
1214 epcm->capture_ipr = IPR_MICBUFFULL|IPR_MICBUFHALFFULL; in snd_emu10k1_capture_mic_open()
1215 epcm->capture_inte = INTE_MICBUFENABLE; in snd_emu10k1_capture_mic_open()
1216 epcm->capture_ba_reg = MICBA; in snd_emu10k1_capture_mic_open()
1217 epcm->capture_bs_reg = MICBS; in snd_emu10k1_capture_mic_open()
1218 epcm->capture_idx_reg = emu->audigy ? A_MICIDX : MICIDX; in snd_emu10k1_capture_mic_open()
1219 substream->runtime->private_data = epcm; in snd_emu10k1_capture_mic_open()
1243 struct snd_emu10k1_pcm *epcm; in snd_emu10k1_capture_efx_open() local
1248 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); in snd_emu10k1_capture_efx_open()
1249 if (epcm == NULL) in snd_emu10k1_capture_efx_open()
1251 epcm->emu = emu; in snd_emu10k1_capture_efx_open()
1252 epcm->type = CAPTURE_EFX; in snd_emu10k1_capture_efx_open()
1253 epcm->substream = substream; in snd_emu10k1_capture_efx_open()
1254 epcm->capture_ipr = IPR_EFXBUFFULL|IPR_EFXBUFHALFFULL; in snd_emu10k1_capture_efx_open()
1255 epcm->capture_inte = INTE_EFXBUFENABLE; in snd_emu10k1_capture_efx_open()
1256 epcm->capture_ba_reg = FXBA; in snd_emu10k1_capture_efx_open()
1257 epcm->capture_bs_reg = FXBS; in snd_emu10k1_capture_efx_open()
1258 epcm->capture_idx_reg = FXIDX; in snd_emu10k1_capture_efx_open()
1259 substream->runtime->private_data = epcm; in snd_emu10k1_capture_efx_open()
1330 epcm->capture_cr_val = emu->efx_voices_mask[0]; in snd_emu10k1_capture_efx_open()
1331 epcm->capture_cr_val2 = emu->efx_voices_mask[1]; in snd_emu10k1_capture_efx_open()