Skip to content

Commit 7eccc86

Browse files
laklimovbroonie
authored andcommitted
ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path
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: 5b39363 ("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> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://patch.msgid.link/20250327154650.337404-1-alexey.klimov@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7e010a0 commit 7eccc86

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

sound/soc/qcom/qdsp6/q6asm-dai.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,7 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
892892

893893
if (ret < 0) {
894894
dev_err(dev, "q6asm_open_write failed\n");
895-
q6asm_audio_client_free(prtd->audio_client);
896-
prtd->audio_client = NULL;
897-
return ret;
895+
goto open_err;
898896
}
899897
}
900898

@@ -903,15 +901,15 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
903901
prtd->session_id, dir);
904902
if (ret) {
905903
dev_err(dev, "Stream reg failed ret:%d\n", ret);
906-
return ret;
904+
goto q6_err;
907905
}
908906

909907
ret = __q6asm_dai_compr_set_codec_params(component, stream,
910908
&params->codec,
911909
prtd->stream_id);
912910
if (ret) {
913911
dev_err(dev, "codec param setup failed ret:%d\n", ret);
914-
return ret;
912+
goto q6_err;
915913
}
916914

917915
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,
920918

921919
if (ret < 0) {
922920
dev_err(dev, "Buffer Mapping failed ret:%d\n", ret);
923-
return -ENOMEM;
921+
ret = -ENOMEM;
922+
goto q6_err;
924923
}
925924

926925
prtd->state = Q6ASM_STREAM_RUNNING;
927926

928927
return 0;
928+
929+
q6_err:
930+
q6asm_cmd(prtd->audio_client, prtd->stream_id, CMD_CLOSE);
931+
932+
open_err:
933+
q6asm_audio_client_free(prtd->audio_client);
934+
prtd->audio_client = NULL;
935+
return ret;
929936
}
930937

931938
static int q6asm_dai_compr_set_metadata(struct snd_soc_component *component,

0 commit comments

Comments
 (0)