Re: [PATCH v2] ASoC: qcom: audioreach: support multichannel PCM formats
From: Prasad Kumpatla
Date: Tue Oct 27 2026 - 04:47:52 EST
#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);
|
|q6dsp_map_channels()| changes the mono mapping from |PCM_CHANNEL_FL| to |PCM_CHANNEL_FC| and does not handle 7 channels. Have these cases been checked and confirmed to be supported as expected for AudioReach ?
Thanks,
Prasad
+ 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;
}