blob: e0d4628c68989730394a08cbe0001bb324bcc78c [file] [log] [blame]
Vignesh Kulothungan55396882017-04-20 14:37:02 -07001/*
Aditya Bavanari1dd2d6a2019-08-13 18:56:10 +05302 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
Vignesh Kulothungan55396882017-04-20 14:37:02 -07003 * 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 Bavanari29bcea22017-10-03 20:10:35 +053023#include <stdbool.h>
Vignesh Kulothungan55396882017-04-20 14:37:02 -070024#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
31#ifdef LINUX_ENABLED
32#define PLATFORM_INFO_XML_PATH "/etc/audio_platform_info.xml"
33#else
Naresh Tanniru10758b62017-06-05 21:05:53 +053034#define PLATFORM_INFO_XML_PATH "/vendor/etc/audio_platform_info.xml"
Vignesh Kulothungan55396882017-04-20 14:37:02 -070035#endif
36
Aditya Bavanari29bcea22017-10-03 20:10:35 +053037enum {
38 ACDB_LOADER_INIT_V1 = 1,
39 ACDB_LOADER_INIT_V2,
40 ACDB_LOADER_INIT_V3,
41 ACDB_LOADER_INIT_V4,
42};
43
Soumya Managoli9fee7c62018-04-06 16:21:50 +053044struct mixer;
Vignesh Kulothungan55396882017-04-20 14:37:02 -070045/* Audio calibration related functions */
46typedef void (*acdb_deallocate_t)();
47typedef int (*acdb_init_t)();
48typedef int (*acdb_init_v2_t)(const char *, char *, int);
49typedef int (*acdb_init_v3_t)(const char *, char *, struct listnode *);
Aditya Bavanari29bcea22017-10-03 20:10:35 +053050typedef int (*acdb_init_v4_t)(void *, int);
Vignesh Kulothungan55396882017-04-20 14:37:02 -070051typedef void (*acdb_send_audio_cal_t)(int, int, int , int);
52typedef void (*acdb_send_audio_cal_v3_t)(int, int, int, int, int);
Aditya Bavanari1dd2d6a2019-08-13 18:56:10 +053053typedef void (*acdb_send_audio_cal_v4_t)(int, int, int, int, int, int);
Vignesh Kulothungan55396882017-04-20 14:37:02 -070054typedef void (*acdb_send_voice_cal_t)(int, int);
55typedef int (*acdb_reload_vocvoltable_t)(int);
56typedef int (*acdb_get_default_app_type_t)(void);
57typedef int (*acdb_loader_get_calibration_t)(char *attr, int size, void *data);
58typedef int (*acdb_set_audio_cal_t) (void *, void *, uint32_t);
59typedef int (*acdb_get_audio_cal_t) (void *, void *, uint32_t*);
60typedef int (*acdb_send_common_top_t) (void);
61typedef int (*acdb_set_codec_data_t) (void *, char *);
62typedef int (*acdb_reload_t) (char *, char *, char *, int);
63typedef int (*acdb_reload_v2_t) (char *, char *, char *, struct listnode *);
64typedef int (*acdb_send_gain_dep_cal_t)(int, int, int, int, int);
65
66struct meta_key_list {
67 struct listnode list;
68 struct audio_cal_info_metainfo cal_info;
69 char name[ACDB_METAINFO_KEY_MODULE_NAME_LEN];
70};
71
Aditya Bavanari29bcea22017-10-03 20:10:35 +053072struct acdb_init_data_v4 {
73 char *cvd_version;
74 char *snd_card_name;
75 struct listnode *meta_key_list;
76 bool *is_instance_id_supported;
77};
78
Vignesh Kulothungan55396882017-04-20 14:37:02 -070079struct acdb_platform_data {
80 /* Audio calibration related functions */
81 void *acdb_handle;
82 acdb_init_t acdb_init;
83 acdb_init_v2_t acdb_init_v2;
84 acdb_init_v3_t acdb_init_v3;
Aditya Bavanari29bcea22017-10-03 20:10:35 +053085 acdb_init_v4_t acdb_init_v4;
Vignesh Kulothungan55396882017-04-20 14:37:02 -070086 struct listnode acdb_meta_key_list;
Aditya Bavanari29bcea22017-10-03 20:10:35 +053087 struct acdb_init_data_v4 acdb_init_data;
Vignesh Kulothungan55396882017-04-20 14:37:02 -070088};
89
90int acdb_init(int);
Soumya Managoli9fee7c62018-04-06 16:21:50 +053091int acdb_init_v2(struct mixer *);
Vignesh Kulothungan55396882017-04-20 14:37:02 -070092
93int acdb_set_metainfo_key(void *platform, char *name, int key);
94#endif //ACDB_H