dsp: adm: Update get params packet size
Update apr header packet size in get pp params. Add header field for the apr packet. Update the check condition to differentiate between in-band and out-band case in adm callback. CRs-Fixed: 2262638 Change-Id: I57ef88e0638c09b203503f4c1cff2f810ef51c6e Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
e58c940b93
commit
aadecdf6c3
28
dsp/q6adm.c
28
dsp/q6adm.c
@@ -1065,7 +1065,10 @@ int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
|
|||||||
NULL, &total_size);
|
NULL, &total_size);
|
||||||
|
|
||||||
/* Pack APR header after filling body so total_size has correct value */
|
/* Pack APR header after filling body so total_size has correct value */
|
||||||
adm_get_params.apr_hdr.pkt_size = total_size;
|
adm_get_params.apr_hdr.hdr_field =
|
||||||
|
APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE),
|
||||||
|
APR_PKT_VER);
|
||||||
|
adm_get_params.apr_hdr.pkt_size = sizeof(adm_get_params);
|
||||||
adm_get_params.apr_hdr.src_svc = APR_SVC_ADM;
|
adm_get_params.apr_hdr.src_svc = APR_SVC_ADM;
|
||||||
adm_get_params.apr_hdr.src_domain = APR_DOMAIN_APPS;
|
adm_get_params.apr_hdr.src_domain = APR_DOMAIN_APPS;
|
||||||
adm_get_params.apr_hdr.src_port = port_id;
|
adm_get_params.apr_hdr.src_port = port_id;
|
||||||
@@ -1083,6 +1086,7 @@ int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
|
|||||||
|
|
||||||
copp_stat = &this_adm.copp.stat[port_idx][copp_idx];
|
copp_stat = &this_adm.copp.stat[port_idx][copp_idx];
|
||||||
atomic_set(copp_stat, -1);
|
atomic_set(copp_stat, -1);
|
||||||
|
|
||||||
ret = apr_send_pkt(this_adm.apr, (uint32_t *) &adm_get_params);
|
ret = apr_send_pkt(this_adm.apr, (uint32_t *) &adm_get_params);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("%s: Get params APR send failed port = 0x%x ret %d\n",
|
pr_err("%s: Get params APR send failed port = 0x%x ret %d\n",
|
||||||
@@ -1377,6 +1381,8 @@ static int adm_process_get_param_response(u32 opcode, u32 idx, u32 *payload,
|
|||||||
if ((payload_size >= struct_size + data_size) &&
|
if ((payload_size >= struct_size + data_size) &&
|
||||||
(ARRAY_SIZE(adm_get_parameters) > idx) &&
|
(ARRAY_SIZE(adm_get_parameters) > idx) &&
|
||||||
(ARRAY_SIZE(adm_get_parameters) >= idx + 1 + data_size)) {
|
(ARRAY_SIZE(adm_get_parameters) >= idx + 1 + data_size)) {
|
||||||
|
pr_debug("%s: Received parameter data in band\n",
|
||||||
|
__func__);
|
||||||
/*
|
/*
|
||||||
* data_size is expressed in number of bytes, store in number of
|
* data_size is expressed in number of bytes, store in number of
|
||||||
* ints
|
* ints
|
||||||
@@ -1387,12 +1393,16 @@ static int adm_process_get_param_response(u32 opcode, u32 idx, u32 *payload,
|
|||||||
__func__, adm_get_parameters[idx]);
|
__func__, adm_get_parameters[idx]);
|
||||||
/* store params after param_size */
|
/* store params after param_size */
|
||||||
memcpy(&adm_get_parameters[idx + 1], param_data, data_size);
|
memcpy(&adm_get_parameters[idx + 1], param_data, data_size);
|
||||||
return 0;
|
} else if (payload_size == sizeof(uint32_t)) {
|
||||||
|
adm_get_parameters[idx] = -1;
|
||||||
|
pr_debug("%s: Out of band case, setting size to %d\n",
|
||||||
|
__func__, adm_get_parameters[idx]);
|
||||||
|
} else {
|
||||||
|
pr_err("%s: Invalid parameter combination, payload_size %d, idx %d\n",
|
||||||
|
__func__, payload_size, idx);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
pr_err("%s: Invalid parameter combination, payload_size %d, idx %d\n",
|
|
||||||
__func__, payload_size, idx);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int adm_process_get_topo_list_response(u32 opcode, int copp_idx,
|
static int adm_process_get_topo_list_response(u32 opcode, int copp_idx,
|
||||||
@@ -1704,18 +1714,12 @@ static int32_t adm_callback(struct apr_client_data *data, void *priv)
|
|||||||
|
|
||||||
idx = ADM_GET_PARAMETER_LENGTH * copp_idx;
|
idx = ADM_GET_PARAMETER_LENGTH * copp_idx;
|
||||||
if (payload[0] == 0 && data->payload_size > 0) {
|
if (payload[0] == 0 && data->payload_size > 0) {
|
||||||
pr_debug("%s: Received parameter data in band\n",
|
|
||||||
__func__);
|
|
||||||
ret = adm_process_get_param_response(
|
ret = adm_process_get_param_response(
|
||||||
data->opcode, idx, payload,
|
data->opcode, idx, payload,
|
||||||
data->payload_size);
|
data->payload_size);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s: Failed to process get param response, error %d\n",
|
pr_err("%s: Failed to process get param response, error %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
} else if (payload[0] == 0 && data->payload_size == 0) {
|
|
||||||
adm_get_parameters[idx] = -1;
|
|
||||||
pr_debug("%s: Out of band case, setting size to %d\n",
|
|
||||||
__func__, adm_get_parameters[idx]);
|
|
||||||
} else {
|
} else {
|
||||||
adm_get_parameters[idx] = -1;
|
adm_get_parameters[idx] = -1;
|
||||||
pr_err("%s: ADM_CMDRSP_GET_PP_PARAMS returned error 0x%x\n",
|
pr_err("%s: ADM_CMDRSP_GET_PP_PARAMS returned error 0x%x\n",
|
||||||
|
Reference in New Issue
Block a user