blob: ca1a16be3a63db30e97307bd720570fb202422a8 [file] [log] [blame]
Weiyin Jiangaa80acd2016-09-21 16:42:11 +08001/*
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +08002 * Copyright (c) 2016-2019, 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"
49
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053050#ifdef DYNAMIC_LOG_ENABLED
51#include <log_xml_parser.h>
52#define LOG_MASK HAL_MOD_FILE_GEF
53#include <log_utils.h>
54#endif
55
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080056#ifdef AUDIO_GENERIC_EFFECT_FRAMEWORK_ENABLED
57
Weiyin Jiang82e40942017-01-10 16:07:34 +080058#if LINUX_ENABLED
Manish Dewangan6a36d002017-10-09 14:11:00 +053059#define GEF_LIBRARY "libqtigef.so"
Weiyin Jiang82e40942017-01-10 16:07:34 +080060#else
David Ng06ccd872017-03-15 11:39:33 -070061#define GEF_LIBRARY "/vendor/lib/libqtigef.so"
Weiyin Jiang82e40942017-01-10 16:07:34 +080062#endif
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080063
64typedef void* (*gef_init_t)(void*);
Dhananjay Kumara427f142017-07-10 13:49:13 +053065typedef void (*gef_deinit_t)(void*);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080066typedef void (*gef_device_config_cb_t)(void*, audio_devices_t,
Weiyin Jiang6f4c8062016-11-23 15:30:29 +080067 audio_channel_mask_t, int, int);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080068
69typedef struct {
70 void* handle;
71 void* gef_ptr;
72 gef_init_t init;
Dhananjay Kumara427f142017-07-10 13:49:13 +053073 gef_deinit_t deinit;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +080074 gef_device_config_cb_t device_config_cb;
75} gef_data;
76
77static gef_data gef_hal_handle;
78
79typedef enum {
80 ASM = 0,
81 ADM
82} gef_calibration_type;
83
84typedef enum {
85 AUDIO_DEVICE_CAL_TYPE = 0,
86 AUDIO_STREAM_CAL_TYPE,
87} acdb_device_type;
88
89
90static acdb_device_type make_acdb_device_type_from_gef_cal_type
91 (gef_calibration_type gef_cal_type)
92{
93 int acdb_device_type = 0;
94
95 switch (gef_cal_type) {
96 case ASM:
97 acdb_device_type = AUDIO_STREAM_CAL_TYPE;
98 break;
99 case ADM:
100 acdb_device_type = AUDIO_DEVICE_CAL_TYPE;
101 break;
102 default:
103 acdb_device_type = -1;
104 break;
105 }
106
107 return ((int)acdb_device_type);
108}
109
110void audio_extn_gef_init(struct audio_device *adev)
111{
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800112 const char* error = NULL;
113
114 ALOGV("%s: Enter with error", __func__);
115
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800116 pthread_mutex_init(&adev->cal_lock, (const pthread_mutexattr_t *) NULL);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800117 memset(&gef_hal_handle, 0, sizeof(gef_data));
118
Satish Babu Patakokila38230962017-10-18 20:34:56 +0530119 //: check error for dlopen
120 gef_hal_handle.handle = dlopen(GEF_LIBRARY, RTLD_LAZY);
121 if (gef_hal_handle.handle == NULL) {
122 ALOGE("%s: DLOPEN failed for %s with error %s",
123 __func__, GEF_LIBRARY, dlerror());
124 goto ERROR_RETURN;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800125 } else {
Satish Babu Patakokila38230962017-10-18 20:34:56 +0530126 ALOGV("%s: DLOPEN successful for %s", __func__, GEF_LIBRARY);
127
128 //call dlerror to clear the error
129 dlerror();
130 gef_hal_handle.init =
131 (gef_init_t)dlsym(gef_hal_handle.handle, "gef_init");
132 error = dlerror();
133
134 if(error != NULL) {
135 ALOGE("%s: dlsym of %s failed with error %s",
136 __func__, "gef_init", error);
137 goto ERROR_RETURN;
138 }
139
140 //call dlerror to clear the error
141 dlerror();
142 gef_hal_handle.deinit =
143 (gef_deinit_t)dlsym(gef_hal_handle.handle, "gef_deinit");
144 error = dlerror();
145
146 if(error != NULL) {
147 ALOGE("%s: dlsym of %s failed with error %s",
148 __func__, "gef_deinit", error);
149 goto ERROR_RETURN;
150 }
151
152 //call dlerror to clear the error
153 error = dlerror();
154 gef_hal_handle.device_config_cb =
155 (gef_device_config_cb_t)dlsym(gef_hal_handle.handle,
156 "gef_device_config_cb");
157 error = dlerror();
158
159 if(error != NULL) {
160 ALOGE("%s: dlsym of %s failed with error %s",
161 __func__, "gef_device_config_cb", error);
162 goto ERROR_RETURN;
163 }
164
165 gef_hal_handle.gef_ptr = gef_hal_handle.init((void*)adev);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800166 }
167
168ERROR_RETURN:
Satish Babu Patakokila38230962017-10-18 20:34:56 +0530169 ALOGV("%s: Exit with error ", __func__);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800170 return;
171}
172
173
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530174#ifdef INSTANCE_ID_ENABLED
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800175//this will be called from GEF to exchange calibration using acdb
176int audio_extn_gef_send_audio_cal(void* dev, int acdb_dev_id,
177 int gef_cal_type, int app_type, int topology_id, int sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530178 uint32_t module_id, uint16_t instance_id, uint32_t param_id,
179 void* data, int length, bool persist)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800180{
181 int ret = 0;
182 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530183 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800184 int acdb_device_type =
185 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
186
187 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530188 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800189
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800190 //lock adev->cal_lock
191 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800192
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530193 //pack cal
194 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800195 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530196 module_id, instance_id, param_id, true);
197
198 ret = platform_send_audio_cal(adev->platform, &cal, data, length, persist);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800199
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800200 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800201
202 ALOGV("%s: Exit with error %d", __func__, ret);
203
204 return ret;
205}
206
207//this will be called from GEF to exchange calibration using acdb
208int audio_extn_gef_get_audio_cal(void* dev, int acdb_dev_id,
209 int gef_cal_type, int app_type, int topology_id, int sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530210 uint32_t module_id, uint16_t instance_id, uint32_t param_id,
211 void* data, int* length, bool persist)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800212{
213 int ret = 0;
214 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530215 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800216 int acdb_device_type =
217 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
218
219 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530220 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800221
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800222 //lock adev->cal_lock
223 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800224
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530225 //pack cal
226 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800227 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530228 module_id, instance_id, param_id, false);
229
230 ret = platform_get_audio_cal(adev->platform, &cal, data, length, persist);
231
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800232 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530233
234 ALOGV("%s: Exit with error %d", __func__, ret);
235
236 return ret;
237}
238
239//this will be called from GEF to store into acdb
240int audio_extn_gef_store_audio_cal(void* dev, int acdb_dev_id,
241 int gef_cal_type, int app_type, int topology_id, int sample_rate,
242 uint32_t module_id, uint16_t instance_id,
243 uint32_t param_id, void* data, int length)
244{
245 int ret = 0;
246 struct audio_device *adev = (struct audio_device*)dev;
247 acdb_audio_cal_cfg_t cal;
248 int acdb_device_type =
249 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
250
251 ALOGV("%s: Enter", __func__);
252 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
253
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800254 //lock adev->cal_lock
255 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530256
257 //pack cal
258 platform_make_cal_cfg(&cal, acdb_dev_id,
259 acdb_device_type, app_type, topology_id, sample_rate,
260 module_id, instance_id, param_id, true);
261
262 ret = platform_store_audio_cal(adev->platform, &cal, data, length);
263
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800264 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530265
266 ALOGV("%s: Exit with error %d", __func__, ret);
267
268 return ret;
269}
270
271//this will be called from GEF to retrieve calibration using acdb
272int audio_extn_gef_retrieve_audio_cal(void* dev, int acdb_dev_id,
273 int gef_cal_type, int app_type, int topology_id, int sample_rate,
274 uint32_t module_id, uint16_t instance_id, uint32_t param_id, void* data, int* length)
275{
276 int ret = 0;
277 struct audio_device *adev = (struct audio_device*)dev;
278 acdb_audio_cal_cfg_t cal;
279 int acdb_device_type =
280 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
281
282 ALOGV("%s: Enter", __func__);
283 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
284
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800285 //lock adev->cal_lock
286 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530287
288 //pack cal
289 platform_make_cal_cfg(&cal, acdb_dev_id,
290 acdb_device_type, app_type, topology_id, sample_rate,
291 module_id, instance_id, param_id, true);
292
293 ret = platform_retrieve_audio_cal(adev->platform, &cal, data, length);
294
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800295 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530296
297 ALOGV("%s: Exit with error %d", __func__, ret);
298
299 return ret;
300}
301#else
302//this will be called from GEF to exchange calibration using acdb
303int audio_extn_gef_send_audio_cal(void* dev, int acdb_dev_id,
304 int gef_cal_type, int app_type, int topology_id, int sample_rate,
305 uint32_t module_id, uint32_t param_id, void* data, int length,
306 bool persist)
307{
308 int ret = 0;
309 struct audio_device *adev = (struct audio_device*)dev;
310 acdb_audio_cal_cfg_t cal;
311 int acdb_device_type =
312 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
313
314 ALOGV("%s: Enter", __func__);
315 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
316
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800317 //lock adev->cal_lock
318 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530319
320 //pack cal
321 platform_make_cal_cfg(&cal, acdb_dev_id,
322 acdb_device_type, app_type, topology_id, sample_rate,
323 module_id, param_id, true);
324
325 ret = platform_send_audio_cal(adev->platform, &cal, data, length, persist);
326
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800327 pthread_mutex_unlock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530328
329 ALOGV("%s: Exit with error %d", __func__, ret);
330
331 return ret;
332}
333
334//this will be called from GEF to exchange calibration using acdb
335int audio_extn_gef_get_audio_cal(void* dev, int acdb_dev_id,
336 int gef_cal_type, int app_type, int topology_id, int sample_rate,
337 uint32_t module_id, uint32_t param_id, void* data, int* length,
338 bool persist)
339{
340 int ret = 0;
341 struct audio_device *adev = (struct audio_device*)dev;
342 acdb_audio_cal_cfg_t cal;
343 int acdb_device_type =
344 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
345
346 ALOGV("%s: Enter", __func__);
347 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
348
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800349 //lock adev->cal_lock
350 pthread_mutex_lock(&adev->cal_lock);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530351
352 //pack cal
353 platform_make_cal_cfg(&cal, acdb_dev_id,
354 acdb_device_type, app_type, topology_id, sample_rate,
355 module_id, param_id, false);
356
357 ret = platform_get_audio_cal(adev->platform, &cal, data, length, persist);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800358
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800359 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800360
361 ALOGV("%s: Exit with error %d", __func__, ret);
362
363 return ret;
364}
365
366//this will be called from GEF to store into acdb
367int audio_extn_gef_store_audio_cal(void* dev, int acdb_dev_id,
368 int gef_cal_type, int app_type, int topology_id, int sample_rate,
369 uint32_t module_id, uint32_t param_id, void* data, int length)
370{
371 int ret = 0;
372 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530373 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800374 int acdb_device_type =
375 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
376
377 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530378 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800379
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800380 //lock adev->cal_lock
381 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800382
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530383 //pack cal
384 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800385 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530386 module_id, param_id, true);
387
388 ret = platform_store_audio_cal(adev->platform, &cal, data, length);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800389
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800390 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800391
392 ALOGV("%s: Exit with error %d", __func__, ret);
393
394 return ret;
395}
396
397//this will be called from GEF to retrieve calibration using acdb
398int audio_extn_gef_retrieve_audio_cal(void* dev, int acdb_dev_id,
399 int gef_cal_type, int app_type, int topology_id, int sample_rate,
400 uint32_t module_id, uint32_t param_id, void* data, int* length)
401{
402 int ret = 0;
403 struct audio_device *adev = (struct audio_device*)dev;
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530404 acdb_audio_cal_cfg_t cal;
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800405 int acdb_device_type =
406 make_acdb_device_type_from_gef_cal_type(gef_cal_type);
407
408 ALOGV("%s: Enter", __func__);
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530409 memset(&cal, 0, sizeof(acdb_audio_cal_cfg_t));
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800410
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800411 //lock adev->cal_lock
412 pthread_mutex_lock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800413
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530414 //pack cal
415 platform_make_cal_cfg(&cal, acdb_dev_id,
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800416 acdb_device_type, app_type, topology_id, sample_rate,
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530417 module_id, param_id, true);
418
419 ret = platform_retrieve_audio_cal(adev->platform, &cal, data, length);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800420
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800421 pthread_mutex_unlock(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800422
423 ALOGV("%s: Exit with error %d", __func__, ret);
424
425 return ret;
426}
Aditya Bavanari29bcea22017-10-03 20:10:35 +0530427#endif
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800428
429//this will be called from HAL to notify GEF of new device configuration
430void audio_extn_gef_notify_device_config(audio_devices_t audio_device,
Weiyin Jiang6f4c8062016-11-23 15:30:29 +0800431 audio_channel_mask_t channel_mask, int sample_rate, int acdb_id)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800432{
433 ALOGV("%s: Enter", __func__);
434
435 //call into GEF to share channel mask and device info
436 if (gef_hal_handle.handle && gef_hal_handle.device_config_cb) {
437 gef_hal_handle.device_config_cb(gef_hal_handle.gef_ptr, audio_device, channel_mask,
Weiyin Jiang6f4c8062016-11-23 15:30:29 +0800438 sample_rate, acdb_id);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800439 }
440
441 ALOGV("%s: Exit", __func__);
442
443 return;
444}
445
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800446void audio_extn_gef_deinit(struct audio_device *adev)
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800447{
448 ALOGV("%s: Enter", __func__);
449
450 if (gef_hal_handle.handle) {
Dhananjay Kumara427f142017-07-10 13:49:13 +0530451 if (gef_hal_handle.handle && gef_hal_handle.deinit)
452 gef_hal_handle.deinit(gef_hal_handle.gef_ptr);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800453 dlclose(gef_hal_handle.handle);
454 }
455
Weiyin Jiangfa65d3e2019-03-05 23:39:45 +0800456 pthread_mutex_destroy(&adev->cal_lock);
Weiyin Jiangaa80acd2016-09-21 16:42:11 +0800457 memset(&gef_hal_handle, 0, sizeof(gef_data));
458
459 ALOGV("%s: Exit", __func__);
460}
461
462#endif