aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBard Liao <bardliao@realtek.com>2017-07-14 02:36:32 -0400
committerMark Brown <broonie@kernel.org>2017-07-17 10:24:55 -0400
commitfa05899c12d54d3a1befa742f62d3188e551a87c (patch)
treeb0efdceae0805540dd5e18246f69aed24101f599
parent5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff)
ASoC: rt5665: force using PLL if MCLK is not suitable
Idealy PLL will be set in machine driver if MCLK doesn't meet the requirement of codec. To let the codec driver be more general, we can use a common PLL setting once sysclk/pll doesn't set properly in machine driver. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/rt5665.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c
index 370ed54d1e15..d3103efcb135 100644
--- a/sound/soc/codecs/rt5665.c
+++ b/sound/soc/codecs/rt5665.c
@@ -4098,9 +4098,12 @@ static int rt5665_hw_params(struct snd_pcm_substream *substream,
4098 rt5665->lrck[dai->id] = params_rate(params); 4098 rt5665->lrck[dai->id] = params_rate(params);
4099 pre_div = rl6231_get_clk_info(rt5665->sysclk, rt5665->lrck[dai->id]); 4099 pre_div = rl6231_get_clk_info(rt5665->sysclk, rt5665->lrck[dai->id]);
4100 if (pre_div < 0) { 4100 if (pre_div < 0) {
4101 dev_err(codec->dev, "Unsupported clock setting %d for DAI %d\n", 4101 dev_warn(codec->dev, "Force using PLL");
4102 rt5665->lrck[dai->id], dai->id); 4102 snd_soc_codec_set_pll(codec, 0, RT5665_PLL1_S_MCLK,
4103 return -EINVAL; 4103 rt5665->sysclk, rt5665->lrck[dai->id] * 512);
4104 snd_soc_codec_set_sysclk(codec, RT5665_SCLK_S_PLL1, 0,
4105 rt5665->lrck[dai->id] * 512, 0);
4106 pre_div = 1;
4104 } 4107 }
4105 frame_size = snd_soc_params_to_frame_size(params); 4108 frame_size = snd_soc_params_to_frame_size(params);
4106 if (frame_size < 0) { 4109 if (frame_size < 0) {