提交 ef473fee 编写于 作者: M Mark Brown

ASoC: Support a wider range of sample rates on Speyside WM8962

As we've only got one audio interface and it is symmetric we can just set
SYSCLK based on the sample rate requested by the application layer. Provide
a default so bypass paths work before audio playback.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 0a742681
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "../codecs/wm8962.h" #include "../codecs/wm8962.h"
static int sample_rate = 44100;
static int speyside_wm8962_set_bias_level(struct snd_soc_card *card, static int speyside_wm8962_set_bias_level(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_context *dapm,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
...@@ -31,13 +33,13 @@ static int speyside_wm8962_set_bias_level(struct snd_soc_card *card, ...@@ -31,13 +33,13 @@ static int speyside_wm8962_set_bias_level(struct snd_soc_card *card,
if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL,
WM8962_FLL_MCLK, 32768, WM8962_FLL_MCLK, 32768,
44100 * 512); sample_rate * 512);
if (ret < 0) if (ret < 0)
pr_err("Failed to start FLL: %d\n", ret); pr_err("Failed to start FLL: %d\n", ret);
ret = snd_soc_dai_set_sysclk(codec_dai, ret = snd_soc_dai_set_sysclk(codec_dai,
WM8962_SYSCLK_FLL, WM8962_SYSCLK_FLL,
44100 * 512, sample_rate * 512,
SND_SOC_CLOCK_IN); SND_SOC_CLOCK_IN);
if (ret < 0) { if (ret < 0) {
pr_err("Failed to set SYSCLK: %d\n", ret); pr_err("Failed to set SYSCLK: %d\n", ret);
...@@ -109,6 +111,8 @@ static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream, ...@@ -109,6 +111,8 @@ static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream,
if (ret < 0) if (ret < 0)
return ret; return ret;
sample_rate = params_rate(params);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册