[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231020084919.18628-1-krzysztof.kozlowski@linaro.org>
Date: Fri, 20 Oct 2023 10:49:19 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami <bgoswami@...cinc.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH] ASoC: qcom: audioreach: Add 4 channel support
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@...aro.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;
}
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);
--
2.34.1
Powered by blists - more mailing lists