hal: msm8974: Fix the wrong device for AUDIO_SOURCE_CAMCORDER
* The 4b08413 commit ("audio: select camcorder snd device according to camera
orientation") adds the ability to configure microphones depending on the
camera orientation, however, some code associated with 'snd_device' is written
in the wrong place, since the subsequent code after them will still reassign
'snd_device'. Fix this by moving the current code to the place
SND_DEVICE_IN_CAMCORDER_MIC, as was originally intended in the original
source.
Change-Id: Ief851c0f320d0acaa95fb5c33713d2e655194497
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 9ff9533..f5532b8 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -7714,37 +7714,37 @@
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) {
- switch (adev->camera_orientation) {
- case CAMERA_BACK_LANDSCAPE:
- snd_device = SND_DEVICE_IN_CAMCORDER_LANDSCAPE;
- break;
- case CAMERA_BACK_INVERT_LANDSCAPE:
- snd_device = SND_DEVICE_IN_CAMCORDER_INVERT_LANDSCAPE;
- break;
- case CAMERA_BACK_PORTRAIT:
- snd_device = SND_DEVICE_IN_CAMCORDER_PORTRAIT;
- break;
- case CAMERA_FRONT_LANDSCAPE:
- snd_device = SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE;
- break;
- case CAMERA_FRONT_INVERT_LANDSCAPE:
- snd_device = SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE;
- break;
- case CAMERA_FRONT_PORTRAIT:
- snd_device = SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT;
- break;
- default:
- ALOGW("%s: invalid camera orientation %08x", __func__, adev->camera_orientation);
- snd_device = SND_DEVICE_IN_CAMCORDER_LANDSCAPE;
- break;
- }
+
if (str_bitwidth == 16) {
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;
else
- snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
+ switch (adev->camera_orientation) {
+ case CAMERA_BACK_LANDSCAPE:
+ snd_device = SND_DEVICE_IN_CAMCORDER_LANDSCAPE;
+ break;
+ case CAMERA_BACK_INVERT_LANDSCAPE:
+ snd_device = SND_DEVICE_IN_CAMCORDER_INVERT_LANDSCAPE;
+ break;
+ case CAMERA_BACK_PORTRAIT:
+ snd_device = SND_DEVICE_IN_CAMCORDER_PORTRAIT;
+ break;
+ case CAMERA_FRONT_LANDSCAPE:
+ snd_device = SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE;
+ break;
+ case CAMERA_FRONT_INVERT_LANDSCAPE:
+ snd_device = SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE;
+ break;
+ case CAMERA_FRONT_PORTRAIT:
+ snd_device = SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT;
+ break;
+ default:
+ ALOGW("%s: invalid camera orientation %08x", __func__, adev->camera_orientation);
+ snd_device = SND_DEVICE_IN_CAMCORDER_LANDSCAPE;
+ break;
+ }
}
/*
* for other bit widths