From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Alexey Klimov <alexey.klimov@linaro.org>,
broonie@kernel.org, linux-sound@vger.kernel.org
Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
krzysztof.kozlowski@linaro.org, pierre-louis.bossart@linux.dev,
vkoul@kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
dmitry.baryshkov@oss.qualcomm.com
Subject: Re: [PATCH] ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path
Date: Thu, 27 Mar 2025 15:53:18 +0000 [thread overview]
Message-ID: <e7c3ea4a-1103-46ff-aa9a-bc0da3bdf1b2@linaro.org> (raw)
In-Reply-To: <20250327154650.337404-1-alexey.klimov@linaro.org>
On 27/03/2025 15:46, Alexey Klimov wrote:
> In case of attempts to compress playback something, for instance,
> when audio routing is not set up correctly, the audio DSP is left in
> inconsistent state because we are not doing the correct things in
> the error path of q6asm_dai_compr_set_params().
>
> So, when routing is not set up and compress playback is attempted
> the following errors are present (simplified log):
>
> q6routing routing: Routing not setup for MultiMedia-1 Session
> q6asm-dai dais: Stream reg failed ret:-22
> q6asm-dai dais: ASoC error (-22): at snd_soc_component_compr_set_params()
> on 17300000.remoteproc:glink-edge:apr:service@7:dais
>
> After setting the correct routing the compress playback will always fail:
>
> q6asm-dai dais: cmd = 0x10db3 returned error = 0x9
> q6asm-dai dais: DSP returned error[9]
> q6asm-dai dais: q6asm_open_write failed
> q6asm-dai dais: ASoC error (-22): at snd_soc_component_compr_set_params()
> on 17300000.remoteproc:glink-edge:apr:service@7:dais
>
> 0x9 here means "Operation is already processed". The CMD_OPEN here was
> sent the second time hence DSP responds that it was already done.
>
> Turns out the CMD_CLOSE should be sent after the q6asm_open_write()
> succeeded but something failed after that, for instance, routing
> setup.
>
> Fix this by slightly reworking the error path in
> q6asm_dai_compr_set_params().
>
> Tested on QRB5165 RB5 and SDM845 RB3 boards.
>
> Cc: stable@vger.kernel.org
> Fixes: 5b39363e54cc ("ASoC: q6asm-dai: prepare set params to accept profile change")
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Cc: Vinod Koul <vkoul@kernel.org>
> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---
thanks for the patch,
This is now pretty much inline with what we have in non-compressed patch.
LGTM.
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
--srini
> sound/soc/qcom/qdsp6/q6asm-dai.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
> index 045100c94352..a400c9a31fea 100644
> --- a/sound/soc/qcom/qdsp6/q6asm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
> @@ -892,9 +892,7 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
>
> if (ret < 0) {
> dev_err(dev, "q6asm_open_write failed\n");
> - q6asm_audio_client_free(prtd->audio_client);
> - prtd->audio_client = NULL;
> - return ret;
> + goto open_err;
> }
> }
>
> @@ -903,7 +901,7 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
> prtd->session_id, dir);
> if (ret) {
> dev_err(dev, "Stream reg failed ret:%d\n", ret);
> - return ret;
> + goto q6_err;
> }
>
> ret = __q6asm_dai_compr_set_codec_params(component, stream,
> @@ -911,7 +909,7 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
> prtd->stream_id);
> if (ret) {
> dev_err(dev, "codec param setup failed ret:%d\n", ret);
> - return ret;
> + goto q6_err;
> }
>
> ret = q6asm_map_memory_regions(dir, prtd->audio_client, prtd->phys,
> @@ -920,12 +918,21 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
>
> if (ret < 0) {
> dev_err(dev, "Buffer Mapping failed ret:%d\n", ret);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto q6_err;
> }
>
> prtd->state = Q6ASM_STREAM_RUNNING;
>
> return 0;
> +
> +q6_err:
> + q6asm_cmd(prtd->audio_client, prtd->stream_id, CMD_CLOSE);
> +
> +open_err:
> + q6asm_audio_client_free(prtd->audio_client);
> + prtd->audio_client = NULL;
> + return ret;
> }
>
> static int q6asm_dai_compr_set_metadata(struct snd_soc_component *component,
next prev parent reply other threads:[~2025-03-27 15:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 15:46 Alexey Klimov
2025-03-27 15:53 ` Srinivas Kandagatla [this message]
2025-03-27 21:11 ` 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=e7c3ea4a-1103-46ff-aa9a-bc0da3bdf1b2@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alexey.klimov@linaro.org \
--cc=broonie@kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=vkoul@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
all inboxes | Powered by JetHome®