From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"James Schulman" <james.schulman@cirrus.com>,
"David Rhodes" <david.rhodes@cirrus.com>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Nuno Sá" <nuno.sa@analog.com>,
"Banajit Goswami" <bgoswami@quicinc.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] ASoC: qcom: x1e80100: Correct channel mapping
Date: Tue, 7 May 2024 14:20:41 +0100 [thread overview]
Message-ID: <738045d2-a445-4f93-abfd-203348a538d1@linaro.org> (raw)
In-Reply-To: <20240507-asoc-x1e80100-4-channel-mapping-v1-4-b12c13e0a55d@linaro.org>
Thanks Krzystof for the patch.
On 07/05/2024 11:27, Krzysztof Kozlowski wrote:
> X1E80100 CRD board comes with four speakers arranged as left front+back
> and then right front+back. Using default channel mapping causes front
> right speaker to play left back stream.
>
> Adjust the channel maps for frontend DAIs to fix stereo and four-channel
> playback.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> sound/soc/qcom/x1e80100.c | 37 +++++++++++++++++++++++++++++++++++--
> 1 file changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c
> index c3c8bf7ffb5b..e90c68815b5c 100644
> --- a/sound/soc/qcom/x1e80100.c
> +++ b/sound/soc/qcom/x1e80100.c
> @@ -12,6 +12,7 @@
>
> #include "common.h"
> #include "qdsp6/q6afe.h"
> +#include "qdsp6/q6dsp-common.h"
> #include "sdw.h"
>
> struct x1e80100_snd_data {
> @@ -74,7 +75,7 @@ static int x1e80100_snd_hw_params(struct snd_pcm_substream *substream,
> return qcom_snd_sdw_hw_params(substream, params, &data->sruntime[cpu_dai->id]);
> }
>
> -static int x1e80100_snd_prepare(struct snd_pcm_substream *substream)
> +static int x1e80100_snd_be_prepare(struct snd_pcm_substream *substream)
> {
> struct snd_soc_pcm_runtime *rtd = substream->private_data;
> struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> @@ -96,12 +97,34 @@ static int x1e80100_snd_hw_free(struct snd_pcm_substream *substream)
> &data->stream_prepared[cpu_dai->id]);
> }
>
> +static int x1e80100_snd_fe_prepare(struct snd_pcm_substream *substream)
> +{
> + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> +
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> + const unsigned int rx_slot[4] = { PCM_CHANNEL_FL,
> + PCM_CHANNEL_LB,
> + PCM_CHANNEL_FR,
> + PCM_CHANNEL_RB };
> +
> + snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, ARRAY_SIZE(rx_slot),
> + rx_slot);
Channel mapping are specific to backend dais rather than front end pcm dais.
This will set all the playback pcms with this channel maps, which is a
problem.
example the 2 channel headset we will endup with data of front channel
and zeros on the right channel, however a speaker might work as you have
4 speakers in your system.
So No for this approach.
--srini
> + }
> +
> + return 0;
> +}
> +
> static const struct snd_soc_ops x1e80100_be_ops = {
> .startup = qcom_snd_sdw_startup,
> .shutdown = x1e80100_snd_shutdown,
> .hw_params = x1e80100_snd_hw_params,
> .hw_free = x1e80100_snd_hw_free,
> - .prepare = x1e80100_snd_prepare,
> + .prepare = x1e80100_snd_be_prepare,
> +};
> +
> +static const struct snd_soc_ops x1e80100_fe_ops = {
> + .prepare = x1e80100_snd_fe_prepare,
> };
>
> static void x1e80100_add_be_ops(struct snd_soc_card *card)
> @@ -118,6 +141,15 @@ static void x1e80100_add_be_ops(struct snd_soc_card *card)
> }
> }
>
> +static int x1e80100_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
> +{
> + /* Add ops for Frontend DAIs coming from Topology */
> + if (link->dynamic && !link->no_pcm && !link->ops)
> + link->ops = &x1e80100_fe_ops;
> +
> + return 0;
> +}
> +
> static int x1e80100_platform_probe(struct platform_device *pdev)
> {
> struct snd_soc_card *card;
> @@ -135,6 +167,7 @@ static int x1e80100_platform_probe(struct platform_device *pdev)
>
> card->owner = THIS_MODULE;
> card->dev = dev;
> + card->add_dai_link = x1e80100_add_dai_link;
> dev_set_drvdata(dev, card);
> snd_soc_card_set_drvdata(card, data);
>
>
next prev parent reply other threads:[~2024-05-07 13:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 10:27 [PATCH 0/4] ASoC: qcom: x1e80100: Correct channel mapping Krzysztof Kozlowski
2024-05-07 10:27 ` [PATCH 1/4] ASoC: Constify channel mapping array arguments in set_channel_map() Krzysztof Kozlowski
2024-05-07 11:57 ` Charles Keepax
2024-05-07 10:27 ` [PATCH 2/4] ASoC: qcom: q6dsp: Implement proper channel mapping in Audioreach Krzysztof Kozlowski
2024-05-07 13:25 ` Srinivas Kandagatla
2024-05-07 18:16 ` Krzysztof Kozlowski
2024-05-07 10:27 ` [PATCH 3/4] ASoC: qcom: q6dsp: Set channel mapping instead of fixed defaults Krzysztof Kozlowski
2024-05-07 10:27 ` [PATCH 4/4] ASoC: qcom: x1e80100: Correct channel mapping Krzysztof Kozlowski
2024-05-07 13:20 ` Srinivas Kandagatla [this message]
2024-05-07 18:15 ` Krzysztof Kozlowski
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=738045d2-a445-4f93-abfd-203348a538d1@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=david.rhodes@cirrus.com \
--cc=james.schulman@cirrus.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=rf@opensource.cirrus.com \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox