Lines Matching refs:ypcm
272 pvoice->ypcm->use_441_slot = 0; in snd_ymfpci_voice_free()
275 pvoice->ypcm = NULL; in snd_ymfpci_voice_free()
287 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_pcm_interrupt() local
290 ypcm = voice->ypcm; in snd_ymfpci_pcm_interrupt()
291 if (!ypcm) in snd_ymfpci_pcm_interrupt()
293 if (ypcm->substream == NULL) in snd_ymfpci_pcm_interrupt()
296 if (ypcm->running) { in snd_ymfpci_pcm_interrupt()
298 if (pos < ypcm->last_pos) in snd_ymfpci_pcm_interrupt()
299 delta = pos + (ypcm->buffer_size - ypcm->last_pos); in snd_ymfpci_pcm_interrupt()
301 delta = pos - ypcm->last_pos; in snd_ymfpci_pcm_interrupt()
302 ypcm->period_pos += delta; in snd_ymfpci_pcm_interrupt()
303 ypcm->last_pos = pos; in snd_ymfpci_pcm_interrupt()
304 if (ypcm->period_pos >= ypcm->period_size) { in snd_ymfpci_pcm_interrupt()
311 ypcm->period_pos %= ypcm->period_size; in snd_ymfpci_pcm_interrupt()
313 snd_pcm_period_elapsed(ypcm->substream); in snd_ymfpci_pcm_interrupt()
317 if (unlikely(ypcm->update_pcm_vol)) { in snd_ymfpci_pcm_interrupt()
318 unsigned int subs = ypcm->substream->number; in snd_ymfpci_pcm_interrupt()
326 if (ypcm->output_rear) in snd_ymfpci_pcm_interrupt()
328 if (ypcm->voices[1]) in snd_ymfpci_pcm_interrupt()
329 bank = &ypcm->voices[1]->bank[next_bank]; in snd_ymfpci_pcm_interrupt()
332 if (ypcm->output_rear) in snd_ymfpci_pcm_interrupt()
334 ypcm->update_pcm_vol--; in snd_ymfpci_pcm_interrupt()
343 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_pcm_capture_interrupt() local
344 struct snd_ymfpci *chip = ypcm->chip; in snd_ymfpci_pcm_capture_interrupt()
348 if (ypcm->running) { in snd_ymfpci_pcm_capture_interrupt()
349 …pos = le32_to_cpu(chip->bank_capture[ypcm->capture_bank_number][chip->active_bank]->start) >> ypcm… in snd_ymfpci_pcm_capture_interrupt()
350 if (pos < ypcm->last_pos) in snd_ymfpci_pcm_capture_interrupt()
351 delta = pos + (ypcm->buffer_size - ypcm->last_pos); in snd_ymfpci_pcm_capture_interrupt()
353 delta = pos - ypcm->last_pos; in snd_ymfpci_pcm_capture_interrupt()
354 ypcm->period_pos += delta; in snd_ymfpci_pcm_capture_interrupt()
355 ypcm->last_pos = pos; in snd_ymfpci_pcm_capture_interrupt()
356 if (ypcm->period_pos >= ypcm->period_size) { in snd_ymfpci_pcm_capture_interrupt()
357 ypcm->period_pos %= ypcm->period_size; in snd_ymfpci_pcm_capture_interrupt()
376 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data; in snd_ymfpci_playback_trigger() local
381 if (ypcm->voices[0] == NULL) { in snd_ymfpci_playback_trigger()
389 chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr); in snd_ymfpci_playback_trigger()
390 if (ypcm->voices[1] != NULL && !ypcm->use_441_slot) in snd_ymfpci_playback_trigger()
391 chip->ctrl_playback[ypcm->voices[1]->number + 1] = cpu_to_le32(ypcm->voices[1]->bank_addr); in snd_ymfpci_playback_trigger()
392 ypcm->running = 1; in snd_ymfpci_playback_trigger()
395 if (substream->pcm == chip->pcm && !ypcm->use_441_slot) { in snd_ymfpci_playback_trigger()
402 chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0; in snd_ymfpci_playback_trigger()
403 if (ypcm->voices[1] != NULL && !ypcm->use_441_slot) in snd_ymfpci_playback_trigger()
404 chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0; in snd_ymfpci_playback_trigger()
405 ypcm->running = 0; in snd_ymfpci_playback_trigger()
421 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data; in snd_ymfpci_capture_trigger() local
430 tmp = snd_ymfpci_readl(chip, YDSXGR_MAPOFREC) | (1 << ypcm->capture_bank_number); in snd_ymfpci_capture_trigger()
432 ypcm->running = 1; in snd_ymfpci_capture_trigger()
437 tmp = snd_ymfpci_readl(chip, YDSXGR_MAPOFREC) & ~(1 << ypcm->capture_bank_number); in snd_ymfpci_capture_trigger()
439 ypcm->running = 0; in snd_ymfpci_capture_trigger()
449 static int snd_ymfpci_pcm_voice_alloc(struct snd_ymfpci_pcm *ypcm, int voices) in snd_ymfpci_pcm_voice_alloc() argument
453 if (ypcm->voices[1] != NULL && voices < 2) { in snd_ymfpci_pcm_voice_alloc()
454 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[1]); in snd_ymfpci_pcm_voice_alloc()
455 ypcm->voices[1] = NULL; in snd_ymfpci_pcm_voice_alloc()
457 if (voices == 1 && ypcm->voices[0] != NULL) in snd_ymfpci_pcm_voice_alloc()
459 if (voices == 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL) in snd_ymfpci_pcm_voice_alloc()
462 if (ypcm->voices[0] != NULL && ypcm->voices[1] == NULL) { in snd_ymfpci_pcm_voice_alloc()
463 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]); in snd_ymfpci_pcm_voice_alloc()
464 ypcm->voices[0] = NULL; in snd_ymfpci_pcm_voice_alloc()
467 err = snd_ymfpci_voice_alloc(ypcm->chip, YMFPCI_PCM, voices > 1, &ypcm->voices[0]); in snd_ymfpci_pcm_voice_alloc()
470 ypcm->voices[0]->ypcm = ypcm; in snd_ymfpci_pcm_voice_alloc()
471 ypcm->voices[0]->interrupt = snd_ymfpci_pcm_interrupt; in snd_ymfpci_pcm_voice_alloc()
473 ypcm->voices[1] = &ypcm->chip->voices[ypcm->voices[0]->number + 1]; in snd_ymfpci_pcm_voice_alloc()
474 ypcm->voices[1]->ypcm = ypcm; in snd_ymfpci_pcm_voice_alloc()
479 static void snd_ymfpci_pcm_init_voice(struct snd_ymfpci_pcm *ypcm, unsigned int voiceidx, in snd_ymfpci_pcm_init_voice() argument
483 struct snd_ymfpci_voice *voice = ypcm->voices[voiceidx]; in snd_ymfpci_pcm_init_voice()
504 vol_left = cpu_to_le32(ypcm->chip->pcm_mixer in snd_ymfpci_pcm_init_voice()
505 [ypcm->substream->number].left << 15); in snd_ymfpci_pcm_init_voice()
506 vol_right = cpu_to_le32(ypcm->chip->pcm_mixer in snd_ymfpci_pcm_init_voice()
507 [ypcm->substream->number].right << 15); in snd_ymfpci_pcm_init_voice()
512 spin_lock_irqsave(&ypcm->chip->voice_lock, flags); in snd_ymfpci_pcm_init_voice()
516 else if (ypcm->chip->device_id == PCI_DEVICE_ID_YAMAHA_754 && in snd_ymfpci_pcm_init_voice()
518 voiceidx == 0 && (ypcm->chip->src441_used == -1 || in snd_ymfpci_pcm_init_voice()
519 ypcm->chip->src441_used == voice->number)) { in snd_ymfpci_pcm_init_voice()
520 ypcm->chip->src441_used = voice->number; in snd_ymfpci_pcm_init_voice()
521 ypcm->use_441_slot = 1; in snd_ymfpci_pcm_init_voice()
524 if (ypcm->chip->src441_used == voice->number && in snd_ymfpci_pcm_init_voice()
526 ypcm->chip->src441_used = -1; in snd_ymfpci_pcm_init_voice()
527 ypcm->use_441_slot = 0; in snd_ymfpci_pcm_init_voice()
531 spin_unlock_irqrestore(&ypcm->chip->voice_lock, flags); in snd_ymfpci_pcm_init_voice()
537 bank->loop_end = cpu_to_le32(ypcm->buffer_size); in snd_ymfpci_pcm_init_voice()
546 if (ypcm->output_front) { in snd_ymfpci_pcm_init_voice()
556 if (ypcm->output_rear) { in snd_ymfpci_pcm_init_voice()
557 if (!ypcm->swap_rear) { in snd_ymfpci_pcm_init_voice()
624 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_playback_hw_params() local
627 err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params)); in snd_ymfpci_playback_hw_params()
637 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_playback_hw_free() local
641 ypcm = runtime->private_data; in snd_ymfpci_playback_hw_free()
645 if (ypcm->voices[1]) { in snd_ymfpci_playback_hw_free()
646 snd_ymfpci_voice_free(chip, ypcm->voices[1]); in snd_ymfpci_playback_hw_free()
647 ypcm->voices[1] = NULL; in snd_ymfpci_playback_hw_free()
649 if (ypcm->voices[0]) { in snd_ymfpci_playback_hw_free()
650 snd_ymfpci_voice_free(chip, ypcm->voices[0]); in snd_ymfpci_playback_hw_free()
651 ypcm->voices[0] = NULL; in snd_ymfpci_playback_hw_free()
660 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_playback_prepare() local
664 ypcm->period_size = runtime->period_size; in snd_ymfpci_playback_prepare()
665 ypcm->buffer_size = runtime->buffer_size; in snd_ymfpci_playback_prepare()
666 ypcm->period_pos = 0; in snd_ymfpci_playback_prepare()
667 ypcm->last_pos = 0; in snd_ymfpci_playback_prepare()
669 snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime, in snd_ymfpci_playback_prepare()
672 if (substream->pcm == chip->pcm && !ypcm->use_441_slot) { in snd_ymfpci_playback_prepare()
693 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_capture_prepare() local
698 ypcm->period_size = runtime->period_size; in snd_ymfpci_capture_prepare()
699 ypcm->buffer_size = runtime->buffer_size; in snd_ymfpci_capture_prepare()
700 ypcm->period_pos = 0; in snd_ymfpci_capture_prepare()
701 ypcm->last_pos = 0; in snd_ymfpci_capture_prepare()
702 ypcm->shift = 0; in snd_ymfpci_capture_prepare()
707 ypcm->shift++; in snd_ymfpci_capture_prepare()
712 ypcm->shift++; in snd_ymfpci_capture_prepare()
713 switch (ypcm->capture_bank_number) { in snd_ymfpci_capture_prepare()
724 bank = chip->bank_capture[ypcm->capture_bank_number][nbank]; in snd_ymfpci_capture_prepare()
726 bank->loop_end = cpu_to_le32(ypcm->buffer_size << ypcm->shift); in snd_ymfpci_capture_prepare()
737 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_playback_pointer() local
738 struct snd_ymfpci_voice *voice = ypcm->voices[0]; in snd_ymfpci_playback_pointer()
740 if (!(ypcm->running && voice)) in snd_ymfpci_playback_pointer()
749 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_capture_pointer() local
751 if (!ypcm->running) in snd_ymfpci_capture_pointer()
753 …return le32_to_cpu(chip->bank_capture[ypcm->capture_bank_number][chip->active_bank]->start) >> ypc… in snd_ymfpci_capture_pointer()
875 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_playback_open_1() local
889 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL); in snd_ymfpci_playback_open_1()
890 if (ypcm == NULL) in snd_ymfpci_playback_open_1()
892 ypcm->chip = chip; in snd_ymfpci_playback_open_1()
893 ypcm->type = PLAYBACK_VOICE; in snd_ymfpci_playback_open_1()
894 ypcm->substream = substream; in snd_ymfpci_playback_open_1()
895 runtime->private_data = ypcm; in snd_ymfpci_playback_open_1()
929 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_playback_open() local
935 ypcm = runtime->private_data; in snd_ymfpci_playback_open()
936 ypcm->output_front = 1; in snd_ymfpci_playback_open()
937 ypcm->output_rear = chip->mode_dup4ch ? 1 : 0; in snd_ymfpci_playback_open()
938 ypcm->swap_rear = 0; in snd_ymfpci_playback_open()
940 if (ypcm->output_rear) { in snd_ymfpci_playback_open()
952 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_playback_spdif_open() local
958 ypcm = runtime->private_data; in snd_ymfpci_playback_spdif_open()
959 ypcm->output_front = 0; in snd_ymfpci_playback_spdif_open()
960 ypcm->output_rear = 1; in snd_ymfpci_playback_spdif_open()
961 ypcm->swap_rear = 1; in snd_ymfpci_playback_spdif_open()
981 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_playback_4ch_open() local
987 ypcm = runtime->private_data; in snd_ymfpci_playback_4ch_open()
988 ypcm->output_front = 0; in snd_ymfpci_playback_4ch_open()
989 ypcm->output_rear = 1; in snd_ymfpci_playback_4ch_open()
990 ypcm->swap_rear = 0; in snd_ymfpci_playback_4ch_open()
1003 struct snd_ymfpci_pcm *ypcm; in snd_ymfpci_capture_open() local
1017 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL); in snd_ymfpci_capture_open()
1018 if (ypcm == NULL) in snd_ymfpci_capture_open()
1020 ypcm->chip = chip; in snd_ymfpci_capture_open()
1021 ypcm->type = capture_bank_number + CAPTURE_REC; in snd_ymfpci_capture_open()
1022 ypcm->substream = substream; in snd_ymfpci_capture_open()
1023 ypcm->capture_bank_number = capture_bank_number; in snd_ymfpci_capture_open()
1025 runtime->private_data = ypcm; in snd_ymfpci_capture_open()
1049 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data; in snd_ymfpci_playback_close() local
1052 if (ypcm->output_rear && chip->rear_opened > 0) { in snd_ymfpci_playback_close()
1094 struct snd_ymfpci_pcm *ypcm = runtime->private_data; in snd_ymfpci_capture_close() local
1096 if (ypcm != NULL) { in snd_ymfpci_capture_close()
1097 chip->capture_substream[ypcm->capture_bank_number] = NULL; in snd_ymfpci_capture_close()
1743 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data; in snd_ymfpci_pcm_vol_put() local
1744 if (!ypcm->use_441_slot) in snd_ymfpci_pcm_vol_put()
1745 ypcm->update_pcm_vol = 2; in snd_ymfpci_pcm_vol_put()