Re: [PATCH] ASoC: qcom: audioreach: Add 4 channel support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>


---

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);



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux