hal: use proper snd_card_name for acdb_init

Use tasha snd card name for tasha lite variants as
well for acdb_init to load the same set of ACDB
files for both the variants.

CRs-Fixed: 2173200
Change-Id: I870986b11c8e6d2937705970e10af0038e008f1e
This commit is contained in:
Aditya Bavanari 2018-01-16 17:48:08 +05:30
parent 38d87fe63e
commit 71b6d537bf
4 changed files with 12 additions and 13 deletions

View File

@ -34,7 +34,7 @@ int acdb_init(int snd_card_num)
int result = -1;
char *cvd_version = NULL;
char *snd_card_name = NULL;
const char *snd_card_name = NULL;
struct mixer *mixer = NULL;
struct acdb_platform_data *my_data = NULL;
@ -115,13 +115,14 @@ int acdb_init(int snd_card_num)
}
/* Get Sound card name */
snd_card_name = strdup(mixer_get_name(mixer));
snd_card_name = mixer_get_name(mixer);
if (!snd_card_name) {
ALOGE("failed to allocate memory for snd_card_name");
result = -1;
goto cleanup;
}
snd_card_name = platform_get_snd_card_name_for_acdb_loader(snd_card_name);
int key = 0;
struct listnode *node = NULL;
struct meta_key_list *key_info = NULL;
@ -160,9 +161,6 @@ cleanup:
if (cvd_version)
free(cvd_version);
if (snd_card_name)
free(snd_card_name);
return result;
}

View File

@ -1851,7 +1851,7 @@ static void audio_hwdep_send_cal(struct platform_data *plat_data)
plat_data->hw_dep_fd = fd;
}
const char * get_snd_card_name_for_acdb_loader(const char *snd_card_name) {
const char * platform_get_snd_card_name_for_acdb_loader(const char *snd_card_name) {
if(snd_card_name == NULL)
return NULL;
@ -1905,7 +1905,7 @@ int platform_acdb_init(void *platform)
{
struct platform_data *my_data = (struct platform_data *)platform;
char *cvd_version = NULL;
const char *snd_card_name, *acdb_snd_card_name;
const char *snd_card_name;
int result = -1;
struct listnode *node;
struct meta_key_list *key_info;
@ -1920,21 +1920,21 @@ int platform_acdb_init(void *platform)
}
snd_card_name = mixer_get_name(my_data->adev->mixer);
acdb_snd_card_name = get_snd_card_name_for_acdb_loader(snd_card_name);
snd_card_name = platform_get_snd_card_name_for_acdb_loader(snd_card_name);
if (my_data->acdb_init_v3) {
result = my_data->acdb_init_v3(acdb_snd_card_name, cvd_version,
result = my_data->acdb_init_v3(snd_card_name, cvd_version,
&my_data->acdb_meta_key_list);
} else if (my_data->acdb_init) {
node = list_head(&my_data->acdb_meta_key_list);
key_info = node_to_item(node, struct meta_key_list, list);
key = key_info->cal_info.nKey;
result = my_data->acdb_init(acdb_snd_card_name, cvd_version, key);
result = my_data->acdb_init(snd_card_name, cvd_version, key);
}
/* Save these variables in platform_data. These will be used
while reloading ACDB files during run time. */
strlcpy(my_data->cvd_version, cvd_version, MAX_CVD_VERSION_STRING_SIZE);
strlcpy(my_data->snd_card_name, acdb_snd_card_name,
strlcpy(my_data->snd_card_name, snd_card_name,
MAX_SND_CARD_STRING_SIZE);
if (cvd_version)

View File

@ -1730,7 +1730,7 @@ static void audio_hwdep_send_cal(struct platform_data *plat_data)
plat_data->hw_dep_fd = fd;
}
const char * get_snd_card_name_for_acdb_loader(const char *snd_card_name) {
const char * platform_get_snd_card_name_for_acdb_loader(const char *snd_card_name) {
if(snd_card_name == NULL)
return NULL;
@ -1767,7 +1767,7 @@ static int platform_acdb_init(void *platform)
}
snd_card_name = mixer_get_name(my_data->adev->mixer);
snd_card_name = get_snd_card_name_for_acdb_loader(snd_card_name);
snd_card_name = platform_get_snd_card_name_for_acdb_loader(snd_card_name);
if (my_data->acdb_init_v3) {
result = my_data->acdb_init_v3(snd_card_name, cvd_version,

View File

@ -260,4 +260,5 @@ int platform_get_max_codec_backend();
int platform_get_mmap_data_fd(void *platform, int dev, int dir,
int *fd, uint32_t *size);
int platform_get_ec_ref_loopback_snd_device(int channel_count);
const char * platform_get_snd_card_name_for_acdb_loader(const char *snd_card_name);
#endif // AUDIO_PLATFORM_API_H