diff options
author | Daniel Mack <zonque@gmail.com> | 2014-07-16 08:04:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-07-16 17:15:15 -0400 |
commit | 8267525c99f7a8ddb71a6f3d56cf17d4073a9973 (patch) | |
tree | ba85d477bfedb1fbc91f56229cb8afdeb4ba22c9 /sound/soc/davinci | |
parent | f3f9cfa8a1a78a3bc0dc6b7d5c26baeb07a75499 (diff) |
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.c | 9 |
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 { | |||
65 | u8 num_serializer; | 65 | u8 num_serializer; |
66 | u8 *serial_dir; | 66 | u8 *serial_dir; |
67 | u8 version; | 67 | u8 version; |
68 | u8 bclk_div; | ||
68 | u16 bclk_lrclk_ratio; | 69 | u16 bclk_lrclk_ratio; |
69 | int streams; | 70 | int streams; |
70 | 71 | ||
@@ -419,6 +420,7 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
419 | ACLKXDIV(div - 1), ACLKXDIV_MASK); | 420 | ACLKXDIV(div - 1), ACLKXDIV_MASK); |
420 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, | 421 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, |
421 | ACLKRDIV(div - 1), ACLKRDIV_MASK); | 422 | ACLKRDIV(div - 1), ACLKRDIV_MASK); |
423 | mcasp->bclk_div = div; | ||
422 | break; | 424 | break; |
423 | 425 | ||
424 | case 2: /* BCLK/LRCLK ratio */ | 426 | case 2: /* BCLK/LRCLK ratio */ |
@@ -721,8 +723,11 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
721 | int period_size = params_period_size(params); | 723 | int period_size = params_period_size(params); |
722 | int ret; | 724 | int ret; |
723 | 725 | ||
724 | /* If mcasp is BCLK master we need to set BCLK divider */ | 726 | /* |
725 | if (mcasp->bclk_master && mcasp->sysclk_freq) { | 727 | * If mcasp is BCLK master, and a BCLK divider was not provided by |
728 | * the machine driver, we need to calculate the ratio. | ||
729 | */ | ||
730 | if (mcasp->bclk_master && mcasp->bclk_div == 0 && mcasp->sysclk_freq) { | ||
726 | unsigned int bclk_freq = snd_soc_params_to_bclk(params); | 731 | unsigned int bclk_freq = snd_soc_params_to_bclk(params); |
727 | unsigned int div = mcasp->sysclk_freq / bclk_freq; | 732 | unsigned int div = mcasp->sysclk_freq / bclk_freq; |
728 | if (mcasp->sysclk_freq % bclk_freq != 0) { | 733 | if (mcasp->sysclk_freq % bclk_freq != 0) { |