Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 1 | /* |
Saurav Kumar | dba3caf | 2020-05-29 20:53:55 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2020, 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 |
| 27 | #define LIB_ACDB_LOADER "libacdbloader.so" |
| 28 | #define CVD_VERSION_MIXER_CTL "CVD Version" |
| 29 | #define ACDB_METAINFO_KEY_MODULE_NAME_LEN 100 |
| 30 | |
Saurav Kumar | dba3caf | 2020-05-29 20:53:55 +0530 | [diff] [blame] | 31 | |
| 32 | #define PLATFORM_INFO_XML_PATH_NAME "audio_platform_info.xml" |
| 33 | |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 34 | |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 35 | enum { |
| 36 | ACDB_LOADER_INIT_V1 = 1, |
| 37 | ACDB_LOADER_INIT_V2, |
| 38 | ACDB_LOADER_INIT_V3, |
| 39 | ACDB_LOADER_INIT_V4, |
| 40 | }; |
| 41 | |
Soumya Managoli | 9fee7c6 | 2018-04-06 16:21:50 +0530 | [diff] [blame] | 42 | struct mixer; |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 43 | /* Audio calibration related functions */ |
| 44 | typedef void (*acdb_deallocate_t)(); |
| 45 | typedef int (*acdb_init_t)(); |
| 46 | typedef int (*acdb_init_v2_t)(const char *, char *, int); |
| 47 | typedef int (*acdb_init_v3_t)(const char *, char *, struct listnode *); |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 48 | typedef int (*acdb_init_v4_t)(void *, int); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 49 | typedef void (*acdb_send_audio_cal_t)(int, int, int , int); |
| 50 | 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] | 51 | typedef void (*acdb_send_audio_cal_v4_t)(int, int, int, int, int, int); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 52 | typedef void (*acdb_send_voice_cal_t)(int, int); |
| 53 | typedef int (*acdb_reload_vocvoltable_t)(int); |
| 54 | typedef int (*acdb_get_default_app_type_t)(void); |
| 55 | typedef int (*acdb_loader_get_calibration_t)(char *attr, int size, void *data); |
| 56 | typedef int (*acdb_set_audio_cal_t) (void *, void *, uint32_t); |
| 57 | typedef int (*acdb_get_audio_cal_t) (void *, void *, uint32_t*); |
| 58 | typedef int (*acdb_send_common_top_t) (void); |
| 59 | typedef int (*acdb_set_codec_data_t) (void *, char *); |
| 60 | typedef int (*acdb_reload_t) (char *, char *, char *, int); |
| 61 | typedef int (*acdb_reload_v2_t) (char *, char *, char *, struct listnode *); |
| 62 | typedef int (*acdb_send_gain_dep_cal_t)(int, int, int, int, int); |
| 63 | |
| 64 | struct meta_key_list { |
| 65 | struct listnode list; |
| 66 | struct audio_cal_info_metainfo cal_info; |
| 67 | char name[ACDB_METAINFO_KEY_MODULE_NAME_LEN]; |
| 68 | }; |
| 69 | |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 70 | struct acdb_init_data_v4 { |
| 71 | char *cvd_version; |
| 72 | char *snd_card_name; |
| 73 | struct listnode *meta_key_list; |
| 74 | bool *is_instance_id_supported; |
| 75 | }; |
| 76 | |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 77 | struct acdb_platform_data { |
| 78 | /* Audio calibration related functions */ |
| 79 | void *acdb_handle; |
| 80 | acdb_init_t acdb_init; |
| 81 | acdb_init_v2_t acdb_init_v2; |
| 82 | acdb_init_v3_t acdb_init_v3; |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 83 | acdb_init_v4_t acdb_init_v4; |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 84 | struct listnode acdb_meta_key_list; |
Aditya Bavanari | 29bcea2 | 2017-10-03 20:10:35 +0530 | [diff] [blame] | 85 | struct acdb_init_data_v4 acdb_init_data; |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | int acdb_init(int); |
Soumya Managoli | 9fee7c6 | 2018-04-06 16:21:50 +0530 | [diff] [blame] | 89 | int acdb_init_v2(struct mixer *); |
Vignesh Kulothungan | 5539688 | 2017-04-20 14:37:02 -0700 | [diff] [blame] | 90 | |
| 91 | int acdb_set_metainfo_key(void *platform, char *name, int key); |
| 92 | #endif //ACDB_H |