aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-04-04 07:31:42 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:24:24 -0400
commit6dfa9a4e6aacba70bff24c47871ac9aba3e76020 (patch)
tree1221f7e82b8077cda05cf4a79dc450695852f0bc /sound/soc/davinci
parent33445643c3146fa43af3e9aa1cce08da9fe03157 (diff)
ASoC: davinci-mcasp: Format data delay configuration enhancement
Use intermediate variable for the data delay needed for the specific format and write the register after the format configuration at once. This will help to control the number of lines as support for more formats going to be added. Also fixes a case when we switch between two formats with different delay requirements. Signed-off-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.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 196158f2d1c4..f0c98653bfe7 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -271,6 +271,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
271{ 271{
272 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai); 272 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
273 int ret = 0; 273 int ret = 0;
274 u32 data_delay;
274 275
275 pm_runtime_get_sync(mcasp->dev); 276 pm_runtime_get_sync(mcasp->dev);
276 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 277 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -278,18 +279,25 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
278 case SND_SOC_DAIFMT_AC97: 279 case SND_SOC_DAIFMT_AC97:
279 mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXDUR); 280 mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
280 mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRDUR); 281 mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
282
283 /* No delay after FS */
284 data_delay = 0;
281 break; 285 break;
282 default: 286 default:
283 /* configure a full-word SYNC pulse (LRCLK) */ 287 /* configure a full-word SYNC pulse (LRCLK) */
284 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXDUR); 288 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
285 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRDUR); 289 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
286 290
287 /* make 1st data bit occur one ACLK cycle after the frame sync */ 291 /* 1st data bit occur one ACLK cycle after the frame sync */
288 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, FSXDLY(1)); 292 data_delay = 1;
289 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, FSRDLY(1));
290 break; 293 break;
291 } 294 }
292 295
296 mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, FSXDLY(data_delay),
297 FSXDLY(3));
298 mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, FSRDLY(data_delay),
299 FSRDLY(3));
300
293 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 301 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
294 case SND_SOC_DAIFMT_CBS_CFS: 302 case SND_SOC_DAIFMT_CBS_CFS:
295 /* codec is clock and frame slave */ 303 /* codec is clock and frame slave */