From 3ce3b59bab4524094c3f81cbcdab121aae871181 Mon Sep 17 00:00:00 2001 From: Sultan Qasim Khan Date: Sat, 23 Jan 2016 03:05:55 -0500 Subject: [PATCH] Revert "ASoC: msm: Add LSM topology & custom topology" This reverts commit 0302e15a5f8a2106b7c09295eb49f209b5a7ffd0. Fixes low call audio issues. --- include/uapi/linux/msm_audio_calibration.h | 20 ---- sound/soc/msm/qdsp6v2/audio_cal_utils.c | 12 -- sound/soc/msm/qdsp6v2/q6lsm.c | 124 ++++----------------- 3 files changed, 20 insertions(+), 136 deletions(-) diff --git a/include/uapi/linux/msm_audio_calibration.h b/include/uapi/linux/msm_audio_calibration.h index de24f255dfa5..dfa66636945c 100644 --- a/include/uapi/linux/msm_audio_calibration.h +++ b/include/uapi/linux/msm_audio_calibration.h @@ -72,8 +72,6 @@ enum { AFE_HW_DELAY_CAL_TYPE, AFE_SIDETONE_CAL_TYPE, - LSM_CUST_TOPOLOGY_CAL_TYPE, - LSM_TOPOLOGY_CAL_TYPE, LSM_CAL_TYPE, ADM_RTAC_INFO_CAL_TYPE, @@ -287,13 +285,6 @@ struct audio_cal_info_sidetone { int32_t pid; }; -struct audio_cal_info_lsm_top { - int32_t topology; - int32_t acdb_id; - int32_t app_type; -}; - - struct audio_cal_info_lsm { int32_t acdb_id; /* RX_DEVICE or TX_DEVICE */ @@ -489,17 +480,6 @@ struct audio_cal_sidetone { struct audio_cal_type_sidetone cal_type; }; -struct audio_cal_type_lsm_top { - struct audio_cal_type_header cal_hdr; - struct audio_cal_data cal_data; - struct audio_cal_info_lsm_top cal_info; -}; - -struct audio_cal_lsm_top { - struct audio_cal_header hdr; - struct audio_cal_type_lsm_top cal_type; -}; - struct audio_cal_type_lsm { struct audio_cal_type_header cal_hdr; struct audio_cal_data cal_data; diff --git a/sound/soc/msm/qdsp6v2/audio_cal_utils.c b/sound/soc/msm/qdsp6v2/audio_cal_utils.c index d28402d9bba4..fb59cff593c0 100644 --- a/sound/soc/msm/qdsp6v2/audio_cal_utils.c +++ b/sound/soc/msm/qdsp6v2/audio_cal_utils.c @@ -94,12 +94,6 @@ size_t get_cal_info_size(int32_t cal_type) case AFE_SIDETONE_CAL_TYPE: size = sizeof(struct audio_cal_info_sidetone); break; - case LSM_CUST_TOPOLOGY_CAL_TYPE: - size = 0; - break; - case LSM_TOPOLOGY_CAL_TYPE: - size = sizeof(struct audio_cal_info_lsm_top); - break; case LSM_CAL_TYPE: size = sizeof(struct audio_cal_info_lsm); break; @@ -212,12 +206,6 @@ size_t get_user_cal_type_size(int32_t cal_type) case AFE_SIDETONE_CAL_TYPE: size = sizeof(struct audio_cal_type_sidetone); break; - case LSM_CUST_TOPOLOGY_CAL_TYPE: - size = sizeof(struct audio_cal_type_basic); - break; - case LSM_TOPOLOGY_CAL_TYPE: - size = sizeof(struct audio_cal_type_lsm_top); - break; case LSM_CAL_TYPE: size = sizeof(struct audio_cal_type_lsm); break; diff --git a/sound/soc/msm/qdsp6v2/q6lsm.c b/sound/soc/msm/qdsp6v2/q6lsm.c index 827e431d6ec8..f75ddaf11b39 100644 --- a/sound/soc/msm/qdsp6v2/q6lsm.c +++ b/sound/soc/msm/qdsp6v2/q6lsm.c @@ -39,13 +39,6 @@ #define QLSM_PARAM_ID_MINOR_VERSION 1 static int lsm_afe_port; -enum { - LSM_CUSTOM_TOP_IDX, - LSM_TOP_IDX, - LSM_CAL_IDX, - LSM_MAX_CAL_IDX -}; - enum { CMD_STATE_CLEARED = 0, CMD_STATE_WAIT_RESP = 1, @@ -63,10 +56,7 @@ struct lsm_common { void *apr; atomic_t apr_users; struct lsm_client common_client[LSM_MAX_SESSION_ID + 1]; - - int set_custom_topology; - struct cal_type_data *cal_data[LSM_MAX_CAL_IDX]; - + struct cal_type_data *cal_data; struct mutex apr_lock; }; @@ -102,12 +92,6 @@ static int q6lsm_callback(struct apr_client_data *data, void *priv) pr_debug("%s: SSR event received 0x%x, event 0x%x, proc 0x%x\n", __func__, data->opcode, data->reset_event, data->reset_proc); - - cal_utils_clear_cal_block_q6maps(LSM_MAX_CAL_IDX, - lsm_common.cal_data); - mutex_lock(&lsm_common.cal_data[LSM_CUSTOM_TOP_IDX]->lock); - lsm_common.set_custom_topology = 1; - mutex_unlock(&lsm_common.cal_data[LSM_CUSTOM_TOP_IDX]->lock); return 0; } @@ -805,12 +789,11 @@ static int q6lsm_send_cal(struct lsm_client *client) return -EINVAL; } - if (lsm_common.cal_data[LSM_CAL_IDX] == NULL) + if (lsm_common.cal_data == NULL) goto done; - mutex_lock(&lsm_common.cal_data[LSM_CAL_IDX]->lock); - cal_block = cal_utils_get_only_cal_block( - lsm_common.cal_data[LSM_CAL_IDX]); + mutex_lock(&lsm_common.cal_data->lock); + cal_block = cal_utils_get_only_cal_block(lsm_common.cal_data); if (cal_block == NULL) goto unlock; @@ -843,7 +826,7 @@ static int q6lsm_send_cal(struct lsm_client *client) pr_err("%s: Failed set_params opcode 0x%x, rc %d\n", __func__, msg_hdr->opcode, rc); unlock: - mutex_unlock(&lsm_common.cal_data[LSM_CAL_IDX]->lock); + mutex_unlock(&lsm_common.cal_data->lock); done: return rc; } @@ -914,8 +897,7 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv) "proc 0x%x SID 0x%x\n", __func__, data->opcode, data->reset_event, data->reset_proc, sid); lsm_common.common_client[sid].lsm_cal_phy_addr = 0; - cal_utils_clear_cal_block_q6maps(LSM_MAX_CAL_IDX, - lsm_common.cal_data); + cal_utils_clear_cal_block_q6maps(1, &lsm_common.cal_data); return 0; } @@ -989,15 +971,13 @@ int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len) mutex_lock(&client->cmd_lock); - mutex_lock(&lsm_common.cal_data[LSM_CAL_IDX]->lock); - cal_block = cal_utils_get_only_cal_block( - lsm_common.cal_data[LSM_CAL_IDX]); + mutex_lock(&lsm_common.cal_data->lock); + cal_block = cal_utils_get_only_cal_block(lsm_common.cal_data); if (cal_block == NULL) goto fail; pr_debug("%s:Snd Model len = %zd cal size %zd phys addr %pa", __func__, - len, cal_block->cal_data.size, - &cal_block->cal_data.paddr); + len, cal_block->cal_data.size, &cal_block->cal_data.paddr); if (!cal_block->cal_data.paddr) { pr_err("%s: No LSM calibration set for session", __func__); rc = -EINVAL; @@ -1051,7 +1031,7 @@ int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len) rc = -EBUSY; goto fail; } - mutex_unlock(&lsm_common.cal_data[LSM_CAL_IDX]->lock); + mutex_unlock(&lsm_common.cal_data->lock); mutex_unlock(&client->cmd_lock); rc = q6lsm_memory_map_regions(client, client->sound_model.phys, @@ -1064,7 +1044,7 @@ int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len) return 0; fail: - mutex_unlock(&lsm_common.cal_data[LSM_CAL_IDX]->lock); + mutex_unlock(&lsm_common.cal_data->lock); mutex_unlock(&client->cmd_lock); exit: q6lsm_snd_model_buf_free(client); @@ -1293,43 +1273,14 @@ int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc) return ret; } -static int get_cal_type_index(int32_t cal_type) -{ - int ret = -EINVAL; - - switch (cal_type) { - case LSM_CUST_TOPOLOGY_CAL_TYPE: - ret = LSM_CUSTOM_TOP_IDX; - break; - case LSM_TOPOLOGY_CAL_TYPE: - ret = LSM_TOP_IDX; - break; - case LSM_CAL_TYPE: - ret = LSM_CAL_IDX; - break; - default: - pr_err("%s: invalid cal type %d!\n", __func__, cal_type); - } - return ret; -} - static int q6lsm_alloc_cal(int32_t cal_type, size_t data_size, void *data) { int ret = 0; - int cal_index; pr_debug("%s:\n", __func__); - cal_index = get_cal_type_index(cal_type); - if (cal_index < 0) { - pr_err("%s: could not get cal index %d!\n", - __func__, cal_index); - ret = -EINVAL; - goto done; - } - ret = cal_utils_alloc_cal(data_size, data, - lsm_common.cal_data[cal_index], 0, NULL); + lsm_common.cal_data, 0, NULL); if (ret < 0) { pr_err("%s: cal_utils_alloc_block failed, ret = %d, cal type = %d!\n", __func__, ret, cal_type); @@ -1344,19 +1295,10 @@ static int q6lsm_dealloc_cal(int32_t cal_type, size_t data_size, void *data) { int ret = 0; - int cal_index; pr_debug("%s:\n", __func__); - cal_index = get_cal_type_index(cal_type); - if (cal_index < 0) { - pr_err("%s: could not get cal index %d!\n", - __func__, cal_index); - ret = -EINVAL; - goto done; - } - ret = cal_utils_dealloc_cal(data_size, data, - lsm_common.cal_data[cal_index]); + lsm_common.cal_data); if (ret < 0) { pr_err("%s: cal_utils_dealloc_block failed, ret = %d, cal type = %d!\n", __func__, ret, cal_type); @@ -1371,32 +1313,16 @@ static int q6lsm_set_cal(int32_t cal_type, size_t data_size, void *data) { int ret = 0; - int cal_index; pr_debug("%s:\n", __func__); - cal_index = get_cal_type_index(cal_type); - if (cal_index < 0) { - pr_err("%s: could not get cal index %d!\n", - __func__, cal_index); - ret = -EINVAL; - goto done; - } - ret = cal_utils_set_cal(data_size, data, - lsm_common.cal_data[cal_index], 0, NULL); + lsm_common.cal_data, 0, NULL); if (ret < 0) { pr_err("%s: cal_utils_set_cal failed, ret = %d, cal type = %d!\n", __func__, ret, cal_type); ret = -EINVAL; goto done; } - - if (cal_index == LSM_CUSTOM_TOP_IDX) { - mutex_lock(&lsm_common.cal_data[LSM_CUSTOM_TOP_IDX]->lock); - lsm_common.set_custom_topology = 1; - mutex_unlock(&lsm_common.cal_data[LSM_CUSTOM_TOP_IDX]->lock); - } - done: return ret; } @@ -1405,33 +1331,23 @@ static void lsm_delete_cal_data(void) { pr_debug("%s:\n", __func__); - cal_utils_destroy_cal_types(LSM_MAX_CAL_IDX, lsm_common.cal_data); + cal_utils_destroy_cal_types(1, &lsm_common.cal_data); return; } static int q6lsm_init_cal_data(void) { int ret = 0; - struct cal_type_info cal_type_info[] = { - {{LSM_CUST_TOPOLOGY_CAL_TYPE, - {q6lsm_alloc_cal, q6lsm_dealloc_cal, NULL, - q6lsm_set_cal, NULL, NULL} }, - {NULL, NULL, cal_utils_match_buf_num} }, - - {{LSM_TOPOLOGY_CAL_TYPE, - {NULL, NULL, NULL, - q6lsm_set_cal, NULL, NULL} }, - {NULL, NULL, cal_utils_match_buf_num} }, - - {{LSM_CAL_TYPE, + struct cal_type_info cal_type_info = { + {LSM_CAL_TYPE, {q6lsm_alloc_cal, q6lsm_dealloc_cal, NULL, q6lsm_set_cal, NULL, NULL} }, - {NULL, NULL, cal_utils_match_buf_num} } + {NULL, NULL, cal_utils_match_buf_num} }; pr_debug("%s:\n", __func__); - ret = cal_utils_create_cal_types(LSM_MAX_CAL_IDX, - lsm_common.cal_data, cal_type_info); + ret = cal_utils_create_cal_types(1, &lsm_common.cal_data, + &cal_type_info); if (ret < 0) { pr_err("%s: could not create cal type!\n", __func__);