From 5bba6cbc207b4973be655cb30987587ce27b27a7 Mon Sep 17 00:00:00 2001 From: Mingming Yin Date: Thu, 30 Jul 2015 14:59:12 -0700 Subject: [PATCH] hal: add FM_TUNER capture support Add FM_TUNER as supported capture source and device. Change-Id: I575125ca485d41b04e31d60f37619037329b0895 --- hal/msm8916/platform.c | 9 ++++++--- hal/msm8974/platform.c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index 873dd4f8..d15a252f 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -2603,7 +2603,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } } else if (source == AUDIO_SOURCE_FM_RX || - source == AUDIO_SOURCE_FM_RX_A2DP) { + source == AUDIO_SOURCE_FM_RX_A2DP || + source == AUDIO_SOURCE_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else if (source == AUDIO_SOURCE_DEFAULT) { goto exit; @@ -2646,7 +2647,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET || in_device & AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; - } else if (in_device & AUDIO_DEVICE_IN_FM_RX) { + } else if (in_device & AUDIO_DEVICE_IN_FM_RX || + in_device & AUDIO_DEVICE_IN_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else { ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); @@ -3297,7 +3299,8 @@ int64_t platform_render_latency(audio_usecase_t usecase) int platform_update_usecase_from_source(int source, int usecase) { ALOGV("%s: input source :%d", __func__, source); - if(source == AUDIO_SOURCE_FM_RX_A2DP) + if (source == AUDIO_SOURCE_FM_RX_A2DP || + source == AUDIO_SOURCE_FM_TUNER) usecase = USECASE_AUDIO_RECORD_FM_VIRTUAL; return usecase; } diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 4df1c019..ab9c77b9 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -2508,7 +2508,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } } } else if (source == AUDIO_SOURCE_FM_RX || - source == AUDIO_SOURCE_FM_RX_A2DP) { + source == AUDIO_SOURCE_FM_RX_A2DP|| + source == AUDIO_SOURCE_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else if (source == AUDIO_SOURCE_DEFAULT) { goto exit; @@ -2551,7 +2552,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d } else if (in_device & AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET || in_device & AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET) { snd_device = SND_DEVICE_IN_USB_HEADSET_MIC; - } else if (in_device & AUDIO_DEVICE_IN_FM_RX) { + } else if (in_device & AUDIO_DEVICE_IN_FM_RX || + in_device & AUDIO_DEVICE_IN_FM_TUNER) { snd_device = SND_DEVICE_IN_CAPTURE_FM; } else { ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); @@ -3227,7 +3229,8 @@ int64_t platform_render_latency(audio_usecase_t usecase) int platform_update_usecase_from_source(int source, int usecase) { ALOGV("%s: input source :%d", __func__, source); - if(source == AUDIO_SOURCE_FM_RX_A2DP) + if (source == AUDIO_SOURCE_FM_RX_A2DP || + source == AUDIO_SOURCE_FM_TUNER) usecase = USECASE_AUDIO_RECORD_FM_VIRTUAL; return usecase; }