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

From: Krzysztof Kozlowski
Date: Thu Nov 30 2023 - 07:17:38 EST


On 23/10/2023 10:42, Srinivas Kandagatla wrote:
> 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

The code is not exactly equivalent, e.g. for one channel L (=1) -> FC
(=3). I assume that's okay for you.

Best regards,
Krzysztof