aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/oxygen/oxygen.c11
-rw-r--r--sound/pci/oxygen/oxygen.h2
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c72
-rw-r--r--sound/pci/oxygen/virtuoso.c5
4 files changed, 64 insertions, 26 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 83c6fab425fe..e2dda16d5dcc 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -256,6 +256,11 @@ static const struct oxygen_model model_generic = {
256 .update_dac_volume = update_ak4396_volume, 256 .update_dac_volume = update_ak4396_volume,
257 .update_dac_mute = update_ak4396_mute, 257 .update_dac_mute = update_ak4396_mute,
258 .dac_tlv = ak4396_db_scale, 258 .dac_tlv = ak4396_db_scale,
259 .used_channels = OXYGEN_CHANNEL_A |
260 OXYGEN_CHANNEL_C |
261 OXYGEN_CHANNEL_SPDIF |
262 OXYGEN_CHANNEL_MULTICH |
263 OXYGEN_CHANNEL_AC97,
259 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5, 264 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5,
260}; 265};
261static const struct oxygen_model model_meridian = { 266static const struct oxygen_model model_meridian = {
@@ -270,7 +275,11 @@ static const struct oxygen_model model_meridian = {
270 .update_dac_volume = update_ak4396_volume, 275 .update_dac_volume = update_ak4396_volume,
271 .update_dac_mute = update_ak4396_mute, 276 .update_dac_mute = update_ak4396_mute,
272 .dac_tlv = ak4396_db_scale, 277 .dac_tlv = ak4396_db_scale,
273 .record_from_dma_b = 1, 278 .used_channels = OXYGEN_CHANNEL_B |
279 OXYGEN_CHANNEL_C |
280 OXYGEN_CHANNEL_SPDIF |
281 OXYGEN_CHANNEL_MULTICH |
282 OXYGEN_CHANNEL_AC97,
274 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5, 283 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5,
275}; 284};
276 285
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index fb9cb36b87b1..9b0234d81d4e 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -80,7 +80,7 @@ struct oxygen_model {
80 void (*update_dac_volume)(struct oxygen *chip); 80 void (*update_dac_volume)(struct oxygen *chip);
81 void (*update_dac_mute)(struct oxygen *chip); 81 void (*update_dac_mute)(struct oxygen *chip);
82 const unsigned int *dac_tlv; 82 const unsigned int *dac_tlv;
83 u8 record_from_dma_b; 83 u8 used_channels;
84 u8 cd_in_from_video_in; 84 u8 cd_in_from_video_in;
85 u8 dac_minimum_volume; 85 u8 dac_minimum_volume;
86 u8 function_flags; 86 u8 function_flags;
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index 0f67defc2b2d..5f15d355a431 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -681,15 +681,22 @@ static void oxygen_pcm_free(struct snd_pcm *pcm)
681int __devinit oxygen_pcm_init(struct oxygen *chip) 681int __devinit oxygen_pcm_init(struct oxygen *chip)
682{ 682{
683 struct snd_pcm *pcm; 683 struct snd_pcm *pcm;
684 int outs, ins;
684 int err; 685 int err;
685 686
686 err = snd_pcm_new(chip->card, "Analog", 0, 1, 1, &pcm); 687 outs = 1; /* OXYGEN_CHANNEL_MULTICH is always used */
688 ins = !!(chip->model->used_channels & (OXYGEN_CHANNEL_A |
689 OXYGEN_CHANNEL_B));
690 err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm);
687 if (err < 0) 691 if (err < 0)
688 return err; 692 return err;
689 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &oxygen_multich_ops); 693 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &oxygen_multich_ops);
690 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 694 if (chip->model->used_channels & OXYGEN_CHANNEL_A)
691 chip->model->record_from_dma_b ? 695 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
692 &oxygen_rec_b_ops : &oxygen_rec_a_ops); 696 &oxygen_rec_a_ops);
697 else if (chip->model->used_channels & OXYGEN_CHANNEL_B)
698 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
699 &oxygen_rec_b_ops);
693 pcm->private_data = chip; 700 pcm->private_data = chip;
694 pcm->private_free = oxygen_pcm_free; 701 pcm->private_free = oxygen_pcm_free;
695 strcpy(pcm->name, "Analog"); 702 strcpy(pcm->name, "Analog");
@@ -697,32 +704,51 @@ int __devinit oxygen_pcm_init(struct oxygen *chip)
697 SNDRV_DMA_TYPE_DEV, 704 SNDRV_DMA_TYPE_DEV,
698 snd_dma_pci_data(chip->pci), 705 snd_dma_pci_data(chip->pci),
699 512 * 1024, 2048 * 1024); 706 512 * 1024, 2048 * 1024);
700 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 707 if (ins)
701 SNDRV_DMA_TYPE_DEV, 708 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
702 snd_dma_pci_data(chip->pci), 709 SNDRV_DMA_TYPE_DEV,
703 128 * 1024, 256 * 1024);
704
705 err = snd_pcm_new(chip->card, "Digital", 1, 1, 1, &pcm);
706 if (err < 0)
707 return err;
708 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &oxygen_spdif_ops);
709 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &oxygen_rec_c_ops);
710 pcm->private_data = chip;
711 pcm->private_free = oxygen_pcm_free;
712 strcpy(pcm->name, "Digital");
713 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
714 snd_dma_pci_data(chip->pci), 710 snd_dma_pci_data(chip->pci),
715 128 * 1024, 256 * 1024); 711 128 * 1024, 256 * 1024);
716 712
717 if (chip->has_ac97_1) { 713 outs = !!(chip->model->used_channels & OXYGEN_CHANNEL_SPDIF);
718 err = snd_pcm_new(chip->card, "AC97", 2, 1, 0, &pcm); 714 ins = !!(chip->model->used_channels & OXYGEN_CHANNEL_C);
715 if (outs | ins) {
716 err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm);
717 if (err < 0)
718 return err;
719 if (outs)
720 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
721 &oxygen_spdif_ops);
722 if (ins)
723 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
724 &oxygen_rec_c_ops);
725 pcm->private_data = chip;
726 pcm->private_free = oxygen_pcm_free;
727 strcpy(pcm->name, "Digital");
728 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
729 snd_dma_pci_data(chip->pci),
730 128 * 1024, 256 * 1024);
731 }
732
733 outs = chip->has_ac97_1 &&
734 (chip->model->used_channels & OXYGEN_CHANNEL_AC97);
735 ins = (chip->model->used_channels & (OXYGEN_CHANNEL_A |
736 OXYGEN_CHANNEL_B))
737 == (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B);
738 if (outs | ins) {
739 err = snd_pcm_new(chip->card, ins ? "Analog2" : "AC97",
740 2, outs, ins, &pcm);
719 if (err < 0) 741 if (err < 0)
720 return err; 742 return err;
721 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 743 if (outs)
722 &oxygen_ac97_ops); 744 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
745 &oxygen_ac97_ops);
746 if (ins)
747 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
748 &oxygen_rec_b_ops);
723 pcm->private_data = chip; 749 pcm->private_data = chip;
724 pcm->private_free = oxygen_pcm_free; 750 pcm->private_free = oxygen_pcm_free;
725 strcpy(pcm->name, "Front Panel"); 751 strcpy(pcm->name, ins ? "Analog 2" : "Front Panel");
726 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 752 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
727 snd_dma_pci_data(chip->pci), 753 snd_dma_pci_data(chip->pci),
728 128 * 1024, 256 * 1024); 754 128 * 1024, 256 * 1024);
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 247d5e1ccb68..0574fa19dca6 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -224,7 +224,10 @@ static const struct oxygen_model model_xonar = {
224 .update_dac_volume = update_pcm1796_volume, 224 .update_dac_volume = update_pcm1796_volume,
225 .update_dac_mute = update_pcm1796_mute, 225 .update_dac_mute = update_pcm1796_mute,
226 .dac_tlv = pcm1796_db_scale, 226 .dac_tlv = pcm1796_db_scale,
227 .record_from_dma_b = 1, 227 .used_channels = OXYGEN_CHANNEL_B |
228 OXYGEN_CHANNEL_C |
229 OXYGEN_CHANNEL_SPDIF |
230 OXYGEN_CHANNEL_MULTICH,
228 .cd_in_from_video_in = 1, 231 .cd_in_from_video_in = 1,
229 .dac_minimum_volume = 15, 232 .dac_minimum_volume = 15,
230 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5, 233 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5,