]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: Automatically control WM8903 sloping stopband filter
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 12 Jun 2009 16:27:07 +0000 (17:27 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 13 Jun 2009 19:06:23 +0000 (20:06 +0100)
For best performance the DAC sloping stopband filter should be
enabled below 24kHz and not enabled above that so remove the
user visible control for this and do it autonomously in the
driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8903.c

index d8a9222fbf745c53077bd3a5f12e89c3f70bded0..3ebd770463e365e0d42d1240ca913bc1cf973bbf 100644 (file)
@@ -715,8 +715,6 @@ SOC_ENUM("DAC Soft Mute Rate", soft_mute),
 SOC_ENUM("DAC Mute Mode", mute_mode),
 SOC_SINGLE("DAC Mono Switch", WM8903_DAC_DIGITAL_1, 12, 1, 0),
 SOC_ENUM("DAC De-emphasis", dac_deemphasis),
-SOC_SINGLE("DAC Sloping Stopband Filter Switch",
-          WM8903_DAC_DIGITAL_1, 11, 1, 0),
 SOC_ENUM("DAC Companding Mode", dac_companding),
 SOC_SINGLE("DAC Companding Switch", WM8903_AUDIO_INTERFACE_0, 1, 1, 0),
 
@@ -1377,12 +1375,19 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
        u16 aif3 = wm8903_read(codec, WM8903_AUDIO_INTERFACE_3);
        u16 clock0 = wm8903_read(codec, WM8903_CLOCK_RATES_0);
        u16 clock1 = wm8903_read(codec, WM8903_CLOCK_RATES_1);
+       u16 dac_digital1 = wm8903_read(codec, WM8903_DAC_DIGITAL_1);
 
        if (substream == wm8903->slave_substream) {
                dev_dbg(&i2c->dev, "Ignoring hw_params for slave substream\n");
                return 0;
        }
 
+       /* Enable sloping stopband filter for low sample rates */
+       if (fs <= 24000)
+               dac_digital1 |= WM8903_DAC_SB_FILT;
+       else
+               dac_digital1 &= ~WM8903_DAC_SB_FILT;
+
        /* Configure sample rate logic for DSP - choose nearest rate */
        dsp_config = 0;
        best_val = abs(sample_rates[dsp_config].rate - fs);
@@ -1507,6 +1512,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
        wm8903_write(codec, WM8903_AUDIO_INTERFACE_1, aif1);
        wm8903_write(codec, WM8903_AUDIO_INTERFACE_2, aif2);
        wm8903_write(codec, WM8903_AUDIO_INTERFACE_3, aif3);
+       wm8903_write(codec, WM8903_DAC_DIGITAL_1, dac_digital1);
 
        return 0;
 }