Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 1 | /* |
Sujin Panicker | 90f923d | 2021-07-14 15:04:43 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 3 | * Not a Contribution. |
| 4 | * |
| 5 | * Copyright (C) 2013 The Android Open Source Project |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef ACDB_H |
| 21 | #define ACDB_H |
| 22 | |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 23 | #include <stdbool.h> |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 24 | #include <linux/msm_audio_calibration.h> |
| 25 | |
| 26 | #define MAX_CVD_VERSION_STRING_SIZE 100 |
Viraja Kommaraju | 7d407e1 | 2019-11-15 21:25:36 +0530 | [diff] [blame] | 27 | |
| 28 | #ifdef DAEMON_SUPPORT_AUTO |
| 29 | #define LIB_ACDB_LOADER "libacdbloaderclient.so" |
| 30 | #else |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 31 | #define LIB_ACDB_LOADER "libacdbloader.so" |
Viraja Kommaraju | 7d407e1 | 2019-11-15 21:25:36 +0530 | [diff] [blame] | 32 | #endif |
| 33 | |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 34 | #define CVD_VERSION_MIXER_CTL "CVD Version" |
| 35 | #define ACDB_METAINFO_KEY_MODULE_NAME_LEN 100 |
| 36 | |
Saurav Kumar | dba3caf | 2020-05-29 20:53:55 +0530 | [diff] [blame] | 37 | |
| 38 | #define PLATFORM_INFO_XML_PATH_NAME "audio_platform_info.xml" |
| 39 | |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 40 | |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 41 | enum { |
| 42 | ACDB_LOADER_INIT_V1 = 1, |
| 43 | ACDB_LOADER_INIT_V2, |
| 44 | ACDB_LOADER_INIT_V3, |
| 45 | ACDB_LOADER_INIT_V4, |
| 46 | }; |
| 47 | |
Soumya Managoli | 9fee7c6 | 2018-04-06 16:21:50 +0530 | [diff] [blame] | 48 | struct mixer; |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 49 | /* Audio calibration related functions */ |
Sujin Panicker | 90f923d | 2021-07-14 15:04:43 +0530 | [diff] [blame] | 50 | typedef void (*acdb_deallocate_t)(void); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 51 | typedef int (*acdb_init_t)(); |
| 52 | typedef int (*acdb_init_v2_t)(const char *, char *, int); |
| 53 | typedef int (*acdb_init_v3_t)(const char *, char *, struct listnode *); |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 54 | typedef int (*acdb_init_v4_t)(void *, int); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 55 | typedef void (*acdb_send_audio_cal_t)(int, int, int , int); |
| 56 | typedef void (*acdb_send_audio_cal_v3_t)(int, int, int, int, int); |
Aditya Bavanari | 1dd2d6a | 2019-08-13 18:56:10 +0530 | [diff] [blame] | 57 | typedef void (*acdb_send_audio_cal_v4_t)(int, int, int, int, int, int); |
Manoj Kumar N D | 7951b25 | 2022-08-23 13:18:00 +0530 | [diff] [blame] | 58 | typedef void (*acdb_send_audio_cal_v6_t)(int, int, int, int, int, int, int, int); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 59 | typedef void (*acdb_send_voice_cal_t)(int, int); |
| 60 | typedef int (*acdb_reload_vocvoltable_t)(int); |
| 61 | typedef int (*acdb_get_default_app_type_t)(void); |
| 62 | typedef int (*acdb_loader_get_calibration_t)(char *attr, int size, void *data); |
| 63 | typedef int (*acdb_set_audio_cal_t) (void *, void *, uint32_t); |
| 64 | typedef int (*acdb_get_audio_cal_t) (void *, void *, uint32_t*); |
| 65 | typedef int (*acdb_send_common_top_t) (void); |
| 66 | typedef int (*acdb_set_codec_data_t) (void *, char *); |
| 67 | typedef int (*acdb_reload_t) (char *, char *, char *, int); |
| 68 | typedef int (*acdb_reload_v2_t) (char *, char *, char *, struct listnode *); |
| 69 | typedef int (*acdb_send_gain_dep_cal_t)(int, int, int, int, int); |
Kunlei Zhang | a3c4cb0 | 2021-03-05 16:03:54 +0800 | [diff] [blame] | 70 | typedef void (*acdb_set_fluence_nn_state_t)(bool); |
| 71 | typedef bool (*acdb_get_fluence_nn_state_t)(); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 72 | |
| 73 | struct meta_key_list { |
| 74 | struct listnode list; |
| 75 | struct audio_cal_info_metainfo cal_info; |
| 76 | char name[ACDB_METAINFO_KEY_MODULE_NAME_LEN]; |
| 77 | }; |
| 78 | |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 79 | struct acdb_init_data_v4 { |
| 80 | char *cvd_version; |
| 81 | char *snd_card_name; |
| 82 | struct listnode *meta_key_list; |
| 83 | bool *is_instance_id_supported; |
| 84 | }; |
| 85 | |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 86 | struct acdb_platform_data { |
| 87 | /* Audio calibration related functions */ |
| 88 | void *acdb_handle; |
| 89 | acdb_init_t acdb_init; |
| 90 | acdb_init_v2_t acdb_init_v2; |
| 91 | acdb_init_v3_t acdb_init_v3; |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 92 | acdb_init_v4_t acdb_init_v4; |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 93 | struct listnode acdb_meta_key_list; |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 94 | struct acdb_init_data_v4 acdb_init_data; |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | int acdb_init(int); |
Soumya Managoli | 9fee7c6 | 2018-04-06 16:21:50 +0530 | [diff] [blame] | 98 | int acdb_init_v2(struct mixer *); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 99 | |
| 100 | int acdb_set_metainfo_key(void *platform, char *name, int key); |
| 101 | #endif //ACDB_H |