alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: Hui Wang <hui.wang@canonical.com>,
	alsa-devel@alsa-project.org, broonie@kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] ASoC: amd: renoir: restore two more registers during resume
Date: Thu, 30 Jul 2020 17:32:41 +0530	[thread overview]
Message-ID: <5d00fc3f-acbe-cfb5-38fe-cd787c509a2d@amd.com> (raw)
In-Reply-To: <20200730075020.15667-1-hui.wang@canonical.com>



On 30/07/20 1:20 pm, Hui Wang wrote:
> 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 in the resume() too, this issue could be fixed.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Hui Wang <hui.wang@canonical.com>
> ---
>   sound/soc/amd/renoir/acp3x-pdm-dma.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
> index 623dfd3ea705..8acb0315a169 100644
> --- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
> +++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
> @@ -474,6 +474,11 @@ static int acp_pdm_resume(struct device *dev)
>   		rtd = runtime->private_data;
>   		period_bytes = frames_to_bytes(runtime, runtime->period_size);
>   		buffer_len = frames_to_bytes(runtime, runtime->buffer_size);
> +		if (runtime->channels == TWO_CH) {
> +			rn_writel(0x0 , rtd->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS);
> +			rn_writel(PDM_DECIMATION_FACTOR, rtd->acp_base +
> +				  ACP_WOV_PDM_DECIMATION_FACTOR);
> +		}


Could you refactor the code.
Remove this logic from resume callback
Add this register sequence in acp_pdm_dai_trigger() callback before 
invoking start_pdm _dma() callback.
Remove acp_pdm_dai_hw_params().
>   		config_acp_dma(rtd, SNDRV_PCM_STREAM_CAPTURE);
>   		init_pdm_ring_buffer(MEM_WINDOW_START, buffer_len, period_bytes,
>   				     adata->acp_base);
> 

  reply	other threads:[~2020-07-30 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30  7:50 [PATCH] ASoC: amd: renoir: restore two more registers during resume Hui Wang
2020-07-30 12:02 ` Mukunda,Vijendar [this message]
2020-07-30 12:07   ` Hui Wang
2020-08-03 15:52 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d00fc3f-acbe-cfb5-38fe-cd787c509a2d@amd.com \
    --to=vijendar.mukunda@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hui.wang@canonical.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).