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.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index c4ad65a3406f..c262049961e1 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -129,7 +129,7 @@ static int oxygen_open(struct snd_pcm_substream *substream,
129 129
130 runtime->private_data = (void *)(uintptr_t)channel; 130 runtime->private_data = (void *)(uintptr_t)channel;
131 if (channel == PCM_B && chip->has_ac97_1 && 131 if (channel == PCM_B && chip->has_ac97_1 &&
132 (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1)) 132 (chip->model.device_config & CAPTURE_2_FROM_AC97_1))
133 runtime->hw = oxygen_ac97_hardware; 133 runtime->hw = oxygen_ac97_hardware;
134 else 134 else
135 runtime->hw = *oxygen_hardware[channel]; 135 runtime->hw = *oxygen_hardware[channel];
@@ -140,11 +140,11 @@ static int oxygen_open(struct snd_pcm_substream *substream,
140 runtime->hw.rate_min = 44100; 140 runtime->hw.rate_min = 44100;
141 break; 141 break;
142 case PCM_MULTICH: 142 case PCM_MULTICH:
143 runtime->hw.channels_max = chip->model->dac_channels; 143 runtime->hw.channels_max = chip->model.dac_channels;
144 break; 144 break;
145 } 145 }
146 if (chip->model->pcm_hardware_filter) 146 if (chip->model.pcm_hardware_filter)
147 chip->model->pcm_hardware_filter(channel, &runtime->hw); 147 chip->model.pcm_hardware_filter(channel, &runtime->hw);
148 err = snd_pcm_hw_constraint_step(runtime, 0, 148 err = snd_pcm_hw_constraint_step(runtime, 0,
149 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32); 149 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
150 if (err < 0) 150 if (err < 0)
@@ -355,7 +355,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream,
355 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, 355 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT,
356 oxygen_rate(hw_params) | 356 oxygen_rate(hw_params) |
357 oxygen_i2s_mclk(hw_params) | 357 oxygen_i2s_mclk(hw_params) |
358 chip->model->adc_i2s_format | 358 chip->model.adc_i2s_format |
359 oxygen_i2s_bits(hw_params), 359 oxygen_i2s_bits(hw_params),
360 OXYGEN_I2S_RATE_MASK | 360 OXYGEN_I2S_RATE_MASK |
361 OXYGEN_I2S_FORMAT_MASK | 361 OXYGEN_I2S_FORMAT_MASK |
@@ -364,7 +364,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream,
364 spin_unlock_irq(&chip->reg_lock); 364 spin_unlock_irq(&chip->reg_lock);
365 365
366 mutex_lock(&chip->mutex); 366 mutex_lock(&chip->mutex);
367 chip->model->set_adc_params(chip, hw_params); 367 chip->model.set_adc_params(chip, hw_params);
368 mutex_unlock(&chip->mutex); 368 mutex_unlock(&chip->mutex);
369 return 0; 369 return 0;
370} 370}
@@ -381,7 +381,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
381 return err; 381 return err;
382 382
383 is_ac97 = chip->has_ac97_1 && 383 is_ac97 = chip->has_ac97_1 &&
384 (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1); 384 (chip->model.device_config & CAPTURE_2_FROM_AC97_1);
385 385
386 spin_lock_irq(&chip->reg_lock); 386 spin_lock_irq(&chip->reg_lock);
387 oxygen_write8_masked(chip, OXYGEN_REC_FORMAT, 387 oxygen_write8_masked(chip, OXYGEN_REC_FORMAT,
@@ -391,7 +391,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
391 oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT, 391 oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT,
392 oxygen_rate(hw_params) | 392 oxygen_rate(hw_params) |
393 oxygen_i2s_mclk(hw_params) | 393 oxygen_i2s_mclk(hw_params) |
394 chip->model->adc_i2s_format | 394 chip->model.adc_i2s_format |
395 oxygen_i2s_bits(hw_params), 395 oxygen_i2s_bits(hw_params),
396 OXYGEN_I2S_RATE_MASK | 396 OXYGEN_I2S_RATE_MASK |
397 OXYGEN_I2S_FORMAT_MASK | 397 OXYGEN_I2S_FORMAT_MASK |
@@ -401,7 +401,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
401 401
402 if (!is_ac97) { 402 if (!is_ac97) {
403 mutex_lock(&chip->mutex); 403 mutex_lock(&chip->mutex);
404 chip->model->set_adc_params(chip, hw_params); 404 chip->model.set_adc_params(chip, hw_params);
405 mutex_unlock(&chip->mutex); 405 mutex_unlock(&chip->mutex);
406 } 406 }
407 return 0; 407 return 0;
@@ -468,7 +468,7 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
468 OXYGEN_MULTICH_FORMAT_MASK); 468 OXYGEN_MULTICH_FORMAT_MASK);
469 oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, 469 oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT,
470 oxygen_rate(hw_params) | 470 oxygen_rate(hw_params) |
471 chip->model->dac_i2s_format | 471 chip->model.dac_i2s_format |
472 oxygen_i2s_bits(hw_params), 472 oxygen_i2s_bits(hw_params),
473 OXYGEN_I2S_RATE_MASK | 473 OXYGEN_I2S_RATE_MASK |
474 OXYGEN_I2S_FORMAT_MASK | 474 OXYGEN_I2S_FORMAT_MASK |
@@ -478,7 +478,7 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
478 spin_unlock_irq(&chip->reg_lock); 478 spin_unlock_irq(&chip->reg_lock);
479 479
480 mutex_lock(&chip->mutex); 480 mutex_lock(&chip->mutex);
481 chip->model->set_dac_params(chip, hw_params); 481 chip->model.set_dac_params(chip, hw_params);
482 mutex_unlock(&chip->mutex); 482 mutex_unlock(&chip->mutex);
483 return 0; 483 return 0;
484} 484}
@@ -657,25 +657,26 @@ int oxygen_pcm_init(struct oxygen *chip)
657 int outs, ins; 657 int outs, ins;
658 int err; 658 int err;
659 659
660 outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_0_TO_I2S); 660 outs = !!(chip->model.device_config & PLAYBACK_0_TO_I2S);
661 ins = !!(chip->model->pcm_dev_cfg & (CAPTURE_0_FROM_I2S_1 | 661 ins = !!(chip->model.device_config & (CAPTURE_0_FROM_I2S_1 |
662 CAPTURE_0_FROM_I2S_2)); 662 CAPTURE_0_FROM_I2S_2));
663 if (outs | ins) { 663 if (outs | ins) {
664 err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm); 664 err = snd_pcm_new(chip->card, "Multichannel",
665 0, outs, ins, &pcm);
665 if (err < 0) 666 if (err < 0)
666 return err; 667 return err;
667 if (outs) 668 if (outs)
668 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 669 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
669 &oxygen_multich_ops); 670 &oxygen_multich_ops);
670 if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_1) 671 if (chip->model.device_config & CAPTURE_0_FROM_I2S_1)
671 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 672 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
672 &oxygen_rec_a_ops); 673 &oxygen_rec_a_ops);
673 else if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_2) 674 else if (chip->model.device_config & CAPTURE_0_FROM_I2S_2)
674 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 675 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
675 &oxygen_rec_b_ops); 676 &oxygen_rec_b_ops);
676 pcm->private_data = chip; 677 pcm->private_data = chip;
677 pcm->private_free = oxygen_pcm_free; 678 pcm->private_free = oxygen_pcm_free;
678 strcpy(pcm->name, "Analog"); 679 strcpy(pcm->name, "Multichannel");
679 if (outs) 680 if (outs)
680 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, 681 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
681 SNDRV_DMA_TYPE_DEV, 682 SNDRV_DMA_TYPE_DEV,
@@ -690,8 +691,8 @@ int oxygen_pcm_init(struct oxygen *chip)
690 BUFFER_BYTES_MAX); 691 BUFFER_BYTES_MAX);
691 } 692 }
692 693
693 outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF); 694 outs = !!(chip->model.device_config & PLAYBACK_1_TO_SPDIF);
694 ins = !!(chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF); 695 ins = !!(chip->model.device_config & CAPTURE_1_FROM_SPDIF);
695 if (outs | ins) { 696 if (outs | ins) {
696 err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm); 697 err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm);
697 if (err < 0) 698 if (err < 0)
@@ -712,11 +713,11 @@ int oxygen_pcm_init(struct oxygen *chip)
712 } 713 }
713 714
714 if (chip->has_ac97_1) { 715 if (chip->has_ac97_1) {
715 outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_2_TO_AC97_1); 716 outs = !!(chip->model.device_config & PLAYBACK_2_TO_AC97_1);
716 ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1); 717 ins = !!(chip->model.device_config & CAPTURE_2_FROM_AC97_1);
717 } else { 718 } else {
718 outs = 0; 719 outs = 0;
719 ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_I2S_2); 720 ins = !!(chip->model.device_config & CAPTURE_2_FROM_I2S_2);
720 } 721 }
721 if (outs | ins) { 722 if (outs | ins) {
722 err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2", 723 err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2",