From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Banajit Goswami <bgoswami@quicinc.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: qcom: audioreach: Add 4 channel support
Date: Mon, 23 Oct 2023 09:42:27 +0100 [thread overview]
Message-ID: <f882b666-8a68-4341-a143-cb226ab7d22b@linaro.org> (raw)
In-Reply-To: <20231020084919.18628-1-krzysztof.kozlowski@linaro.org>
Thanks for the patch,
On 20/10/2023 09:49, Krzysztof Kozlowski wrote:
> Add support four channel streams. Map channel 3 and 4 to left/right
> surround ("quad(side)" from ffmpeg standard channel list) to match what
> is in qdsp6/q6dsp-common.c driver.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> quad(side):
> https://trac.ffmpeg.org/wiki/AudioChannelManipulation#Listchannelnamesandstandardchannellayouts
> ---
> sound/soc/qcom/qdsp6/audioreach.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
> index 5974c7929dd3..4dd2a2e261c9 100644
> --- a/sound/soc/qcom/qdsp6/audioreach.c
> +++ b/sound/soc/qcom/qdsp6/audioreach.c
> @@ -833,6 +833,11 @@ static int audioreach_mfc_set_media_format(struct q6apm_graph *graph,
> } else if (num_channels == 2) {
> media_format->channel_mapping[0] = PCM_CHANNEL_L;
> media_format->channel_mapping[1] = PCM_CHANNEL_R;
> + } else if (num_channels == 4) {
> + media_format->channel_mapping[0] = PCM_CHANNEL_FL;
> + media_format->channel_mapping[1] = PCM_CHANNEL_FR;
> + media_format->channel_mapping[2] = PCM_CHANNEL_LS;
> + media_format->channel_mapping[3] = PCM_CHANNEL_RS;
These are fine, but duplicated from q6dsp_map_channels(), Please
consider using q6dsp_map_channels().
Also when you do that pl get rid of PCM_CHANNEL_L and PCM_CHANNEL_R
defines in audioreach.h
thanks,
--srini
> }
>
> rc = q6apm_send_cmd_sync(graph->apm, pkt, 0);
> @@ -869,6 +874,11 @@ static int audioreach_set_compr_media_format(struct media_format *media_fmt_hdr,
> } else if (mcfg->num_channels == 2) {
> mp3_cfg->channel_mapping[0] = PCM_CHANNEL_L;
> mp3_cfg->channel_mapping[1] = PCM_CHANNEL_R;
> + } else if (mcfg->num_channels == 4) {
> + mp3_cfg->channel_mapping[0] = PCM_CHANNEL_FL;
> + mp3_cfg->channel_mapping[1] = PCM_CHANNEL_FR;
> + mp3_cfg->channel_mapping[2] = PCM_CHANNEL_LS;
> + mp3_cfg->channel_mapping[3] = PCM_CHANNEL_RS;
> }
> break;
> case SND_AUDIOCODEC_AAC:
> @@ -1057,7 +1067,7 @@ static int audioreach_pcm_set_media_format(struct q6apm_graph *graph,
> int rc, payload_size;
> struct gpr_pkt *pkt;
>
> - if (num_channels > 2) {
> + if (num_channels > 4) {
> dev_err(graph->dev, "Error: Invalid channels (%d)!\n", num_channels);
> return -EINVAL;
> }
> @@ -1094,7 +1104,11 @@ static int audioreach_pcm_set_media_format(struct q6apm_graph *graph,
> } else if (num_channels == 2) {
> media_cfg->channel_mapping[0] = PCM_CHANNEL_L;
> media_cfg->channel_mapping[1] = PCM_CHANNEL_R;
> -
> + } else if (num_channels == 4) {
> + media_cfg->channel_mapping[0] = PCM_CHANNEL_FL;
> + media_cfg->channel_mapping[1] = PCM_CHANNEL_FR;
> + media_cfg->channel_mapping[2] = PCM_CHANNEL_LS;
> + media_cfg->channel_mapping[3] = PCM_CHANNEL_RS;
> }
>
> rc = q6apm_send_cmd_sync(graph->apm, pkt, 0);
> @@ -1116,7 +1130,7 @@ static int audioreach_shmem_set_media_format(struct q6apm_graph *graph,
> struct gpr_pkt *pkt;
> void *p;
>
> - if (num_channels > 2) {
> + if (num_channels > 4) {
> dev_err(graph->dev, "Error: Invalid channels (%d)!\n", num_channels);
> return -EINVAL;
> }
> @@ -1158,6 +1172,11 @@ static int audioreach_shmem_set_media_format(struct q6apm_graph *graph,
> else if (num_channels == 2) {
> cfg->channel_mapping[0] = PCM_CHANNEL_L;
> cfg->channel_mapping[1] = PCM_CHANNEL_R;
> + } else if (num_channels == 4) {
> + cfg->channel_mapping[0] = PCM_CHANNEL_FL;
> + cfg->channel_mapping[1] = PCM_CHANNEL_FR;
> + cfg->channel_mapping[2] = PCM_CHANNEL_LS;
> + cfg->channel_mapping[3] = PCM_CHANNEL_RS;
> }
> } else {
> rc = audioreach_set_compr_media_format(header, p, mcfg);
next prev parent reply other threads:[~2023-10-23 8:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 8:49 Krzysztof Kozlowski
2023-10-23 8:42 ` Srinivas Kandagatla [this message]
2023-11-30 12:17 ` Krzysztof Kozlowski
2023-11-30 12:24 ` Srinivas Kandagatla
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=f882b666-8a68-4341-a143-cb226ab7d22b@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--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
all inboxes | Powered by JetHome®