Lines Matching refs:pcmp
51 struct gus_pcm_private *pcmp = private_data; in snd_gf1_pcm_block_change_ack() local
53 if (pcmp) { in snd_gf1_pcm_block_change_ack()
54 atomic_dec(&pcmp->dma_count); in snd_gf1_pcm_block_change_ack()
55 wake_up(&pcmp->sleep); in snd_gf1_pcm_block_change_ack()
66 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_block_change() local
84 block.private_data = pcmp; in snd_gf1_pcm_block_change()
86 if (!snd_gf1_dma_transfer_block(pcmp->gus, &block, 0, 0)) in snd_gf1_pcm_block_change()
87 atomic_inc(&pcmp->dma_count); in snd_gf1_pcm_block_change()
94 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_trigger_up() local
95 struct snd_gus_card * gus = pcmp->gus; in snd_gf1_pcm_trigger_up()
104 spin_lock_irqsave(&pcmp->lock, flags); in snd_gf1_pcm_trigger_up()
105 if (pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE) { in snd_gf1_pcm_trigger_up()
106 spin_unlock_irqrestore(&pcmp->lock, flags); in snd_gf1_pcm_trigger_up()
109 pcmp->flags |= SNDRV_GF1_PCM_PFLG_ACTIVE; in snd_gf1_pcm_trigger_up()
110 pcmp->final_volume = 0; in snd_gf1_pcm_trigger_up()
111 spin_unlock_irqrestore(&pcmp->lock, flags); in snd_gf1_pcm_trigger_up()
117 if (pcmp->blocks == 1) { in snd_gf1_pcm_trigger_up()
121 for (voice = 0; voice < pcmp->voices; voice++) { in snd_gf1_pcm_trigger_up()
122 begin = pcmp->memory + voice * (pcmp->dma_size / runtime->channels); in snd_gf1_pcm_trigger_up()
123 curr = begin + (pcmp->bpos * pcmp->block_size) / runtime->channels; in snd_gf1_pcm_trigger_up()
124 end = curr + (pcmp->block_size / runtime->channels); in snd_gf1_pcm_trigger_up()
134 snd_gf1_select_voice(gus, pcmp->pvoices[voice]->number); in snd_gf1_pcm_trigger_up()
152 for (voice = 0; voice < pcmp->voices; voice++) { in snd_gf1_pcm_trigger_up()
153 snd_gf1_select_voice(gus, pcmp->pvoices[voice]->number); in snd_gf1_pcm_trigger_up()
162 for (voice = 0; voice < pcmp->voices; voice++) { in snd_gf1_pcm_trigger_up()
163 snd_gf1_select_voice(gus, pcmp->pvoices[voice]->number); in snd_gf1_pcm_trigger_up()
174 struct gus_pcm_private * pcmp; in snd_gf1_pcm_interrupt_wave() local
185 pcmp = pvoice->private_data; in snd_gf1_pcm_interrupt_wave()
186 if (pcmp == NULL) { in snd_gf1_pcm_interrupt_wave()
191 gus = pcmp->gus; in snd_gf1_pcm_interrupt_wave()
192 runtime = pcmp->substream->runtime; in snd_gf1_pcm_interrupt_wave()
202 snd_gf1_select_voice(gus, pcmp->pvoices[1]->number); in snd_gf1_pcm_interrupt_wave()
207 pcmp->bpos++; in snd_gf1_pcm_interrupt_wave()
208 pcmp->bpos %= pcmp->blocks; in snd_gf1_pcm_interrupt_wave()
209 if (pcmp->bpos + 1 >= pcmp->blocks) { /* last block? */ in snd_gf1_pcm_interrupt_wave()
214 end = pcmp->memory + (((pcmp->bpos + 1) * pcmp->block_size) / runtime->channels); in snd_gf1_pcm_interrupt_wave()
216 step = pcmp->dma_size / runtime->channels; in snd_gf1_pcm_interrupt_wave()
218 if (!pcmp->final_volume) { in snd_gf1_pcm_interrupt_wave()
222 for (idx = 0; idx < pcmp->voices; idx++, end += step) { in snd_gf1_pcm_interrupt_wave()
223 snd_gf1_select_voice(gus, pcmp->pvoices[idx]->number); in snd_gf1_pcm_interrupt_wave()
232 for (idx = 0; idx < pcmp->voices; idx++) { in snd_gf1_pcm_interrupt_wave()
233 snd_gf1_select_voice(gus, pcmp->pvoices[idx]->number); in snd_gf1_pcm_interrupt_wave()
241 snd_pcm_period_elapsed(pcmp->substream); in snd_gf1_pcm_interrupt_wave()
245 end = pcmp->bpos * pcmp->block_size; in snd_gf1_pcm_interrupt_wave()
247 snd_gf1_pcm_block_change(pcmp->substream, end, pcmp->memory + (end / 2), pcmp->block_size / 2); in snd_gf1_pcm_interrupt_wave()
248 …snd_gf1_pcm_block_change(pcmp->substream, end + (pcmp->block_size / 2), pcmp->memory + (pcmp->dma_… in snd_gf1_pcm_interrupt_wave()
250 snd_gf1_pcm_block_change(pcmp->substream, end, pcmp->memory + end, pcmp->block_size); in snd_gf1_pcm_interrupt_wave()
261 struct gus_pcm_private *pcmp = pvoice->private_data; in snd_gf1_pcm_interrupt_volume() local
268 if (pcmp == NULL) in snd_gf1_pcm_interrupt_volume()
271 if (!(pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE)) in snd_gf1_pcm_interrupt_volume()
274 cvoice = pcmp->pvoices[0] == pvoice ? 0 : 1; in snd_gf1_pcm_interrupt_volume()
275 if (pcmp->substream == NULL) in snd_gf1_pcm_interrupt_volume()
281 pcmp->final_volume = 1; in snd_gf1_pcm_interrupt_volume()
341 static int get_bpos(struct gus_pcm_private *pcmp, int voice, unsigned int pos, in get_bpos() argument
344 unsigned int bpos = pos + (voice * (pcmp->dma_size / 2)); in get_bpos()
345 if (snd_BUG_ON(bpos > pcmp->dma_size)) in get_bpos()
347 if (snd_BUG_ON(bpos + len > pcmp->dma_size)) in get_bpos()
356 struct gus_pcm_private *pcmp = runtime->private_data; in playback_copy_ack() local
357 struct snd_gus_card *gus = pcmp->gus; in playback_copy_ack()
362 pcmp->memory + bpos, len); in playback_copy_ack()
367 pcmp->memory + bpos, len, w16, invert); in playback_copy_ack()
375 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_copy() local
379 bpos = get_bpos(pcmp, voice, pos, len); in snd_gf1_pcm_playback_copy()
392 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_silence() local
396 bpos = get_bpos(pcmp, voice, pos, len); in snd_gf1_pcm_playback_silence()
409 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_hw_params() local
413 if (pcmp->memory > 0) { in snd_gf1_pcm_playback_hw_params()
414 snd_gf1_mem_free(&gus->gf1.mem_alloc, pcmp->memory); in snd_gf1_pcm_playback_hw_params()
415 pcmp->memory = 0; in snd_gf1_pcm_playback_hw_params()
424 pcmp->memory = block->ptr; in snd_gf1_pcm_playback_hw_params()
426 pcmp->voices = params_channels(hw_params); in snd_gf1_pcm_playback_hw_params()
427 if (pcmp->pvoices[0] == NULL) { in snd_gf1_pcm_playback_hw_params()
428 pcmp->pvoices[0] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0); in snd_gf1_pcm_playback_hw_params()
429 if (!pcmp->pvoices[0]) in snd_gf1_pcm_playback_hw_params()
431 pcmp->pvoices[0]->handler_wave = snd_gf1_pcm_interrupt_wave; in snd_gf1_pcm_playback_hw_params()
432 pcmp->pvoices[0]->handler_volume = snd_gf1_pcm_interrupt_volume; in snd_gf1_pcm_playback_hw_params()
433 pcmp->pvoices[0]->volume_change = snd_gf1_pcm_volume_change; in snd_gf1_pcm_playback_hw_params()
434 pcmp->pvoices[0]->private_data = pcmp; in snd_gf1_pcm_playback_hw_params()
436 if (pcmp->voices > 1 && pcmp->pvoices[1] == NULL) { in snd_gf1_pcm_playback_hw_params()
437 pcmp->pvoices[1] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0); in snd_gf1_pcm_playback_hw_params()
438 if (!pcmp->pvoices[1]) in snd_gf1_pcm_playback_hw_params()
440 pcmp->pvoices[1]->handler_wave = snd_gf1_pcm_interrupt_wave; in snd_gf1_pcm_playback_hw_params()
441 pcmp->pvoices[1]->handler_volume = snd_gf1_pcm_interrupt_volume; in snd_gf1_pcm_playback_hw_params()
442 pcmp->pvoices[1]->volume_change = snd_gf1_pcm_volume_change; in snd_gf1_pcm_playback_hw_params()
443 pcmp->pvoices[1]->private_data = pcmp; in snd_gf1_pcm_playback_hw_params()
444 } else if (pcmp->voices == 1) { in snd_gf1_pcm_playback_hw_params()
445 if (pcmp->pvoices[1]) { in snd_gf1_pcm_playback_hw_params()
446 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[1]); in snd_gf1_pcm_playback_hw_params()
447 pcmp->pvoices[1] = NULL; in snd_gf1_pcm_playback_hw_params()
456 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_hw_free() local
458 if (pcmp->pvoices[0]) { in snd_gf1_pcm_playback_hw_free()
459 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[0]); in snd_gf1_pcm_playback_hw_free()
460 pcmp->pvoices[0] = NULL; in snd_gf1_pcm_playback_hw_free()
462 if (pcmp->pvoices[1]) { in snd_gf1_pcm_playback_hw_free()
463 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[1]); in snd_gf1_pcm_playback_hw_free()
464 pcmp->pvoices[1] = NULL; in snd_gf1_pcm_playback_hw_free()
466 if (pcmp->memory > 0) { in snd_gf1_pcm_playback_hw_free()
467 snd_gf1_mem_free(&pcmp->gus->gf1.mem_alloc, pcmp->memory); in snd_gf1_pcm_playback_hw_free()
468 pcmp->memory = 0; in snd_gf1_pcm_playback_hw_free()
476 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_prepare() local
478 pcmp->bpos = 0; in snd_gf1_pcm_playback_prepare()
479 pcmp->dma_size = snd_pcm_lib_buffer_bytes(substream); in snd_gf1_pcm_playback_prepare()
480 pcmp->block_size = snd_pcm_lib_period_bytes(substream); in snd_gf1_pcm_playback_prepare()
481 pcmp->blocks = pcmp->dma_size / pcmp->block_size; in snd_gf1_pcm_playback_prepare()
490 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_trigger() local
496 spin_lock(&pcmp->lock); in snd_gf1_pcm_playback_trigger()
497 pcmp->flags &= ~SNDRV_GF1_PCM_PFLG_ACTIVE; in snd_gf1_pcm_playback_trigger()
498 spin_unlock(&pcmp->lock); in snd_gf1_pcm_playback_trigger()
499 voice = pcmp->pvoices[0]->number; in snd_gf1_pcm_playback_trigger()
501 if (pcmp->pvoices[1]) { in snd_gf1_pcm_playback_trigger()
502 voice = pcmp->pvoices[1]->number; in snd_gf1_pcm_playback_trigger()
515 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_pointer() local
521 if (pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE) { in snd_gf1_pcm_playback_pointer()
522 snd_gf1_select_voice(gus, pcmp->pvoices[0]->number); in snd_gf1_pcm_playback_pointer()
524 pos = (snd_gf1_read_addr(gus, SNDRV_GF1_VA_CURRENT, voice_ctrl & 4) >> 4) - pcmp->memory; in snd_gf1_pcm_playback_pointer()
659 struct gus_pcm_private *pcmp; in snd_gf1_pcm_playback_open() local
664 pcmp = kzalloc(sizeof(*pcmp), GFP_KERNEL); in snd_gf1_pcm_playback_open()
665 if (pcmp == NULL) in snd_gf1_pcm_playback_open()
667 pcmp->gus = gus; in snd_gf1_pcm_playback_open()
668 spin_lock_init(&pcmp->lock); in snd_gf1_pcm_playback_open()
669 init_waitqueue_head(&pcmp->sleep); in snd_gf1_pcm_playback_open()
670 atomic_set(&pcmp->dma_count, 0); in snd_gf1_pcm_playback_open()
672 runtime->private_data = pcmp; in snd_gf1_pcm_playback_open()
682 pcmp->flags = SNDRV_GF1_PCM_PFLG_NONE; in snd_gf1_pcm_playback_open()
683 pcmp->substream = substream; in snd_gf1_pcm_playback_open()
695 struct gus_pcm_private *pcmp = runtime->private_data; in snd_gf1_pcm_playback_close() local
697 if (!wait_event_timeout(pcmp->sleep, (atomic_read(&pcmp->dma_count) <= 0), 2*HZ)) in snd_gf1_pcm_playback_close()
756 struct gus_pcm_private *pcmp; in snd_gf1_pcm_volume_put() local
775 pcmp = pvoice->private_data; in snd_gf1_pcm_volume_put()
776 if (!(pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE)) in snd_gf1_pcm_volume_put()
782 …vol = pvoice == pcmp->pvoices[0] ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_righ… in snd_gf1_pcm_volume_put()
784 pcmp->final_volume = 1; in snd_gf1_pcm_volume_put()