aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2016-03-11 06:18:51 -0500
committerMark Brown <broonie@kernel.org>2016-03-11 21:42:26 -0500
commit4a11ff260053b1097a5afa6c51e8d5e064aa88a7 (patch)
treed87ce175b21210a659f35f48c0bc2951ca4df766
parentc670254f63fe09681b1c4c82d3d059c6cc04ce09 (diff)
ASoC: davinci-mcasp: dai format runtime reconfiguration
In case when the dai format is set via the dai_link the format configuration happens once when the links are probed. If the McASP lose context after this, the information will be lost and McASP will not going to work correctly. To overcome this issue, we save the fmt and set it within hw_params as well. Reported-by: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/davinci/davinci-mcasp.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 3cf46afb353f..e1324989bd6b 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -77,6 +77,7 @@ struct davinci_mcasp {
77 u32 fifo_base; 77 u32 fifo_base;
78 struct device *dev; 78 struct device *dev;
79 struct snd_pcm_substream *substreams[2]; 79 struct snd_pcm_substream *substreams[2];
80 unsigned int dai_fmt;
80 81
81 /* McASP specific data */ 82 /* McASP specific data */
82 int tdm_slots; 83 int tdm_slots;
@@ -398,6 +399,9 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
398 bool fs_pol_rising; 399 bool fs_pol_rising;
399 bool inv_fs = false; 400 bool inv_fs = false;
400 401
402 if (!fmt)
403 return 0;
404
401 pm_runtime_get_sync(mcasp->dev); 405 pm_runtime_get_sync(mcasp->dev);
402 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 406 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
403 case SND_SOC_DAIFMT_DSP_A: 407 case SND_SOC_DAIFMT_DSP_A:
@@ -529,6 +533,8 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
529 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); 533 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
530 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); 534 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
531 } 535 }
536
537 mcasp->dai_fmt = fmt;
532out: 538out:
533 pm_runtime_put(mcasp->dev); 539 pm_runtime_put(mcasp->dev);
534 return ret; 540 return ret;
@@ -1026,6 +1032,10 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
1026 int period_size = params_period_size(params); 1032 int period_size = params_period_size(params);
1027 int ret; 1033 int ret;
1028 1034
1035 ret = davinci_mcasp_set_dai_fmt(cpu_dai, mcasp->dai_fmt);
1036 if (ret)
1037 return ret;
1038
1029 /* 1039 /*
1030 * If mcasp is BCLK master, and a BCLK divider was not provided by 1040 * If mcasp is BCLK master, and a BCLK divider was not provided by
1031 * the machine driver, we need to calculate the ratio. 1041 * the machine driver, we need to calculate the ratio.