audio: Add support for quad EC capture

Define quad EC reference device for FFV and also
define acdb and pcm id for quad EC capture in platform xml.

CRs-Fixed: 2379310
Change-Id: I80c447d4a2161f9c4ee82935a01878f6578281d1
diff --git a/hal/audio_extn/ffv.c b/hal/audio_extn/ffv.c
index e86f434..2e99c40 100644
--- a/hal/audio_extn/ffv.c
+++ b/hal/audio_extn/ffv.c
@@ -59,6 +59,7 @@
 #define AUDIO_PARAMETER_FFV_EC_REF_CHANNEL_COUNT "ffv_ec_ref_channel_count"
 #define AUDIO_PARAMETER_FFV_EC_REF_DEVICE "ffv_ec_ref_dev"
 #define AUDIO_PARAMETER_FFV_CHANNEL_INDEX "ffv_channel_index"
+#define AUDIO_PARAMETER_FFV_CHANNEL_COUNT "ffv_channel_count"
 
 #if LINUX_ENABLED
 #define FFV_CONFIG_FILE_PATH "/etc/BF_1out.cfg"
@@ -158,6 +159,7 @@
     pthread_mutex_t init_lock;
     bool capture_started;
     int target_ch_idx;
+    int ch_count;
 
 #ifdef FFV_PCM_DUMP
     FILE *fp_input;
@@ -188,6 +190,7 @@
     .handle = NULL,
     .capture_started = false,
     .target_ch_idx = -1,
+    .ch_count = 6,
 };
 
 static struct pcm_config ffv_pcm_config = {
@@ -458,9 +461,9 @@
     ffvmod.capture_config = ffv_pcm_config;
     ffvmod.ec_ref_config = ffv_pcm_config;
     ffvmod.out_config = ffv_pcm_config;
-    /* configure capture session with 6/8 channels */
+    /* configure capture session with 6/8/4 channels */
     ffvmod.capture_config.channels = ffvmod.split_ec_ref_data ?
-        FFV_CHANNEL_MODE_OCT : FFV_CHANNEL_MODE_HEX;
+                   FFV_CHANNEL_MODE_OCT : ffvmod.ch_count;
     ffvmod.capture_config.period_size =
                    CALCULATE_PERIOD_SIZE(FFV_PCM_BUFFER_DURATION_MS,
                                          ffvmod.capture_config.rate,
@@ -889,6 +892,9 @@
             } else if (val == 2) {
                 ALOGD("%s: stereo ec ref", __func__);
                 ffvmod.ec_ref_ch_cnt = FFV_CHANNEL_MODE_STEREO;
+            } else if (val == 4) {
+                ALOGD("%s: quad ec ref", __func__);
+                ffvmod.ec_ref_ch_cnt = FFV_CHANNEL_MODE_QUAD;
             } else {
                 ALOGE("%s: Invalid ec ref", __func__);
             }
@@ -928,5 +934,12 @@
             ALOGD("%s: set target chan index %d", __func__, val);
             ffvmod.target_ch_idx = val;
         }
+
+        ret = str_parms_get_int(parms, AUDIO_PARAMETER_FFV_CHANNEL_COUNT, &val);
+        if (ret >= 0) {
+            str_parms_del(parms, AUDIO_PARAMETER_FFV_CHANNEL_COUNT);
+            ALOGD("%s: set ffv channel count %d", __func__, val);
+            ffvmod.ch_count = val;
+        }
     }
 }