Merge f0b97c8e69c0b62d794cfe83aa2d538e039a803e on remote branch

Change-Id: I860fec2e11f34052fe945958a138ac454bb49294
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index aa2a68e..847fff2 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3761,8 +3761,15 @@
             out_set_pcm_volume(&out->stream, out->volume_l, out->volume_r);
         }
     } else {
-        platform_set_stream_channel_map(adev->platform, out->channel_mask,
-                   out->pcm_device_id, &out->channel_map_param.channel_map[0]);
+        /*
+         * set custom channel map if:
+         *   1. neither mono nor stereo clips i.e. channels > 2 OR
+         *   2. custom channel map has been set by client
+         * else default channel map of FC/FR/FL can always be set to DSP
+         */
+        if (popcount(out->channel_mask) > 2 || out->channel_map_param.channel_map[0])
+            platform_set_stream_channel_map(adev->platform, out->channel_mask,
+                       out->pcm_device_id, &out->channel_map_param.channel_map[0]);
         audio_enable_asm_bit_width_enforce_mode(adev->mixer,
                                                 adev->dsp_bit_width_enforce_mode,
                                                 true);