hal: msm8974: Use stereo recording depending on camera orientation

* The 4b08413 commit ("select camcorder snd device according to camera
  orientation") adds the ability to configure microphones depending on
  camera orientation. Use this option to select the desired device for stereo
  video recording depending on the orientation of the camera.
* Use SND_DEVICE_IN_SPEAKER_DMIC_STEREO for CAMERA_BACK_LANDSCAPE as a
  standard device, since in this camera position it is more advantageous
  to connect the 'speaker-mic' first to avoid inverted audio channels.
* For full-fledged work, you need to set "ro.audio.monitorRotation=true"
  to listen to the orientation of the device or manually send parameters
  via AudioManager.

Change-Id: Ieb217c47d48771970a800b93eefafeb20493fee4
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 89f6a50..6ebd6c2 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -7266,7 +7266,22 @@
                 if ((my_data->fluence_type & FLUENCE_DUAL_MIC) &&
                     (my_data->source_mic_type & SOURCE_DUAL_MIC) &&
                     (channel_count == 2))
-                    snd_device = SND_DEVICE_IN_HANDSET_DMIC_STEREO;
+                    switch (adev->camera_orientation) {
+                        case CAMERA_BACK_LANDSCAPE:
+                        case CAMERA_FRONT_INVERT_LANDSCAPE:
+                            snd_device = SND_DEVICE_IN_SPEAKER_DMIC_STEREO;
+                            break;
+                        case CAMERA_BACK_INVERT_LANDSCAPE:
+                        case CAMERA_BACK_PORTRAIT:
+                        case CAMERA_FRONT_LANDSCAPE:
+                        case CAMERA_FRONT_PORTRAIT:
+                            snd_device = SND_DEVICE_IN_HANDSET_DMIC_STEREO;
+                            break;
+                        default:
+                            ALOGW("%s: invalid camera orientation %08x", __func__, adev->camera_orientation);
+                            snd_device = SND_DEVICE_IN_HANDSET_DMIC_STEREO;
+                            break;
+                    }
                 else
                     switch (adev->camera_orientation) {
                         case CAMERA_BACK_LANDSCAPE: