From: Fabio Estevam fabio.estevam@freescale.com
Currently after playing any audio file, we get the following error message:
$ aplay clarinet.wav Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo $ wm8962 0-001a: Unsupported sysclk ratio 544
This error message appears about 5 seconds after the audio playback has finished.
In order to avoid such error message, let's add a .hw_free function which will zero out wm8962->lrclk and wm8962->bclk, which according to the code below:
if (!wm8962->bclk || !wm8962->lrclk) { dev_dbg(codec->dev, "No audio clocks configured\n"); return; }
,will cause the wm8962_configure_bclk() function not to search a valid sysclk ratio after playback has finished.
Suggested-by: Nicolin Chen b42378@freescale.com Signed-off-by: Fabio Estevam fabio.estevam@freescale.com --- sound/soc/codecs/wm8962.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 6a5066c..01033c2 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2914,6 +2914,18 @@ static int wm8962_mute(struct snd_soc_dai *dai, int mute) WM8962_DAC_MUTE, val); }
+static int wm8962_hw_free(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_codec *codec = dai->codec; + struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); + + wm8962->lrclk = 0; + wm8962->bclk = 0; + + return 0; +} + #define WM8962_RATES SNDRV_PCM_RATE_8000_96000
#define WM8962_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ @@ -2921,6 +2933,7 @@ static int wm8962_mute(struct snd_soc_dai *dai, int mute)
static const struct snd_soc_dai_ops wm8962_dai_ops = { .hw_params = wm8962_hw_params, + .hw_free = wm8962_hw_free, .set_sysclk = wm8962_set_dai_sysclk, .set_fmt = wm8962_set_dai_fmt, .digital_mute = wm8962_mute,