diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-09-22 02:55:19 -0400 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2008-09-22 02:55:19 -0400 |
commit | 9bd6a73aef955216816fd6e28f371a868ed073d5 (patch) | |
tree | 4a416d4f4ed5308a83195f47f498b946bfb9062e /sound/pci/oxygen/oxygen_pcm.c | |
parent | 6627bea10e8b31cdedd3a59a311d9ad1e010059a (diff) |
ALSA: oxygen: use a copy of the model struct
Put a copy of the model structure into the chip structure so that model-
specific drivers can modify it depending on a particular device
instance.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_pcm.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_pcm.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index c4ad65a3406f..5e8071ac766f 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.pcm_dev_cfg & 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.pcm_dev_cfg & 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,9 +657,9 @@ 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.pcm_dev_cfg & PLAYBACK_0_TO_I2S); |
661 | ins = !!(chip->model->pcm_dev_cfg & (CAPTURE_0_FROM_I2S_1 | | 661 | ins = !!(chip->model.pcm_dev_cfg & (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, "Analog", 0, outs, ins, &pcm); |
665 | if (err < 0) | 665 | if (err < 0) |
@@ -667,10 +667,10 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
667 | if (outs) | 667 | if (outs) |
668 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 668 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
669 | &oxygen_multich_ops); | 669 | &oxygen_multich_ops); |
670 | if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_1) | 670 | if (chip->model.pcm_dev_cfg & CAPTURE_0_FROM_I2S_1) |
671 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | 671 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
672 | &oxygen_rec_a_ops); | 672 | &oxygen_rec_a_ops); |
673 | else if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_2) | 673 | else if (chip->model.pcm_dev_cfg & CAPTURE_0_FROM_I2S_2) |
674 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | 674 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
675 | &oxygen_rec_b_ops); | 675 | &oxygen_rec_b_ops); |
676 | pcm->private_data = chip; | 676 | pcm->private_data = chip; |
@@ -690,8 +690,8 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
690 | BUFFER_BYTES_MAX); | 690 | BUFFER_BYTES_MAX); |
691 | } | 691 | } |
692 | 692 | ||
693 | outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF); | 693 | outs = !!(chip->model.pcm_dev_cfg & PLAYBACK_1_TO_SPDIF); |
694 | ins = !!(chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF); | 694 | ins = !!(chip->model.pcm_dev_cfg & CAPTURE_1_FROM_SPDIF); |
695 | if (outs | ins) { | 695 | if (outs | ins) { |
696 | err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm); | 696 | err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm); |
697 | if (err < 0) | 697 | if (err < 0) |
@@ -712,11 +712,11 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | if (chip->has_ac97_1) { | 714 | if (chip->has_ac97_1) { |
715 | outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_2_TO_AC97_1); | 715 | outs = !!(chip->model.pcm_dev_cfg & PLAYBACK_2_TO_AC97_1); |
716 | ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1); | 716 | ins = !!(chip->model.pcm_dev_cfg & CAPTURE_2_FROM_AC97_1); |
717 | } else { | 717 | } else { |
718 | outs = 0; | 718 | outs = 0; |
719 | ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_I2S_2); | 719 | ins = !!(chip->model.pcm_dev_cfg & CAPTURE_2_FROM_I2S_2); |
720 | } | 720 | } |
721 | if (outs | ins) { | 721 | if (outs | ins) { |
722 | err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2", | 722 | err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2", |