audio: introduce dedicated adev->cal_lock for gef interfaces
Audio device lock is not suitable for GEF operations, so add a dedicated
calibration lock for GEF.
CRs-Fixed: 2413132
Change-Id: Ic1e840c02e9d7f1bce5d3cb12702366af1c07f01
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index cf7c9f5..a540078 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2111,10 +2111,6 @@
struct stream_out stream_out;
audio_usecase_t hfp_ucid;
int status = 0;
- audio_devices_t audio_device = AUDIO_DEVICE_NONE;
- audio_channel_mask_t channel_mask = AUDIO_CHANNEL_NONE;
- int sample_rate = 0;
- int acdb_id = 0;
ALOGD("%s for use case (%s)", __func__, use_case_table[uc_id]);
@@ -2404,11 +2400,12 @@
usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
}
- /* Cache stream information to be notified to gef clients */
- audio_device = usecase->stream.out->devices;
- channel_mask = usecase->stream.out->channel_mask;
- sample_rate = usecase->stream.out->app_type_cfg.sample_rate;
- acdb_id = platform_get_snd_device_acdb_id(usecase->out_snd_device);
+ /* Notify device change info to effect clients registered */
+ audio_extn_gef_notify_device_config(
+ usecase->stream.out->devices,
+ usecase->stream.out->channel_mask,
+ usecase->stream.out->app_type_cfg.sample_rate,
+ platform_get_snd_device_acdb_id(usecase->out_snd_device));
}
enable_audio_route(adev, usecase);
@@ -2470,16 +2467,6 @@
}
}
- /* Notify device change info to effect clients registered
- * NOTE: device lock has to be unlock temporarily here.
- * To the worst case, we notify stale info to clients.
- */
- if (usecase->type == PCM_PLAYBACK) {
- pthread_mutex_unlock(&adev->lock);
- audio_extn_gef_notify_device_config(audio_device, channel_mask, sample_rate, acdb_id);
- pthread_mutex_lock(&adev->lock);
- }
-
if (usecase == voip_usecase) {
struct stream_out *voip_out = voip_usecase->stream.out;
audio_extn_utils_send_app_type_gain(adev,
@@ -8267,7 +8254,7 @@
if (audio_extn_qaf_is_enabled())
audio_extn_qaf_deinit();
audio_route_free(adev->audio_route);
- audio_extn_gef_deinit();
+ audio_extn_gef_deinit(adev);
free(adev->snd_dev_ref_cnt);
platform_deinit(adev->platform);
for (i = 0; i < ARRAY_SIZE(adev->use_case_table); ++i) {