Skip to content

Commit

Permalink
Revert "ASoC: msm: Add LSM topology & custom topology"
Browse files Browse the repository at this point in the history
This reverts commit 0302e15.
Fixes low call audio issues.
  • Loading branch information
sultanqasim committed Jan 23, 2016
1 parent b645348 commit 3ce3b59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 136 deletions.
20 changes: 0 additions & 20 deletions include/uapi/linux/msm_audio_calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions sound/soc/msm/qdsp6v2/audio_cal_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
124 changes: 20 additions & 104 deletions sound/soc/msm/qdsp6v2/q6lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
};

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
}
Expand All @@ -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__);
Expand Down

0 comments on commit 3ce3b59

Please sign in to comment.