summaryrefslogtreecommitdiff
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2014-06-13 12:50:00 +0300
committerMark Brown <broonie@linaro.org>2014-06-21 11:05:01 +0100
commit0929878f93be5534974e058bc1e4b3abb36478b5 (patch)
treebbf7764317a8565a99e66a706e5514e45713cd1a /sound/soc/davinci
parent6479285d8aa1cbf22d21706370e812e7af51241c (diff)
downloadlinux-exynos-0929878f93be5534974e058bc1e4b3abb36478b5.tar.gz
linux-exynos-0929878f93be5534974e058bc1e4b3abb36478b5.tar.bz2
linux-exynos-0929878f93be5534974e058bc1e4b3abb36478b5.zip
ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider
Do not fail if the exact BLCK rate can not be produced, just print a warning. Check that sysclk frequency is set before implicitly setting the BCLK divider. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 121971e1371e..5b81adb3c93e 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -721,14 +721,18 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
int ret;
/* If mcasp is BCLK master we need to set BCLK divider */
- if (mcasp->bclk_master) {
+ if (mcasp->bclk_master && mcasp->sysclk_freq) {
unsigned int bclk_freq = snd_soc_params_to_bclk(params);
+ unsigned int div = mcasp->sysclk_freq / bclk_freq;
if (mcasp->sysclk_freq % bclk_freq != 0) {
- dev_err(mcasp->dev, "Can't produce required BCLK\n");
- return -EINVAL;
+ if (((mcasp->sysclk_freq / div) - bclk_freq) >
+ (bclk_freq - (mcasp->sysclk_freq / (div+1))))
+ div++;
+ dev_warn(mcasp->dev,
+ "Inaccurate BCLK: %u Hz / %u != %u Hz\n",
+ mcasp->sysclk_freq, div, bclk_freq);
}
- davinci_mcasp_set_clkdiv(
- cpu_dai, 1, mcasp->sysclk_freq / bclk_freq);
+ davinci_mcasp_set_clkdiv(cpu_dai, 1, div);
}
ret = mcasp_common_hw_param(mcasp, substream->stream,