aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/xonar_pcm179x.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-01-10 10:09:23 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-10 10:46:21 -0500
commit00b8dd7dd71ef129176731d5fa24f5e298797599 (patch)
treea3cb8cef9a89f6a0b55490adab58ae257a05a294 /sound/pci/oxygen/xonar_pcm179x.c
parentd353eaa9a8133cdad8c1da23c84f9f529a23f0c2 (diff)
ALSA: virtuoso: use lower master clock with H6 daughterboard
Because of the unshielded connector cable, it is important to use as low a master clock frequency as possible with the H6. For double rate modes (64-96 kHz), the MCLK rate is unconditionally lowered from 512x to 256x because the higher rate would not improve anything. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/xonar_pcm179x.c')
-rw-r--r--sound/pci/oxygen/xonar_pcm179x.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c
index fce55fa5b0b0..2a50a55cbbb1 100644
--- a/sound/pci/oxygen/xonar_pcm179x.c
+++ b/sound/pci/oxygen/xonar_pcm179x.c
@@ -224,6 +224,7 @@ struct xonar_pcm179x {
224 u8 pcm1796_regs[4][5]; 224 u8 pcm1796_regs[4][5];
225 unsigned int current_rate; 225 unsigned int current_rate;
226 bool os_128; 226 bool os_128;
227 bool h6;
227 bool hp_active; 228 bool hp_active;
228 s8 hp_gain_offset; 229 s8 hp_gain_offset;
229 bool has_cs2000; 230 bool has_cs2000;
@@ -384,6 +385,7 @@ static void xonar_hdav_init(struct oxygen *chip)
384 data->pcm179x.generic.ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; 385 data->pcm179x.generic.ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK;
385 data->pcm179x.generic.ext_power_bit = GPI_EXT_POWER; 386 data->pcm179x.generic.ext_power_bit = GPI_EXT_POWER;
386 data->pcm179x.dacs = chip->model.dac_channels_mixer / 2; 387 data->pcm179x.dacs = chip->model.dac_channels_mixer / 2;
388 data->pcm179x.h6 = chip->model.dac_channels_mixer > 2;
387 389
388 pcm1796_init(chip); 390 pcm1796_init(chip);
389 391
@@ -461,6 +463,7 @@ static void xonar_st_init(struct oxygen *chip)
461 struct xonar_pcm179x *data = chip->model_data; 463 struct xonar_pcm179x *data = chip->model_data;
462 464
463 data->generic.anti_pop_delay = 100; 465 data->generic.anti_pop_delay = 100;
466 data->h6 = chip->model.dac_channels_mixer > 2;
464 data->has_cs2000 = 1; 467 data->has_cs2000 = 1;
465 data->cs2000_regs[CS2000_FUN_CFG_1] = CS2000_REF_CLK_DIV_1; 468 data->cs2000_regs[CS2000_FUN_CFG_1] = CS2000_REF_CLK_DIV_1;
466 data->broken_i2c = true; 469 data->broken_i2c = true;
@@ -554,11 +557,10 @@ static unsigned int mclk_from_rate(struct oxygen *chip, unsigned int rate)
554 struct xonar_pcm179x *data = chip->model_data; 557 struct xonar_pcm179x *data = chip->model_data;
555 558
556 if (rate <= 32000) 559 if (rate <= 32000)
557 return OXYGEN_I2S_MCLK_512; 560 return data->h6 ? OXYGEN_I2S_MCLK_256 : OXYGEN_I2S_MCLK_512;
558 else if (rate <= 48000 && data->os_128) 561 else if (rate <= 48000)
559 return OXYGEN_I2S_MCLK_512; 562 return data->os_128 && !data->h6
560 else if (rate <= 96000) 563 ? OXYGEN_I2S_MCLK_512 : OXYGEN_I2S_MCLK_256;
561 return OXYGEN_I2S_MCLK_256;
562 else 564 else
563 return OXYGEN_I2S_MCLK_128; 565 return OXYGEN_I2S_MCLK_128;
564} 566}
@@ -579,9 +581,9 @@ static void update_pcm1796_oversampling(struct oxygen *chip)
579 unsigned int i; 581 unsigned int i;
580 u8 reg; 582 u8 reg;
581 583
582 if (data->current_rate <= 32000) 584 if (data->current_rate <= 32000 && !data->h6)
583 reg = PCM1796_OS_128; 585 reg = PCM1796_OS_128;
584 else if (data->current_rate <= 48000 && data->os_128) 586 else if (data->current_rate <= 48000 && data->os_128 && !data->h6)
585 reg = PCM1796_OS_128; 587 reg = PCM1796_OS_128;
586 else if (data->current_rate <= 96000 || data->os_128) 588 else if (data->current_rate <= 96000 || data->os_128)
587 reg = PCM1796_OS_64; 589 reg = PCM1796_OS_64;
@@ -636,28 +638,31 @@ static void update_cs2000_rate(struct oxygen *chip, unsigned int rate)
636 638
637 switch (rate) { 639 switch (rate) {
638 case 32000: 640 case 32000:
639 rate_mclk = OXYGEN_RATE_32000 | OXYGEN_I2S_MCLK_512; 641 if (data->h6)
642 rate_mclk = OXYGEN_RATE_32000 | OXYGEN_I2S_MCLK_256;
643 else
644 rate_mclk = OXYGEN_RATE_32000 | OXYGEN_I2S_MCLK_512;
640 break; 645 break;
641 case 44100: 646 case 44100:
642 if (data->os_128) 647 if (data->os_128 && !data->h6)
643 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_512; 648 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_512;
644 else 649 else
645 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_256; 650 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_256;
646 break; 651 break;
647 default: /* 48000 */ 652 default: /* 48000 */
648 if (data->os_128) 653 if (data->os_128 && !data->h6)
649 rate_mclk = OXYGEN_RATE_48000 | OXYGEN_I2S_MCLK_512; 654 rate_mclk = OXYGEN_RATE_48000 | OXYGEN_I2S_MCLK_512;
650 else 655 else
651 rate_mclk = OXYGEN_RATE_48000 | OXYGEN_I2S_MCLK_256; 656 rate_mclk = OXYGEN_RATE_48000 | OXYGEN_I2S_MCLK_256;
652 break; 657 break;
653 case 64000: 658 case 64000:
654 rate_mclk = OXYGEN_RATE_32000 | OXYGEN_I2S_MCLK_512; 659 rate_mclk = OXYGEN_RATE_32000 | OXYGEN_I2S_MCLK_256;
655 break; 660 break;
656 case 88200: 661 case 88200:
657 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_512; 662 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_256;
658 break; 663 break;
659 case 96000: 664 case 96000:
660 rate_mclk = OXYGEN_RATE_48000 | OXYGEN_I2S_MCLK_512; 665 rate_mclk = OXYGEN_RATE_48000 | OXYGEN_I2S_MCLK_256;
661 break; 666 break;
662 case 176400: 667 case 176400:
663 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_512; 668 rate_mclk = OXYGEN_RATE_44100 | OXYGEN_I2S_MCLK_512;