hal: Add separate backend for headset-mic

Add separate backend for headset-mic
for concurrent record usecase.

Change-Id: Iba26751eb51c00a62016a47e0d3c726b155cf169
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 329da7b..95c92d0 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2947,6 +2947,14 @@
             strdup("SLIM_6_RX Format");
         my_data->current_backend_cfg[HEADPHONE_BACKEND].samplerate_mixer_ctl =
             strdup("SLIM_6_RX SampleRate");
+        //TODO: enable CONCURRENT_CAPTURE_ENABLED flag only if separate backend is defined
+        //for headset-mic. This is to capture separate data from headset-mic and handset-mic.
+#ifdef CONCURRENT_CAPTURE_ENABLED
+        my_data->current_backend_cfg[HEADSET_TX_BACKEND].bitwidth_mixer_ctl =
+            strdup("SLIM_1_RX Format");
+        my_data->current_backend_cfg[HEADSET_TX_BACKEND].samplerate_mixer_ctl =
+            strdup("SLIM_1_RX SampleRate");
+#endif
     }
 
     my_data->current_backend_cfg[USB_AUDIO_TX_BACKEND].bitwidth_mixer_ctl =
@@ -3864,6 +3872,8 @@
                         port = HDMI_TX_BACKEND;
                 else if (strcmp(backend_tag_table[snd_device], "hdmi-arc-in") == 0)
                         port = HDMI_ARC_TX_BACKEND;
+                else if (strcmp(backend_tag_table[snd_device], "headset-mic") == 0)
+                        port = HEADSET_TX_BACKEND;
         }
     } else {
         ALOGW("%s:napb: Invalid device - %d ", __func__, snd_device);
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 44d4a74..2620fa8 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -67,10 +67,15 @@
  * All these devices are handled by the internal HW codec. We can
  * enable any one of these devices at any time
  */
+#ifdef CONCURRENT_CAPTURE_ENABLED
+#define AUDIO_DEVICE_IN_ALL_CODEC_BACKEND \
+    (AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BACK_MIC | \
+     AUDIO_DEVICE_IN_VOICE_CALL) & ~AUDIO_DEVICE_BIT_IN
+#else
 #define AUDIO_DEVICE_IN_ALL_CODEC_BACKEND \
     (AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BACK_MIC | \
      AUDIO_DEVICE_IN_WIRED_HEADSET | AUDIO_DEVICE_IN_VOICE_CALL) & ~AUDIO_DEVICE_BIT_IN
-
+#endif
 /* Sound devices specific to the platform
  * The DEVICE_OUT_* and DEVICE_IN_* should be mapped to these sound
  * devices to enable corresponding mixer paths
@@ -306,6 +311,7 @@
     SPDIF_TX_BACKEND,
     HDMI_TX_BACKEND,
     HDMI_ARC_TX_BACKEND,
+    HEADSET_TX_BACKEND,
     MAX_CODEC_BACKENDS
 };