diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2009-01-16 16:47:30 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-17 06:02:21 -0500 |
commit | 9ef344f89ac41116d4ab138b0941c784a3ab8cf4 (patch) | |
tree | e34c9c9cbb4d450d3acb0fa42070ae1d37625e2d /sound | |
parent | 554b91edec1c588b889a7357ff201c0a450e31ff (diff) |
ALSA: wss-lib: remove "pops" before each played sound
A WSS codec is autocalibrated each time before
playing sound. Do only one calibration during
codec initialization.
Complete snd_wss_calibrate_mute to mute loopback
volume as well.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/isa/wss/wss_lib.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 13299aebd077..f0c0be5bb684 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
@@ -181,25 +181,6 @@ static void snd_wss_wait(struct snd_wss *chip) | |||
181 | udelay(100); | 181 | udelay(100); |
182 | } | 182 | } |
183 | 183 | ||
184 | static void snd_wss_outm(struct snd_wss *chip, unsigned char reg, | ||
185 | unsigned char mask, unsigned char value) | ||
186 | { | ||
187 | unsigned char tmp = (chip->image[reg] & mask) | value; | ||
188 | |||
189 | snd_wss_wait(chip); | ||
190 | #ifdef CONFIG_SND_DEBUG | ||
191 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | ||
192 | snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | ||
193 | #endif | ||
194 | chip->image[reg] = tmp; | ||
195 | if (!chip->calibrate_mute) { | ||
196 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | ||
197 | wmb(); | ||
198 | wss_outb(chip, CS4231P(REG), tmp); | ||
199 | mb(); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | static void snd_wss_dout(struct snd_wss *chip, unsigned char reg, | 184 | static void snd_wss_dout(struct snd_wss *chip, unsigned char reg, |
204 | unsigned char value) | 185 | unsigned char value) |
205 | { | 186 | { |
@@ -587,7 +568,15 @@ static void snd_wss_calibrate_mute(struct snd_wss *chip, int mute) | |||
587 | chip->image[CS4231_RIGHT_INPUT]); | 568 | chip->image[CS4231_RIGHT_INPUT]); |
588 | snd_wss_dout(chip, CS4231_LOOPBACK, | 569 | snd_wss_dout(chip, CS4231_LOOPBACK, |
589 | chip->image[CS4231_LOOPBACK]); | 570 | chip->image[CS4231_LOOPBACK]); |
571 | } else { | ||
572 | snd_wss_dout(chip, CS4231_LEFT_INPUT, | ||
573 | 0); | ||
574 | snd_wss_dout(chip, CS4231_RIGHT_INPUT, | ||
575 | 0); | ||
576 | snd_wss_dout(chip, CS4231_LOOPBACK, | ||
577 | 0xfd); | ||
590 | } | 578 | } |
579 | |||
591 | snd_wss_dout(chip, CS4231_AUX1_LEFT_INPUT, | 580 | snd_wss_dout(chip, CS4231_AUX1_LEFT_INPUT, |
592 | mute | chip->image[CS4231_AUX1_LEFT_INPUT]); | 581 | mute | chip->image[CS4231_AUX1_LEFT_INPUT]); |
593 | snd_wss_dout(chip, CS4231_AUX1_RIGHT_INPUT, | 582 | snd_wss_dout(chip, CS4231_AUX1_RIGHT_INPUT, |
@@ -630,7 +619,6 @@ static void snd_wss_playback_format(struct snd_wss *chip, | |||
630 | int full_calib = 1; | 619 | int full_calib = 1; |
631 | 620 | ||
632 | mutex_lock(&chip->mce_mutex); | 621 | mutex_lock(&chip->mce_mutex); |
633 | snd_wss_calibrate_mute(chip, 1); | ||
634 | if (chip->hardware == WSS_HW_CS4231A || | 622 | if (chip->hardware == WSS_HW_CS4231A || |
635 | (chip->hardware & WSS_HW_CS4232_MASK)) { | 623 | (chip->hardware & WSS_HW_CS4232_MASK)) { |
636 | spin_lock_irqsave(&chip->reg_lock, flags); | 624 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -681,7 +669,6 @@ static void snd_wss_playback_format(struct snd_wss *chip, | |||
681 | udelay(100); /* this seems to help */ | 669 | udelay(100); /* this seems to help */ |
682 | snd_wss_mce_down(chip); | 670 | snd_wss_mce_down(chip); |
683 | } | 671 | } |
684 | snd_wss_calibrate_mute(chip, 0); | ||
685 | mutex_unlock(&chip->mce_mutex); | 672 | mutex_unlock(&chip->mce_mutex); |
686 | } | 673 | } |
687 | 674 | ||
@@ -693,7 +680,6 @@ static void snd_wss_capture_format(struct snd_wss *chip, | |||
693 | int full_calib = 1; | 680 | int full_calib = 1; |
694 | 681 | ||
695 | mutex_lock(&chip->mce_mutex); | 682 | mutex_lock(&chip->mce_mutex); |
696 | snd_wss_calibrate_mute(chip, 1); | ||
697 | if (chip->hardware == WSS_HW_CS4231A || | 683 | if (chip->hardware == WSS_HW_CS4231A || |
698 | (chip->hardware & WSS_HW_CS4232_MASK)) { | 684 | (chip->hardware & WSS_HW_CS4232_MASK)) { |
699 | spin_lock_irqsave(&chip->reg_lock, flags); | 685 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -750,7 +736,6 @@ static void snd_wss_capture_format(struct snd_wss *chip, | |||
750 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 736 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
751 | snd_wss_mce_down(chip); | 737 | snd_wss_mce_down(chip); |
752 | } | 738 | } |
753 | snd_wss_calibrate_mute(chip, 0); | ||
754 | mutex_unlock(&chip->mce_mutex); | 739 | mutex_unlock(&chip->mce_mutex); |
755 | } | 740 | } |
756 | 741 | ||
@@ -807,6 +792,7 @@ static void snd_wss_init(struct snd_wss *chip) | |||
807 | { | 792 | { |
808 | unsigned long flags; | 793 | unsigned long flags; |
809 | 794 | ||
795 | snd_wss_calibrate_mute(chip, 1); | ||
810 | snd_wss_mce_down(chip); | 796 | snd_wss_mce_down(chip); |
811 | 797 | ||
812 | #ifdef SNDRV_DEBUG_MCE | 798 | #ifdef SNDRV_DEBUG_MCE |
@@ -830,6 +816,8 @@ static void snd_wss_init(struct snd_wss *chip) | |||
830 | 816 | ||
831 | snd_wss_mce_up(chip); | 817 | snd_wss_mce_up(chip); |
832 | spin_lock_irqsave(&chip->reg_lock, flags); | 818 | spin_lock_irqsave(&chip->reg_lock, flags); |
819 | chip->image[CS4231_IFACE_CTRL] &= ~CS4231_AUTOCALIB; | ||
820 | snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | ||
833 | snd_wss_out(chip, | 821 | snd_wss_out(chip, |
834 | CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); | 822 | CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); |
835 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 823 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -863,6 +851,7 @@ static void snd_wss_init(struct snd_wss *chip) | |||
863 | chip->image[CS4231_REC_FORMAT]); | 851 | chip->image[CS4231_REC_FORMAT]); |
864 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 852 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
865 | snd_wss_mce_down(chip); | 853 | snd_wss_mce_down(chip); |
854 | snd_wss_calibrate_mute(chip, 0); | ||
866 | 855 | ||
867 | #ifdef SNDRV_DEBUG_MCE | 856 | #ifdef SNDRV_DEBUG_MCE |
868 | snd_printk("init: (5)\n"); | 857 | snd_printk("init: (5)\n"); |
@@ -921,8 +910,6 @@ static void snd_wss_close(struct snd_wss *chip, unsigned int mode) | |||
921 | mutex_unlock(&chip->open_mutex); | 910 | mutex_unlock(&chip->open_mutex); |
922 | return; | 911 | return; |
923 | } | 912 | } |
924 | snd_wss_calibrate_mute(chip, 1); | ||
925 | |||
926 | /* disable IRQ */ | 913 | /* disable IRQ */ |
927 | spin_lock_irqsave(&chip->reg_lock, flags); | 914 | spin_lock_irqsave(&chip->reg_lock, flags); |
928 | if (!(chip->hardware & WSS_HW_AD1848_MASK)) | 915 | if (!(chip->hardware & WSS_HW_AD1848_MASK)) |
@@ -955,8 +942,6 @@ static void snd_wss_close(struct snd_wss *chip, unsigned int mode) | |||
955 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 942 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
956 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 943 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
957 | 944 | ||
958 | snd_wss_calibrate_mute(chip, 0); | ||
959 | |||
960 | chip->mode = 0; | 945 | chip->mode = 0; |
961 | mutex_unlock(&chip->open_mutex); | 946 | mutex_unlock(&chip->open_mutex); |
962 | } | 947 | } |
@@ -1149,7 +1134,7 @@ irqreturn_t snd_wss_interrupt(int irq, void *dev_id) | |||
1149 | if (chip->hardware & WSS_HW_AD1848_MASK) | 1134 | if (chip->hardware & WSS_HW_AD1848_MASK) |
1150 | wss_outb(chip, CS4231P(STATUS), 0); | 1135 | wss_outb(chip, CS4231P(STATUS), 0); |
1151 | else | 1136 | else |
1152 | snd_wss_outm(chip, CS4231_IRQ_STATUS, status, 0); | 1137 | snd_wss_out(chip, CS4231_IRQ_STATUS, status); |
1153 | spin_unlock(&chip->reg_lock); | 1138 | spin_unlock(&chip->reg_lock); |
1154 | return IRQ_HANDLED; | 1139 | return IRQ_HANDLED; |
1155 | } | 1140 | } |