Loading hal/audio_extn/a2dp.c +28 −0 Original line number Original line Diff line number Diff line Loading @@ -1422,6 +1422,30 @@ static int reset_a2dp_enc_config_params() return ret; return ret; } } static int reset_a2dp_dec_config_params() { struct mixer_ctl *ctl_dec_data = NULL; struct abr_dec_cfg_t dummy_reset_cfg; int ret = 0; if (a2dp.abr_config.is_abr_enabled) { ctl_dec_data = mixer_get_ctl_by_name(a2dp.adev->mixer, MIXER_DEC_CONFIG_BLOCK); if (!ctl_dec_data) { ALOGE("%s: ERROR A2DP decoder config mixer control not identifed", __func__); return -EINVAL; } memset(&dummy_reset_cfg, 0x0, sizeof(dummy_reset_cfg)); ret = mixer_ctl_set_array(ctl_dec_data, (void *)&dummy_reset_cfg, sizeof(dummy_reset_cfg)); if (ret != 0) { ALOGE("%s: Failed to set dummy decoder config", __func__); return ret; } } return ret; } int audio_extn_a2dp_stop_playback() int audio_extn_a2dp_stop_playback() { { int ret = 0; int ret = 0; Loading @@ -1445,6 +1469,7 @@ int audio_extn_a2dp_stop_playback() else else ALOGV("%s: stop steam to Bluetooth IPC lib successful", __func__); ALOGV("%s: stop steam to Bluetooth IPC lib successful", __func__); reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); a2dp_reset_backend_cfg(); a2dp_reset_backend_cfg(); if (a2dp.abr_config.is_abr_enabled && a2dp.abr_config.abr_started) if (a2dp.abr_config.is_abr_enabled && a2dp.abr_config.abr_started) stop_abr(); stop_abr(); Loading Loading @@ -1488,6 +1513,7 @@ int audio_extn_a2dp_set_parameters(struct str_parms *parms, bool *reconfig) if (audio_is_a2dp_out_device(val)) { if (audio_is_a2dp_out_device(val)) { ALOGV("%s: Received device disconnect request", __func__); ALOGV("%s: Received device disconnect request", __func__); reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); close_a2dp_output(); close_a2dp_output(); } } goto param_handled; goto param_handled; Loading @@ -1513,6 +1539,7 @@ int audio_extn_a2dp_set_parameters(struct str_parms *parms, bool *reconfig) } } } } reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); if (a2dp.audio_stream_suspend) { if (a2dp.audio_stream_suspend) { a2dp.audio_stream_suspend(); a2dp.audio_stream_suspend(); } } Loading Loading @@ -1627,6 +1654,7 @@ void audio_extn_a2dp_init(void *adev) a2dp.is_handoff_in_progress = false; a2dp.is_handoff_in_progress = false; a2dp.is_aptx_dual_mono_supported = false; a2dp.is_aptx_dual_mono_supported = false; reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); update_offload_codec_support(); update_offload_codec_support(); } } Loading hal/audio_extn/maxxaudio.c +100 −92 Original line number Original line Diff line number Diff line Loading @@ -17,30 +17,32 @@ #define LOG_TAG "audio_hw_waves" #define LOG_TAG "audio_hw_waves" /*#define LOG_NDEBUG 0*/ /*#define LOG_NDEBUG 0*/ #include <stdlib.h> #include <audio_hw.h> #include <dlfcn.h> #include <pthread.h> #include <unistd.h> #include <cutils/str_parms.h> #include <cutils/str_parms.h> #include <dlfcn.h> #include <log/log.h> #include <log/log.h> #include <audio_hw.h> #include <math.h> #include <system/audio.h> #include <platform_api.h> #include <platform_api.h> #include <pthread.h> #include <stdlib.h> #include <string.h> #include <string.h> #include <math.h> #include <system/audio.h> #include <unistd.h> #include "audio_extn.h" #include "audio_extn.h" #include "maxxaudio.h" #include "maxxaudio.h" #define LIB_MA_PARAM "libmaqdspparams.so" #define LIB_MA_PARAM "libmaxxaudioqdsp.so" #define LIB_MA_PATH "vendor/lib/" #define LIB_MA_PATH "vendor/lib/" #define PRESET_PATH "/vendor/etc/default.mps" #define PRESET_PATH "/vendor/etc" #define MPS_BASE_STRING "default" #define USER_PRESET_PATH "" #define USER_PRESET_PATH "" #define CONFIG_PATH "/vendor/etc/maxx_conf.ini" #define CONFIG_PATH "/vendor/etc/maxx_conf.ini" #define CAL_PRESIST_STR "cal_persist" #define CAL_PRESIST_STR "cal_persist" #define CAL_SAMPLERATE_STR "cal_samplerate" #define CAL_SAMPLERATE_STR "cal_samplerate" #define MA_QDSP_PARAM_INIT "maxxaudio_qdsp_parameters_initialize" #define MA_QDSP_PARAM_INIT "maxxaudio_qdsp_initialize" #define MA_QDSP_PARAM_DEINIT "maxxaudio_qdsp_parameters_uninitialize" #define MA_QDSP_PARAM_DEINIT "maxxaudio_qdsp_uninitialize" #define MA_QDSP_SET_LR_SWAP "maxxaudio_qdsp_set_lr_swap" #define MA_QDSP_SET_LR_SWAP "maxxaudio_qdsp_set_lr_swap" #define MA_QDSP_SET_MODE "maxxaudio_qdsp_set_sound_mode" #define MA_QDSP_SET_MODE "maxxaudio_qdsp_set_sound_mode" #define MA_QDSP_SET_VOL "maxxaudio_qdsp_set_volume" #define MA_QDSP_SET_VOL "maxxaudio_qdsp_set_volume" Loading @@ -50,7 +52,6 @@ #define SUPPORTED_USB 0x01 #define SUPPORTED_USB 0x01 struct ma_audio_cal_settings { struct ma_audio_cal_settings { void *platform; int app_type; int app_type; audio_devices_t device; audio_devices_t device; }; }; Loading Loading @@ -78,34 +79,30 @@ typedef enum MA_CMD { } ma_cmd_t; } ma_cmd_t; typedef void *ma_audio_cal_handle_t; typedef void *ma_audio_cal_handle_t; typedef int (*set_audio_cal_t)(const struct ma_audio_cal_settings *, const char *); typedef int (*set_audio_cal_t)(const char *); typedef bool (*ma_param_init_t)( typedef bool (*ma_param_init_t)(ma_audio_cal_handle_t *, const char *, ma_audio_cal_handle_t *, const char *, const char *, set_audio_cal_t); void *, const char *, const char *, const char *, set_audio_cal_t); typedef bool (*ma_param_deinit_t)(ma_audio_cal_handle_t); typedef bool (*ma_param_deinit_t)(ma_audio_cal_handle_t *); typedef bool (*ma_set_lr_swap_t)( typedef bool (*ma_set_lr_swap_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, bool); const struct ma_audio_cal_settings *, bool); typedef bool (*ma_set_sound_mode_t)( typedef bool (*ma_set_sound_mode_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, const struct ma_audio_cal_settings *, unsigned int); unsigned int); typedef bool (*ma_set_volume_t)( typedef bool (*ma_set_volume_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, double); const struct ma_audio_cal_settings *, double); typedef bool (*ma_set_volume_table_t)( typedef bool (*ma_set_volume_table_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, const struct ma_audio_cal_settings *, size_t, struct ma_state *); size_t, struct ma_state *); struct ma_platform_data { struct ma_platform_data { void *waves_handle; void *waves_handle; void *platform; pthread_mutex_t lock; pthread_mutex_t lock; ma_param_init_t ma_param_init; ma_param_init_t ma_param_init; ma_param_deinit_t ma_param_deinit; ma_param_deinit_t ma_param_deinit; Loading @@ -120,49 +117,42 @@ static uint16_t g_supported_dev = 0; static struct ma_state ma_cur_state_table[STREAM_MAX_TYPES]; static struct ma_state ma_cur_state_table[STREAM_MAX_TYPES]; static struct ma_platform_data *my_data = NULL; static struct ma_platform_data *my_data = NULL; static int set_audio_cal( static int set_audio_cal(const char *audio_cal) const struct ma_audio_cal_settings *audio_cal_settings, const char *audio_cal) { { ALOGV("set_audio_cal: %s", audio_cal); ALOGV("set_audio_cal: %s", audio_cal); return platform_set_parameters(audio_cal_settings->platform, return platform_set_parameters(my_data->platform, str_parms_create_str(audio_cal)); str_parms_create_str(audio_cal)); } } static bool ma_set_lr_swap_l( static bool ma_set_lr_swap_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, bool swap) bool swap) { { return my_data->ma_set_lr_swap(g_ma_audio_cal_handle, audio_cal_settings, swap); return my_data->ma_set_lr_swap(g_ma_audio_cal_handle, audio_cal_settings, swap); } } static bool ma_set_sound_mode_l( static bool ma_set_sound_mode_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, int sound_mode) int sound_mode) { { return my_data->ma_set_sound_mode(g_ma_audio_cal_handle, return my_data->ma_set_sound_mode(g_ma_audio_cal_handle, audio_cal_settings, sound_mode); audio_cal_settings, sound_mode); } } static bool ma_set_volume_l( static bool ma_set_volume_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, double volume) double volume) { { return my_data->ma_set_volume(g_ma_audio_cal_handle, audio_cal_settings, volume); return my_data->ma_set_volume(g_ma_audio_cal_handle, audio_cal_settings, volume); } } static bool ma_set_volume_table_l( static bool ma_set_volume_table_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, size_t num_streams, struct ma_state *volume_table) size_t num_streams, struct ma_state *volume_table) { { return my_data->ma_set_volume_table( return my_data->ma_set_volume_table(g_ma_audio_cal_handle, g_ma_audio_cal_handle, audio_cal_settings, num_streams, audio_cal_settings, num_streams, volume_table); volume_table); } } static inline bool valid_usecase(struct audio_usecase *usecase) static inline bool valid_usecase(struct audio_usecase *usecase) Loading @@ -175,7 +165,7 @@ static inline bool valid_usecase(struct audio_usecase *usecase) /* support devices */ /* support devices */ ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) || ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) || (usecase->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) || (usecase->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) || (usecase->devices & AUDIO_DEVICE_OUT_ALL_A2DP) || /* TODO: enable A2DP when it is ready */ (usecase->devices & AUDIO_DEVICE_OUT_ALL_USB))) (usecase->devices & AUDIO_DEVICE_OUT_ALL_USB))) return true; return true; Loading Loading @@ -219,7 +209,6 @@ static bool check_and_send_all_audio_cal(struct audio_device *adev, ma_cmd_t cmd list_for_each(node, &adev->usecase_list) { list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); usecase = node_to_item(node, struct audio_usecase, list); if (valid_usecase(usecase)) { if (valid_usecase(usecase)) { ma_cal->platform = adev->platform; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->device = usecase->stream.out->devices; ma_cal->device = usecase->stream.out->devices; ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", Loading @@ -236,8 +225,8 @@ static bool check_and_send_all_audio_cal(struct audio_device *adev, ma_cmd_t cmd ALOGV("%s: send volume table === Start", __func__); ALOGV("%s: send volume table === Start", __func__); for (i = 0; i < STREAM_MAX_TYPES; i++) for (i = 0; i < STREAM_MAX_TYPES; i++) ALOGV("%s: stream(%d) volume(%f) active(%s)", __func__, i, ALOGV("%s: stream(%d) volume(%f) active(%s)", __func__, ma_cur_state_table[i].vol, i, ma_cur_state_table[i].vol, ma_cur_state_table[i].active ? "T" : "F"); ma_cur_state_table[i].active ? "T" : "F"); ALOGV("%s: send volume table === End", __func__); ALOGV("%s: send volume table === End", __func__); break; break; Loading @@ -258,7 +247,6 @@ static bool check_and_send_all_audio_cal(struct audio_device *adev, ma_cmd_t cmd default: default: ALOGE("%s: unsupported cmd %d", __func__, cmd); ALOGE("%s: unsupported cmd %d", __func__, cmd); } } } } } } free(ma_cal); free(ma_cal); Loading Loading @@ -294,10 +282,14 @@ static bool find_sup_dev(char *name) static void ma_set_swap_l(struct audio_device *adev, bool enable) static void ma_set_swap_l(struct audio_device *adev, bool enable) { { // do platform LR swap if it enables on Waves effect // but there is no Waves implementation if (!my_data) { if (!my_data) { ALOGE("%s: maxxaudio isn't initialized.", __func__); platform_check_and_set_swap_lr_channels(adev, enable); ALOGV("%s: maxxaudio isn't initialized.", __func__); return; return; } } if (enable) if (enable) check_and_send_all_audio_cal(adev, MA_CMD_SWAP_ENABLE); check_and_send_all_audio_cal(adev, MA_CMD_SWAP_ENABLE); else else Loading Loading @@ -350,7 +342,10 @@ void audio_extn_ma_init(void *platform) { { ma_stream_type_t i = 0; ma_stream_type_t i = 0; int ret = 0; int ret = 0; char lib_path[256]; char lib_path[128] = {0}; char mps_path[128] = {0}; struct snd_card_split *snd_split_handle = NULL; snd_split_handle = audio_extn_get_snd_card_split(); if (platform == NULL) { if (platform == NULL) { ALOGE("%s: platform is NULL", __func__); ALOGE("%s: platform is NULL", __func__); Loading @@ -366,6 +361,7 @@ void audio_extn_ma_init(void *platform) pthread_mutex_init(&my_data->lock, NULL); pthread_mutex_init(&my_data->lock, NULL); my_data->platform = platform; ret = snprintf(lib_path, sizeof(lib_path), "%s/%s", LIB_MA_PATH, LIB_MA_PARAM); ret = snprintf(lib_path, sizeof(lib_path), "%s/%s", LIB_MA_PATH, LIB_MA_PARAM); if (ret < 0) { if (ret < 0) { ALOGE("%s: snprintf failed for lib %s, ret %d", __func__, LIB_MA_PARAM, ret); ALOGE("%s: snprintf failed for lib %s, ret %d", __func__, LIB_MA_PARAM, ret); Loading @@ -386,8 +382,8 @@ void audio_extn_ma_init(void *platform) goto error; goto error; } } my_data->ma_param_deinit = (ma_param_deinit_t)dlsym(my_data->waves_handle, my_data->ma_param_deinit = (ma_param_deinit_t)dlsym( MA_QDSP_PARAM_DEINIT); my_data->waves_handle, MA_QDSP_PARAM_DEINIT); if (!my_data->ma_param_deinit) { if (!my_data->ma_param_deinit) { ALOGE("%s: dlsym error %s for ma_param_deinit", __func__, dlerror()); ALOGE("%s: dlsym error %s for ma_param_deinit", __func__, dlerror()); goto error; goto error; Loading @@ -400,8 +396,8 @@ void audio_extn_ma_init(void *platform) goto error; goto error; } } my_data->ma_set_sound_mode = (ma_set_sound_mode_t)dlsym(my_data->waves_handle, my_data->ma_set_sound_mode = (ma_set_sound_mode_t)dlsym( MA_QDSP_SET_MODE); my_data->waves_handle, MA_QDSP_SET_MODE); if (!my_data->ma_set_sound_mode) { if (!my_data->ma_set_sound_mode) { ALOGE("%s: dlsym error %s for ma_set_sound_mode", __func__, dlerror()); ALOGE("%s: dlsym error %s for ma_set_sound_mode", __func__, dlerror()); goto error; goto error; Loading @@ -414,19 +410,30 @@ void audio_extn_ma_init(void *platform) goto error; goto error; } } my_data->ma_set_volume_table = (ma_set_volume_table_t)dlsym(my_data->waves_handle, my_data->ma_set_volume_table = (ma_set_volume_table_t)dlsym( MA_QDSP_SET_VOLT); my_data->waves_handle, MA_QDSP_SET_VOLT); if (!my_data->ma_set_volume_table) { if (!my_data->ma_set_volume_table) { ALOGE("%s: dlsym error %s for ma_set_volume_table", __func__, dlerror()); ALOGE("%s: dlsym error %s for ma_set_volume_table", __func__, dlerror()); goto error; goto error; } } } } /* get preset table */ if (snd_split_handle == NULL) { snprintf(mps_path, sizeof(mps_path), "%s/%s.mps", PRESET_PATH, MPS_BASE_STRING); } else { snprintf(mps_path, sizeof(mps_path), "%s/%s_%s.mps", PRESET_PATH, MPS_BASE_STRING, snd_split_handle->form_factor); } /* check file */ /* check file */ if (access(PRESET_PATH, F_OK) < 0) { if (access(mps_path, F_OK) < 0) { ALOGW("%s: file %s isn't existed.", __func__, PRESET_PATH); ALOGW("%s: file %s isn't existed.", __func__, mps_path); goto error; goto error; } } else ALOGD("%s: Loading mps file: %s", __func__, mps_path); /* TODO: check user preset table once the feature is enabled /* TODO: check user preset table once the feature is enabled if (access(USER_PRESET_PATH, F_OK) < 0 ){ if (access(USER_PRESET_PATH, F_OK) < 0 ){ ALOGW("%s: file %s isn't existed.", __func__, USER_PRESET_PATH); ALOGW("%s: file %s isn't existed.", __func__, USER_PRESET_PATH); Loading @@ -440,9 +447,8 @@ void audio_extn_ma_init(void *platform) /* init ma parameter */ /* init ma parameter */ if (my_data->ma_param_init(&g_ma_audio_cal_handle, if (my_data->ma_param_init(&g_ma_audio_cal_handle, platform, /* TODO: remove this on next version*/ mps_path, PRESET_PATH, USER_PRESET_PATH, /* unused */ USER_PRESET_PATH, /* useless */ CONFIG_PATH, CONFIG_PATH, &set_audio_cal)) { &set_audio_cal)) { if (!g_ma_audio_cal_handle) { if (!g_ma_audio_cal_handle) { Loading Loading @@ -487,8 +493,8 @@ void audio_extn_ma_deinit() } } // adev_init and adev lock held // adev_init and adev lock held bool audio_extn_ma_set_state( bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, struct audio_device *adev, int stream_type, float vol, bool active) float vol, bool active) { { bool ret = false; bool ret = false; ma_stream_type_t stype = (ma_stream_type_t)stream_type; ma_stream_type_t stype = (ma_stream_type_t)stream_type; Loading @@ -497,7 +503,7 @@ bool audio_extn_ma_set_state( __func__, stream_type, vol, active ? "true" : "false"); __func__, stream_type, vol, active ? "true" : "false"); if (!my_data) { if (!my_data) { ALOGE("%s: maxxaudio isn't initialized.", __func__); ALOGV("%s: maxxaudio isn't initialized.", __func__); return ret; return ret; } } Loading @@ -519,7 +525,7 @@ bool audio_extn_ma_set_state( return ret; return ret; } } void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *usecase) void audio_extn_ma_set_device(struct audio_usecase *usecase) { { int i = 0; int i = 0; int u_index = -1; int u_index = -1; Loading @@ -540,7 +546,6 @@ void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *u /* update audio_cal and send it */ /* update audio_cal and send it */ if (ma_cal != NULL){ if (ma_cal != NULL){ ma_cal->platform = adev->platform; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->device = usecase->stream.out->devices; ma_cal->device = usecase->stream.out->devices; ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", Loading Loading @@ -571,7 +576,8 @@ void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *u } } } } void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms) void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms) { { int ret; int ret; bool ret_b; bool ret_b; Loading @@ -594,7 +600,8 @@ void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *p } } // check connect status // check connect status ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value)); if (ret >= 0) { if (ret >= 0) { audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); if (audio_is_usb_out_device(device)) { if (audio_is_usb_out_device(device)) { Loading @@ -607,7 +614,8 @@ void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *p } } // check disconnect status // check disconnect status ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value)); if (ret >= 0) { if (ret >= 0) { audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); if (audio_is_usb_out_device(device)) { if (audio_is_usb_out_device(device)) { Loading hal/audio_extn/maxxaudio.h +11 −9 Original line number Original line Diff line number Diff line Loading @@ -21,15 +21,17 @@ #define audio_extn_ma_init(platform) (0) #define audio_extn_ma_init(platform) (0) #define audio_extn_ma_deinit() (0) #define audio_extn_ma_deinit() (0) #define audio_extn_ma_set_state(adev, type, vol, active) (false) #define audio_extn_ma_set_state(adev, type, vol, active) (false) #define audio_extn_ma_set_device(adev, usecase) (0) #define audio_extn_ma_set_device(usecase) (0) #define audio_extn_ma_set_parameters(adev, param) (0) #define audio_extn_ma_set_parameters(adev, param) (0) #define audio_extn_ma_supported_usb() (false) #define audio_extn_ma_supported_usb() (false) #else #else void audio_extn_ma_init(void *platform); void audio_extn_ma_init(void *platform); void audio_extn_ma_deinit(); void audio_extn_ma_deinit(); bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, float vol, bool active); bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *usecase); float vol, bool active); void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms); void audio_extn_ma_set_device(struct audio_usecase *usecase); void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms); bool audio_extn_ma_supported_usb(); bool audio_extn_ma_supported_usb(); #endif /* MAXXAUDIO_QDSP_ENABLED */ #endif /* MAXXAUDIO_QDSP_ENABLED */ Loading hal/audio_hw.c +4 −2 Original line number Original line Diff line number Diff line Loading @@ -1464,7 +1464,7 @@ int select_devices(struct audio_device *adev, enable_audio_route(adev, usecase); enable_audio_route(adev, usecase); audio_extn_ma_set_device(adev, usecase); audio_extn_ma_set_device(usecase); /* Applicable only on the targets that has external modem. /* Applicable only on the targets that has external modem. * Enable device command should be sent to modem only after * Enable device command should be sent to modem only after Loading Loading @@ -2602,7 +2602,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) out->devices = new_dev; out->devices = new_dev; if (output_drives_call(adev, out)) { if (output_drives_call(adev, out)) { if (!voice_is_in_call(adev)) { if (!voice_is_call_state_active(adev)) { if (adev->mode == AUDIO_MODE_IN_CALL) { if (adev->mode == AUDIO_MODE_IN_CALL) { adev->current_call_output = out; adev->current_call_output = out; ret = voice_start_call(adev); ret = voice_start_call(adev); Loading Loading @@ -5676,6 +5676,8 @@ static int adev_open(const hw_module_t *module, const char *name, } } } } adev->mic_break_enabled = property_get_bool("vendor.audio.mic_break", false); // commented as full set of app type cfg is sent from platform // commented as full set of app type cfg is sent from platform // audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer); // audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer); audio_device_ref_count++; audio_device_ref_count++; Loading hal/audio_hw.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -328,6 +328,7 @@ struct audio_device { bool mic_muted; bool mic_muted; bool enable_voicerx; bool enable_voicerx; bool enable_hfp; bool enable_hfp; bool mic_break_enabled; int snd_card; int snd_card; void *platform; void *platform; Loading Loading
hal/audio_extn/a2dp.c +28 −0 Original line number Original line Diff line number Diff line Loading @@ -1422,6 +1422,30 @@ static int reset_a2dp_enc_config_params() return ret; return ret; } } static int reset_a2dp_dec_config_params() { struct mixer_ctl *ctl_dec_data = NULL; struct abr_dec_cfg_t dummy_reset_cfg; int ret = 0; if (a2dp.abr_config.is_abr_enabled) { ctl_dec_data = mixer_get_ctl_by_name(a2dp.adev->mixer, MIXER_DEC_CONFIG_BLOCK); if (!ctl_dec_data) { ALOGE("%s: ERROR A2DP decoder config mixer control not identifed", __func__); return -EINVAL; } memset(&dummy_reset_cfg, 0x0, sizeof(dummy_reset_cfg)); ret = mixer_ctl_set_array(ctl_dec_data, (void *)&dummy_reset_cfg, sizeof(dummy_reset_cfg)); if (ret != 0) { ALOGE("%s: Failed to set dummy decoder config", __func__); return ret; } } return ret; } int audio_extn_a2dp_stop_playback() int audio_extn_a2dp_stop_playback() { { int ret = 0; int ret = 0; Loading @@ -1445,6 +1469,7 @@ int audio_extn_a2dp_stop_playback() else else ALOGV("%s: stop steam to Bluetooth IPC lib successful", __func__); ALOGV("%s: stop steam to Bluetooth IPC lib successful", __func__); reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); a2dp_reset_backend_cfg(); a2dp_reset_backend_cfg(); if (a2dp.abr_config.is_abr_enabled && a2dp.abr_config.abr_started) if (a2dp.abr_config.is_abr_enabled && a2dp.abr_config.abr_started) stop_abr(); stop_abr(); Loading Loading @@ -1488,6 +1513,7 @@ int audio_extn_a2dp_set_parameters(struct str_parms *parms, bool *reconfig) if (audio_is_a2dp_out_device(val)) { if (audio_is_a2dp_out_device(val)) { ALOGV("%s: Received device disconnect request", __func__); ALOGV("%s: Received device disconnect request", __func__); reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); close_a2dp_output(); close_a2dp_output(); } } goto param_handled; goto param_handled; Loading @@ -1513,6 +1539,7 @@ int audio_extn_a2dp_set_parameters(struct str_parms *parms, bool *reconfig) } } } } reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); if (a2dp.audio_stream_suspend) { if (a2dp.audio_stream_suspend) { a2dp.audio_stream_suspend(); a2dp.audio_stream_suspend(); } } Loading Loading @@ -1627,6 +1654,7 @@ void audio_extn_a2dp_init(void *adev) a2dp.is_handoff_in_progress = false; a2dp.is_handoff_in_progress = false; a2dp.is_aptx_dual_mono_supported = false; a2dp.is_aptx_dual_mono_supported = false; reset_a2dp_enc_config_params(); reset_a2dp_enc_config_params(); reset_a2dp_dec_config_params(); update_offload_codec_support(); update_offload_codec_support(); } } Loading
hal/audio_extn/maxxaudio.c +100 −92 Original line number Original line Diff line number Diff line Loading @@ -17,30 +17,32 @@ #define LOG_TAG "audio_hw_waves" #define LOG_TAG "audio_hw_waves" /*#define LOG_NDEBUG 0*/ /*#define LOG_NDEBUG 0*/ #include <stdlib.h> #include <audio_hw.h> #include <dlfcn.h> #include <pthread.h> #include <unistd.h> #include <cutils/str_parms.h> #include <cutils/str_parms.h> #include <dlfcn.h> #include <log/log.h> #include <log/log.h> #include <audio_hw.h> #include <math.h> #include <system/audio.h> #include <platform_api.h> #include <platform_api.h> #include <pthread.h> #include <stdlib.h> #include <string.h> #include <string.h> #include <math.h> #include <system/audio.h> #include <unistd.h> #include "audio_extn.h" #include "audio_extn.h" #include "maxxaudio.h" #include "maxxaudio.h" #define LIB_MA_PARAM "libmaqdspparams.so" #define LIB_MA_PARAM "libmaxxaudioqdsp.so" #define LIB_MA_PATH "vendor/lib/" #define LIB_MA_PATH "vendor/lib/" #define PRESET_PATH "/vendor/etc/default.mps" #define PRESET_PATH "/vendor/etc" #define MPS_BASE_STRING "default" #define USER_PRESET_PATH "" #define USER_PRESET_PATH "" #define CONFIG_PATH "/vendor/etc/maxx_conf.ini" #define CONFIG_PATH "/vendor/etc/maxx_conf.ini" #define CAL_PRESIST_STR "cal_persist" #define CAL_PRESIST_STR "cal_persist" #define CAL_SAMPLERATE_STR "cal_samplerate" #define CAL_SAMPLERATE_STR "cal_samplerate" #define MA_QDSP_PARAM_INIT "maxxaudio_qdsp_parameters_initialize" #define MA_QDSP_PARAM_INIT "maxxaudio_qdsp_initialize" #define MA_QDSP_PARAM_DEINIT "maxxaudio_qdsp_parameters_uninitialize" #define MA_QDSP_PARAM_DEINIT "maxxaudio_qdsp_uninitialize" #define MA_QDSP_SET_LR_SWAP "maxxaudio_qdsp_set_lr_swap" #define MA_QDSP_SET_LR_SWAP "maxxaudio_qdsp_set_lr_swap" #define MA_QDSP_SET_MODE "maxxaudio_qdsp_set_sound_mode" #define MA_QDSP_SET_MODE "maxxaudio_qdsp_set_sound_mode" #define MA_QDSP_SET_VOL "maxxaudio_qdsp_set_volume" #define MA_QDSP_SET_VOL "maxxaudio_qdsp_set_volume" Loading @@ -50,7 +52,6 @@ #define SUPPORTED_USB 0x01 #define SUPPORTED_USB 0x01 struct ma_audio_cal_settings { struct ma_audio_cal_settings { void *platform; int app_type; int app_type; audio_devices_t device; audio_devices_t device; }; }; Loading Loading @@ -78,34 +79,30 @@ typedef enum MA_CMD { } ma_cmd_t; } ma_cmd_t; typedef void *ma_audio_cal_handle_t; typedef void *ma_audio_cal_handle_t; typedef int (*set_audio_cal_t)(const struct ma_audio_cal_settings *, const char *); typedef int (*set_audio_cal_t)(const char *); typedef bool (*ma_param_init_t)( typedef bool (*ma_param_init_t)(ma_audio_cal_handle_t *, const char *, ma_audio_cal_handle_t *, const char *, const char *, set_audio_cal_t); void *, const char *, const char *, const char *, set_audio_cal_t); typedef bool (*ma_param_deinit_t)(ma_audio_cal_handle_t); typedef bool (*ma_param_deinit_t)(ma_audio_cal_handle_t *); typedef bool (*ma_set_lr_swap_t)( typedef bool (*ma_set_lr_swap_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, bool); const struct ma_audio_cal_settings *, bool); typedef bool (*ma_set_sound_mode_t)( typedef bool (*ma_set_sound_mode_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, const struct ma_audio_cal_settings *, unsigned int); unsigned int); typedef bool (*ma_set_volume_t)( typedef bool (*ma_set_volume_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, double); const struct ma_audio_cal_settings *, double); typedef bool (*ma_set_volume_table_t)( typedef bool (*ma_set_volume_table_t)(ma_audio_cal_handle_t, ma_audio_cal_handle_t, const struct ma_audio_cal_settings *, const struct ma_audio_cal_settings *, size_t, struct ma_state *); size_t, struct ma_state *); struct ma_platform_data { struct ma_platform_data { void *waves_handle; void *waves_handle; void *platform; pthread_mutex_t lock; pthread_mutex_t lock; ma_param_init_t ma_param_init; ma_param_init_t ma_param_init; ma_param_deinit_t ma_param_deinit; ma_param_deinit_t ma_param_deinit; Loading @@ -120,49 +117,42 @@ static uint16_t g_supported_dev = 0; static struct ma_state ma_cur_state_table[STREAM_MAX_TYPES]; static struct ma_state ma_cur_state_table[STREAM_MAX_TYPES]; static struct ma_platform_data *my_data = NULL; static struct ma_platform_data *my_data = NULL; static int set_audio_cal( static int set_audio_cal(const char *audio_cal) const struct ma_audio_cal_settings *audio_cal_settings, const char *audio_cal) { { ALOGV("set_audio_cal: %s", audio_cal); ALOGV("set_audio_cal: %s", audio_cal); return platform_set_parameters(audio_cal_settings->platform, return platform_set_parameters(my_data->platform, str_parms_create_str(audio_cal)); str_parms_create_str(audio_cal)); } } static bool ma_set_lr_swap_l( static bool ma_set_lr_swap_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, bool swap) bool swap) { { return my_data->ma_set_lr_swap(g_ma_audio_cal_handle, audio_cal_settings, swap); return my_data->ma_set_lr_swap(g_ma_audio_cal_handle, audio_cal_settings, swap); } } static bool ma_set_sound_mode_l( static bool ma_set_sound_mode_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, int sound_mode) int sound_mode) { { return my_data->ma_set_sound_mode(g_ma_audio_cal_handle, return my_data->ma_set_sound_mode(g_ma_audio_cal_handle, audio_cal_settings, sound_mode); audio_cal_settings, sound_mode); } } static bool ma_set_volume_l( static bool ma_set_volume_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, double volume) double volume) { { return my_data->ma_set_volume(g_ma_audio_cal_handle, audio_cal_settings, volume); return my_data->ma_set_volume(g_ma_audio_cal_handle, audio_cal_settings, volume); } } static bool ma_set_volume_table_l( static bool ma_set_volume_table_l( const struct ma_audio_cal_settings *audio_cal_settings, const struct ma_audio_cal_settings *audio_cal_settings, size_t num_streams, struct ma_state *volume_table) size_t num_streams, struct ma_state *volume_table) { { return my_data->ma_set_volume_table( return my_data->ma_set_volume_table(g_ma_audio_cal_handle, g_ma_audio_cal_handle, audio_cal_settings, num_streams, audio_cal_settings, num_streams, volume_table); volume_table); } } static inline bool valid_usecase(struct audio_usecase *usecase) static inline bool valid_usecase(struct audio_usecase *usecase) Loading @@ -175,7 +165,7 @@ static inline bool valid_usecase(struct audio_usecase *usecase) /* support devices */ /* support devices */ ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) || ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) || (usecase->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) || (usecase->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) || (usecase->devices & AUDIO_DEVICE_OUT_ALL_A2DP) || /* TODO: enable A2DP when it is ready */ (usecase->devices & AUDIO_DEVICE_OUT_ALL_USB))) (usecase->devices & AUDIO_DEVICE_OUT_ALL_USB))) return true; return true; Loading Loading @@ -219,7 +209,6 @@ static bool check_and_send_all_audio_cal(struct audio_device *adev, ma_cmd_t cmd list_for_each(node, &adev->usecase_list) { list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); usecase = node_to_item(node, struct audio_usecase, list); if (valid_usecase(usecase)) { if (valid_usecase(usecase)) { ma_cal->platform = adev->platform; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->device = usecase->stream.out->devices; ma_cal->device = usecase->stream.out->devices; ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", Loading @@ -236,8 +225,8 @@ static bool check_and_send_all_audio_cal(struct audio_device *adev, ma_cmd_t cmd ALOGV("%s: send volume table === Start", __func__); ALOGV("%s: send volume table === Start", __func__); for (i = 0; i < STREAM_MAX_TYPES; i++) for (i = 0; i < STREAM_MAX_TYPES; i++) ALOGV("%s: stream(%d) volume(%f) active(%s)", __func__, i, ALOGV("%s: stream(%d) volume(%f) active(%s)", __func__, ma_cur_state_table[i].vol, i, ma_cur_state_table[i].vol, ma_cur_state_table[i].active ? "T" : "F"); ma_cur_state_table[i].active ? "T" : "F"); ALOGV("%s: send volume table === End", __func__); ALOGV("%s: send volume table === End", __func__); break; break; Loading @@ -258,7 +247,6 @@ static bool check_and_send_all_audio_cal(struct audio_device *adev, ma_cmd_t cmd default: default: ALOGE("%s: unsupported cmd %d", __func__, cmd); ALOGE("%s: unsupported cmd %d", __func__, cmd); } } } } } } free(ma_cal); free(ma_cal); Loading Loading @@ -294,10 +282,14 @@ static bool find_sup_dev(char *name) static void ma_set_swap_l(struct audio_device *adev, bool enable) static void ma_set_swap_l(struct audio_device *adev, bool enable) { { // do platform LR swap if it enables on Waves effect // but there is no Waves implementation if (!my_data) { if (!my_data) { ALOGE("%s: maxxaudio isn't initialized.", __func__); platform_check_and_set_swap_lr_channels(adev, enable); ALOGV("%s: maxxaudio isn't initialized.", __func__); return; return; } } if (enable) if (enable) check_and_send_all_audio_cal(adev, MA_CMD_SWAP_ENABLE); check_and_send_all_audio_cal(adev, MA_CMD_SWAP_ENABLE); else else Loading Loading @@ -350,7 +342,10 @@ void audio_extn_ma_init(void *platform) { { ma_stream_type_t i = 0; ma_stream_type_t i = 0; int ret = 0; int ret = 0; char lib_path[256]; char lib_path[128] = {0}; char mps_path[128] = {0}; struct snd_card_split *snd_split_handle = NULL; snd_split_handle = audio_extn_get_snd_card_split(); if (platform == NULL) { if (platform == NULL) { ALOGE("%s: platform is NULL", __func__); ALOGE("%s: platform is NULL", __func__); Loading @@ -366,6 +361,7 @@ void audio_extn_ma_init(void *platform) pthread_mutex_init(&my_data->lock, NULL); pthread_mutex_init(&my_data->lock, NULL); my_data->platform = platform; ret = snprintf(lib_path, sizeof(lib_path), "%s/%s", LIB_MA_PATH, LIB_MA_PARAM); ret = snprintf(lib_path, sizeof(lib_path), "%s/%s", LIB_MA_PATH, LIB_MA_PARAM); if (ret < 0) { if (ret < 0) { ALOGE("%s: snprintf failed for lib %s, ret %d", __func__, LIB_MA_PARAM, ret); ALOGE("%s: snprintf failed for lib %s, ret %d", __func__, LIB_MA_PARAM, ret); Loading @@ -386,8 +382,8 @@ void audio_extn_ma_init(void *platform) goto error; goto error; } } my_data->ma_param_deinit = (ma_param_deinit_t)dlsym(my_data->waves_handle, my_data->ma_param_deinit = (ma_param_deinit_t)dlsym( MA_QDSP_PARAM_DEINIT); my_data->waves_handle, MA_QDSP_PARAM_DEINIT); if (!my_data->ma_param_deinit) { if (!my_data->ma_param_deinit) { ALOGE("%s: dlsym error %s for ma_param_deinit", __func__, dlerror()); ALOGE("%s: dlsym error %s for ma_param_deinit", __func__, dlerror()); goto error; goto error; Loading @@ -400,8 +396,8 @@ void audio_extn_ma_init(void *platform) goto error; goto error; } } my_data->ma_set_sound_mode = (ma_set_sound_mode_t)dlsym(my_data->waves_handle, my_data->ma_set_sound_mode = (ma_set_sound_mode_t)dlsym( MA_QDSP_SET_MODE); my_data->waves_handle, MA_QDSP_SET_MODE); if (!my_data->ma_set_sound_mode) { if (!my_data->ma_set_sound_mode) { ALOGE("%s: dlsym error %s for ma_set_sound_mode", __func__, dlerror()); ALOGE("%s: dlsym error %s for ma_set_sound_mode", __func__, dlerror()); goto error; goto error; Loading @@ -414,19 +410,30 @@ void audio_extn_ma_init(void *platform) goto error; goto error; } } my_data->ma_set_volume_table = (ma_set_volume_table_t)dlsym(my_data->waves_handle, my_data->ma_set_volume_table = (ma_set_volume_table_t)dlsym( MA_QDSP_SET_VOLT); my_data->waves_handle, MA_QDSP_SET_VOLT); if (!my_data->ma_set_volume_table) { if (!my_data->ma_set_volume_table) { ALOGE("%s: dlsym error %s for ma_set_volume_table", __func__, dlerror()); ALOGE("%s: dlsym error %s for ma_set_volume_table", __func__, dlerror()); goto error; goto error; } } } } /* get preset table */ if (snd_split_handle == NULL) { snprintf(mps_path, sizeof(mps_path), "%s/%s.mps", PRESET_PATH, MPS_BASE_STRING); } else { snprintf(mps_path, sizeof(mps_path), "%s/%s_%s.mps", PRESET_PATH, MPS_BASE_STRING, snd_split_handle->form_factor); } /* check file */ /* check file */ if (access(PRESET_PATH, F_OK) < 0) { if (access(mps_path, F_OK) < 0) { ALOGW("%s: file %s isn't existed.", __func__, PRESET_PATH); ALOGW("%s: file %s isn't existed.", __func__, mps_path); goto error; goto error; } } else ALOGD("%s: Loading mps file: %s", __func__, mps_path); /* TODO: check user preset table once the feature is enabled /* TODO: check user preset table once the feature is enabled if (access(USER_PRESET_PATH, F_OK) < 0 ){ if (access(USER_PRESET_PATH, F_OK) < 0 ){ ALOGW("%s: file %s isn't existed.", __func__, USER_PRESET_PATH); ALOGW("%s: file %s isn't existed.", __func__, USER_PRESET_PATH); Loading @@ -440,9 +447,8 @@ void audio_extn_ma_init(void *platform) /* init ma parameter */ /* init ma parameter */ if (my_data->ma_param_init(&g_ma_audio_cal_handle, if (my_data->ma_param_init(&g_ma_audio_cal_handle, platform, /* TODO: remove this on next version*/ mps_path, PRESET_PATH, USER_PRESET_PATH, /* unused */ USER_PRESET_PATH, /* useless */ CONFIG_PATH, CONFIG_PATH, &set_audio_cal)) { &set_audio_cal)) { if (!g_ma_audio_cal_handle) { if (!g_ma_audio_cal_handle) { Loading Loading @@ -487,8 +493,8 @@ void audio_extn_ma_deinit() } } // adev_init and adev lock held // adev_init and adev lock held bool audio_extn_ma_set_state( bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, struct audio_device *adev, int stream_type, float vol, bool active) float vol, bool active) { { bool ret = false; bool ret = false; ma_stream_type_t stype = (ma_stream_type_t)stream_type; ma_stream_type_t stype = (ma_stream_type_t)stream_type; Loading @@ -497,7 +503,7 @@ bool audio_extn_ma_set_state( __func__, stream_type, vol, active ? "true" : "false"); __func__, stream_type, vol, active ? "true" : "false"); if (!my_data) { if (!my_data) { ALOGE("%s: maxxaudio isn't initialized.", __func__); ALOGV("%s: maxxaudio isn't initialized.", __func__); return ret; return ret; } } Loading @@ -519,7 +525,7 @@ bool audio_extn_ma_set_state( return ret; return ret; } } void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *usecase) void audio_extn_ma_set_device(struct audio_usecase *usecase) { { int i = 0; int i = 0; int u_index = -1; int u_index = -1; Loading @@ -540,7 +546,6 @@ void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *u /* update audio_cal and send it */ /* update audio_cal and send it */ if (ma_cal != NULL){ if (ma_cal != NULL){ ma_cal->platform = adev->platform; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->app_type = usecase->stream.out->app_type_cfg.app_type; ma_cal->device = usecase->stream.out->devices; ma_cal->device = usecase->stream.out->devices; ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", ALOGV("%s: send usecase(%d) app_type(%d) device(%d)", Loading Loading @@ -571,7 +576,8 @@ void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *u } } } } void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms) void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms) { { int ret; int ret; bool ret_b; bool ret_b; Loading @@ -594,7 +600,8 @@ void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *p } } // check connect status // check connect status ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value)); if (ret >= 0) { if (ret >= 0) { audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); if (audio_is_usb_out_device(device)) { if (audio_is_usb_out_device(device)) { Loading @@ -607,7 +614,8 @@ void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *p } } // check disconnect status // check disconnect status ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value)); if (ret >= 0) { if (ret >= 0) { audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); audio_devices_t device = (audio_devices_t)strtoul(value, NULL, 10); if (audio_is_usb_out_device(device)) { if (audio_is_usb_out_device(device)) { Loading
hal/audio_extn/maxxaudio.h +11 −9 Original line number Original line Diff line number Diff line Loading @@ -21,15 +21,17 @@ #define audio_extn_ma_init(platform) (0) #define audio_extn_ma_init(platform) (0) #define audio_extn_ma_deinit() (0) #define audio_extn_ma_deinit() (0) #define audio_extn_ma_set_state(adev, type, vol, active) (false) #define audio_extn_ma_set_state(adev, type, vol, active) (false) #define audio_extn_ma_set_device(adev, usecase) (0) #define audio_extn_ma_set_device(usecase) (0) #define audio_extn_ma_set_parameters(adev, param) (0) #define audio_extn_ma_set_parameters(adev, param) (0) #define audio_extn_ma_supported_usb() (false) #define audio_extn_ma_supported_usb() (false) #else #else void audio_extn_ma_init(void *platform); void audio_extn_ma_init(void *platform); void audio_extn_ma_deinit(); void audio_extn_ma_deinit(); bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, float vol, bool active); bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *usecase); float vol, bool active); void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms); void audio_extn_ma_set_device(struct audio_usecase *usecase); void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms); bool audio_extn_ma_supported_usb(); bool audio_extn_ma_supported_usb(); #endif /* MAXXAUDIO_QDSP_ENABLED */ #endif /* MAXXAUDIO_QDSP_ENABLED */ Loading
hal/audio_hw.c +4 −2 Original line number Original line Diff line number Diff line Loading @@ -1464,7 +1464,7 @@ int select_devices(struct audio_device *adev, enable_audio_route(adev, usecase); enable_audio_route(adev, usecase); audio_extn_ma_set_device(adev, usecase); audio_extn_ma_set_device(usecase); /* Applicable only on the targets that has external modem. /* Applicable only on the targets that has external modem. * Enable device command should be sent to modem only after * Enable device command should be sent to modem only after Loading Loading @@ -2602,7 +2602,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) out->devices = new_dev; out->devices = new_dev; if (output_drives_call(adev, out)) { if (output_drives_call(adev, out)) { if (!voice_is_in_call(adev)) { if (!voice_is_call_state_active(adev)) { if (adev->mode == AUDIO_MODE_IN_CALL) { if (adev->mode == AUDIO_MODE_IN_CALL) { adev->current_call_output = out; adev->current_call_output = out; ret = voice_start_call(adev); ret = voice_start_call(adev); Loading Loading @@ -5676,6 +5676,8 @@ static int adev_open(const hw_module_t *module, const char *name, } } } } adev->mic_break_enabled = property_get_bool("vendor.audio.mic_break", false); // commented as full set of app type cfg is sent from platform // commented as full set of app type cfg is sent from platform // audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer); // audio_extn_utils_send_default_app_type_cfg(adev->platform, adev->mixer); audio_device_ref_count++; audio_device_ref_count++; Loading
hal/audio_hw.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -328,6 +328,7 @@ struct audio_device { bool mic_muted; bool mic_muted; bool enable_voicerx; bool enable_voicerx; bool enable_hfp; bool enable_hfp; bool mic_break_enabled; int snd_card; int snd_card; void *platform; void *platform; Loading