aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen_pcm.c')
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c78
1 files changed, 42 insertions, 36 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index b70046aca657..b17c405e069d 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -119,7 +119,7 @@ static int oxygen_open(struct snd_pcm_substream *substream,
119 119
120 runtime->private_data = (void *)(uintptr_t)channel; 120 runtime->private_data = (void *)(uintptr_t)channel;
121 if (channel == PCM_B && chip->has_ac97_1 && 121 if (channel == PCM_B && chip->has_ac97_1 &&
122 (chip->model->used_channels & OXYGEN_CHANNEL_AC97)) 122 (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1))
123 runtime->hw = oxygen_ac97_hardware; 123 runtime->hw = oxygen_ac97_hardware;
124 else 124 else
125 runtime->hw = *oxygen_hardware[channel]; 125 runtime->hw = *oxygen_hardware[channel];
@@ -365,7 +365,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
365 return err; 365 return err;
366 366
367 is_ac97 = chip->has_ac97_1 && 367 is_ac97 = chip->has_ac97_1 &&
368 (chip->model->used_channels & OXYGEN_CHANNEL_AC97); 368 (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
369 369
370 spin_lock_irq(&chip->reg_lock); 370 spin_lock_irq(&chip->reg_lock);
371 oxygen_write8_masked(chip, OXYGEN_REC_FORMAT, 371 oxygen_write8_masked(chip, OXYGEN_REC_FORMAT,
@@ -640,34 +640,39 @@ int oxygen_pcm_init(struct oxygen *chip)
640 int outs, ins; 640 int outs, ins;
641 int err; 641 int err;
642 642
643 outs = 1; /* OXYGEN_CHANNEL_MULTICH is always used */ 643 outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_0_TO_I2S);
644 ins = !!(chip->model->used_channels & (OXYGEN_CHANNEL_A | 644 ins = !!(chip->model->pcm_dev_cfg & (CAPTURE_0_FROM_I2S_1 |
645 OXYGEN_CHANNEL_B)); 645 CAPTURE_0_FROM_I2S_2));
646 err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm); 646 if (outs | ins) {
647 if (err < 0) 647 err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm);
648 return err; 648 if (err < 0)
649 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &oxygen_multich_ops); 649 return err;
650 if (chip->model->used_channels & OXYGEN_CHANNEL_A) 650 if (outs)
651 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 651 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
652 &oxygen_rec_a_ops); 652 &oxygen_multich_ops);
653 else if (chip->model->used_channels & OXYGEN_CHANNEL_B) 653 if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_1)
654 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 654 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
655 &oxygen_rec_b_ops); 655 &oxygen_rec_a_ops);
656 pcm->private_data = chip; 656 else if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_2)
657 pcm->private_free = oxygen_pcm_free; 657 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
658 strcpy(pcm->name, "Analog"); 658 &oxygen_rec_b_ops);
659 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, 659 pcm->private_data = chip;
660 SNDRV_DMA_TYPE_DEV, 660 pcm->private_free = oxygen_pcm_free;
661 snd_dma_pci_data(chip->pci), 661 strcpy(pcm->name, "Analog");
662 512 * 1024, 2048 * 1024); 662 if (outs)
663 if (ins) 663 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
664 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 664 SNDRV_DMA_TYPE_DEV,
665 SNDRV_DMA_TYPE_DEV, 665 snd_dma_pci_data(chip->pci),
666 snd_dma_pci_data(chip->pci), 666 512 * 1024, 2048 * 1024);
667 128 * 1024, 256 * 1024); 667 if (ins)
668 668 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
669 outs = !!(chip->model->used_channels & OXYGEN_CHANNEL_SPDIF); 669 SNDRV_DMA_TYPE_DEV,
670 ins = !!(chip->model->used_channels & OXYGEN_CHANNEL_C); 670 snd_dma_pci_data(chip->pci),
671 128 * 1024, 256 * 1024);
672 }
673
674 outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF);
675 ins = !!(chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF);
671 if (outs | ins) { 676 if (outs | ins) {
672 err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm); 677 err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm);
673 if (err < 0) 678 if (err < 0)
@@ -686,12 +691,13 @@ int oxygen_pcm_init(struct oxygen *chip)
686 128 * 1024, 256 * 1024); 691 128 * 1024, 256 * 1024);
687 } 692 }
688 693
689 outs = chip->has_ac97_1 && 694 if (chip->has_ac97_1) {
690 (chip->model->used_channels & OXYGEN_CHANNEL_AC97); 695 outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_2_TO_AC97_1);
691 ins = outs || 696 ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
692 (chip->model->used_channels & (OXYGEN_CHANNEL_A | 697 } else {
693 OXYGEN_CHANNEL_B)) 698 outs = 0;
694 == (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B); 699 ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_I2S_2);
700 }
695 if (outs | ins) { 701 if (outs | ins) {
696 err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2", 702 err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2",
697 2, outs, ins, &pcm); 703 2, outs, ins, &pcm);