Lines Matching +full:p +full:- +full:384
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Lee Revell <rlrevell@joe-job.com>
5 * James Courtier-Dutton <James@superbug.co.uk>
25 epcm = voice->epcm; in snd_emu10k1_pcm_interrupt()
28 if (epcm->substream == NULL) in snd_emu10k1_pcm_interrupt()
31 dev_dbg(emu->card->dev, in snd_emu10k1_pcm_interrupt()
33 epcm->substream->runtime->hw->pointer(emu, epcm->substream), in snd_emu10k1_pcm_interrupt()
34 snd_pcm_lib_period_bytes(epcm->substream), in snd_emu10k1_pcm_interrupt()
35 snd_pcm_lib_buffer_bytes(epcm->substream)); in snd_emu10k1_pcm_interrupt()
37 snd_pcm_period_elapsed(epcm->substream); in snd_emu10k1_pcm_interrupt()
45 if (emu->pcm_capture_substream->runtime->mode == SNDRV_PCM_MODE_FRAME) in snd_emu10k1_pcm_ac97adc_interrupt()
49 snd_pcm_period_elapsed(emu->pcm_capture_substream); in snd_emu10k1_pcm_ac97adc_interrupt()
57 if (emu->pcm_capture_mic_substream->runtime->mode == SNDRV_PCM_MODE_FRAME) in snd_emu10k1_pcm_ac97mic_interrupt()
61 snd_pcm_period_elapsed(emu->pcm_capture_mic_substream); in snd_emu10k1_pcm_ac97mic_interrupt()
69 if (emu->pcm_capture_efx_substream->runtime->mode == SNDRV_PCM_MODE_FRAME) in snd_emu10k1_pcm_efx_interrupt()
73 snd_pcm_period_elapsed(emu->pcm_capture_efx_substream); in snd_emu10k1_pcm_efx_interrupt()
78 for (unsigned i = 0; i < ARRAY_SIZE(epcm->voices); i++) { in snd_emu10k1_pcm_free_voices()
79 if (epcm->voices[i]) { in snd_emu10k1_pcm_free_voices()
80 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); in snd_emu10k1_pcm_free_voices()
81 epcm->voices[i] = NULL; in snd_emu10k1_pcm_free_voices()
93 err = snd_emu10k1_voice_alloc(epcm->emu, in snd_emu10k1_pcm_channel_alloc()
95 epcm, &epcm->voices[0]); in snd_emu10k1_pcm_channel_alloc()
99 if (epcm->extra == NULL) { in snd_emu10k1_pcm_channel_alloc()
100 // The hardware supports only (half-)loop interrupts, so to support an in snd_emu10k1_pcm_channel_alloc()
102 // period-sized loop as the interrupt source. Additionally, the interrupt in snd_emu10k1_pcm_channel_alloc()
104 err = snd_emu10k1_voice_alloc(epcm->emu, in snd_emu10k1_pcm_channel_alloc()
106 epcm, &epcm->extra); in snd_emu10k1_pcm_channel_alloc()
109 dev_dbg(emu->card->dev, "pcm_channel_alloc: " in snd_emu10k1_pcm_channel_alloc()
116 epcm->extra->interrupt = snd_emu10k1_pcm_interrupt; in snd_emu10k1_pcm_channel_alloc()
122 // Primes 2-7 and 2^n multiples thereof, up to 16.
134 384, 448, 512, 640,
135 384*2, 448*2, 512*2, 640*2,
136 384*4, 448*4, 512*4, 640*4,
137 384*8, 448*8, 512*8, 640*8,
138 384*16, 448*16, 512*16, 640*16,
139 384*32, 448*32, 512*32, 640*32,
140 384*64, 448*64, 512*64, 640*64,
141 384*128,448*128,512*128
208 if (emu->card_capabilities->emu_model && in snd_emu10k1_constrain_capture_rates()
209 emu->emu1010.word_clock == 44100) { in snd_emu10k1_constrain_capture_rates()
211 runtime->hw.rates = SNDRV_PCM_RATE_11025 | \ in snd_emu10k1_constrain_capture_rates()
214 runtime->hw.rate_min = 11025; in snd_emu10k1_constrain_capture_rates()
215 runtime->hw.rate_max = 44100; in snd_emu10k1_constrain_capture_rates()
219 emu->audigy ? &hw_constraints_audigy_capture_rates : in snd_emu10k1_constrain_capture_rates()
228 rate = emu->emu1010.word_clock; in snd_emu1010_constrain_efx_rate()
229 runtime->hw.rate_min = runtime->hw.rate_max = rate; in snd_emu1010_constrain_efx_rate()
230 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate); in snd_emu1010_constrain_efx_rate()
292 voice = evoice->number; in snd_emu10k1_pcm_init_voice()
294 silent_page = ((unsigned int)emu->silent_page.addr << emu->address_mode) | in snd_emu10k1_pcm_init_voice()
295 (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); in snd_emu10k1_pcm_init_voice()
304 CCCA, emu10k1_select_interprom(evoice->epcm->pitch_target) | in snd_emu10k1_pcm_init_voice()
317 if (emu->audigy) { in snd_emu10k1_pcm_init_voice()
333 emu->voices[voice].dirty = 1; in snd_emu10k1_pcm_init_voice()
343 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_pcm_init_voices()
346 &mix->send_routing[stereo][0], in snd_emu10k1_pcm_init_voices()
347 &mix->send_volume[stereo][0]); in snd_emu10k1_pcm_init_voices()
351 &mix->send_routing[2][0], in snd_emu10k1_pcm_init_voices()
352 &mix->send_volume[2][0]); in snd_emu10k1_pcm_init_voices()
353 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_pcm_init_voices()
374 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_hw_params()
375 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_hw_params()
380 if (epcm->type == PLAYBACK_EMUVOICE) { in snd_emu10k1_playback_hw_params()
394 if (emu->iommu_workaround) in snd_emu10k1_playback_hw_params()
399 if (emu->iommu_workaround && runtime->dma_bytes >= EMUPAGESIZE) in snd_emu10k1_playback_hw_params()
400 runtime->dma_bytes -= EMUPAGESIZE; in snd_emu10k1_playback_hw_params()
403 if (epcm->memblk != NULL) in snd_emu10k1_playback_hw_params()
404 snd_emu10k1_free_pages(emu, epcm->memblk); in snd_emu10k1_playback_hw_params()
405 epcm->memblk = snd_emu10k1_alloc_pages(emu, substream); in snd_emu10k1_playback_hw_params()
406 epcm->start_addr = 0; in snd_emu10k1_playback_hw_params()
407 if (! epcm->memblk) in snd_emu10k1_playback_hw_params()
408 return -ENOMEM; in snd_emu10k1_playback_hw_params()
409 mapped = ((struct snd_emu10k1_memblk *)epcm->memblk)->mapped_page; in snd_emu10k1_playback_hw_params()
411 return -ENOMEM; in snd_emu10k1_playback_hw_params()
412 epcm->start_addr = mapped << PAGE_SHIFT; in snd_emu10k1_playback_hw_params()
420 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_hw_free()
423 if (runtime->private_data == NULL) in snd_emu10k1_playback_hw_free()
425 epcm = runtime->private_data; in snd_emu10k1_playback_hw_free()
426 if (epcm->extra) { in snd_emu10k1_playback_hw_free()
427 snd_emu10k1_voice_free(epcm->emu, epcm->extra); in snd_emu10k1_playback_hw_free()
428 epcm->extra = NULL; in snd_emu10k1_playback_hw_free()
431 if (epcm->memblk) { in snd_emu10k1_playback_hw_free()
432 snd_emu10k1_free_pages(emu, epcm->memblk); in snd_emu10k1_playback_hw_free()
433 epcm->memblk = NULL; in snd_emu10k1_playback_hw_free()
434 epcm->start_addr = 0; in snd_emu10k1_playback_hw_free()
443 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_prepare()
444 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_prepare()
445 bool w_16 = snd_pcm_format_width(runtime->format) == 16; in snd_emu10k1_playback_prepare()
446 bool stereo = runtime->channels == 2; in snd_emu10k1_playback_prepare()
450 rate = runtime->rate; in snd_emu10k1_playback_prepare()
451 if (emu->card_capabilities->emu_model && in snd_emu10k1_playback_prepare()
452 emu->emu1010.word_clock == 44100) in snd_emu10k1_playback_prepare()
454 epcm->pitch_target = emu10k1_calc_pitch_target(rate); in snd_emu10k1_playback_prepare()
456 start_addr = epcm->start_addr >> w_16; in snd_emu10k1_playback_prepare()
457 end_addr = start_addr + runtime->period_size; in snd_emu10k1_playback_prepare()
458 snd_emu10k1_pcm_init_extra_voice(emu, epcm->extra, w_16, in snd_emu10k1_playback_prepare()
461 epcm->ccca_start_addr = start_addr; in snd_emu10k1_playback_prepare()
462 end_addr = start_addr + runtime->buffer_size; in snd_emu10k1_playback_prepare()
463 snd_emu10k1_pcm_init_voices(emu, epcm->voices[0], w_16, stereo, in snd_emu10k1_playback_prepare()
465 &emu->pcm_mixer[substream->number]); in snd_emu10k1_playback_prepare()
473 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_efx_playback_prepare()
474 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_efx_playback_prepare()
479 epcm->pitch_target = PITCH_48000; in snd_emu10k1_efx_playback_prepare()
481 start_addr = epcm->start_addr >> 1; // 16-bit voices in snd_emu10k1_efx_playback_prepare()
483 extra_size = runtime->period_size; in snd_emu10k1_efx_playback_prepare()
484 channel_size = runtime->buffer_size; in snd_emu10k1_efx_playback_prepare()
486 snd_emu10k1_pcm_init_extra_voice(emu, epcm->extra, true, in snd_emu10k1_efx_playback_prepare()
489 epcm->ccca_start_addr = start_addr; in snd_emu10k1_efx_playback_prepare()
490 for (i = 0; i < runtime->channels; i++) { in snd_emu10k1_efx_playback_prepare()
491 snd_emu10k1_pcm_init_voices(emu, epcm->voices[i], true, false, in snd_emu10k1_efx_playback_prepare()
493 &emu->efx_pcm_mixer[i]); in snd_emu10k1_efx_playback_prepare()
522 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_capture_prepare()
523 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_capture_prepare()
527 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, 0); in snd_emu10k1_capture_prepare()
528 switch (epcm->type) { in snd_emu10k1_capture_prepare()
533 if (emu->card_capabilities->emu_model) { in snd_emu10k1_capture_prepare()
534 // The upper 32 16-bit capture voices, two for each of the 16 32-bit channels. in snd_emu10k1_capture_prepare()
536 epcm->capture_cr_val = 0; in snd_emu10k1_capture_prepare()
537 epcm->capture_cr_val2 = 0xffffffff >> (32 - runtime->channels * 2); in snd_emu10k1_capture_prepare()
539 if (emu->audigy) { in snd_emu10k1_capture_prepare()
550 snd_emu10k1_ptr_write(emu, epcm->capture_ba_reg, 0, runtime->dma_addr); in snd_emu10k1_capture_prepare()
551 epcm->capture_bufsize = snd_pcm_lib_buffer_bytes(substream); in snd_emu10k1_capture_prepare()
552 epcm->capture_bs_val = 0; in snd_emu10k1_capture_prepare()
554 if (capture_buffer_sizes[idx] == epcm->capture_bufsize) { in snd_emu10k1_capture_prepare()
555 epcm->capture_bs_val = idx + 1; in snd_emu10k1_capture_prepare()
559 if (epcm->capture_bs_val == 0) { in snd_emu10k1_capture_prepare()
561 epcm->capture_bs_val++; in snd_emu10k1_capture_prepare()
563 if (epcm->type == CAPTURE_AC97ADC) { in snd_emu10k1_capture_prepare()
564 unsigned rate = runtime->rate; in snd_emu10k1_capture_prepare()
565 if (!(runtime->hw.rates & SNDRV_PCM_RATE_48000)) in snd_emu10k1_capture_prepare()
568 epcm->capture_cr_val = emu->audigy ? A_ADCCR_LCHANENABLE : ADCCR_LCHANENABLE; in snd_emu10k1_capture_prepare()
569 if (runtime->channels > 1) in snd_emu10k1_capture_prepare()
570 epcm->capture_cr_val |= emu->audigy ? A_ADCCR_RCHANENABLE : ADCCR_RCHANENABLE; in snd_emu10k1_capture_prepare()
571 epcm->capture_cr_val |= emu->audigy ? in snd_emu10k1_capture_prepare()
588 // except for 16-bit stereo. And the interpolator will actually in snd_emu10k1_playback_fill_cache()
589 // access them at all only when we're pitch-shifting. in snd_emu10k1_playback_fill_cache()
594 ccr = (64 - 3) << REG_SHIFT(CCR_CACHEINVALIDSIZE); in snd_emu10k1_playback_fill_cache()
607 struct snd_pcm_substream *substream = epcm->substream; in snd_emu10k1_playback_prepare_voices()
608 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_prepare_voices()
609 unsigned eloop_start = epcm->start_addr >> w_16; in snd_emu10k1_playback_prepare_voices()
611 unsigned eloop_size = runtime->period_size; in snd_emu10k1_playback_prepare_voices()
612 unsigned loop_size = runtime->buffer_size; in snd_emu10k1_playback_prepare_voices()
617 // - The actual position is delayed by the cache size (64 frames) in snd_emu10k1_playback_prepare_voices()
618 // - The interpolator is centered around the 4th frame in snd_emu10k1_playback_prepare_voices()
619 loop_start += (epcm->resume_pos + 64 - 3) % loop_size; in snd_emu10k1_playback_prepare_voices()
621 unsigned voice = epcm->voices[i]->number; in snd_emu10k1_playback_prepare_voices()
631 // In principle, this wouldn't need to be the cache's entire size - in in snd_emu10k1_playback_prepare_voices()
636 // align them with the interrupts. This makes a non-delayed interrupt in snd_emu10k1_playback_prepare_voices()
638 // for (CA - CIS) >= period_boundary for every channel in the stream. in snd_emu10k1_playback_prepare_voices()
640 // This is why all other (open) drivers for these chips use timer-based in snd_emu10k1_playback_prepare_voices()
643 eloop_start += (epcm->resume_pos + eloop_size - 3) % eloop_size; in snd_emu10k1_playback_prepare_voices()
644 snd_emu10k1_ptr_write(emu, CCCA_CURRADDR, epcm->extra->number, eloop_start); in snd_emu10k1_playback_prepare_voices()
654 snd_emu10k1_ptr_write_multiple(emu, evoice->number, in snd_emu10k1_playback_commit_volume()
669 vattn = mix->attn[tmp] << 16; in snd_emu10k1_playback_unmute_voice()
714 voice = evoice->number; in snd_emu10k1_playback_trigger_voice()
715 snd_emu10k1_playback_commit_pitch(emu, voice, evoice->epcm->pitch_target << 16); in snd_emu10k1_playback_trigger_voice()
723 voice = evoice->number; in snd_emu10k1_playback_stop_voice()
730 epcm->running = 1; in snd_emu10k1_playback_set_running()
731 snd_emu10k1_voice_intr_enable(emu, epcm->extra->number); in snd_emu10k1_playback_set_running()
737 snd_emu10k1_voice_intr_disable(emu, epcm->extra->number); in snd_emu10k1_playback_set_stopped()
738 epcm->running = 0; in snd_emu10k1_playback_set_stopped()
745 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_trigger()
746 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_trigger()
748 bool w_16 = snd_pcm_format_width(runtime->format) == 16; in snd_emu10k1_playback_trigger()
749 bool stereo = runtime->channels == 2; in snd_emu10k1_playback_trigger()
753 dev_dbg(emu->card->dev, in snd_emu10k1_playback_trigger()
754 "trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", in snd_emu10k1_playback_trigger()
755 (int)emu, cmd, substream->ops->pointer(substream)) in snd_emu10k1_playback_trigger()
757 spin_lock(&emu->reg_lock); in snd_emu10k1_playback_trigger()
764 mix = &emu->pcm_mixer[substream->number]; in snd_emu10k1_playback_trigger()
765 snd_emu10k1_playback_unmute_voices(emu, epcm->voices[0], stereo, mix); in snd_emu10k1_playback_trigger()
767 snd_emu10k1_playback_trigger_voice(emu, epcm->voices[0]); in snd_emu10k1_playback_trigger()
768 snd_emu10k1_playback_trigger_voice(emu, epcm->extra); in snd_emu10k1_playback_trigger()
773 snd_emu10k1_playback_stop_voice(emu, epcm->voices[0]); in snd_emu10k1_playback_trigger()
774 snd_emu10k1_playback_stop_voice(emu, epcm->extra); in snd_emu10k1_playback_trigger()
776 snd_emu10k1_playback_mute_voices(emu, epcm->voices[0], stereo); in snd_emu10k1_playback_trigger()
779 result = -EINVAL; in snd_emu10k1_playback_trigger()
782 spin_unlock(&emu->reg_lock); in snd_emu10k1_playback_trigger()
790 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_capture_trigger()
791 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_capture_trigger()
794 spin_lock(&emu->reg_lock); in snd_emu10k1_capture_trigger()
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()
802 dev_dbg(emu->card->dev, "adccr = 0x%x, adcbs = 0x%x\n", in snd_emu10k1_capture_trigger()
803 epcm->adccr, epcm->adcbs); 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()
810 if (emu->audigy) { in snd_emu10k1_capture_trigger()
812 A_FXWC1, epcm->capture_cr_val, in snd_emu10k1_capture_trigger()
813 A_FXWC2, epcm->capture_cr_val2, in snd_emu10k1_capture_trigger()
815 dev_dbg(emu->card->dev, in snd_emu10k1_capture_trigger()
817 epcm->capture_cr_val, in snd_emu10k1_capture_trigger()
818 epcm->capture_cr_val2); in snd_emu10k1_capture_trigger()
820 snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val); in snd_emu10k1_capture_trigger()
825 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, epcm->capture_bs_val); in snd_emu10k1_capture_trigger()
826 epcm->running = 1; in snd_emu10k1_capture_trigger()
827 epcm->first_ptr = 1; in snd_emu10k1_capture_trigger()
831 epcm->running = 0; in snd_emu10k1_capture_trigger()
832 snd_emu10k1_intr_disable(emu, epcm->capture_inte); in snd_emu10k1_capture_trigger()
833 outl(epcm->capture_ipr, emu->port + IPR); in snd_emu10k1_capture_trigger()
834 snd_emu10k1_ptr_write(emu, epcm->capture_bs_reg, 0, 0); in snd_emu10k1_capture_trigger()
835 switch (epcm->type) { in snd_emu10k1_capture_trigger()
840 if (emu->audigy) { in snd_emu10k1_capture_trigger()
853 result = -EINVAL; in snd_emu10k1_capture_trigger()
855 spin_unlock(&emu->reg_lock); in snd_emu10k1_capture_trigger()
862 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_pointer()
863 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_playback_pointer()
866 if (!epcm->running) in snd_emu10k1_playback_pointer()
869 ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->voices[0]->number) & 0x00ffffff; in snd_emu10k1_playback_pointer()
870 ptr -= epcm->ccca_start_addr; in snd_emu10k1_playback_pointer()
872 // This is the size of the whole cache minus the interpolator read-ahead, in snd_emu10k1_playback_pointer()
877 // already read the buffer, and set runtime->delay accordingly. However, in snd_emu10k1_playback_pointer()
879 // to obtain), so only a fixed worst-case value would be practical. in snd_emu10k1_playback_pointer()
881 ptr -= 64 - 3; in snd_emu10k1_playback_pointer()
883 ptr += runtime->buffer_size; in snd_emu10k1_playback_pointer()
886 dev_dbg(emu->card->dev, in snd_emu10k1_playback_pointer()
888 (long)ptr, (long)runtime->buffer_size, in snd_emu10k1_playback_pointer()
889 (long)runtime->period_size); in snd_emu10k1_playback_pointer()
900 int voice = epcm->voices[i]->number; in snd_emu10k1_efx_playback_voice_mask()
911 int voice = epcm->voices[i]->number; in snd_emu10k1_efx_playback_freeze_voices()
922 snd_emu10k1_playback_unmute_voice(emu, epcm->voices[i], false, true, in snd_emu10k1_efx_playback_unmute_voices()
923 &emu->efx_pcm_mixer[i]); in snd_emu10k1_efx_playback_unmute_voices()
931 snd_emu10k1_playback_stop_voice(emu, epcm->voices[i]); in snd_emu10k1_efx_playback_stop_voices()
935 snd_emu10k1_playback_mute_voice(emu, epcm->voices[i]); in snd_emu10k1_efx_playback_stop_voices()
942 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_efx_playback_trigger()
943 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_efx_playback_trigger()
947 spin_lock(&emu->reg_lock); in snd_emu10k1_efx_playback_trigger()
953 epcm, runtime->channels); in snd_emu10k1_efx_playback_trigger()
959 emu, epcm, runtime->channels); in snd_emu10k1_efx_playback_trigger()
961 emu, epcm, true, false, runtime->channels); in snd_emu10k1_efx_playback_trigger()
967 snd_emu10k1_efx_playback_unmute_voices(emu, epcm, runtime->channels); in snd_emu10k1_efx_playback_trigger()
973 snd_emu10k1_playback_trigger_voice(emu, epcm->extra); in snd_emu10k1_efx_playback_trigger()
978 emu, epcm, runtime->channels); in snd_emu10k1_efx_playback_trigger()
980 if (result != -EAGAIN) in snd_emu10k1_efx_playback_trigger()
989 snd_emu10k1_playback_stop_voice(emu, epcm->extra); in snd_emu10k1_efx_playback_trigger()
991 emu, epcm, runtime->channels); in snd_emu10k1_efx_playback_trigger()
993 epcm->resume_pos = snd_emu10k1_playback_pointer(substream); in snd_emu10k1_efx_playback_trigger()
996 result = -EINVAL; in snd_emu10k1_efx_playback_trigger()
1000 spin_unlock(&emu->reg_lock); in snd_emu10k1_efx_playback_trigger()
1008 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_capture_pointer()
1009 struct snd_emu10k1_pcm *epcm = runtime->private_data; in snd_emu10k1_capture_pointer()
1012 if (!epcm->running) in snd_emu10k1_capture_pointer()
1014 if (epcm->first_ptr) { in snd_emu10k1_capture_pointer()
1016 epcm->first_ptr = 0; in snd_emu10k1_capture_pointer()
1018 ptr = snd_emu10k1_ptr_read(emu, epcm->capture_idx_reg, 0) & 0x0000ffff; in snd_emu10k1_capture_pointer()
1062 .period_bytes_min = 384,
1082 .period_bytes_min = 384,
1100 kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; in snd_emu10k1_pcm_mixer_notify1()
1102 kctl->vd[idx].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; in snd_emu10k1_pcm_mixer_notify1()
1103 snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE | in snd_emu10k1_pcm_mixer_notify1()
1110 snd_emu10k1_pcm_mixer_notify1(emu, emu->ctl_send_routing, idx, activate); in snd_emu10k1_pcm_mixer_notify()
1111 snd_emu10k1_pcm_mixer_notify1(emu, emu->ctl_send_volume, idx, activate); in snd_emu10k1_pcm_mixer_notify()
1112 snd_emu10k1_pcm_mixer_notify1(emu, emu->ctl_attn, idx, activate); in snd_emu10k1_pcm_mixer_notify()
1117 snd_emu10k1_pcm_mixer_notify1(emu, emu->ctl_efx_send_routing, idx, activate); in snd_emu10k1_pcm_efx_mixer_notify()
1118 snd_emu10k1_pcm_mixer_notify1(emu, emu->ctl_efx_send_volume, idx, activate); in snd_emu10k1_pcm_efx_mixer_notify()
1119 snd_emu10k1_pcm_mixer_notify1(emu, emu->ctl_efx_attn, idx, activate); in snd_emu10k1_pcm_efx_mixer_notify()
1124 kfree(runtime->private_data); in snd_emu10k1_pcm_free_substream()
1134 mix = &emu->efx_pcm_mixer[i]; in snd_emu10k1_efx_playback_close()
1135 mix->epcm = NULL; in snd_emu10k1_efx_playback_close()
1162 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_efx_playback_open()
1167 return -ENOMEM; in snd_emu10k1_efx_playback_open()
1168 epcm->emu = emu; in snd_emu10k1_efx_playback_open()
1169 epcm->type = PLAYBACK_EFX; in snd_emu10k1_efx_playback_open()
1170 epcm->substream = substream; in snd_emu10k1_efx_playback_open()
1172 runtime->private_data = epcm; in snd_emu10k1_efx_playback_open()
1173 runtime->private_free = snd_emu10k1_pcm_free_substream; in snd_emu10k1_efx_playback_open()
1174 runtime->hw = snd_emu10k1_efx_playback; in snd_emu10k1_efx_playback_open()
1175 if (emu->card_capabilities->emu_model) in snd_emu10k1_efx_playback_open()
1184 mix = &emu->efx_pcm_mixer[i]; in snd_emu10k1_efx_playback_open()
1186 mix->send_routing[0][j] = i + j; in snd_emu10k1_efx_playback_open()
1187 memset(&mix->send_volume, 0, sizeof(mix->send_volume)); in snd_emu10k1_efx_playback_open()
1188 mix->send_volume[0][0] = 255; in snd_emu10k1_efx_playback_open()
1189 mix->attn[0] = 0x8000; in snd_emu10k1_efx_playback_open()
1190 mix->epcm = epcm; in snd_emu10k1_efx_playback_open()
1201 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_playback_open()
1206 return -ENOMEM; in snd_emu10k1_playback_open()
1207 epcm->emu = emu; in snd_emu10k1_playback_open()
1208 epcm->type = PLAYBACK_EMUVOICE; in snd_emu10k1_playback_open()
1209 epcm->substream = substream; in snd_emu10k1_playback_open()
1210 runtime->private_data = epcm; in snd_emu10k1_playback_open()
1211 runtime->private_free = snd_emu10k1_pcm_free_substream; in snd_emu10k1_playback_open()
1212 runtime->hw = snd_emu10k1_playback; in snd_emu10k1_playback_open()
1218 if (emu->card_capabilities->emu_model) in snd_emu10k1_playback_open()
1219 sample_rate = emu->emu1010.word_clock; in snd_emu10k1_playback_open()
1227 mix = &emu->pcm_mixer[substream->number]; in snd_emu10k1_playback_open()
1229 mix->send_routing[0][i] = mix->send_routing[1][i] = mix->send_routing[2][i] = i; in snd_emu10k1_playback_open()
1230 memset(&mix->send_volume, 0, sizeof(mix->send_volume)); in snd_emu10k1_playback_open()
1231 mix->send_volume[0][0] = mix->send_volume[0][1] = in snd_emu10k1_playback_open()
1232 mix->send_volume[1][0] = mix->send_volume[2][1] = 255; in snd_emu10k1_playback_open()
1233 mix->attn[0] = mix->attn[1] = mix->attn[2] = 0x8000; in snd_emu10k1_playback_open()
1234 mix->epcm = epcm; in snd_emu10k1_playback_open()
1235 snd_emu10k1_pcm_mixer_notify(emu, substream->number, 1); in snd_emu10k1_playback_open()
1242 struct snd_emu10k1_pcm_mixer *mix = &emu->pcm_mixer[substream->number]; in snd_emu10k1_playback_close()
1244 mix->epcm = NULL; in snd_emu10k1_playback_close()
1245 snd_emu10k1_pcm_mixer_notify(emu, substream->number, 0); in snd_emu10k1_playback_close()
1252 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_capture_open()
1257 return -ENOMEM; in snd_emu10k1_capture_open()
1258 epcm->emu = emu; in snd_emu10k1_capture_open()
1259 epcm->type = CAPTURE_AC97ADC; in snd_emu10k1_capture_open()
1260 epcm->substream = substream; in snd_emu10k1_capture_open()
1261 epcm->capture_ipr = IPR_ADCBUFFULL|IPR_ADCBUFHALFFULL; in snd_emu10k1_capture_open()
1262 epcm->capture_inte = INTE_ADCBUFENABLE; in snd_emu10k1_capture_open()
1263 epcm->capture_ba_reg = ADCBA; in snd_emu10k1_capture_open()
1264 epcm->capture_bs_reg = ADCBS; in snd_emu10k1_capture_open()
1265 epcm->capture_idx_reg = emu->audigy ? A_ADCIDX : ADCIDX; in snd_emu10k1_capture_open()
1266 runtime->private_data = epcm; in snd_emu10k1_capture_open()
1267 runtime->private_free = snd_emu10k1_pcm_free_substream; in snd_emu10k1_capture_open()
1268 runtime->hw = snd_emu10k1_capture; in snd_emu10k1_capture_open()
1272 emu->capture_interrupt = snd_emu10k1_pcm_ac97adc_interrupt; in snd_emu10k1_capture_open()
1273 emu->pcm_capture_substream = substream; in snd_emu10k1_capture_open()
1281 emu->capture_interrupt = NULL; in snd_emu10k1_capture_close()
1282 emu->pcm_capture_substream = NULL; in snd_emu10k1_capture_close()
1290 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_capture_mic_open()
1294 return -ENOMEM; in snd_emu10k1_capture_mic_open()
1295 epcm->emu = emu; in snd_emu10k1_capture_mic_open()
1296 epcm->type = CAPTURE_AC97MIC; in snd_emu10k1_capture_mic_open()
1297 epcm->substream = substream; in snd_emu10k1_capture_mic_open()
1298 epcm->capture_ipr = IPR_MICBUFFULL|IPR_MICBUFHALFFULL; in snd_emu10k1_capture_mic_open()
1299 epcm->capture_inte = INTE_MICBUFENABLE; in snd_emu10k1_capture_mic_open()
1300 epcm->capture_ba_reg = MICBA; in snd_emu10k1_capture_mic_open()
1301 epcm->capture_bs_reg = MICBS; in snd_emu10k1_capture_mic_open()
1302 epcm->capture_idx_reg = emu->audigy ? A_MICIDX : MICIDX; in snd_emu10k1_capture_mic_open()
1303 substream->runtime->private_data = epcm; in snd_emu10k1_capture_mic_open()
1304 substream->runtime->private_free = snd_emu10k1_pcm_free_substream; in snd_emu10k1_capture_mic_open()
1305 runtime->hw = snd_emu10k1_capture; in snd_emu10k1_capture_mic_open()
1306 runtime->hw.rates = SNDRV_PCM_RATE_8000; in snd_emu10k1_capture_mic_open()
1307 runtime->hw.rate_min = runtime->hw.rate_max = 8000; in snd_emu10k1_capture_mic_open()
1310 emu->capture_mic_interrupt = snd_emu10k1_pcm_ac97mic_interrupt; in snd_emu10k1_capture_mic_open()
1311 emu->pcm_capture_mic_substream = substream; in snd_emu10k1_capture_mic_open()
1319 emu->capture_mic_interrupt = NULL; in snd_emu10k1_capture_mic_close()
1320 emu->pcm_capture_mic_substream = NULL; in snd_emu10k1_capture_mic_close()
1328 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_capture_efx_open()
1329 int nefx = emu->audigy ? 64 : 32; in snd_emu10k1_capture_efx_open()
1334 return -ENOMEM; in snd_emu10k1_capture_efx_open()
1335 epcm->emu = emu; in snd_emu10k1_capture_efx_open()
1336 epcm->type = CAPTURE_EFX; in snd_emu10k1_capture_efx_open()
1337 epcm->substream = substream; in snd_emu10k1_capture_efx_open()
1338 epcm->capture_ipr = IPR_EFXBUFFULL|IPR_EFXBUFHALFFULL; in snd_emu10k1_capture_efx_open()
1339 epcm->capture_inte = INTE_EFXBUFENABLE; in snd_emu10k1_capture_efx_open()
1340 epcm->capture_ba_reg = FXBA; in snd_emu10k1_capture_efx_open()
1341 epcm->capture_bs_reg = FXBS; in snd_emu10k1_capture_efx_open()
1342 epcm->capture_idx_reg = FXIDX; in snd_emu10k1_capture_efx_open()
1343 substream->runtime->private_data = epcm; in snd_emu10k1_capture_efx_open()
1344 substream->runtime->private_free = snd_emu10k1_pcm_free_substream; in snd_emu10k1_capture_efx_open()
1345 runtime->hw = snd_emu10k1_capture_efx; in snd_emu10k1_capture_efx_open()
1346 if (emu->card_capabilities->emu_model) { in snd_emu10k1_capture_efx_open()
1361 runtime->hw.channels_min = runtime->hw.channels_max = 4; in snd_emu10k1_capture_efx_open()
1365 runtime->hw.channels_min = runtime->hw.channels_max = 2; in snd_emu10k1_capture_efx_open()
1367 runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE; in snd_emu10k1_capture_efx_open()
1369 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_capture_efx_open()
1370 runtime->hw.channels_min = runtime->hw.channels_max = 0; in snd_emu10k1_capture_efx_open()
1372 if (emu->efx_voices_mask[idx/32] & (1 << (idx%32))) { in snd_emu10k1_capture_efx_open()
1373 runtime->hw.channels_min++; in snd_emu10k1_capture_efx_open()
1374 runtime->hw.channels_max++; in snd_emu10k1_capture_efx_open()
1377 epcm->capture_cr_val = emu->efx_voices_mask[0]; in snd_emu10k1_capture_efx_open()
1378 epcm->capture_cr_val2 = emu->efx_voices_mask[1]; in snd_emu10k1_capture_efx_open()
1379 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_capture_efx_open()
1389 emu->capture_efx_interrupt = snd_emu10k1_pcm_efx_interrupt; in snd_emu10k1_capture_efx_open()
1390 emu->pcm_capture_efx_substream = substream; in snd_emu10k1_capture_efx_open()
1398 emu->capture_efx_interrupt = NULL; in snd_emu10k1_capture_efx_close()
1399 emu->pcm_capture_efx_substream = NULL; in snd_emu10k1_capture_efx_close()
1438 err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm); in snd_emu10k1_pcm()
1442 pcm->private_data = emu; in snd_emu10k1_pcm()
1447 pcm->info_flags = 0; in snd_emu10k1_pcm()
1448 pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; in snd_emu10k1_pcm()
1449 strcpy(pcm->name, "ADC Capture/Standard PCM Playback"); in snd_emu10k1_pcm()
1450 emu->pcm = pcm; in snd_emu10k1_pcm()
1453 …for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substre… in snd_emu10k1_pcm()
1455 &emu->pci->dev, in snd_emu10k1_pcm()
1458 …for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substrea… in snd_emu10k1_pcm()
1460 &emu->pci->dev, 64*1024, 64*1024); in snd_emu10k1_pcm()
1471 err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm); in snd_emu10k1_pcm_multi()
1475 pcm->private_data = emu; in snd_emu10k1_pcm_multi()
1479 pcm->info_flags = 0; in snd_emu10k1_pcm_multi()
1480 pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; in snd_emu10k1_pcm_multi()
1481 strcpy(pcm->name, "Multichannel Playback"); in snd_emu10k1_pcm_multi()
1482 emu->pcm_multi = pcm; in snd_emu10k1_pcm_multi()
1484 …for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substre… in snd_emu10k1_pcm_multi()
1486 &emu->pci->dev, in snd_emu10k1_pcm_multi()
1506 err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm); in snd_emu10k1_pcm_mic()
1510 pcm->private_data = emu; in snd_emu10k1_pcm_mic()
1514 pcm->info_flags = 0; in snd_emu10k1_pcm_mic()
1515 strcpy(pcm->name, "Mic Capture"); in snd_emu10k1_pcm_mic()
1516 emu->pcm_mic = pcm; in snd_emu10k1_pcm_mic()
1518 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &emu->pci->dev, in snd_emu10k1_pcm_mic()
1527 int nefx = emu->audigy ? 64 : 32; in snd_emu10k1_pcm_efx_voices_mask_info()
1528 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in snd_emu10k1_pcm_efx_voices_mask_info()
1529 uinfo->count = nefx; in snd_emu10k1_pcm_efx_voices_mask_info()
1530 uinfo->value.integer.min = 0; in snd_emu10k1_pcm_efx_voices_mask_info()
1531 uinfo->value.integer.max = 1; in snd_emu10k1_pcm_efx_voices_mask_info()
1538 int nefx = emu->audigy ? 64 : 32; in snd_emu10k1_pcm_efx_voices_mask_get()
1542 ucontrol->value.integer.value[idx] = (emu->efx_voices_mask[idx / 32] & (1 << (idx % 32))) ? 1 : 0; in snd_emu10k1_pcm_efx_voices_mask_get()
1550 int nefx = emu->audigy ? 64 : 32; in snd_emu10k1_pcm_efx_voices_mask_put()
1555 if (ucontrol->value.integer.value[idx]) { in snd_emu10k1_pcm_efx_voices_mask_put()
1561 return -EINVAL; in snd_emu10k1_pcm_efx_voices_mask_put()
1563 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_pcm_efx_voices_mask_put()
1564 change = (nval[0] != emu->efx_voices_mask[0]) || in snd_emu10k1_pcm_efx_voices_mask_put()
1565 (nval[1] != emu->efx_voices_mask[1]); in snd_emu10k1_pcm_efx_voices_mask_put()
1566 emu->efx_voices_mask[0] = nval[0]; in snd_emu10k1_pcm_efx_voices_mask_put()
1567 emu->efx_voices_mask[1] = nval[1]; in snd_emu10k1_pcm_efx_voices_mask_put()
1568 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_pcm_efx_voices_mask_put()
1592 #define INITIAL_TRAM_POS(size) ((((size) / 2) - INITIAL_TRAM_SHIFT) - 1)
1607 dev_dbg(emu->card->dev, in snd_emu10k1_fx8010_playback_tram_poke1()
1608 "tram_poke1: dst_left = 0x%p, dst_right = 0x%p, " in snd_emu10k1_fx8010_playback_tram_poke1()
1609 "src = 0x%p, count = 0x%x\n", in snd_emu10k1_fx8010_playback_tram_poke1()
1613 while (count--) { in snd_emu10k1_fx8010_playback_tram_poke1()
1614 *dst_left-- = *src++; in snd_emu10k1_fx8010_playback_tram_poke1()
1615 *dst_right-- = *src++; in snd_emu10k1_fx8010_playback_tram_poke1()
1618 while (count--) { in snd_emu10k1_fx8010_playback_tram_poke1()
1619 *dst_right-- = *src++; in snd_emu10k1_fx8010_playback_tram_poke1()
1620 *dst_left-- = *src++; in snd_emu10k1_fx8010_playback_tram_poke1()
1629 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in fx8010_pb_trans_copy()
1630 unsigned int tram_size = pcm->buffer_size; in fx8010_pb_trans_copy()
1631 unsigned short *src = (unsigned short *)(substream->runtime->dma_area + rec->sw_data); in fx8010_pb_trans_copy()
1633 unsigned int tram_pos = pcm->tram_pos; in fx8010_pb_trans_copy()
1634 unsigned int tram_shift = pcm->tram_shift; in fx8010_pb_trans_copy()
1638 snd_emu10k1_fx8010_playback_tram_poke1((unsigned short *)emu->fx8010.etram_pages.area + tram_pos, in fx8010_pb_trans_copy()
1639 (unsigned short *)emu->fx8010.etram_pages.area + tram_pos + tram_size / 2, in fx8010_pb_trans_copy()
1642 frames -= count; in fx8010_pb_trans_copy()
1643 tram_pos = (tram_size / 2) - 1; in fx8010_pb_trans_copy()
1646 snd_emu10k1_fx8010_playback_tram_poke1((unsigned short *)emu->fx8010.etram_pages.area + tram_pos, in fx8010_pb_trans_copy()
1647 (unsigned short *)emu->fx8010.etram_pages.area + tram_pos + tram_size / 2, in fx8010_pb_trans_copy()
1649 tram_pos -= frames; in fx8010_pb_trans_copy()
1650 pcm->tram_pos = tram_pos; in fx8010_pb_trans_copy()
1651 pcm->tram_shift = tram_shift; in fx8010_pb_trans_copy()
1657 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_transfer()
1659 return snd_pcm_indirect_playback_transfer(substream, &pcm->pcm_rec, in snd_emu10k1_fx8010_playback_transfer()
1666 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_hw_free()
1669 for (i = 0; i < pcm->channels; i++) in snd_emu10k1_fx8010_playback_hw_free()
1670 snd_emu10k1_ptr_write(emu, TANKMEMADDRREGBASE + 0x80 + pcm->etram[i], 0, 0); in snd_emu10k1_fx8010_playback_hw_free()
1677 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_fx8010_playback_prepare()
1678 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_prepare()
1682 dev_dbg(emu->card->dev, "prepare: etram_pages = 0x%p, dma_area = 0x%x, " in snd_emu10k1_fx8010_playback_prepare()
1684 emu->fx8010.etram_pages, runtime->dma_area, in snd_emu10k1_fx8010_playback_prepare()
1685 runtime->buffer_size, runtime->buffer_size << 2); in snd_emu10k1_fx8010_playback_prepare()
1687 memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); in snd_emu10k1_fx8010_playback_prepare()
1688 pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ in snd_emu10k1_fx8010_playback_prepare()
1689 pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_emu10k1_fx8010_playback_prepare()
1690 pcm->tram_pos = INITIAL_TRAM_POS(pcm->buffer_size); in snd_emu10k1_fx8010_playback_prepare()
1691 pcm->tram_shift = 0; in snd_emu10k1_fx8010_playback_prepare()
1693 emu->gpr_base + pcm->gpr_running, 0, /* reset */ in snd_emu10k1_fx8010_playback_prepare()
1694 emu->gpr_base + pcm->gpr_trigger, 0, /* reset */ in snd_emu10k1_fx8010_playback_prepare()
1695 emu->gpr_base + pcm->gpr_size, runtime->buffer_size, in snd_emu10k1_fx8010_playback_prepare()
1696 emu->gpr_base + pcm->gpr_ptr, 0, /* reset ptr number */ in snd_emu10k1_fx8010_playback_prepare()
1697 emu->gpr_base + pcm->gpr_count, runtime->period_size, in snd_emu10k1_fx8010_playback_prepare()
1698 emu->gpr_base + pcm->gpr_tmpcount, runtime->period_size, in snd_emu10k1_fx8010_playback_prepare()
1700 for (i = 0; i < pcm->channels; i++) in snd_emu10k1_fx8010_playback_prepare()
1701 …ANKMEMADDRREGBASE + 0x80 + pcm->etram[i], 0, (TANKMEMADDRREG_READ|TANKMEMADDRREG_ALIGN) + i * (run… in snd_emu10k1_fx8010_playback_prepare()
1708 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_trigger()
1711 spin_lock(&emu->reg_lock); in snd_emu10k1_fx8010_playback_trigger()
1729 …register_irq_handler(emu, snd_emu10k1_fx8010_playback_irq, pcm->gpr_running, substream, &pcm->irq); in snd_emu10k1_fx8010_playback_trigger()
1733 snd_emu10k1_ptr_write(emu, emu->gpr_base + pcm->gpr_trigger, 0, 1); in snd_emu10k1_fx8010_playback_trigger()
1738 snd_emu10k1_fx8010_unregister_irq_handler(emu, &pcm->irq); in snd_emu10k1_fx8010_playback_trigger()
1739 snd_emu10k1_ptr_write(emu, emu->gpr_base + pcm->gpr_trigger, 0, 0); in snd_emu10k1_fx8010_playback_trigger()
1740 pcm->tram_pos = INITIAL_TRAM_POS(pcm->buffer_size); in snd_emu10k1_fx8010_playback_trigger()
1741 pcm->tram_shift = 0; in snd_emu10k1_fx8010_playback_trigger()
1744 result = -EINVAL; in snd_emu10k1_fx8010_playback_trigger()
1748 spin_unlock(&emu->reg_lock); in snd_emu10k1_fx8010_playback_trigger()
1755 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_pointer()
1758 if (!snd_emu10k1_ptr_read(emu, emu->gpr_base + pcm->gpr_trigger, 0)) in snd_emu10k1_fx8010_playback_pointer()
1760 ptr = snd_emu10k1_ptr_read(emu, emu->gpr_base + pcm->gpr_ptr, 0) << 2; in snd_emu10k1_fx8010_playback_pointer()
1761 return snd_pcm_indirect_playback_pointer(substream, &pcm->pcm_rec, ptr); in snd_emu10k1_fx8010_playback_pointer()
1787 struct snd_pcm_runtime *runtime = substream->runtime; in snd_emu10k1_fx8010_playback_open()
1788 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_open()
1790 runtime->hw = snd_emu10k1_fx8010_playback; in snd_emu10k1_fx8010_playback_open()
1791 runtime->hw.channels_min = runtime->hw.channels_max = pcm->channels; in snd_emu10k1_fx8010_playback_open()
1792 runtime->hw.period_bytes_max = (pcm->buffer_size * 2) / 2; in snd_emu10k1_fx8010_playback_open()
1793 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_fx8010_playback_open()
1794 if (pcm->valid == 0) { in snd_emu10k1_fx8010_playback_open()
1795 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_fx8010_playback_open()
1796 return -ENODEV; in snd_emu10k1_fx8010_playback_open()
1798 pcm->opened = 1; in snd_emu10k1_fx8010_playback_open()
1799 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_fx8010_playback_open()
1806 struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; in snd_emu10k1_fx8010_playback_close()
1808 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_fx8010_playback_close()
1809 pcm->opened = 0; in snd_emu10k1_fx8010_playback_close()
1810 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_fx8010_playback_close()
1830 err = snd_pcm_new(emu->card, "emu10k1 efx", device, emu->audigy ? 0 : 8, 1, &pcm); in snd_emu10k1_pcm_efx()
1834 pcm->private_data = emu; in snd_emu10k1_pcm_efx()
1836 if (!emu->audigy) in snd_emu10k1_pcm_efx()
1840 pcm->info_flags = 0; in snd_emu10k1_pcm_efx()
1841 if (emu->audigy) in snd_emu10k1_pcm_efx()
1842 strcpy(pcm->name, "Multichannel Capture"); in snd_emu10k1_pcm_efx()
1844 strcpy(pcm->name, "Multichannel Capture/PT Playback"); in snd_emu10k1_pcm_efx()
1845 emu->pcm_efx = pcm; in snd_emu10k1_pcm_efx()
1847 if (!emu->card_capabilities->emu_model) { in snd_emu10k1_pcm_efx()
1849 // The mask determines which of these and the EXTOUTs the multi- in snd_emu10k1_pcm_efx()
1851 if (emu->audigy) { in snd_emu10k1_pcm_efx()
1852 emu->efx_voices_mask[0] = 0; in snd_emu10k1_pcm_efx()
1853 emu->efx_voices_mask[1] = 0xffff; in snd_emu10k1_pcm_efx()
1855 emu->efx_voices_mask[0] = 0xffff0000; in snd_emu10k1_pcm_efx()
1856 emu->efx_voices_mask[1] = 0; in snd_emu10k1_pcm_efx()
1860 return -ENOMEM; in snd_emu10k1_pcm_efx()
1861 kctl->id.device = device; in snd_emu10k1_pcm_efx()
1862 err = snd_ctl_add(emu->card, kctl); in snd_emu10k1_pcm_efx()
1866 // On E-MU cards, the DSP code copies the P16VINs/EMU32INs to in snd_emu10k1_pcm_efx()
1871 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &emu->pci->dev, in snd_emu10k1_pcm_efx()