Lines Matching refs:ypcm

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