Loading hal/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ LOCAL_SRC_FILES := \ platform_info.c \ audio_extn/ext_speaker.c \ audio_extn/audio_extn.c \ audio_extn/utils.c \ $(AUDIO_PLATFORM)/platform.c ifdef MULTIPLE_HW_VARIANTS_ENABLED Loading hal/audio_extn/audio_extn.h +3 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,9 @@ void audio_extn_dsm_feedback_enable(struct audio_device *adev, bool benable); #endif void audio_extn_utils_send_default_app_type_cfg(void *platform, struct mixer *mixer); int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, struct audio_usecase *usecase); #ifndef HWDEP_CAL_ENABLED #define audio_extn_hwdep_cal_send(snd_card, acdb_handle) (0) #else Loading hal/audio_extn/utils.c 0 → 100644 +179 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "audio_hw_utils" //#define LOG_NDEBUG 0 #include <errno.h> #include <cutils/properties.h> #include <cutils/config_utils.h> #include <stdlib.h> #include <dlfcn.h> #include <cutils/str_parms.h> #include <cutils/log.h> #include <cutils/misc.h> #include "audio_hw.h" #include "platform.h" #include "platform_api.h" #include "audio_extn.h" #define MAX_LENGTH_MIXER_CONTROL_IN_INT 128 static int set_mixer_ctrl(struct audio_device *adev, int pcm_device_id, int app_type, int acdb_dev_id, int sample_rate, int stream_type) { char mixer_ctl_name[MAX_LENGTH_MIXER_CONTROL_IN_INT]; struct mixer_ctl *ctl; int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT], len = 0, rc = 0; if (stream_type == PCM_PLAYBACK) { snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Audio Stream %d App Type Cfg", pcm_device_id); } else if (stream_type == PCM_CAPTURE) { snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Audio Stream Capture %d App Type Cfg", pcm_device_id); } ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); rc = -EINVAL; goto exit; } app_type_cfg[len++] = app_type; app_type_cfg[len++] = acdb_dev_id; app_type_cfg[len++] = sample_rate; ALOGV("%s: stream type %d app_type %d, acdb_dev_id %d sample rate %d", __func__, stream_type, app_type, acdb_dev_id, sample_rate); mixer_ctl_set_array(ctl, app_type_cfg, len); exit: return rc; } void audio_extn_utils_send_default_app_type_cfg(void *platform, struct mixer *mixer) { int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT] = {-1}; int length = 0, app_type = 0,rc = 0; struct mixer_ctl *ctl = NULL; const char *mixer_ctl_name = "App Type Config"; ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s",__func__, mixer_ctl_name); return; } rc = platform_get_default_app_type_v2(platform, PCM_PLAYBACK, &app_type); if (rc == 0) { app_type_cfg[length++] = 1; app_type_cfg[length++] = app_type; app_type_cfg[length++] = 48000; app_type_cfg[length++] = 16; mixer_ctl_set_array(ctl, app_type_cfg, length); } return; } int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, struct audio_usecase *usecase) { struct mixer_ctl *ctl; int pcm_device_id, acdb_dev_id = 0, snd_device = usecase->out_snd_device; int32_t sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; int app_type = 0, rc = 0; ALOGV("%s", __func__); if (usecase->type != PCM_HFP_CALL) { ALOGV("%s: not a playback or HFP path, no need to cfg app type", __func__); rc = 0; goto exit_send_app_type_cfg; } if ((usecase->id != USECASE_AUDIO_HFP_SCO) && (usecase->id != USECASE_AUDIO_HFP_SCO_WB)) { ALOGV("%s: a playback path where app type cfg is not required", __func__); rc = 0; goto exit_send_app_type_cfg; } snd_device = usecase->out_snd_device; pcm_device_id = platform_get_pcm_device_id(usecase->id, PCM_PLAYBACK); snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ? audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device; acdb_dev_id = platform_get_snd_device_acdb_id(snd_device); if (acdb_dev_id < 0) { ALOGE("%s: Couldn't get the acdb dev id", __func__); rc = -EINVAL; goto exit_send_app_type_cfg; } if (usecase->type == PCM_HFP_CALL) { /* config HFP session:1 playback path */ rc = platform_get_default_app_type_v2(adev->platform, PCM_PLAYBACK, &app_type); if (rc < 0) goto exit_send_app_type_cfg; sample_rate= CODEC_BACKEND_DEFAULT_SAMPLE_RATE; rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_PLAYBACK); if (rc < 0) goto exit_send_app_type_cfg; /* config HFP session:1 capture path */ rc = platform_get_default_app_type_v2(adev->platform, PCM_CAPTURE, &app_type); if (rc == 0) { rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_CAPTURE); if (rc < 0) goto exit_send_app_type_cfg; } /* config HFP session:2 capture path */ pcm_device_id = HFP_ASM_RX_TX; snd_device = usecase->in_snd_device; acdb_dev_id = platform_get_snd_device_acdb_id(snd_device); if (acdb_dev_id <= 0) { ALOGE("%s: Couldn't get the acdb dev id", __func__); rc = -EINVAL; goto exit_send_app_type_cfg; } rc = platform_get_default_app_type_v2(adev->platform, PCM_CAPTURE, &app_type); if (rc == 0) { rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_CAPTURE); if (rc < 0) goto exit_send_app_type_cfg; } /* config HFP session:2 playback path */ rc = platform_get_default_app_type_v2(adev->platform, PCM_PLAYBACK, &app_type); if (rc == 0) { rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_PLAYBACK); if (rc < 0) goto exit_send_app_type_cfg; } } rc = 0; exit_send_app_type_cfg: return rc; } hal/audio_hw.c +2 −0 Original line number Diff line number Diff line Loading @@ -547,6 +547,7 @@ int enable_audio_route(struct audio_device *adev, else snd_device = usecase->out_snd_device; audio_extn_utils_send_app_type_cfg(adev, usecase); strcpy(mixer_path, use_case_table[usecase->id]); platform_add_backend_name(adev->platform, mixer_path, snd_device); ALOGD("%s: usecase(%d) apply and update mixer path: %s", __func__, usecase->id, mixer_path); Loading Loading @@ -3704,6 +3705,7 @@ static int adev_open(const hw_module_t *module, const char *name, } } audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer); audio_device_ref_count++; if (property_get("audio_hal.period_multiplier", value, NULL) > 0) { Loading hal/msm8916/platform.c +52 −6 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ /* EDID format ID for LPCM audio */ #define EDID_FORMAT_LPCM 1 /* fallback app type if the default app type from acdb loader fails */ #define DEFAULT_APP_TYPE_RX_PATH 0x11130 #define DEFAULT_APP_TYPE_TX_PATH 0x11132 /* Retry for delay in FW loading*/ #define RETRY_NUMBER 20 #define RETRY_US 500000 Loading Loading @@ -89,6 +93,11 @@ enum { CAL_MODE_RTAC = 0x4 }; enum { BUFF_IDX_0 = 0, BUFF_IDX_1 = 1, }; #define PLATFORM_CONFIG_KEY_OPERATOR_INFO "operator_info" struct operator_info { Loading @@ -111,6 +120,7 @@ static struct listnode *operator_specific_device_table[SND_DEVICE_MAX]; typedef void (*acdb_deallocate_t)(); typedef int (*acdb_init_v2_cvd_t)(const char *, char *, int); typedef void (*acdb_send_audio_cal_t)(int, int); typedef void (*acdb_send_audio_cal_v3_t)(int, int, int , int, int); typedef void (*acdb_send_voice_cal_t)(int, int); typedef int (*acdb_reload_vocvoltable_t)(int); typedef int (*acdb_loader_get_calibration_t)(char *attr, int size, void *data); Loading @@ -131,6 +141,7 @@ struct platform_data { acdb_init_v2_cvd_t acdb_init; acdb_deallocate_t acdb_deallocate; acdb_send_audio_cal_t acdb_send_audio_cal; acdb_send_audio_cal_v3_t acdb_send_audio_cal_v3; acdb_send_voice_cal_t acdb_send_voice_cal; acdb_reload_vocvoltable_t acdb_reload_vocvoltable; void *hw_info; Loading Loading @@ -942,6 +953,12 @@ void *platform_init(struct audio_device *adev) ALOGE("%s: Could not find the symbol acdb_loader_deallocate_ACDB from %s", __func__, LIB_ACDB_LOADER); my_data->acdb_send_audio_cal_v3 = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle, "acdb_loader_send_audio_cal_v3"); if (!my_data->acdb_send_audio_cal_v3) ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s", __func__, LIB_ACDB_LOADER); my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle, "acdb_loader_send_audio_cal"); if (!my_data->acdb_send_audio_cal) Loading Loading @@ -1226,6 +1243,20 @@ done: return ret; } int platform_get_default_app_type_v2(void *platform, usecase_type_t type, int *app_type) { ALOGV("%s: platform: %p, type: %d", __func__, platform, type); int rc = 0; if (type == PCM_CAPTURE) { *app_type = DEFAULT_APP_TYPE_TX_PATH; } else if (type == PCM_PLAYBACK) { *app_type = DEFAULT_APP_TYPE_RX_PATH; } else { rc = -EINVAL; } return rc; } int platform_get_snd_device_acdb_id(snd_device_t snd_device) { if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) { Loading @@ -1243,6 +1274,7 @@ int platform_send_audio_calibration(void *platform, snd_device_t snd_device) { struct platform_data *my_data = (struct platform_data *)platform; int acdb_dev_id, acdb_dev_type; int sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE; acdb_dev_id = acdb_device_table[audio_extn_get_spkr_prot_snd_device(snd_device)]; if (acdb_dev_id < 0) { Loading @@ -1250,14 +1282,28 @@ int platform_send_audio_calibration(void *platform, snd_device_t snd_device) __func__, snd_device); return -EINVAL; } if (my_data->acdb_send_audio_cal) { ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)", __func__, snd_device, acdb_dev_id); if (snd_device >= SND_DEVICE_OUT_BEGIN && snd_device < SND_DEVICE_OUT_END) if (snd_device >= SND_DEVICE_OUT_BEGIN && snd_device < SND_DEVICE_OUT_END) acdb_dev_type = ACDB_DEV_TYPE_OUT; else acdb_dev_type = ACDB_DEV_TYPE_IN; if ((my_data->acdb_send_audio_cal_v3) && (snd_device == SND_DEVICE_IN_VOICE_SPEAKER_MIC_HFP)) { /* TX path calibration */ my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_IN, DEFAULT_APP_TYPE_TX_PATH, sample_rate, BUFF_IDX_0); my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_OUT, DEFAULT_APP_TYPE_RX_PATH, sample_rate, BUFF_IDX_0); } else if ((my_data->acdb_send_audio_cal_v3) && (snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_HFP)) { /* RX path calibration */ ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)", __func__, snd_device, acdb_dev_id); my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_IN, DEFAULT_APP_TYPE_TX_PATH, sample_rate, BUFF_IDX_1); my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_OUT, DEFAULT_APP_TYPE_RX_PATH, sample_rate, BUFF_IDX_1); } else if (my_data->acdb_send_audio_cal) { my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type); } return 0; Loading Loading
hal/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ LOCAL_SRC_FILES := \ platform_info.c \ audio_extn/ext_speaker.c \ audio_extn/audio_extn.c \ audio_extn/utils.c \ $(AUDIO_PLATFORM)/platform.c ifdef MULTIPLE_HW_VARIANTS_ENABLED Loading
hal/audio_extn/audio_extn.h +3 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,9 @@ void audio_extn_dsm_feedback_enable(struct audio_device *adev, bool benable); #endif void audio_extn_utils_send_default_app_type_cfg(void *platform, struct mixer *mixer); int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, struct audio_usecase *usecase); #ifndef HWDEP_CAL_ENABLED #define audio_extn_hwdep_cal_send(snd_card, acdb_handle) (0) #else Loading
hal/audio_extn/utils.c 0 → 100644 +179 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "audio_hw_utils" //#define LOG_NDEBUG 0 #include <errno.h> #include <cutils/properties.h> #include <cutils/config_utils.h> #include <stdlib.h> #include <dlfcn.h> #include <cutils/str_parms.h> #include <cutils/log.h> #include <cutils/misc.h> #include "audio_hw.h" #include "platform.h" #include "platform_api.h" #include "audio_extn.h" #define MAX_LENGTH_MIXER_CONTROL_IN_INT 128 static int set_mixer_ctrl(struct audio_device *adev, int pcm_device_id, int app_type, int acdb_dev_id, int sample_rate, int stream_type) { char mixer_ctl_name[MAX_LENGTH_MIXER_CONTROL_IN_INT]; struct mixer_ctl *ctl; int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT], len = 0, rc = 0; if (stream_type == PCM_PLAYBACK) { snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Audio Stream %d App Type Cfg", pcm_device_id); } else if (stream_type == PCM_CAPTURE) { snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Audio Stream Capture %d App Type Cfg", pcm_device_id); } ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); rc = -EINVAL; goto exit; } app_type_cfg[len++] = app_type; app_type_cfg[len++] = acdb_dev_id; app_type_cfg[len++] = sample_rate; ALOGV("%s: stream type %d app_type %d, acdb_dev_id %d sample rate %d", __func__, stream_type, app_type, acdb_dev_id, sample_rate); mixer_ctl_set_array(ctl, app_type_cfg, len); exit: return rc; } void audio_extn_utils_send_default_app_type_cfg(void *platform, struct mixer *mixer) { int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT] = {-1}; int length = 0, app_type = 0,rc = 0; struct mixer_ctl *ctl = NULL; const char *mixer_ctl_name = "App Type Config"; ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s",__func__, mixer_ctl_name); return; } rc = platform_get_default_app_type_v2(platform, PCM_PLAYBACK, &app_type); if (rc == 0) { app_type_cfg[length++] = 1; app_type_cfg[length++] = app_type; app_type_cfg[length++] = 48000; app_type_cfg[length++] = 16; mixer_ctl_set_array(ctl, app_type_cfg, length); } return; } int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, struct audio_usecase *usecase) { struct mixer_ctl *ctl; int pcm_device_id, acdb_dev_id = 0, snd_device = usecase->out_snd_device; int32_t sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; int app_type = 0, rc = 0; ALOGV("%s", __func__); if (usecase->type != PCM_HFP_CALL) { ALOGV("%s: not a playback or HFP path, no need to cfg app type", __func__); rc = 0; goto exit_send_app_type_cfg; } if ((usecase->id != USECASE_AUDIO_HFP_SCO) && (usecase->id != USECASE_AUDIO_HFP_SCO_WB)) { ALOGV("%s: a playback path where app type cfg is not required", __func__); rc = 0; goto exit_send_app_type_cfg; } snd_device = usecase->out_snd_device; pcm_device_id = platform_get_pcm_device_id(usecase->id, PCM_PLAYBACK); snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ? audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device; acdb_dev_id = platform_get_snd_device_acdb_id(snd_device); if (acdb_dev_id < 0) { ALOGE("%s: Couldn't get the acdb dev id", __func__); rc = -EINVAL; goto exit_send_app_type_cfg; } if (usecase->type == PCM_HFP_CALL) { /* config HFP session:1 playback path */ rc = platform_get_default_app_type_v2(adev->platform, PCM_PLAYBACK, &app_type); if (rc < 0) goto exit_send_app_type_cfg; sample_rate= CODEC_BACKEND_DEFAULT_SAMPLE_RATE; rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_PLAYBACK); if (rc < 0) goto exit_send_app_type_cfg; /* config HFP session:1 capture path */ rc = platform_get_default_app_type_v2(adev->platform, PCM_CAPTURE, &app_type); if (rc == 0) { rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_CAPTURE); if (rc < 0) goto exit_send_app_type_cfg; } /* config HFP session:2 capture path */ pcm_device_id = HFP_ASM_RX_TX; snd_device = usecase->in_snd_device; acdb_dev_id = platform_get_snd_device_acdb_id(snd_device); if (acdb_dev_id <= 0) { ALOGE("%s: Couldn't get the acdb dev id", __func__); rc = -EINVAL; goto exit_send_app_type_cfg; } rc = platform_get_default_app_type_v2(adev->platform, PCM_CAPTURE, &app_type); if (rc == 0) { rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_CAPTURE); if (rc < 0) goto exit_send_app_type_cfg; } /* config HFP session:2 playback path */ rc = platform_get_default_app_type_v2(adev->platform, PCM_PLAYBACK, &app_type); if (rc == 0) { rc = set_mixer_ctrl(adev, pcm_device_id, app_type, acdb_dev_id, sample_rate, PCM_PLAYBACK); if (rc < 0) goto exit_send_app_type_cfg; } } rc = 0; exit_send_app_type_cfg: return rc; }
hal/audio_hw.c +2 −0 Original line number Diff line number Diff line Loading @@ -547,6 +547,7 @@ int enable_audio_route(struct audio_device *adev, else snd_device = usecase->out_snd_device; audio_extn_utils_send_app_type_cfg(adev, usecase); strcpy(mixer_path, use_case_table[usecase->id]); platform_add_backend_name(adev->platform, mixer_path, snd_device); ALOGD("%s: usecase(%d) apply and update mixer path: %s", __func__, usecase->id, mixer_path); Loading Loading @@ -3704,6 +3705,7 @@ static int adev_open(const hw_module_t *module, const char *name, } } audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer); audio_device_ref_count++; if (property_get("audio_hal.period_multiplier", value, NULL) > 0) { Loading
hal/msm8916/platform.c +52 −6 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ /* EDID format ID for LPCM audio */ #define EDID_FORMAT_LPCM 1 /* fallback app type if the default app type from acdb loader fails */ #define DEFAULT_APP_TYPE_RX_PATH 0x11130 #define DEFAULT_APP_TYPE_TX_PATH 0x11132 /* Retry for delay in FW loading*/ #define RETRY_NUMBER 20 #define RETRY_US 500000 Loading Loading @@ -89,6 +93,11 @@ enum { CAL_MODE_RTAC = 0x4 }; enum { BUFF_IDX_0 = 0, BUFF_IDX_1 = 1, }; #define PLATFORM_CONFIG_KEY_OPERATOR_INFO "operator_info" struct operator_info { Loading @@ -111,6 +120,7 @@ static struct listnode *operator_specific_device_table[SND_DEVICE_MAX]; typedef void (*acdb_deallocate_t)(); typedef int (*acdb_init_v2_cvd_t)(const char *, char *, int); typedef void (*acdb_send_audio_cal_t)(int, int); typedef void (*acdb_send_audio_cal_v3_t)(int, int, int , int, int); typedef void (*acdb_send_voice_cal_t)(int, int); typedef int (*acdb_reload_vocvoltable_t)(int); typedef int (*acdb_loader_get_calibration_t)(char *attr, int size, void *data); Loading @@ -131,6 +141,7 @@ struct platform_data { acdb_init_v2_cvd_t acdb_init; acdb_deallocate_t acdb_deallocate; acdb_send_audio_cal_t acdb_send_audio_cal; acdb_send_audio_cal_v3_t acdb_send_audio_cal_v3; acdb_send_voice_cal_t acdb_send_voice_cal; acdb_reload_vocvoltable_t acdb_reload_vocvoltable; void *hw_info; Loading Loading @@ -942,6 +953,12 @@ void *platform_init(struct audio_device *adev) ALOGE("%s: Could not find the symbol acdb_loader_deallocate_ACDB from %s", __func__, LIB_ACDB_LOADER); my_data->acdb_send_audio_cal_v3 = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle, "acdb_loader_send_audio_cal_v3"); if (!my_data->acdb_send_audio_cal_v3) ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s", __func__, LIB_ACDB_LOADER); my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle, "acdb_loader_send_audio_cal"); if (!my_data->acdb_send_audio_cal) Loading Loading @@ -1226,6 +1243,20 @@ done: return ret; } int platform_get_default_app_type_v2(void *platform, usecase_type_t type, int *app_type) { ALOGV("%s: platform: %p, type: %d", __func__, platform, type); int rc = 0; if (type == PCM_CAPTURE) { *app_type = DEFAULT_APP_TYPE_TX_PATH; } else if (type == PCM_PLAYBACK) { *app_type = DEFAULT_APP_TYPE_RX_PATH; } else { rc = -EINVAL; } return rc; } int platform_get_snd_device_acdb_id(snd_device_t snd_device) { if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) { Loading @@ -1243,6 +1274,7 @@ int platform_send_audio_calibration(void *platform, snd_device_t snd_device) { struct platform_data *my_data = (struct platform_data *)platform; int acdb_dev_id, acdb_dev_type; int sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE; acdb_dev_id = acdb_device_table[audio_extn_get_spkr_prot_snd_device(snd_device)]; if (acdb_dev_id < 0) { Loading @@ -1250,14 +1282,28 @@ int platform_send_audio_calibration(void *platform, snd_device_t snd_device) __func__, snd_device); return -EINVAL; } if (my_data->acdb_send_audio_cal) { ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)", __func__, snd_device, acdb_dev_id); if (snd_device >= SND_DEVICE_OUT_BEGIN && snd_device < SND_DEVICE_OUT_END) if (snd_device >= SND_DEVICE_OUT_BEGIN && snd_device < SND_DEVICE_OUT_END) acdb_dev_type = ACDB_DEV_TYPE_OUT; else acdb_dev_type = ACDB_DEV_TYPE_IN; if ((my_data->acdb_send_audio_cal_v3) && (snd_device == SND_DEVICE_IN_VOICE_SPEAKER_MIC_HFP)) { /* TX path calibration */ my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_IN, DEFAULT_APP_TYPE_TX_PATH, sample_rate, BUFF_IDX_0); my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_OUT, DEFAULT_APP_TYPE_RX_PATH, sample_rate, BUFF_IDX_0); } else if ((my_data->acdb_send_audio_cal_v3) && (snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_HFP)) { /* RX path calibration */ ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)", __func__, snd_device, acdb_dev_id); my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_IN, DEFAULT_APP_TYPE_TX_PATH, sample_rate, BUFF_IDX_1); my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_OUT, DEFAULT_APP_TYPE_RX_PATH, sample_rate, BUFF_IDX_1); } else if (my_data->acdb_send_audio_cal) { my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type); } return 0; Loading