Re: [RFC PATCH v2 6/6] ASoC: q6asm-dai: add support to set_codec_params

From: Daniel Baluta
Date: Wed Jul 22 2020 - 10:04:45 EST


On Tue, Jul 21, 2020 at 8:03 PM Srinivas Kandagatla
<srinivas.kandagatla@xxxxxxxxxx> wrote:
>
> Make use of new set_codec_params callback to allow decoder switching
> during gapless playback.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
> ---
> sound/soc/qcom/qdsp6/q6asm-dai.c | 33 ++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
> index b5c719682919..a8cfb1996614 100644
> --- a/sound/soc/qcom/qdsp6/q6asm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
> @@ -876,6 +876,37 @@ static int __q6asm_dai_compr_set_codec_params(struct snd_soc_component *componen
> return 0;
> }
>
> +static int q6asm_dai_compr_set_codec_params(struct snd_soc_component *component,
> + struct snd_compr_stream *stream,
> + struct snd_codec *codec)
> +{
> + struct snd_compr_runtime *runtime = stream->runtime;
> + struct q6asm_dai_rtd *prtd = runtime->private_data;
> + int ret;
> +
> + ret = q6asm_open_write(prtd->audio_client, prtd->next_track_stream_id,
> + codec->id, codec->profile, prtd->bits_per_sample,
> + true);
> + if (ret < 0) {
> + pr_err("q6asm_open_write failed\n");

Since you have component->dev here I think it is worth it to use
dev_err instead of pr_err.

Same for the rest of the code.