summaryrefslogtreecommitdiff
path: root/sound/pci/oxygen/oxygen_pcm.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-03-19 08:19:41 +0100
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:28 +0200
commitf009ad9b39e6484d8e36e9e5029c07eab8c12e8f (patch)
tree79b4bc6bb9c9b9cbf5a410fc8e83120b46bdb310 /sound/pci/oxygen/oxygen_pcm.c
parentfa5d8106cb52e5df28673f59cc25af520dc83382 (diff)
[ALSA] oxygen: change model-specific PCM device configuration
When specifying which PCM devices to use, model drivers now use flags that also specify the routing between PCM devices and DMA channels instead of just DMA channel bits. This simplifies some code that checks for these flags. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
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,
runtime->private_data = (void *)(uintptr_t)channel;
if (channel == PCM_B && chip->has_ac97_1 &&
- (chip->model->used_channels & OXYGEN_CHANNEL_AC97))
+ (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1))
runtime->hw = oxygen_ac97_hardware;
else
runtime->hw = *oxygen_hardware[channel];
@@ -365,7 +365,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
return err;
is_ac97 = chip->has_ac97_1 &&
- (chip->model->used_channels & OXYGEN_CHANNEL_AC97);
+ (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
spin_lock_irq(&chip->reg_lock);
oxygen_write8_masked(chip, OXYGEN_REC_FORMAT,
@@ -640,34 +640,39 @@ int oxygen_pcm_init(struct oxygen *chip)
int outs, ins;
int err;
- outs = 1; /* OXYGEN_CHANNEL_MULTICH is always used */
- ins = !!(chip->model->used_channels & (OXYGEN_CHANNEL_A |
- OXYGEN_CHANNEL_B));
- err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm);
- if (err < 0)
- return err;
- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &oxygen_multich_ops);
- if (chip->model->used_channels & OXYGEN_CHANNEL_A)
- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
- &oxygen_rec_a_ops);
- else if (chip->model->used_channels & OXYGEN_CHANNEL_B)
- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
- &oxygen_rec_b_ops);
- pcm->private_data = chip;
- pcm->private_free = oxygen_pcm_free;
- strcpy(pcm->name, "Analog");
- snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
- SNDRV_DMA_TYPE_DEV,
- snd_dma_pci_data(chip->pci),
- 512 * 1024, 2048 * 1024);
- if (ins)
- snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
- SNDRV_DMA_TYPE_DEV,
- snd_dma_pci_data(chip->pci),
- 128 * 1024, 256 * 1024);
-
- outs = !!(chip->model->used_channels & OXYGEN_CHANNEL_SPDIF);
- ins = !!(chip->model->used_channels & OXYGEN_CHANNEL_C);
+ outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_0_TO_I2S);
+ ins = !!(chip->model->pcm_dev_cfg & (CAPTURE_0_FROM_I2S_1 |
+ CAPTURE_0_FROM_I2S_2));
+ if (outs | ins) {
+ err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm);
+ if (err < 0)
+ return err;
+ if (outs)
+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ &oxygen_multich_ops);
+ if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_1)
+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+ &oxygen_rec_a_ops);
+ else if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_2)
+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+ &oxygen_rec_b_ops);
+ pcm->private_data = chip;
+ pcm->private_free = oxygen_pcm_free;
+ strcpy(pcm->name, "Analog");
+ if (outs)
+ snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
+ SNDRV_DMA_TYPE_DEV,
+ snd_dma_pci_data(chip->pci),
+ 512 * 1024, 2048 * 1024);
+ if (ins)
+ snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
+ SNDRV_DMA_TYPE_DEV,
+ snd_dma_pci_data(chip->pci),
+ 128 * 1024, 256 * 1024);
+ }
+
+ outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF);
+ ins = !!(chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF);
if (outs | ins) {
err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm);
if (err < 0)
@@ -686,12 +691,13 @@ int oxygen_pcm_init(struct oxygen *chip)
128 * 1024, 256 * 1024);
}
- outs = chip->has_ac97_1 &&
- (chip->model->used_channels & OXYGEN_CHANNEL_AC97);
- ins = outs ||
- (chip->model->used_channels & (OXYGEN_CHANNEL_A |
- OXYGEN_CHANNEL_B))
- == (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B);
+ if (chip->has_ac97_1) {
+ outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_2_TO_AC97_1);
+ ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
+ } else {
+ outs = 0;
+ ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_I2S_2);
+ }
if (outs | ins) {
err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2",
2, outs, ins, &pcm);