Merge "hal: Check hfp usecase to differenciate between nb and wb"
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index fb428db..d432670 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -184,8 +184,10 @@
#ifndef HFP_ENABLED
#define audio_extn_hfp_is_active(adev) (0)
+#define audio_extn_hfp_get_usecase() (0)
#else
bool audio_extn_hfp_is_active(struct audio_device *adev);
+audio_usecase_t audio_extn_hfp_get_usecase();
#endif
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/hfp.c b/hal/audio_extn/hfp.c
index 2d6e1e0..c480490 100644
--- a/hal/audio_extn/hfp.c
+++ b/hal/audio_extn/hfp.c
@@ -220,7 +220,7 @@
bool audio_extn_hfp_is_active(struct audio_device *adev)
{
struct audio_usecase *hfp_usecase = NULL;
- hfp_usecase = get_usecase_from_list(adev, USECASE_AUDIO_HFP_SCO);
+ hfp_usecase = get_usecase_from_list(adev, hfpmod.ucid);
if (hfp_usecase != NULL)
return true;
@@ -228,6 +228,11 @@
return false;
}
+audio_usecase_t audio_extn_hfp_get_usecase()
+{
+ return hfpmod.ucid;
+}
+
void audio_extn_hfp_set_parameters(struct audio_device *adev, struct str_parms *parms)
{
int ret;
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 147146c..ff25a2c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -602,6 +602,7 @@
struct audio_usecase *vc_usecase = NULL;
struct audio_usecase *voip_usecase = NULL;
struct audio_usecase *hfp_usecase = NULL;
+ audio_usecase_t hfp_ucid;
struct listnode *node;
int status = 0;
@@ -641,7 +642,8 @@
out_snd_device = voip_usecase->out_snd_device;
}
} else if (audio_extn_hfp_is_active(adev)) {
- hfp_usecase = get_usecase_from_list(adev, USECASE_AUDIO_HFP_SCO);
+ hfp_ucid = audio_extn_hfp_get_usecase();
+ hfp_usecase = get_usecase_from_list(adev, hfp_ucid);
if (hfp_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) {
in_snd_device = hfp_usecase->in_snd_device;
out_snd_device = hfp_usecase->out_snd_device;