Commit 1ac2bd16 authored by Olivier Moysan's avatar Olivier Moysan Committed by Mark Brown

ASoC: stm32: i2s: fix dma configuration

DMA configuration is not balanced on start/stop.
Move DMA configuration to trigger callback.
Signed-off-by: default avatarOlivier Moysan <olivier.moysan@st.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent ebf629d5
...@@ -488,7 +488,7 @@ static int stm32_i2s_configure(struct snd_soc_dai *cpu_dai, ...@@ -488,7 +488,7 @@ static int stm32_i2s_configure(struct snd_soc_dai *cpu_dai,
{ {
struct stm32_i2s_data *i2s = snd_soc_dai_get_drvdata(cpu_dai); struct stm32_i2s_data *i2s = snd_soc_dai_get_drvdata(cpu_dai);
int format = params_width(params); int format = params_width(params);
u32 cfgr, cfgr_mask, cfg1, cfg1_mask; u32 cfgr, cfgr_mask, cfg1;
unsigned int fthlv; unsigned int fthlv;
int ret; int ret;
...@@ -529,15 +529,11 @@ static int stm32_i2s_configure(struct snd_soc_dai *cpu_dai, ...@@ -529,15 +529,11 @@ static int stm32_i2s_configure(struct snd_soc_dai *cpu_dai,
if (ret < 0) if (ret < 0)
return ret; return ret;
cfg1 = I2S_CFG1_RXDMAEN | I2S_CFG1_TXDMAEN;
cfg1_mask = cfg1;
fthlv = STM32_I2S_FIFO_SIZE * I2S_FIFO_TH_ONE_QUARTER / 4; fthlv = STM32_I2S_FIFO_SIZE * I2S_FIFO_TH_ONE_QUARTER / 4;
cfg1 |= I2S_CFG1_FTHVL_SET(fthlv - 1); cfg1 = I2S_CFG1_FTHVL_SET(fthlv - 1);
cfg1_mask |= I2S_CFG1_FTHVL_MASK;
return regmap_update_bits(i2s->regmap, STM32_I2S_CFG1_REG, return regmap_update_bits(i2s->regmap, STM32_I2S_CFG1_REG,
cfg1_mask, cfg1); I2S_CFG1_FTHVL_MASK, cfg1);
} }
static int stm32_i2s_startup(struct snd_pcm_substream *substream, static int stm32_i2s_startup(struct snd_pcm_substream *substream,
...@@ -592,6 +588,10 @@ static int stm32_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -592,6 +588,10 @@ static int stm32_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
/* Enable i2s */ /* Enable i2s */
dev_dbg(cpu_dai->dev, "start I2S\n"); dev_dbg(cpu_dai->dev, "start I2S\n");
cfg1_mask = I2S_CFG1_RXDMAEN | I2S_CFG1_TXDMAEN;
regmap_update_bits(i2s->regmap, STM32_I2S_CFG1_REG,
cfg1_mask, cfg1_mask);
ret = regmap_update_bits(i2s->regmap, STM32_I2S_CR1_REG, ret = regmap_update_bits(i2s->regmap, STM32_I2S_CR1_REG,
I2S_CR1_SPE, I2S_CR1_SPE); I2S_CR1_SPE, I2S_CR1_SPE);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment