Skip to content

Commit 5a81178

Browse files
Akshu Agrawalbroonie
authored andcommitted
ASoC: amd :High hw_level while simultaneous capture
Simultaneous capture on dmic and headset mic is having issue with high hw_level being reported. Issue Can be reproduced by: arecord -D hw:2,0 -f dat -d 60 /tmp/test0 & arecord -D hw:2,2 -f dat -d 60 /tmp/test1 & cat /proc/asound/card2/pcm?c/sub0/status Actual issue is : When we open one capture stream on one instance lets say I2S_SP and then once again if we open other capture on other instance lets say I2S_BT while first capture is in progress and when we try to read the status of both running instances by below command cat /proc/asound/card2/pcm?c/sub0/status we observe that avail_max is being doubled on first opened capture(I2S_SP in the example). This is because our previous implementation was like when any instance is opened it gets initialized in dma_open irrespective of on what instance it called open. For example: First I2S_SP called opened it initializes both SP/BT capture streams irrespective of on which instance the stream opened.next time I2S_BT called opened and it initializes both SP/BT this corrupts the behaviour . So with this patch the stream gets initialized only on specific instance when ever it gets opened calls hw_params. This rectifies the issue. Signed-off-by: Ravulapati Vishnu vardhan rao <[email protected]> Signed-off-by: Akshu Agrawal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f2b1e1c commit 5a81178

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

sound/soc/amd/raven/acp3x-pcm-dma.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,6 @@ static int acp3x_dma_open(struct snd_soc_component *component,
241241
adata->i2ssp_play_stream && !adata->i2ssp_capture_stream)
242242
rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
243243

244-
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
245-
adata->play_stream = substream;
246-
adata->i2ssp_play_stream = substream;
247-
} else {
248-
adata->capture_stream = substream;
249-
adata->i2ssp_capture_stream = substream;
250-
}
251-
252244
i2s_data->acp3x_base = adata->acp3x_base;
253245
runtime->private_data = i2s_data;
254246
return ret;
@@ -263,23 +255,42 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component,
263255
struct snd_soc_pcm_runtime *prtd;
264256
struct snd_soc_card *card;
265257
struct acp3x_platform_info *pinfo;
258+
struct i2s_dev_data *adata;
266259
u64 size;
267260

268261
prtd = substream->private_data;
269262
card = prtd->card;
270263
pinfo = snd_soc_card_get_drvdata(card);
264+
adata = dev_get_drvdata(component->dev);
271265
rtd = substream->runtime->private_data;
272266
if (!rtd)
273267
return -EINVAL;
274268

275-
if (pinfo)
276-
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
269+
if (pinfo) {
270+
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
277271
rtd->i2s_instance = pinfo->play_i2s_instance;
278-
else
272+
switch (rtd->i2s_instance) {
273+
case I2S_BT_INSTANCE:
274+
adata->play_stream = substream;
275+
break;
276+
case I2S_SP_INSTANCE:
277+
default:
278+
adata->i2ssp_play_stream = substream;
279+
}
280+
} else {
279281
rtd->i2s_instance = pinfo->cap_i2s_instance;
280-
else
282+
switch (rtd->i2s_instance) {
283+
case I2S_BT_INSTANCE:
284+
adata->capture_stream = substream;
285+
break;
286+
case I2S_SP_INSTANCE:
287+
default:
288+
adata->i2ssp_capture_stream = substream;
289+
}
290+
}
291+
} else {
281292
pr_err("pinfo failed\n");
282-
293+
}
283294
size = params_buffer_bytes(params);
284295
rtd->dma_addr = substream->dma_buffer.addr;
285296
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);

0 commit comments

Comments
 (0)