ASoC: amd: renoir: restore two more registers during resume
Subsystems (4)
PATCH v2 1/1 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().
--- sound/soc/amd/renoir/acp3x-pdm-dma.c | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
sound/soc/amd/renoir/acp3x-pdm-dma.c +9 -20
@@ -314,40 +314,30 @@ static int acp_pdm_dma_close(struct snd_soc_component *component,return 0 ; } -static int acp_pdm_dai_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params, -struct snd_soc_dai *dai) +static int acp_pdm_dai_trigger (struct snd_pcm_substream *substream, +int cmd,struct snd_soc_dai *dai) {struct pdm_stream_instance *rtd; +int ret; +bool pdm_status;unsigned int ch_mask; rtd = substream->runtime->private_data; -switch (params_channels (params)) { + ret =0 ; +switch (substream->runtime->channels) {case TWO_CH : ch_mask =0x00 ;break ;default :return -EINVAL ; } -rn_writel (ch_mask, rtd->acp_base +ACP_WOV_PDM_NO_OF_CHANNELS ); -rn_writel (PDM_DECIMATION_FACTOR , rtd->acp_base + -ACP_WOV_PDM_DECIMATION_FACTOR ); -return 0 ; -} - -static int acp_pdm_dai_trigger (struct snd_pcm_substream *substream, -int cmd,struct snd_soc_dai *dai) -{ -struct pdm_stream_instance *rtd; -int ret; -bool pdm_status; - - rtd = substream->runtime->private_data; - ret =0 ;switch (cmd) {case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_RESUME :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : +rn_writel (ch_mask, rtd->acp_base +ACP_WOV_PDM_NO_OF_CHANNELS ); +rn_writel (PDM_DECIMATION_FACTOR , rtd->acp_base + +ACP_WOV_PDM_DECIMATION_FACTOR ); rtd->bytescount =acp_pdm_get_byte_count (rtd, substream->stream); pdm_status =check_pdm_dma_status (rtd->acp_base);
@@ -369,7 +359,6 @@ static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream, }static struct snd_soc_dai_ops acp_pdm_dai_ops = { - .hw_params = acp_pdm_dai_hw_params, .trigger = acp_pdm_dai_trigger, };
Signature · 1 line
2.17.1
Quoted 18 lines · Hui Wang
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 thedai_hw_params()into thepdm_dai_trigger(), then these two registers will be set during resume sincepdm_dai_trigger()will be called during resume. And delete the empty functiondai_hw_params().
Quoted 2 lines
Signed-off-by Hui Wang <[email protected]>
Quoted 67 lines
--- sound/soc/amd/renoir/acp3x-pdm-dma.c | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-)sound/soc/amd/renoir/acp3x-pdm-dma.c +9
-20@@ -314,40 +314,30 @@ static int acp_pdm_dma_close(struct snd_soc_component *component,return 0 ; } -static int acp_pdm_dai_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params, -struct snd_soc_dai *dai) +static int acp_pdm_dai_trigger (struct snd_pcm_substream *substream, +int cmd,struct snd_soc_dai *dai) {struct pdm_stream_instance *rtd; +int ret; +bool pdm_status;unsigned int ch_mask; rtd = substream->runtime->private_data; -switch (params_channels (params)) { + ret =0 ; +switch (substream->runtime->channels) {case TWO_CH : ch_mask =0x00 ;break ;default :return -EINVAL ; } -rn_writel (ch_mask, rtd->acp_base +ACP_WOV_PDM_NO_OF_CHANNELS ); -rn_writel (PDM_DECIMATION_FACTOR , rtd->acp_base + -ACP_WOV_PDM_DECIMATION_FACTOR ); -return 0 ; -} - -static int acp_pdm_dai_trigger (struct snd_pcm_substream *substream, -int cmd,struct snd_soc_dai *dai) -{ -struct pdm_stream_instance *rtd; -int ret; -bool pdm_status; - - rtd = substream->runtime->private_data; - ret =0 ;switch (cmd) {case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_RESUME :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : +rn_writel (ch_mask, rtd->acp_base +ACP_WOV_PDM_NO_OF_CHANNELS ); +rn_writel (PDM_DECIMATION_FACTOR , rtd->acp_base + +ACP_WOV_PDM_DECIMATION_FACTOR ); rtd->bytescount =acp_pdm_get_byte_count (rtd, substream->stream); pdm_status =check_pdm_dma_status (rtd->acp_base);@@ -369,7 +359,6 @@ static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream, }static struct snd_soc_dai_ops acp_pdm_dai_ops = { - .hw_params = acp_pdm_dai_hw_params, .trigger = acp_pdm_dai_trigger, };
Mark Brown
maintainerQuoted 5 lines · Hui Wang
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.
Quoted 7 lines
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.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: amd: renoir: restore two more registers during resume
commit: ccff7bd468d5e0595176656a051ef67c01f01968
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark