Lines Matching refs:ypcm

277 		pvoice->ypcm->use_441_slot = 0;
280 pvoice->ypcm = NULL;
292 struct snd_ymfpci_pcm *ypcm;
295 ypcm = voice->ypcm;
296 if (!ypcm)
298 if (ypcm->substream == NULL)
301 if (ypcm->running) {
303 if (pos < ypcm->last_pos)
304 delta = pos + (ypcm->buffer_size - ypcm->last_pos);
306 delta = pos - ypcm->last_pos;
307 ypcm->period_pos += delta;
308 ypcm->last_pos = pos;
309 if (ypcm->period_pos >= ypcm->period_size) {
316 ypcm->period_pos %= ypcm->period_size;
318 snd_pcm_period_elapsed(ypcm->substream);
322 if (unlikely(ypcm->update_pcm_vol)) {
323 unsigned int subs = ypcm->substream->number;
331 if (ypcm->output_rear)
333 if (ypcm->voices[1])
334 bank = &ypcm->voices[1]->bank[next_bank];
337 if (ypcm->output_rear)
339 ypcm->update_pcm_vol--;
348 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
349 struct snd_ymfpci *chip = ypcm->chip;
353 if (ypcm->running) {
354 pos = le32_to_cpu(chip->bank_capture[ypcm->capture_bank_number][chip->active_bank]->start) >> ypcm->shift;
355 if (pos < ypcm->last_pos)
356 delta = pos + (ypcm->buffer_size - ypcm->last_pos);
358 delta = pos - ypcm->last_pos;
359 ypcm->period_pos += delta;
360 ypcm->last_pos = pos;
361 if (ypcm->period_pos >= ypcm->period_size) {
362 ypcm->period_pos %= ypcm->period_size;
381 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
386 if (ypcm->voices[0] == NULL) {
394 chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr);
395 if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
396 chip->ctrl_playback[ypcm->voices[1]->number + 1] = cpu_to_le32(ypcm->voices[1]->bank_addr);
397 ypcm->running = 1;
400 if (substream->pcm == chip->pcm && !ypcm->use_441_slot) {
407 chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
408 if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
409 chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0;
410 ypcm->running = 0;
426 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
435 tmp = snd_ymfpci_readl(chip, YDSXGR_MAPOFREC) | (1 << ypcm->capture_bank_number);
437 ypcm->running = 1;
442 tmp = snd_ymfpci_readl(chip, YDSXGR_MAPOFREC) & ~(1 << ypcm->capture_bank_number);
444 ypcm->running = 0;
454 static int snd_ymfpci_pcm_voice_alloc(struct snd_ymfpci_pcm *ypcm, int voices)
458 if (ypcm->voices[1] != NULL && voices < 2) {
459 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[1]);
460 ypcm->voices[1] = NULL;
462 if (voices == 1 && ypcm->voices[0] != NULL)
464 if (voices == 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL)
467 if (ypcm->voices[0] != NULL && ypcm->voices[1] == NULL) {
468 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]);
469 ypcm->voices[0] = NULL;
472 err = snd_ymfpci_voice_alloc(ypcm->chip, YMFPCI_PCM, voices > 1, &ypcm->voices[0]);
475 ypcm->voices[0]->ypcm = ypcm;
476 ypcm->voices[0]->interrupt = snd_ymfpci_pcm_interrupt;
478 ypcm->voices[1] = &ypcm->chip->voices[ypcm->voices[0]->number + 1];
479 ypcm->voices[1]->ypcm = ypcm;
484 static void snd_ymfpci_pcm_init_voice(struct snd_ymfpci_pcm *ypcm, unsigned int voiceidx,
488 struct snd_ymfpci_voice *voice = ypcm->voices[voiceidx];
509 vol_left = cpu_to_le32(ypcm->chip->pcm_mixer
510 [ypcm->substream->number].left << 15);
511 vol_right = cpu_to_le32(ypcm->chip->pcm_mixer
512 [ypcm->substream->number].right << 15);
517 spin_lock_irqsave(&ypcm->chip->voice_lock, flags);
521 else if (ypcm->chip->device_id == PCI_DEVICE_ID_YAMAHA_754 &&
523 voiceidx == 0 && (ypcm->chip->src441_used == -1 ||
524 ypcm->chip->src441_used == voice->number)) {
525 ypcm->chip->src441_used = voice->number;
526 ypcm->use_441_slot = 1;
529 if (ypcm->chip->src441_used == voice->number &&
531 ypcm->chip->src441_used = -1;
532 ypcm->use_441_slot = 0;
536 spin_unlock_irqrestore(&ypcm->chip->voice_lock, flags);
542 bank->loop_end = cpu_to_le32(ypcm->buffer_size);
551 if (ypcm->output_front) {
561 if (ypcm->output_rear) {
562 if (!ypcm->swap_rear) {
629 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
632 err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params));
642 struct snd_ymfpci_pcm *ypcm;
646 ypcm = runtime->private_data;
650 if (ypcm->voices[1]) {
651 snd_ymfpci_voice_free(chip, ypcm->voices[1]);
652 ypcm->voices[1] = NULL;
654 if (ypcm->voices[0]) {
655 snd_ymfpci_voice_free(chip, ypcm->voices[0]);
656 ypcm->voices[0] = NULL;
665 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
669 ypcm->period_size = runtime->period_size;
670 ypcm->buffer_size = runtime->buffer_size;
671 ypcm->period_pos = 0;
672 ypcm->last_pos = 0;
674 snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime,
677 if (substream->pcm == chip->pcm && !ypcm->use_441_slot) {
698 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
703 ypcm->period_size = runtime->period_size;
704 ypcm->buffer_size = runtime->buffer_size;
705 ypcm->period_pos = 0;
706 ypcm->last_pos = 0;
707 ypcm->shift = 0;
712 ypcm->shift++;
717 ypcm->shift++;
718 switch (ypcm->capture_bank_number) {
729 bank = chip->bank_capture[ypcm->capture_bank_number][nbank];
731 bank->loop_end = cpu_to_le32(ypcm->buffer_size << ypcm->shift);
742 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
743 struct snd_ymfpci_voice *voice = ypcm->voices[0];
745 if (!(ypcm->running && voice))
754 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
756 if (!ypcm->running)
758 return le32_to_cpu(chip->bank_capture[ypcm->capture_bank_number][chip->active_bank]->start) >> ypcm->shift;
880 struct snd_ymfpci_pcm *ypcm;
894 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
895 if (ypcm == NULL)
897 ypcm->chip = chip;
898 ypcm->type = PLAYBACK_VOICE;
899 ypcm->substream = substream;
900 runtime->private_data = ypcm;
934 struct snd_ymfpci_pcm *ypcm;
940 ypcm = runtime->private_data;
941 ypcm->output_front = 1;
942 ypcm->output_rear = chip->mode_dup4ch ? 1 : 0;
943 ypcm->swap_rear = 0;
945 if (ypcm->output_rear) {
957 struct snd_ymfpci_pcm *ypcm;
963 ypcm = runtime->private_data;
964 ypcm->output_front = 0;
965 ypcm->output_rear = 1;
966 ypcm->swap_rear = 1;
986 struct snd_ymfpci_pcm *ypcm;
992 ypcm = runtime->private_data;
993 ypcm->output_front = 0;
994 ypcm->output_rear = 1;
995 ypcm->swap_rear = 0;
1008 struct snd_ymfpci_pcm *ypcm;
1022 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
1023 if (ypcm == NULL)
1025 ypcm->chip = chip;
1026 ypcm->type = capture_bank_number + CAPTURE_REC;
1027 ypcm->substream = substream;
1028 ypcm->capture_bank_number = capture_bank_number;
1030 runtime->private_data = ypcm;
1054 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
1057 if (ypcm->output_rear && chip->rear_opened > 0) {
1099 struct snd_ymfpci_pcm *ypcm = runtime->private_data;
1101 if (ypcm != NULL) {
1102 chip->capture_substream[ypcm->capture_bank_number] = NULL;
1748 struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
1749 if (!ypcm->use_441_slot)
1750 ypcm->update_pcm_vol = 2;