hal: do not set custom channel map for mono and stereo clips

In case of compress playback for some mono clips, DSP assumes
the channel map to be FL/FR, while default custom channel map
is set to FC, then volume can't be adjusted.
For mono and stereo clips, don't set custom channel map if
it's not specified by clients. This can ensure volume can
always be applied for FL/FR/FC channels.

Change-Id: I28aea5cf98a0a5d794669bc1a8fce674abbd18eb
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 8f18c8f..a4d6d43 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3913,8 +3913,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);