blob: 553f3ebf3205b5c13cb25d88156f368f7db3758b [file] [log] [blame]
Weiyin Jiangaa80acd2016-09-21 16:42:11 +08001/*
Aniket Kumar Lata0e6e1e52019-11-14 21:43:55 -08002 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
Weiyin Jiangaa80acd2016-09-21 16:42:11 +08003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
13 * * Neither the name of The Linux Foundation nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#define LOG_TAG "audio_hw_generic_effect"
31//#define LOG_NDEBUG 0
32#define LOG_NDDEBUG 0
33
34#include <errno.h>
35#include <math.h>
Weiyin Jiang2995f662019-04-17 14:25:12 +080036#include <log/log.h>
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080037#include <fcntl.h>
38#include <dirent.h>
39#include "audio_hw.h"
40#include "platform.h"
41#include "platform_api.h"
42#include <sys/stat.h>
43#include <stdlib.h>
44#include <dlfcn.h>
45#include <math.h>
46#include <cutils/properties.h>
47#include "audio_extn.h"
48#include "audio_hw.h"
trkzmnab2e2dc2020-02-03 18:07:31 +030049#include <pthread.h>
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080050
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053051#ifdef DYNAMIC_LOG_ENABLED
52#include <log_xml_parser.h>
53#define LOG_MASK HAL_MOD_FILE_GEF
54#include <log_utils.h>
55#endif
56
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080057#ifdef AUDIO_GENERIC_EFFECT_FRAMEWORK_ENABLED
58
Weiyin Jiang82e40942017-01-10 16:07:34 +080059#if LINUX_ENABLED
Manish Dewangan6a36d002017-10-09 14:11:00 +053060#define GEF_LIBRARY "libqtigef.so"
Weiyin Jiang82e40942017-01-10 16:07:34 +080061#else
David Ng06ccd872017-03-15 11:39:33 -070062#define GEF_LIBRARY "/vendor/lib/libqtigef.so"
Weiyin Jiang82e40942017-01-10 16:07:34 +080063#endif
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080064
65typedef void* (*gef_init_t)(void*);
Dhananjay Kumara427f142017-07-10 13:49:13 +053066typedef void (*gef_deinit_t)(void*);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080067typedef void (*gef_device_config_cb_t)(void*, audio_devices_t,
Weiyin Jiang40dcdb92019-07-08 17:31:52 +080068 audio_channel_mask_t, int, int, int);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080069
70typedef struct {
71 void* handle;
72 void* gef_ptr;
73 gef_init_t init;
Dhananjay Kumara427f142017-07-10 13:49:13 +053074 gef_deinit_t deinit;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080075 gef_device_config_cb_t device_config_cb;
76} gef_data;
77
78static gef_data gef_hal_handle;
79
80typedef enum {
81 ASM = 0,
82 ADM
83} gef_calibration_type;
84
85typedef enum {
86 AUDIO_DEVICE_CAL_TYPE = 0,
87 AUDIO_STREAM_CAL_TYPE,
88} acdb_device_type;
89
90
91static acdb_device_type make_acdb_device_type_from_gef_cal_type
92 (gef_calibration_type gef_cal_type)
93{
94 int acdb_device_type = 0;
95
96 switch (gef_cal_type) {
97 case ASM:
98 acdb_device_type = AUDIO_STREAM_CAL_TYPE;
99 break;
100 case ADM:
101 acdb_device_type = AUDIO_DEVICE_CAL_TYPE;
102 break;
103 default:
104 acdb_device_type = -1;
105 break;
106 }
107
108 return ((int)acdb_device_type);
109}
110
111void audio_extn_gef_init(struct audio_device *adev)
112{
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800113 const char* error = NULL;
114
115 ALOGV("%s: Enter with error", __func__);
116
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800117 pthread_mutex_init(&adev->cal_lock, (const pthread_mutexattr_t *) NULL);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800118 memset(&gef_hal_handle, 0, sizeof(gef_data));
119
Satish Babu Patakokila38230962017-10-18 20:34:56 +0530120 //: check error for dlopen
121 gef_hal_handle.handle = dlopen(GEF_LIBRARY, RTLD_LAZY);
122 if (gef_hal_handle.handle == NULL) {
123 ALOGE("%s: DLOPEN failed for %s with error %s",
124 __func__, GEF_LIBRARY, dlerror());
125 goto ERROR_RETURN;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800126 } else {
Satish Babu Patakokila38230962017-10-18 20:34:56 +0530127 ALOGV("%s: DLOPEN successful for %s", __func__, GEF_LIBRARY);
128
129 //call dlerror to clear the error
130 dlerror();
131 gef_hal_handle.init =
132 (gef_init_t)dlsym(gef_hal_handle.handle, "gef_init");
133 error = dlerror();
134
135 if(error != NULL) {
136 ALOGE("%s: dlsym of %s failed with error %s",
137 __func__, "gef_init", error);
138 goto ERROR_RETURN;
139 }
140
141 //call dlerror to clear the error
142 dlerror();
143 gef_hal_handle.deinit =
144 (gef_deinit_t)dlsym(gef_hal_handle.handle, "gef_deinit");
145 error = dlerror();
146
147 if(error != NULL) {
148 ALOGE("%s: dlsym of %s failed with error %s",
149 __func__, "gef_deinit", error);
150 goto ERROR_RETURN;
151 }
152
153 //call dlerror to clear the error
154 error = dlerror();
155 gef_hal_handle.device_config_cb =
156 (gef_device_config_cb_t)dlsym(gef_hal_handle.handle,
157 "gef_device_config_cb");
158 error = dlerror();
159
160 if(error != NULL) {
161 ALOGE("%s: dlsym of %s failed with error %s",
162 __func__, "gef_device_config_cb", error);
163 goto ERROR_RETURN;
164 }
165
166 gef_hal_handle.gef_ptr = gef_hal_handle.init((void*)adev);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800167 }
168
169ERROR_RETURN:
Satish Babu Patakokila38230962017-10-18 20:34:56 +0530170 ALOGV("%s: Exit with error ", __func__);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800171 return;
172}
173
174
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530175#ifdef INSTANCE_ID_ENABLED
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800176//this will be called from GEF to exchange calibration using acdb
177int audio_extn_gef_send_audio_cal(void* dev, int acdb_dev_id,
178 int gef_cal_type, int app_type, int topology_id, int sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530179 uint32_t module_id, uint16_t instance_id, uint32_t param_id,
180 void* data, int length, bool persist)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800181{
182 int ret = 0;
183 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530184 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800185 int acdb_device_type =
186 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
187
188 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530189 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800190
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800191 //lock adev->cal_lock
192 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800193
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530194 //pack cal
195 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800196 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530197 module_id, instance_id, param_id, true);
198
199 ret = platform_send_audio_cal(adev->platform, &cal, data, length, persist);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800200
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800201 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800202
203 ALOGV("%s: Exit with error %d", __func__, ret);
204
205 return ret;
206}
207
208//this will be called from GEF to exchange calibration using acdb
209int audio_extn_gef_get_audio_cal(void* dev, int acdb_dev_id,
210 int gef_cal_type, int app_type, int topology_id, int sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530211 uint32_t module_id, uint16_t instance_id, uint32_t param_id,
212 void* data, int* length, bool persist)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800213{
214 int ret = 0;
215 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530216 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800217 int acdb_device_type =
218 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
219
220 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530221 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800222
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800223 //lock adev->cal_lock
224 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800225
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530226 //pack cal
227 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800228 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530229 module_id, instance_id, param_id, false);
230
231 ret = platform_get_audio_cal(adev->platform, &cal, data, length, persist);
232
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800233 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530234
235 ALOGV("%s: Exit with error %d", __func__, ret);
236
237 return ret;
238}
239
240//this will be called from GEF to store into acdb
241int audio_extn_gef_store_audio_cal(void* dev, int acdb_dev_id,
242 int gef_cal_type, int app_type, int topology_id, int sample_rate,
243 uint32_t module_id, uint16_t instance_id,
244 uint32_t param_id, void* data, int length)
245{
246 int ret = 0;
247 struct audio_device *adev = (struct audio_device*)dev;
248 acdb_audio_cal_cfg_t cal;
249 int acdb_device_type =
250 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
251
252 ALOGV("%s: Enter", __func__);
253 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
254
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800255 //lock adev->cal_lock
256 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530257
258 //pack cal
259 platform_make_cal_cfg(&cal, acdb_dev_id,
260 acdb_device_type, app_type, topology_id, sample_rate,
261 module_id, instance_id, param_id, true);
262
263 ret = platform_store_audio_cal(adev->platform, &cal, data, length);
264
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800265 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530266
267 ALOGV("%s: Exit with error %d", __func__, ret);
268
269 return ret;
270}
271
272//this will be called from GEF to retrieve calibration using acdb
273int audio_extn_gef_retrieve_audio_cal(void* dev, int acdb_dev_id,
274 int gef_cal_type, int app_type, int topology_id, int sample_rate,
275 uint32_t module_id, uint16_t instance_id, uint32_t param_id, void* data, int* length)
276{
277 int ret = 0;
278 struct audio_device *adev = (struct audio_device*)dev;
279 acdb_audio_cal_cfg_t cal;
280 int acdb_device_type =
281 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
282
283 ALOGV("%s: Enter", __func__);
284 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
285
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800286 //lock adev->cal_lock
287 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530288
289 //pack cal
290 platform_make_cal_cfg(&cal, acdb_dev_id,
291 acdb_device_type, app_type, topology_id, sample_rate,
292 module_id, instance_id, param_id, true);
293
294 ret = platform_retrieve_audio_cal(adev->platform, &cal, data, length);
295
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800296 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530297
298 ALOGV("%s: Exit with error %d", __func__, ret);
299
300 return ret;
301}
302#else
303//this will be called from GEF to exchange calibration using acdb
304int audio_extn_gef_send_audio_cal(void* dev, int acdb_dev_id,
305 int gef_cal_type, int app_type, int topology_id, int sample_rate,
306 uint32_t module_id, uint32_t param_id, void* data, int length,
307 bool persist)
308{
309 int ret = 0;
310 struct audio_device *adev = (struct audio_device*)dev;
311 acdb_audio_cal_cfg_t cal;
312 int acdb_device_type =
313 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
314
315 ALOGV("%s: Enter", __func__);
316 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
317
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800318 //lock adev->cal_lock
319 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530320
321 //pack cal
322 platform_make_cal_cfg(&cal, acdb_dev_id,
323 acdb_device_type, app_type, topology_id, sample_rate,
324 module_id, param_id, true);
325
326 ret = platform_send_audio_cal(adev->platform, &cal, data, length, persist);
327
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800328 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530329
330 ALOGV("%s: Exit with error %d", __func__, ret);
331
332 return ret;
333}
334
335//this will be called from GEF to exchange calibration using acdb
336int audio_extn_gef_get_audio_cal(void* dev, int acdb_dev_id,
337 int gef_cal_type, int app_type, int topology_id, int sample_rate,
338 uint32_t module_id, uint32_t param_id, void* data, int* length,
339 bool persist)
340{
341 int ret = 0;
342 struct audio_device *adev = (struct audio_device*)dev;
343 acdb_audio_cal_cfg_t cal;
344 int acdb_device_type =
345 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
346
347 ALOGV("%s: Enter", __func__);
348 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
349
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800350 //lock adev->cal_lock
351 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530352
353 //pack cal
354 platform_make_cal_cfg(&cal, acdb_dev_id,
355 acdb_device_type, app_type, topology_id, sample_rate,
356 module_id, param_id, false);
357
358 ret = platform_get_audio_cal(adev->platform, &cal, data, length, persist);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800359
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800360 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800361
362 ALOGV("%s: Exit with error %d", __func__, ret);
363
364 return ret;
365}
366
367//this will be called from GEF to store into acdb
368int audio_extn_gef_store_audio_cal(void* dev, int acdb_dev_id,
369 int gef_cal_type, int app_type, int topology_id, int sample_rate,
370 uint32_t module_id, uint32_t param_id, void* data, int length)
371{
372 int ret = 0;
373 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530374 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800375 int acdb_device_type =
376 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
377
378 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530379 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800380
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800381 //lock adev->cal_lock
382 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800383
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530384 //pack cal
385 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800386 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530387 module_id, param_id, true);
388
389 ret = platform_store_audio_cal(adev->platform, &cal, data, length);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800390
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800391 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800392
393 ALOGV("%s: Exit with error %d", __func__, ret);
394
395 return ret;
396}
397
398//this will be called from GEF to retrieve calibration using acdb
399int audio_extn_gef_retrieve_audio_cal(void* dev, int acdb_dev_id,
400 int gef_cal_type, int app_type, int topology_id, int sample_rate,
401 uint32_t module_id, uint32_t param_id, void* data, int* length)
402{
403 int ret = 0;
404 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530405 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800406 int acdb_device_type =
407 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
408
409 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530410 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800411
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800412 //lock adev->cal_lock
413 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800414
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530415 //pack cal
416 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800417 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530418 module_id, param_id, true);
419
420 ret = platform_retrieve_audio_cal(adev->platform, &cal, data, length);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800421
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800422 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800423
424 ALOGV("%s: Exit with error %d", __func__, ret);
425
426 return ret;
427}
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530428#endif
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800429
430//this will be called from HAL to notify GEF of new device configuration
Aniket Kumar Lata0e6e1e52019-11-14 21:43:55 -0800431void audio_extn_gef_notify_device_config(struct listnode *audio_devices,
Weiyin Jiang40dcdb92019-07-08 17:31:52 +0800432 audio_channel_mask_t channel_mask, int sample_rate, int acdb_id, int app_type)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800433{
434 ALOGV("%s: Enter", __func__);
435
436 //call into GEF to share channel mask and device info
437 if (gef_hal_handle.handle && gef_hal_handle.device_config_cb) {
Aniket Kumar Lata0e6e1e52019-11-14 21:43:55 -0800438 gef_hal_handle.device_config_cb(gef_hal_handle.gef_ptr, get_device_types(audio_devices),
439 channel_mask, sample_rate, acdb_id, app_type);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800440 }
441
442 ALOGV("%s: Exit", __func__);
443
444 return;
445}
446
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800447void audio_extn_gef_deinit(struct audio_device *adev)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800448{
449 ALOGV("%s: Enter", __func__);
450
451 if (gef_hal_handle.handle) {
Dhananjay Kumara427f142017-07-10 13:49:13 +0530452 if (gef_hal_handle.handle && gef_hal_handle.deinit)
453 gef_hal_handle.deinit(gef_hal_handle.gef_ptr);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800454 dlclose(gef_hal_handle.handle);
455 }
456
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800457 pthread_mutex_destroy(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800458 memset(&gef_hal_handle, 0, sizeof(gef_data));
459
460 ALOGV("%s: Exit", __func__);
461}
462
463#endif