Skip to content

Commit ccff7bd

Browse files
jason77-wangbroonie
authored andcommitted
ASoC: amd: renoir: restore two more registers during resume
Recently we found an issue about the suspend and resume. If dmic is recording the sound, and we run suspend and resume, after the resume, the dmic can't work well anymore. we need to close the app and reopen the app, then the dmic could record the sound again. For example, we run "arecord -D hw:CARD=acp,DEV=0 -f S32_LE -c 2 -r 48000 test.wav", then suspend and resume, after the system resume back, we speak to the dmic. then stop the arecord, use aplay to play the test.wav, we could hear the sound recorded after resume is weird, it is not what we speak to the dmic. I found two registers are set in the dai_hw_params(), if the two registers are set during the resume, this issue could be fixed. Move the code of the dai_hw_params() into the pdm_dai_trigger(), then these two registers will be set during resume since pdm_dai_trigger() will be called during resume. And delete the empty function dai_hw_params(). Signed-off-by: Hui Wang <[email protected]> Reviewed-by: Vijendar Mukunda <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b023666 commit ccff7bd

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

sound/soc/amd/renoir/acp3x-pdm-dma.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -314,40 +314,30 @@ static int acp_pdm_dma_close(struct snd_soc_component *component,
314314
return 0;
315315
}
316316

317-
static int acp_pdm_dai_hw_params(struct snd_pcm_substream *substream,
318-
struct snd_pcm_hw_params *params,
319-
struct snd_soc_dai *dai)
317+
static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream,
318+
int cmd, struct snd_soc_dai *dai)
320319
{
321320
struct pdm_stream_instance *rtd;
321+
int ret;
322+
bool pdm_status;
322323
unsigned int ch_mask;
323324

324325
rtd = substream->runtime->private_data;
325-
switch (params_channels(params)) {
326+
ret = 0;
327+
switch (substream->runtime->channels) {
326328
case TWO_CH:
327329
ch_mask = 0x00;
328330
break;
329331
default:
330332
return -EINVAL;
331333
}
332-
rn_writel(ch_mask, rtd->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS);
333-
rn_writel(PDM_DECIMATION_FACTOR, rtd->acp_base +
334-
ACP_WOV_PDM_DECIMATION_FACTOR);
335-
return 0;
336-
}
337-
338-
static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream,
339-
int cmd, struct snd_soc_dai *dai)
340-
{
341-
struct pdm_stream_instance *rtd;
342-
int ret;
343-
bool pdm_status;
344-
345-
rtd = substream->runtime->private_data;
346-
ret = 0;
347334
switch (cmd) {
348335
case SNDRV_PCM_TRIGGER_START:
349336
case SNDRV_PCM_TRIGGER_RESUME:
350337
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
338+
rn_writel(ch_mask, rtd->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS);
339+
rn_writel(PDM_DECIMATION_FACTOR, rtd->acp_base +
340+
ACP_WOV_PDM_DECIMATION_FACTOR);
351341
rtd->bytescount = acp_pdm_get_byte_count(rtd,
352342
substream->stream);
353343
pdm_status = check_pdm_dma_status(rtd->acp_base);
@@ -369,7 +359,6 @@ static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream,
369359
}
370360

371361
static struct snd_soc_dai_ops acp_pdm_dai_ops = {
372-
.hw_params = acp_pdm_dai_hw_params,
373362
.trigger = acp_pdm_dai_trigger,
374363
};
375364

0 commit comments

Comments
 (0)