aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-12-04 10:22:45 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-04 10:22:45 -0500
commit86e1d57e4f24ca27ce813bdc2afaac4adafcbaf4 (patch)
tree22b4797bfec25faa93a1166ea4ad39932536ee0d /sound/pci/oxygen/oxygen_pcm.c
parentbaf9226667734579e344f612ed39f727079cad51 (diff)
parentac2c92e0cd06387ecee8115f5fa385fba6413c42 (diff)
Merge branch 'topic/hda' into for-linus
Diffstat (limited to 'sound/pci/oxygen/oxygen_pcm.c')
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index ef2345d82b86..9dff6954c397 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -271,13 +271,16 @@ static unsigned int oxygen_rate(struct snd_pcm_hw_params *hw_params)
271 } 271 }
272} 272}
273 273
274static unsigned int oxygen_i2s_mclk(struct snd_pcm_hw_params *hw_params) 274unsigned int oxygen_default_i2s_mclk(struct oxygen *chip,
275 unsigned int channel,
276 struct snd_pcm_hw_params *hw_params)
275{ 277{
276 if (params_rate(hw_params) <= 96000) 278 if (params_rate(hw_params) <= 96000)
277 return OXYGEN_I2S_MCLK_256; 279 return OXYGEN_I2S_MCLK_256;
278 else 280 else
279 return OXYGEN_I2S_MCLK_128; 281 return OXYGEN_I2S_MCLK_128;
280} 282}
283EXPORT_SYMBOL(oxygen_default_i2s_mclk);
281 284
282static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params) 285static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params)
283{ 286{
@@ -354,7 +357,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream,
354 OXYGEN_REC_FORMAT_A_MASK); 357 OXYGEN_REC_FORMAT_A_MASK);
355 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, 358 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT,
356 oxygen_rate(hw_params) | 359 oxygen_rate(hw_params) |
357 oxygen_i2s_mclk(hw_params) | 360 chip->model.get_i2s_mclk(chip, PCM_A, hw_params) |
358 chip->model.adc_i2s_format | 361 chip->model.adc_i2s_format |
359 oxygen_i2s_bits(hw_params), 362 oxygen_i2s_bits(hw_params),
360 OXYGEN_I2S_RATE_MASK | 363 OXYGEN_I2S_RATE_MASK |
@@ -390,7 +393,8 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
390 if (!is_ac97) 393 if (!is_ac97)
391 oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT, 394 oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT,
392 oxygen_rate(hw_params) | 395 oxygen_rate(hw_params) |
393 oxygen_i2s_mclk(hw_params) | 396 chip->model.get_i2s_mclk(chip, PCM_B,
397 hw_params) |
394 chip->model.adc_i2s_format | 398 chip->model.adc_i2s_format |
395 oxygen_i2s_bits(hw_params), 399 oxygen_i2s_bits(hw_params),
396 OXYGEN_I2S_RATE_MASK | 400 OXYGEN_I2S_RATE_MASK |
@@ -435,6 +439,7 @@ static int oxygen_spdif_hw_params(struct snd_pcm_substream *substream,
435 if (err < 0) 439 if (err < 0)
436 return err; 440 return err;
437 441
442 mutex_lock(&chip->mutex);
438 spin_lock_irq(&chip->reg_lock); 443 spin_lock_irq(&chip->reg_lock);
439 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL, 444 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL,
440 OXYGEN_SPDIF_OUT_ENABLE); 445 OXYGEN_SPDIF_OUT_ENABLE);
@@ -446,6 +451,7 @@ static int oxygen_spdif_hw_params(struct snd_pcm_substream *substream,
446 OXYGEN_SPDIF_OUT_RATE_MASK); 451 OXYGEN_SPDIF_OUT_RATE_MASK);
447 oxygen_update_spdif_source(chip); 452 oxygen_update_spdif_source(chip);
448 spin_unlock_irq(&chip->reg_lock); 453 spin_unlock_irq(&chip->reg_lock);
454 mutex_unlock(&chip->mutex);
449 return 0; 455 return 0;
450} 456}
451 457
@@ -459,6 +465,7 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
459 if (err < 0) 465 if (err < 0)
460 return err; 466 return err;
461 467
468 mutex_lock(&chip->mutex);
462 spin_lock_irq(&chip->reg_lock); 469 spin_lock_irq(&chip->reg_lock);
463 oxygen_write8_masked(chip, OXYGEN_PLAY_CHANNELS, 470 oxygen_write8_masked(chip, OXYGEN_PLAY_CHANNELS,
464 oxygen_play_channels(hw_params), 471 oxygen_play_channels(hw_params),
@@ -469,18 +476,18 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
469 oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, 476 oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT,
470 oxygen_rate(hw_params) | 477 oxygen_rate(hw_params) |
471 chip->model.dac_i2s_format | 478 chip->model.dac_i2s_format |
472 oxygen_i2s_mclk(hw_params) | 479 chip->model.get_i2s_mclk(chip, PCM_MULTICH,
480 hw_params) |
473 oxygen_i2s_bits(hw_params), 481 oxygen_i2s_bits(hw_params),
474 OXYGEN_I2S_RATE_MASK | 482 OXYGEN_I2S_RATE_MASK |
475 OXYGEN_I2S_FORMAT_MASK | 483 OXYGEN_I2S_FORMAT_MASK |
476 OXYGEN_I2S_MCLK_MASK | 484 OXYGEN_I2S_MCLK_MASK |
477 OXYGEN_I2S_BITS_MASK); 485 OXYGEN_I2S_BITS_MASK);
478 oxygen_update_dac_routing(chip);
479 oxygen_update_spdif_source(chip); 486 oxygen_update_spdif_source(chip);
480 spin_unlock_irq(&chip->reg_lock); 487 spin_unlock_irq(&chip->reg_lock);
481 488
482 mutex_lock(&chip->mutex);
483 chip->model.set_dac_params(chip, hw_params); 489 chip->model.set_dac_params(chip, hw_params);
490 oxygen_update_dac_routing(chip);
484 mutex_unlock(&chip->mutex); 491 mutex_unlock(&chip->mutex);
485 return 0; 492 return 0;
486} 493}