hal: enable mono clips for incall music delivery

Currently ICMD output is set as stereo and do downmix to
mono when writing to driver, the speed of mono playback
will be doubled.

Do downmix for steteo clips only to fix it.

Change-Id: I654cad4348f2538e07b596ec7b00a5c8f53f537a
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 0580353..462f2cc 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -5680,7 +5680,7 @@
                 int16_t *src = (int16_t *)buffer;
                 int16_t *dst = (int16_t *)buffer;
 
-                LOG_ALWAYS_FATAL_IF(out->config.channels != 1 || channel_count != 2 ||
+                LOG_ALWAYS_FATAL_IF(channel_count > 2 ||
                                     out->format != AUDIO_FORMAT_PCM_16_BIT,
                                     "out_write called for %s use case with wrong properties",
                                     use_case_table[out->usecase]);
@@ -5694,12 +5694,13 @@
                  * Code below goes over each frame in the buffer and adds both
                  * L and R samples and then divides by 2 to convert to mono
                  */
-                for (size_t i = 0; i < frames ; i++, dst++, src += 2) {
-                    *dst = (int16_t)(((int32_t)src[0] + (int32_t)src[1]) >> 1);
+                if (channel_count == 2) {
+                    for (size_t i = 0; i < frames ; i++, dst++, src += 2) {
+                        *dst = (int16_t)(((int32_t)src[0] + (int32_t)src[1]) >> 1);
+                    }
+                    bytes_to_write /= 2;
                 }
-                bytes_to_write /= 2;
             }
-
             ALOGVV("%s: writing buffer (%zu bytes) to pcm device", __func__, bytes);
 
             long ns = 0;
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index e6a4ed6..d9e54cd 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -748,8 +748,8 @@
 
         out->config = pcm_config_incall_music;
         //FIXME: add support for MONO stream configuration when audioflinger mixer supports it
-        out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO;
-        out->channel_mask = AUDIO_CHANNEL_OUT_STEREO;
+        out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_MONO;
+        out->supported_channel_masks[1] = AUDIO_CHANNEL_OUT_STEREO;
         out->config.rate = out->sample_rate;
 
         ALOGV("%s: mode=%d, usecase id=%d", __func__, adev->mode, out->usecase);