summaryrefslogtreecommitdiffstats
path: root/hal/audio_extn
diff options
context:
space:
mode:
authorLakshman Chaluvaraju <lchalu@codeaurora.org>2019-06-24 10:04:52 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2019-08-27 21:36:16 -0700
commit3fe883a23e5f668b119c31af6e6b5c4dc5539c07 (patch)
tree5f3b27d8a5c54990a0ad677add8531cd6bcfb91f /hal/audio_extn
parentaccff5940e271f72dcc2301ff9f9dc3eae2322ae (diff)
downloadhardware_qcom_audio-3fe883a23e5f668b119c31af6e6b5c4dc5539c07.tar.gz
hardware_qcom_audio-3fe883a23e5f668b119c31af6e6b5c4dc5539c07.tar.bz2
hardware_qcom_audio-3fe883a23e5f668b119c31af6e6b5c4dc5539c07.zip
fm: Restore fm on Speaker
During fm plaback even though routing device is changed from WHP to SPK on UI, fm continues to route through WHP on targets with shared backend for WHP and SPK. This is due to APM unaware of routing device is change to SPK and selects WHP to play LL touch tones causes all active usecase on SPK to move to WHP and fm routes through WHP. Change is to handle this scenario by re-routing fm on SPK once standby is received for LL touch tones. Change-Id: Ia503d4c134a3679fc2a51e2f9b7b8343e7b7cd1e
Diffstat (limited to 'hal/audio_extn')
-rw-r--r--hal/audio_extn/audio_extn.h2
-rw-r--r--hal/audio_extn/fm.c23
2 files changed, 24 insertions, 1 deletions
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index c847291f..14d2325f 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -1025,10 +1025,12 @@ int audio_extn_set_soundfocus_data(struct audio_device *adev,
#ifndef FM_POWER_OPT
#define audio_extn_fm_set_parameters(adev, parms) (0)
#define audio_extn_fm_get_parameters(query, reply) (0)
+#define audio_extn_fm_route_on_selected_device(adev, device) (0)
#else
void audio_extn_fm_set_parameters(struct audio_device *adev,
struct str_parms *parms);
void audio_extn_fm_get_parameters(struct str_parms *query, struct str_parms *reply);
+void audio_extn_fm_route_on_selected_device(struct audio_device *adev, audio_devices_t device);
#endif
#ifndef APTX_DECODER_ENABLED
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 0a048cd9..ade6a7eb 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -389,4 +389,25 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
exit:
ALOGV("%s: exit", __func__);
}
+
+void audio_extn_fm_route_on_selected_device(struct audio_device *adev, audio_devices_t device)
+{
+ struct listnode *node;
+ struct audio_usecase *usecase;
+
+ if (fmmod.is_fm_running) {
+ list_for_each(node, &adev->usecase_list) {
+ usecase = node_to_item(node, struct audio_usecase, list);
+ if (usecase->id == USECASE_AUDIO_PLAYBACK_FM) {
+ if (fmmod.fm_device != device) {
+ ALOGV("%s selected routing device %x current device %x"
+ "are different, reroute on selected device", __func__,
+ fmmod.fm_device, device);
+ select_devices(adev, usecase->id);
+ }
+ }
+ }
+ }
+}
+
#endif /* FM_POWER_OPT end */