aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2014-07-16 14:04:41 +0200
committerMark Brown <broonie@linaro.org>2014-07-16 22:15:15 +0100
commit8267525c99f7a8ddb71a6f3d56cf17d4073a9973 (patch)
treeba85d477bfedb1fbc91f56229cb8afdeb4ba22c9 /sound/soc/davinci
parentASoC: davinci-mcasp: Use dmaengine based platform driver for AM335x/447x (diff)
downloadlinux-dev-8267525c99f7a8ddb71a6f3d56cf17d4073a9973.tar.xz
linux-dev-8267525c99f7a8ddb71a6f3d56cf17d4073a9973.zip
ASoC: mcasp: don't override bclk divider if it was provided by the machine
If a machine driver provides an BCLK divider to the McASP driver, skip the automatic calculation. This fixes machines on which the physical sample transport always works in 32 bits, even though not all of them are actually used. snd_soc_params_to_bclk() will fail to address such cases properly. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 02421d4275f5..c28508da34cf 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -65,6 +65,7 @@ struct davinci_mcasp {
u8 num_serializer;
u8 *serial_dir;
u8 version;
+ u8 bclk_div;
u16 bclk_lrclk_ratio;
int streams;
@@ -419,6 +420,7 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div
ACLKXDIV(div - 1), ACLKXDIV_MASK);
mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG,
ACLKRDIV(div - 1), ACLKRDIV_MASK);
+ mcasp->bclk_div = div;
break;
case 2: /* BCLK/LRCLK ratio */
@@ -721,8 +723,11 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
int period_size = params_period_size(params);
int ret;
- /* If mcasp is BCLK master we need to set BCLK divider */
- if (mcasp->bclk_master && mcasp->sysclk_freq) {
+ /*
+ * If mcasp is BCLK master, and a BCLK divider was not provided by
+ * the machine driver, we need to calculate the ratio.
+ */
+ if (mcasp->bclk_master && mcasp->bclk_div == 0 && 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) {