瀏覽代碼

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>
Peter Ujfalusi 9 年之前
父節點
當前提交
4a11ff2600
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      sound/soc/davinci/davinci-mcasp.c

+ 10 - 0
sound/soc/davinci/davinci-mcasp.c

@@ -77,6 +77,7 @@ struct davinci_mcasp {
 	u32 fifo_base;
 	u32 fifo_base;
 	struct device *dev;
 	struct device *dev;
 	struct snd_pcm_substream *substreams[2];
 	struct snd_pcm_substream *substreams[2];
+	unsigned int dai_fmt;
 
 
 	/* McASP specific data */
 	/* McASP specific data */
 	int	tdm_slots;
 	int	tdm_slots;
@@ -398,6 +399,9 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	bool fs_pol_rising;
 	bool fs_pol_rising;
 	bool inv_fs = false;
 	bool inv_fs = false;
 
 
+	if (!fmt)
+		return 0;
+
 	pm_runtime_get_sync(mcasp->dev);
 	pm_runtime_get_sync(mcasp->dev);
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_DSP_A:
 	case SND_SOC_DAIFMT_DSP_A:
@@ -529,6 +533,8 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
 		mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
 		mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
 		mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
 	}
 	}
+
+	mcasp->dai_fmt = fmt;
 out:
 out:
 	pm_runtime_put(mcasp->dev);
 	pm_runtime_put(mcasp->dev);
 	return ret;
 	return ret;
@@ -1026,6 +1032,10 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
 	int period_size = params_period_size(params);
 	int period_size = params_period_size(params);
 	int ret;
 	int ret;
 
 
+	ret = davinci_mcasp_set_dai_fmt(cpu_dai, mcasp->dai_fmt);
+	if (ret)
+		return ret;
+
 	/*
 	/*
 	 * If mcasp is BCLK master, and a BCLK divider was not provided by
 	 * If mcasp is BCLK master, and a BCLK divider was not provided by
 	 * the machine driver, we need to calculate the ratio.
 	 * the machine driver, we need to calculate the ratio.