From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Zhangfei Gao <zhangfei.gao@oss.qualcomm.com>,
Mark Brown <broonie@kernel.org>,
Srinivas Kandagatla <srini@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
shengchao.guo@oss.qualcomm.com,
mohammad.rafi.shaik@oss.qualcomm.com,
bartosz.golaszewski@oss.qualcomm.com,
Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ASoC: qcom: audioreach: support multichannel PCM formats
Date: Tue, 27 Oct 2026 13:47:38 +0000 [thread overview]
Message-ID: <0dd1f699-6e08-4e9c-bf92-187edf9904c7@oss.qualcomm.com> (raw)
In-Reply-To: <20261026082534.986449-1-zhangfei.gao@oss.qualcomm.com>
On 10/26/26 8:25 AM, Zhangfei Gao wrote:
> AudioReach currently rejects PCM streams with more than four channels in
> the PCM and shared-memory media format paths.
bit more context would help, why you need it now?
>
> Reuse q6dsp_map_channels() to support multichannel PCM formats.
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@oss.qualcomm.com>
> ---
>
> v2: reuse q6dsp_map_channels
>
> sound/soc/qcom/qdsp6/audioreach.c | 26 -------------------------
> sound/soc/qcom/qdsp6/audioreach.h | 1 -
> sound/soc/qcom/qdsp6/q6apm-dai.c | 12 +++++++++---
> sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 9 +++++++--
> 4 files changed, 16 insertions(+), 32 deletions(-)
>
> diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
> index d2dc5d37bccf..33161523c7da 100644
> --- a/sound/soc/qcom/qdsp6/audioreach.c
> +++ b/sound/soc/qcom/qdsp6/audioreach.c
> @@ -306,22 +306,6 @@ void *audioreach_alloc_apm_cmd_pkt(int pkt_size, uint32_t opcode, uint32_t token
> }
> EXPORT_SYMBOL_GPL(audioreach_alloc_apm_cmd_pkt);
>
> -void audioreach_set_default_channel_mapping(u8 *ch_map, int num_channels)
> -{
> - if (num_channels == 1) {
> - ch_map[0] = PCM_CHANNEL_FL;
> - } else if (num_channels == 2) {
> - ch_map[0] = PCM_CHANNEL_FL;
> - ch_map[1] = PCM_CHANNEL_FR;
> - } else if (num_channels == 4) {
> - ch_map[0] = PCM_CHANNEL_FL;
> - ch_map[1] = PCM_CHANNEL_FR;
> - ch_map[2] = PCM_CHANNEL_LS;
> - ch_map[3] = PCM_CHANNEL_RS;
> - }
> -}
> -EXPORT_SYMBOL_GPL(audioreach_set_default_channel_mapping);
> -
while you at this, please remove AR_PCM_MAX_NUM_CHANNEL too.
Other than that it looks good to me.
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
--srini
> static void apm_populate_container_config(struct apm_container_obj *cfg,
> const struct audioreach_container *cont)
> {
> @@ -1185,11 +1169,6 @@ static int audioreach_pcm_set_media_format(struct q6apm_graph *graph,
> int payload_size;
> int i, j;
>
> - if (num_channels > 4) {
> - dev_err(graph->dev, "Error: Invalid channels (%d)!\n", num_channels);
> - return -EINVAL;
> - }
> -
> payload_size = APM_PCM_MODULE_FMT_CMD_PSIZE(num_channels);
>
> struct gpr_pkt *pkt __free(kfree) =
> @@ -1275,11 +1254,6 @@ static int audioreach_shmem_set_media_format(struct q6apm_graph *graph,
> int i, j;
> void *p;
>
> - if (num_channels > 4) {
> - dev_err(graph->dev, "Error: Invalid channels (%d)!\n", num_channels);
> - return -EINVAL;
> - }
> -
> payload_size = APM_SHMEM_FMT_CFG_PSIZE(num_channels) + APM_MODULE_PARAM_DATA_SIZE;
>
> struct gpr_pkt *pkt __free(kfree) =
> diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h
> index 587f14ce71d2..495072da070b 100644
> --- a/sound/soc/qcom/qdsp6/audioreach.h
> +++ b/sound/soc/qcom/qdsp6/audioreach.h
> @@ -1009,7 +1009,6 @@ static inline u16 audioreach_gpr_dest_domain(gpr_device_t *gdev)
>
> void *audioreach_alloc_apm_cmd_pkt(int pkt_size, uint32_t opcode,
> uint32_t token);
> -void audioreach_set_default_channel_mapping(u8 *ch_map, int num_channels);
> void *audioreach_alloc_cmd_pkt(int payload_size, uint32_t opcode,
> uint32_t token, uint32_t src_port,
> uint32_t dest_port);
> diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
> index 58beaf906b9f..83594b693569 100644
> --- a/sound/soc/qcom/qdsp6/q6apm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
> @@ -21,6 +21,7 @@
> #include <asm/div64.h>
> #include <asm/dma.h>
> #include "q6apm.h"
> +#include "q6dsp-common.h"
>
> #define DRV_NAME "q6apm-dai"
> #define POS_BUFFER_BYTES 4096
> @@ -344,7 +345,10 @@ static int q6apm_dai_prepare(struct snd_soc_component *component,
> cfg.num_channels = runtime->channels;
> cfg.bit_width = prtd->bits_per_sample;
> cfg.fmt = SND_AUDIOCODEC_PCM;
> - audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels);
> + ret = q6dsp_map_channels(cfg.channel_map, runtime->channels);
> + if (ret)
> + return ret;
> +
> if (prtd->state) {
> /* clear the previous setup if any */
> q6apm_graph_stop(prtd->graph);
> @@ -1007,8 +1011,10 @@ static int q6apm_dai_compr_set_params(struct snd_soc_component *component,
> cfg.num_channels = 2;
> cfg.bit_width = prtd->bits_per_sample;
> cfg.fmt = codec->id;
> - audioreach_set_default_channel_mapping(cfg.channel_map,
> - cfg.num_channels);
> + ret = q6dsp_map_channels(cfg.channel_map, cfg.num_channels);
> + if (ret)
> + return ret;
> +
> memcpy(&cfg.codec, codec, sizeof(*codec));
>
> ret = q6apm_graph_media_format_shmem(prtd->graph, &cfg);
> diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
> index 83f2711bceea..fcc0267d3657 100644
> --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
> +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
> @@ -147,7 +147,9 @@ static int q6hdmi_hw_params(struct snd_pcm_substream *substream,
> cfg->bit_width = params_width(params);
> cfg->sample_rate = params_rate(params);
> cfg->num_channels = channels;
> - audioreach_set_default_channel_mapping(cfg->channel_map, channels);
> + ret = q6dsp_map_channels(cfg->channel_map, channels);
> + if (ret)
> + return ret;
>
> switch (dai->id) {
> case DISPLAY_PORT_RX_0:
> @@ -173,11 +175,14 @@ static int q6dma_hw_params(struct snd_pcm_substream *substream,
> struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
> struct audioreach_module_config *cfg = &dai_data->module_config[dai->id];
> int channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max;
> + int ret;
>
> cfg->bit_width = params_width(params);
> cfg->sample_rate = params_rate(params);
> cfg->num_channels = channels;
> - audioreach_set_default_channel_mapping(cfg->channel_map, channels);
> + ret = q6dsp_map_channels(cfg->channel_map, channels);
> + if (ret)
> + return ret;
>
> return 0;
> }
next prev parent reply other threads:[~2026-10-27 13:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 8:25 Zhangfei Gao
2026-10-27 8:46 ` Prasad Kumpatla
2026-10-27 9:55 ` Zhangfei Gao
2026-10-27 11:45 ` Prasad Kumpatla
2026-10-27 13:47 ` Srinivas Kandagatla [this message]
2026-10-28 2:40 ` Zhangfei Gao
2026-10-28 2:47 ` [PATCH v3] " Zhangfei Gao
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=0dd1f699-6e08-4e9c-bf92-187edf9904c7@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mohammad.rafi.shaik@oss.qualcomm.com \
--cc=perex@perex.cz \
--cc=prasad.kumpatla@oss.qualcomm.com \
--cc=shengchao.guo@oss.qualcomm.com \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
--cc=zhangfei.gao@oss.qualcomm.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®