Skip to content

Commit dc7473e

Browse files
morimotobroonie
authored andcommitted
ASoC: renesas: msiof: setup both (Playback/Capture) in the same time
SITMDRn / SIRMDRn and some other registers should not be updated during working even though it was not related the target direction (for example, do TX settings during RX is working), otherwise it cause a FSERR. Setup both direction (Playback/Capture) in the same time. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Yusuke Goda <yusuke.goda.sx@renesas.com> Link: https://patch.msgid.link/877bxnyutt.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 25aa058 commit dc7473e

1 file changed

Lines changed: 41 additions & 29 deletions

File tree

sound/soc/renesas/rcar/msiof.c

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@
3636
* We need to use SW reset (= reset_control_xxx()) instead of TXRST/RXRST.
3737
*/
3838

39+
/*
40+
* [NOTE-BOTH-SETTING]
41+
*
42+
* SITMDRn / SIRMDRn and some other registers should not be updated during working even though it
43+
* was not related the target direction (for example, do TX settings during RX is working),
44+
* otherwise it cause a FSERR.
45+
*
46+
* Setup both direction (Playback/Capture) in the same time.
47+
*/
48+
3949
#include <linux/module.h>
4050
#include <linux/of.h>
4151
#include <linux/of_dma.h>
@@ -165,39 +175,40 @@ static int msiof_hw_start(struct snd_soc_component *component,
165175
/* Start DMAC */
166176
snd_dmaengine_pcm_trigger(substream, cmd);
167177

178+
/*
179+
* setup both direction (Playback/Capture) in the same time.
180+
* see
181+
* above [NOTE-BOTH-SETTING]
182+
*/
183+
168184
/* SITMDRx */
169-
if (is_play) {
170-
val = SITMDR1_PCON |
171-
FIELD_PREP(SIMDR1_SYNCMD, SIMDR1_SYNCMD_LR) |
172-
SIMDR1_SYNCAC | SIMDR1_XXSTP;
173-
if (msiof_flag_has(priv, MSIOF_FLAGS_NEED_DELAY))
174-
val |= FIELD_PREP(SIMDR1_DTDL, 1);
175-
176-
msiof_write(priv, SITMDR1, val);
177-
178-
val = FIELD_PREP(SIMDR2_BITLEN1, width - 1);
179-
msiof_write(priv, SITMDR2, val | FIELD_PREP(SIMDR2_GRP, 1));
180-
msiof_write(priv, SITMDR3, val);
181-
}
185+
val = SITMDR1_PCON | SIMDR1_SYNCAC | SIMDR1_XXSTP |
186+
FIELD_PREP(SIMDR1_SYNCMD, SIMDR1_SYNCMD_LR);
187+
if (msiof_flag_has(priv, MSIOF_FLAGS_NEED_DELAY))
188+
val |= FIELD_PREP(SIMDR1_DTDL, 1);
189+
190+
msiof_write(priv, SITMDR1, val);
191+
192+
val = FIELD_PREP(SIMDR2_BITLEN1, width - 1);
193+
msiof_write(priv, SITMDR2, val | FIELD_PREP(SIMDR2_GRP, 1));
194+
msiof_write(priv, SITMDR3, val);
195+
182196
/* SIRMDRx */
183-
else {
184-
val = FIELD_PREP(SIMDR1_SYNCMD, SIMDR1_SYNCMD_LR) |
185-
SIMDR1_SYNCAC;
186-
if (msiof_flag_has(priv, MSIOF_FLAGS_NEED_DELAY))
187-
val |= FIELD_PREP(SIMDR1_DTDL, 1);
197+
val = SIMDR1_SYNCAC |
198+
FIELD_PREP(SIMDR1_SYNCMD, SIMDR1_SYNCMD_LR);
199+
if (msiof_flag_has(priv, MSIOF_FLAGS_NEED_DELAY))
200+
val |= FIELD_PREP(SIMDR1_DTDL, 1);
188201

189-
msiof_write(priv, SIRMDR1, val);
202+
msiof_write(priv, SIRMDR1, val);
190203

191-
val = FIELD_PREP(SIMDR2_BITLEN1, width - 1);
192-
msiof_write(priv, SIRMDR2, val | FIELD_PREP(SIMDR2_GRP, 1));
193-
msiof_write(priv, SIRMDR3, val);
194-
}
204+
val = FIELD_PREP(SIMDR2_BITLEN1, width - 1);
205+
msiof_write(priv, SIRMDR2, val | FIELD_PREP(SIMDR2_GRP, 1));
206+
msiof_write(priv, SIRMDR3, val);
195207

196208
/* SIFCTR */
197-
if (is_play)
198-
msiof_update(priv, SIFCTR, SIFCTR_TFWM, FIELD_PREP(SIFCTR_TFWM, SIFCTR_TFWM_1));
199-
else
200-
msiof_update(priv, SIFCTR, SIFCTR_RFWM, FIELD_PREP(SIFCTR_RFWM, SIFCTR_RFWM_1));
209+
msiof_write(priv, SIFCTR,
210+
FIELD_PREP(SIFCTR_TFWM, SIFCTR_TFWM_1) |
211+
FIELD_PREP(SIFCTR_RFWM, SIFCTR_RFWM_1));
201212

202213
/* SIIER */
203214
if (is_play)
@@ -214,10 +225,11 @@ static int msiof_hw_start(struct snd_soc_component *component,
214225
msiof_update(priv, SISTR, val, val);
215226

216227
/* SICTR */
228+
val = SICTR_TEDG | SICTR_REDG;
217229
if (is_play)
218-
val = SICTR_TXE | SICTR_TEDG;
230+
val |= SICTR_TXE;
219231
else
220-
val = SICTR_RXE | SICTR_REDG;
232+
val |= SICTR_RXE;
221233
msiof_update_and_wait(priv, SICTR, val, val, val);
222234

223235
return 0;

0 commit comments

Comments
 (0)