From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Mark Brown <broonie@kernel.org>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
bard.liao@intel.com, Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Jerome Brunet <jbrunet@baylibre.com>
Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 1/4] ASoC: makes CPU/Codec channel connection map more generic
Date: Tue, 17 Oct 2023 09:45:55 -0500 [thread overview]
Message-ID: <d3c97c54-d149-4bed-9013-3f07bc6a7f52@linux.intel.com> (raw)
In-Reply-To: <87y1g3wdng.wl-kuninori.morimoto.gx@renesas.com>
Hi Morimoto-san,
we're facing an across-the-board regression with this patch, even in
regular 'nocodec' configurations with dummy dais and no codec.
> @@ -1055,22 +1054,28 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
> /* copy params for each cpu */
> tmp_params = *params;
>
> - if (!rtd->dai_link->codec_ch_maps)
> - goto hw_params;
By removing this test, we now proceed and deal with both FE and BE...
> /*
> * construct cpu channel mask by combining ch_mask of each
> * codec which maps to the cpu.
> + * see
> + * soc.h :: [dai_link->ch_maps Image sample]
> */
> - for_each_rtd_codec_dais(rtd, j, codec_dai) {
> - if (rtd->dai_link->codec_ch_maps[j].connected_cpu_id == i)
> - ch_mask |= rtd->dai_link->codec_ch_maps[j].ch_mask;
> + if (rtd->dai_link->num_cpus >= rtd->dai_link->num_codecs) {
> + /* .ch_map is from CPU */
> + ch_mask = rtd->dai_link->ch_maps[i].ch_mask;
... and for a FE dailink there's no ch_maps so this results in a kernel
oops.
> + } else {
> + int j;
> +
> + /* .ch_map is from Codec */
> + for_each_rtd_codec_dais(rtd, j, codec_dai)
> + if (rtd->dai_link->ch_maps[j].connected_node == i)
> + ch_mask |= rtd->dai_link->ch_maps[j].ch_mask;
> }
>
> /* fixup cpu channel number */
> if (ch_mask)
> soc_pcm_codec_params_fixup(&tmp_params, ch_mask);
>
> -hw_params:
> ret = snd_soc_dai_hw_params(cpu_dai, substream, &tmp_params);
> if (ret < 0)
> goto out;
Bard suggested the following diff (being tested now), comments welcome.
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 0bfff2ea111d..ce84d9c1d8be 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1054,6 +1054,9 @@ static int __soc_pcm_hw_params(struct
snd_soc_pcm_runtime *rtd,
/* copy params for each cpu */
tmp_params = *params;
+ /* ch_map is only set in BE dai link */
+ if (rtd->dai_link->dynamic)
+ goto run;
/*
* construct cpu channel mask by combining ch_mask of each
* codec which maps to the cpu.
@@ -1075,7 +1078,7 @@ static int __soc_pcm_hw_params(struct
snd_soc_pcm_runtime *rtd,
/* fixup cpu channel number */
if (ch_mask)
soc_pcm_codec_params_fixup(&tmp_params, ch_mask);
-
+run:
ret = snd_soc_dai_hw_params(cpu_dai, substream,
&tmp_params);
if (ret < 0)
goto out;
next prev parent reply other threads:[~2023-10-17 14:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 1:37 [PATCH v4 0/4] ASoC: makes CPU/Codec channel connection map more generic Kuninori Morimoto
2023-10-16 1:37 ` [PATCH v4 1/4] " Kuninori Morimoto
2023-10-17 14:45 ` Pierre-Louis Bossart [this message]
2023-10-17 23:03 ` Kuninori Morimoto
2023-10-17 23:16 ` Pierre-Louis Bossart
2023-10-18 0:08 ` Kuninori Morimoto
2023-10-19 2:02 ` Kuninori Morimoto
2023-10-19 2:04 ` [PATCH][TEST-REQUEST] " Kuninori Morimoto
2023-10-19 3:34 ` kernel test robot
2023-10-19 15:32 ` Pierre-Louis Bossart
2023-10-19 23:55 ` Kuninori Morimoto
2023-10-16 1:37 ` [PATCH v4 2/4] ASoC: audio-graph-card2: add CPU:Codec = N:M support Kuninori Morimoto
2023-10-16 1:37 ` [PATCH v4 3/4] ASoC: audio-graph-card2-custom-sample: add CPU/Codec = N:M sample Kuninori Morimoto
2023-10-16 1:37 ` [PATCH v4 4/4] dt-bindings: audio-graph-port: add ch-maps property Kuninori Morimoto
2023-10-17 10:07 ` Conor Dooley
2023-10-16 8:25 ` [PATCH v4 0/4] ASoC: makes CPU/Codec channel connection map more generic Jerome Brunet
2023-10-16 22:59 ` Kuninori Morimoto
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=d3c97c54-d149-4bed-9013-3f07bc6a7f52@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=bard.liao@intel.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jbrunet@baylibre.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=robh+dt@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.