dsp: Fix payload mismatch issue in AFE clock setting

IID support is set from user space during boot up
which can come in parallel with AFE set clock requests
due to which param payload is set in difference with
the actual set param command as per instance id support.

Change-Id: I07e45fda0943cac814f25c16da930dfae5d209a6
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:
Aditya Bavanari
2019-02-28 11:06:41 +05:30
committed by Meng Wang
parent efdb8d9f66
commit 23513e0973
3 changed files with 89 additions and 11 deletions

View File

@@ -1461,7 +1461,8 @@ done:
}
static int q6afe_svc_set_params(int index, struct mem_mapping_hdr *mem_hdr,
u8 *packed_param_data, u32 packed_data_size)
u8 *packed_param_data, u32 packed_data_size,
bool is_iid_supported)
{
int ret;
@@ -1471,7 +1472,7 @@ static int q6afe_svc_set_params(int index, struct mem_mapping_hdr *mem_hdr,
return ret;
}
if (q6common_is_instance_id_supported())
if (is_iid_supported)
return q6afe_svc_set_params_v2(index, mem_hdr,
packed_param_data,
packed_data_size);
@@ -1489,13 +1490,15 @@ static int q6afe_svc_pack_and_set_param_in_band(int index,
u32 packed_data_size =
sizeof(struct param_hdr_v3) + param_hdr.param_size;
int ret = 0;
bool is_iid_supported = q6common_is_instance_id_supported();
packed_param_data = kzalloc(packed_data_size, GFP_KERNEL);
if (!packed_param_data)
return -ENOMEM;
ret = q6common_pack_pp_params(packed_param_data, &param_hdr, param_data,
&packed_data_size);
ret = q6common_pack_pp_params_v2(packed_param_data, &param_hdr,
param_data, &packed_data_size,
is_iid_supported);
if (ret) {
pr_err("%s: Failed to pack parameter header and data, error %d\n",
__func__, ret);
@@ -1503,7 +1506,7 @@ static int q6afe_svc_pack_and_set_param_in_band(int index,
}
ret = q6afe_svc_set_params(index, NULL, packed_param_data,
packed_data_size);
packed_data_size, is_iid_supported);
done:
kfree(packed_param_data);
@@ -2590,6 +2593,7 @@ static int afe_send_codec_reg_config(
struct param_hdr_v3 param_hdr;
int idx = 0;
int ret = -EINVAL;
bool is_iid_supported = q6common_is_instance_id_supported();
memset(&param_hdr, 0, sizeof(param_hdr));
max_single_param = sizeof(struct param_hdr_v3) +
@@ -2612,10 +2616,10 @@ static int afe_send_codec_reg_config(
while (packed_data_size + max_single_param < max_data_size &&
idx < cdc_reg_cfg->num_registers) {
ret = q6common_pack_pp_params(
ret = q6common_pack_pp_params_v2(
packed_param_data + packed_data_size,
&param_hdr, (u8 *) &cdc_reg_cfg->reg_data[idx],
&single_param_size);
&single_param_size, is_iid_supported);
if (ret) {
pr_err("%s: Failed to pack parameters with error %d\n",
__func__, ret);
@@ -2626,7 +2630,8 @@ static int afe_send_codec_reg_config(
}
ret = q6afe_svc_set_params(IDX_GLOBAL_CFG, NULL,
packed_param_data, packed_data_size);
packed_param_data, packed_data_size,
is_iid_supported);
if (ret) {
pr_err("%s: AFE_PARAM_ID_CDC_REG_CFG failed %d\n",
__func__, ret);