Lines Matching refs:epcm
40 struct snd_emu10k1_pcm *epcm;
42 if ((epcm = voice->epcm) == NULL)
44 if (epcm->substream == NULL)
46 snd_pcm_period_elapsed(epcm->substream);
71 struct snd_emu10k1_pcm *epcm = runtime->private_data;
74 if (!epcm->running)
76 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->voices[0]->number) & 0x00ffffff;
78 ptr -= epcm->ccca_start_addr;
84 static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voices)
88 if (epcm->voices[1] != NULL && voices < 2) {
89 snd_emu10k1_voice_free(epcm->emu, epcm->voices[1]);
90 epcm->voices[1] = NULL;
93 if (epcm->voices[i] == NULL)
99 for (i = 0; i < ARRAY_SIZE(epcm->voices); i++) {
100 if (epcm->voices[i]) {
101 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]);
102 epcm->voices[i] = NULL;
105 err = snd_emu10k1_voice_alloc(epcm->emu,
106 epcm->type == PLAYBACK_EMUVOICE ? EMU10K1_PCM : EMU10K1_EFX,
108 &epcm->voices[0]);
112 epcm->voices[0]->epcm = epcm;
115 epcm->voices[i] = &epcm->emu->voices[epcm->voices[0]->number + i];
116 epcm->voices[i]->epcm = epcm;
119 if (epcm->extra == NULL) {
120 err = snd_emu10k1_voice_alloc(epcm->emu,
121 epcm->type == PLAYBACK_EMUVOICE ? EMU10K1_PCM : EMU10K1_EFX,
123 &epcm->extra);
131 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]);
132 epcm->voices[i] = NULL;
136 epcm->extra->epcm = epcm;
137 epcm->extra->interrupt = snd_emu10k1_pcm_interrupt;
264 struct snd_pcm_substream *substream = evoice->epcm->substream;
308 evoice->epcm->ccca_start_addr = start_addr + ccis;
388 struct snd_emu10k1_pcm *epcm = runtime->private_data;
391 if ((err = snd_emu10k1_pcm_channel_alloc(epcm, params_channels(hw_params))) < 0)
397 if (epcm->memblk != NULL)
398 snd_emu10k1_free_pages(emu, epcm->memblk);
399 epcm->memblk = snd_emu10k1_alloc_pages(emu, substream);
400 epcm->start_addr = 0;
401 if (! epcm->memblk)
403 mapped = ((struct snd_emu10k1_memblk *)epcm->memblk)->mapped_page;
406 epcm->start_addr = mapped << PAGE_SHIFT;
415 struct snd_emu10k1_pcm *epcm;
419 epcm = runtime->private_data;
420 if (epcm->extra) {
421 snd_emu10k1_voice_free(epcm->emu, epcm->extra);
422 epcm->extra = NULL;
424 if (epcm->voices[1]) {
425 snd_emu10k1_voice_free(epcm->emu, epcm->voices[1]);
426 epcm->voices[1] = NULL;
428 if (epcm->voices[0]) {
429 snd_emu10k1_voice_free(epcm->emu, epcm->voices[0]);
430 epcm->voices[0] = NULL;
432 if (epcm->memblk) {
433 snd_emu10k1_free_pages(emu, epcm->memblk);
434 epcm->memblk = NULL;
435 epcm->start_addr = 0;
445 struct snd_emu10k1_pcm *epcm;
450 epcm = runtime->private_data;
451 if (epcm->extra) {
452 snd_emu10k1_voice_free(epcm->emu, epcm->extra);
453 epcm->extra = NULL;
456 if (epcm->voices[i]) {
457 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]);
458 epcm->voices[i] = NULL;
461 if (epcm->memblk) {
462 snd_emu10k1_free_pages(emu, epcm->memblk);
463 epcm->memblk = NULL;
464 epcm->start_addr = 0;
474 struct snd_emu10k1_pcm *epcm = runtime->private_data;
477 start_addr = epcm->start_addr;
484 snd_emu10k1_pcm_init_voice(emu, 1, 1, epcm->extra,
486 start_addr = epcm->start_addr;
487 end_addr = epcm->start_addr + snd_pcm_lib_buffer_bytes(substream);
488 snd_emu10k1_pcm_init_voice(emu, 1, 0, epcm->voices[0],
491 if (epcm->voices[1])
492 snd_emu10k1_pcm_init_voice(emu, 0, 0, epcm->voices[1],
502 struct snd_emu10k1_pcm *epcm = runtime->private_data;
507 start_addr = epcm->start_addr;
508 end_addr = epcm->start_addr + snd_pcm_lib_buffer_bytes(substream);
515 snd_emu10k1_pcm_init_voice(emu, 1, 1, epcm->extra,
519 snd_emu10k1_pcm_init_voice(emu, 1, 0, epcm->voices[0],
525 snd_emu10k1_pcm_init_voice(emu, 0, 0, epcm->voices[i],
569 struct snd_emu10k1_pcm *epcm = runtime->private_data;
573 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, 0);
574 switch (epcm->type) {
588 snd_emu10k1_ptr_write(emu, epcm->capture_ba_reg, 0, runtime->dma_addr);
589 epcm->capture_bufsize = snd_pcm_lib_buffer_bytes(substream);
590 epcm->capture_bs_val = 0;
592 if (capture_period_sizes[idx] == epcm->capture_bufsize) {
593 epcm->capture_bs_val = idx + 1;
597 if (epcm->capture_bs_val == 0) {
599 epcm->capture_bs_val++;
601 if (epcm->type == CAPTURE_AC97ADC) {
602 epcm->capture_cr_val = emu->audigy ? A_ADCCR_LCHANENABLE : ADCCR_LCHANENABLE;
604 epcm->capture_cr_val |= emu->audigy ? A_ADCCR_RCHANENABLE : ADCCR_RCHANENABLE;
605 epcm->capture_cr_val |= emu->audigy ?
619 runtime = evoice->epcm->substream->runtime;
658 substream = evoice->epcm->substream;
680 substream = evoice->epcm->substream;
690 if (master || evoice->epcm->type == PLAYBACK_EFX)
714 struct snd_emu10k1_pcm *epcm,
724 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->extra->number);
726 ptr |= epcm->ccca_start_addr + period_pos;
727 snd_emu10k1_ptr_write(emu, CCCA, epcm->extra->number, ptr);
735 struct snd_emu10k1_pcm *epcm = runtime->private_data;
746 snd_emu10k1_playback_invalidate_cache(emu, 1, epcm->extra); /* do we need this? */
747 snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[0]);
752 snd_emu10k1_playback_mangle_extra(emu, epcm, substream, runtime);
754 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix);
755 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix);
756 snd_emu10k1_playback_prepare_voice(emu, epcm->extra, 1, 1, NULL);
757 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[0], 1, 0);
758 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[1], 0, 0);
759 snd_emu10k1_playback_trigger_voice(emu, epcm->extra, 1, 1);
760 epcm->running = 1;
765 epcm->running = 0;
766 snd_emu10k1_playback_stop_voice(emu, epcm->voices[0]);
767 snd_emu10k1_playback_stop_voice(emu, epcm->voices[1]);
768 snd_emu10k1_playback_stop_voice(emu, epcm->extra);
783 struct snd_emu10k1_pcm *epcm = runtime->private_data;
791 outl(epcm->capture_ipr, emu->port + IPR);
792 snd_emu10k1_intr_enable(emu, epcm->capture_inte);
795 epcm->adccr, epcm->adcbs);
797 switch (epcm->type) {
799 snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val);
803 snd_emu10k1_ptr_write(emu, A_FXWC1, 0, epcm->capture_cr_val);
804 snd_emu10k1_ptr_write(emu, A_FXWC2, 0, epcm->capture_cr_val2);
805 snd_printdd("cr_val=0x%x, cr_val2=0x%x\n", epcm->capture_cr_val, epcm->capture_cr_val2);
807 snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val);
812 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, epcm->capture_bs_val);
813 epcm->running = 1;
814 epcm->first_ptr = 1;
818 epcm->running = 0;
819 snd_emu10k1_intr_disable(emu, epcm->capture_inte);
820 outl(epcm->capture_ipr, emu->port + IPR);
821 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, 0);
822 switch (epcm->type) {
848 struct snd_emu10k1_pcm *epcm = runtime->private_data;
851 if (!epcm->running)
853 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->voices[0]->number) & 0x00ffffff;
854 if (ptr < epcm->ccca_start_addr)
855 ptr += runtime->buffer_size - epcm->ccca_start_addr;
857 ptr -= epcm->ccca_start_addr;
876 struct snd_emu10k1_pcm *epcm = runtime->private_data;
885 snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[i]);
887 snd_emu10k1_playback_invalidate_cache(emu, 1, epcm->extra);
892 snd_emu10k1_playback_prepare_voice(emu, epcm->extra, 1, 1, NULL);
893 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 0, 0,
896 snd_emu10k1_playback_prepare_voice(emu, epcm->voices[i], 0, 0,
898 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[0], 0, 0);
899 snd_emu10k1_playback_trigger_voice(emu, epcm->extra, 1, 1);
901 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[i], 0, 0);
902 epcm->running = 1;
907 epcm->running = 0;
909 snd_emu10k1_playback_stop_voice(emu, epcm->voices[i]);
911 snd_emu10k1_playback_stop_voice(emu, epcm->extra);
926 struct snd_emu10k1_pcm *epcm = runtime->private_data;
929 if (!epcm->running)
931 if (epcm->first_ptr) {
933 epcm->first_ptr = 0;
935 ptr = snd_emu10k1_ptr_read(emu, epcm->capture_idx_reg, 0) & 0x0000ffff;
1055 mix->epcm = NULL;
1064 struct snd_emu10k1_pcm *epcm;
1069 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1070 if (epcm == NULL)
1072 epcm->emu = emu;
1073 epcm->type = PLAYBACK_EFX;
1074 epcm->substream = substream;
1078 runtime->private_data = epcm;
1088 mix->epcm = epcm;
1097 struct snd_emu10k1_pcm *epcm;
1102 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1103 if (epcm == NULL)
1105 epcm->emu = emu;
1106 epcm->type = PLAYBACK_EMUVOICE;
1107 epcm->substream = substream;
1108 runtime->private_data = epcm;
1112 kfree(epcm);
1116 kfree(epcm);
1126 mix->epcm = epcm;
1136 mix->epcm = NULL;
1145 struct snd_emu10k1_pcm *epcm;
1147 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1148 if (epcm == NULL)
1150 epcm->emu = emu;
1151 epcm->type = CAPTURE_AC97ADC;
1152 epcm->substream = substream;
1153 epcm->capture_ipr = IPR_ADCBUFFULL|IPR_ADCBUFHALFFULL;
1154 epcm->capture_inte = INTE_ADCBUFENABLE;
1155 epcm->capture_ba_reg = ADCBA;
1156 epcm->capture_bs_reg = ADCBS;
1157 epcm->capture_idx_reg = emu->audigy ? A_ADCIDX : ADCIDX;
1158 runtime->private_data = epcm;
1180 struct snd_emu10k1_pcm *epcm;
1183 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1184 if (epcm == NULL)
1186 epcm->emu = emu;
1187 epcm->type = CAPTURE_AC97MIC;
1188 epcm->substream = substream;
1189 epcm->capture_ipr = IPR_MICBUFFULL|IPR_MICBUFHALFFULL;
1190 epcm->capture_inte = INTE_MICBUFENABLE;
1191 epcm->capture_ba_reg = MICBA;
1192 epcm->capture_bs_reg = MICBS;
1193 epcm->capture_idx_reg = emu->audigy ? A_MICIDX : MICIDX;
1194 substream->runtime->private_data = epcm;
1218 struct snd_emu10k1_pcm *epcm;
1223 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1224 if (epcm == NULL)
1226 epcm->emu = emu;
1227 epcm->type = CAPTURE_EFX;
1228 epcm->substream = substream;
1229 epcm->capture_ipr = IPR_EFXBUFFULL|IPR_EFXBUFHALFFULL;
1230 epcm->capture_inte = INTE_EFXBUFENABLE;
1231 epcm->capture_ba_reg = FXBA;
1232 epcm->capture_bs_reg = FXBS;
1233 epcm->capture_idx_reg = FXIDX;
1234 substream->runtime->private_data = epcm;
1291 epcm->capture_cr_val = emu->efx_voices_mask[0];
1292 epcm->capture_cr_val2 = emu->efx_voices_mask[1];