diff options
Diffstat (limited to 'sound/pci/oxygen/oxygen_pcm.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_pcm.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index f24659af53d3..72481fdd11f3 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -308,9 +308,10 @@ static unsigned int oxygen_rate(struct snd_pcm_hw_params *hw_params) | |||
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | static unsigned int oxygen_i2s_magic2(struct snd_pcm_hw_params *hw_params) | 311 | static unsigned int oxygen_i2s_mclk(struct snd_pcm_hw_params *hw_params) |
312 | { | 312 | { |
313 | return params_rate(hw_params) <= 96000 ? 0x10 : 0x00; | 313 | return params_rate(hw_params) <= 96000 |
314 | ? OXYGEN_I2S_MCLK_256 : OXYGEN_I2S_MCLK_128; | ||
314 | } | 315 | } |
315 | 316 | ||
316 | static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params) | 317 | static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params) |
@@ -388,12 +389,12 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream, | |||
388 | OXYGEN_REC_FORMAT_A_MASK); | 389 | OXYGEN_REC_FORMAT_A_MASK); |
389 | oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, | 390 | oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, |
390 | oxygen_rate(hw_params) | | 391 | oxygen_rate(hw_params) | |
391 | oxygen_i2s_magic2(hw_params) | | 392 | oxygen_i2s_mclk(hw_params) | |
392 | chip->model->adc_i2s_format | | 393 | chip->model->adc_i2s_format | |
393 | oxygen_i2s_bits(hw_params), | 394 | oxygen_i2s_bits(hw_params), |
394 | OXYGEN_I2S_RATE_MASK | | 395 | OXYGEN_I2S_RATE_MASK | |
395 | OXYGEN_I2S_FORMAT_MASK | | 396 | OXYGEN_I2S_FORMAT_MASK | |
396 | OXYGEN_I2S_MAGIC2_MASK | | 397 | OXYGEN_I2S_MCLK_MASK | |
397 | OXYGEN_I2S_BITS_MASK); | 398 | OXYGEN_I2S_BITS_MASK); |
398 | oxygen_clear_bits8(chip, OXYGEN_REC_ROUTING, 0x08); | 399 | oxygen_clear_bits8(chip, OXYGEN_REC_ROUTING, 0x08); |
399 | spin_unlock_irq(&chip->reg_lock); | 400 | spin_unlock_irq(&chip->reg_lock); |
@@ -420,12 +421,12 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream, | |||
420 | OXYGEN_REC_FORMAT_B_MASK); | 421 | OXYGEN_REC_FORMAT_B_MASK); |
421 | oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT, | 422 | oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT, |
422 | oxygen_rate(hw_params) | | 423 | oxygen_rate(hw_params) | |
423 | oxygen_i2s_magic2(hw_params) | | 424 | oxygen_i2s_mclk(hw_params) | |
424 | chip->model->adc_i2s_format | | 425 | chip->model->adc_i2s_format | |
425 | oxygen_i2s_bits(hw_params), | 426 | oxygen_i2s_bits(hw_params), |
426 | OXYGEN_I2S_RATE_MASK | | 427 | OXYGEN_I2S_RATE_MASK | |
427 | OXYGEN_I2S_FORMAT_MASK | | 428 | OXYGEN_I2S_FORMAT_MASK | |
428 | OXYGEN_I2S_MAGIC2_MASK | | 429 | OXYGEN_I2S_MCLK_MASK | |
429 | OXYGEN_I2S_BITS_MASK); | 430 | OXYGEN_I2S_BITS_MASK); |
430 | oxygen_clear_bits8(chip, OXYGEN_REC_ROUTING, 0x10); | 431 | oxygen_clear_bits8(chip, OXYGEN_REC_ROUTING, 0x10); |
431 | spin_unlock_irq(&chip->reg_lock); | 432 | spin_unlock_irq(&chip->reg_lock); |
@@ -514,24 +515,6 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream, | |||
514 | return 0; | 515 | return 0; |
515 | } | 516 | } |
516 | 517 | ||
517 | static int oxygen_ac97_hw_params(struct snd_pcm_substream *substream, | ||
518 | struct snd_pcm_hw_params *hw_params) | ||
519 | { | ||
520 | struct oxygen *chip = snd_pcm_substream_chip(substream); | ||
521 | int err; | ||
522 | |||
523 | err = oxygen_hw_params(substream, hw_params); | ||
524 | if (err < 0) | ||
525 | return err; | ||
526 | |||
527 | spin_lock_irq(&chip->reg_lock); | ||
528 | oxygen_write8_masked(chip, OXYGEN_PLAY_FORMAT, | ||
529 | oxygen_format(hw_params) << OXYGEN_AC97_FORMAT_SHIFT, | ||
530 | OXYGEN_AC97_FORMAT_MASK); | ||
531 | spin_unlock_irq(&chip->reg_lock); | ||
532 | return 0; | ||
533 | } | ||
534 | |||
535 | static int oxygen_hw_free(struct snd_pcm_substream *substream) | 518 | static int oxygen_hw_free(struct snd_pcm_substream *substream) |
536 | { | 519 | { |
537 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 520 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
@@ -680,7 +663,7 @@ static struct snd_pcm_ops oxygen_ac97_ops = { | |||
680 | .open = oxygen_ac97_open, | 663 | .open = oxygen_ac97_open, |
681 | .close = oxygen_close, | 664 | .close = oxygen_close, |
682 | .ioctl = snd_pcm_lib_ioctl, | 665 | .ioctl = snd_pcm_lib_ioctl, |
683 | .hw_params = oxygen_ac97_hw_params, | 666 | .hw_params = oxygen_hw_params, |
684 | .hw_free = oxygen_hw_free, | 667 | .hw_free = oxygen_hw_free, |
685 | .prepare = oxygen_prepare, | 668 | .prepare = oxygen_prepare, |
686 | .trigger = oxygen_trigger, | 669 | .trigger = oxygen_trigger, |