|
@@ -110,6 +110,10 @@ static int32_t qdsp_cvp_callback(struct apr_client_data *data, void *priv);
|
|
|
static int voice_send_set_pp_enable_cmd(
|
|
|
struct voice_data *v, struct module_instance_info mod_inst_info,
|
|
|
int enable);
|
|
|
+
|
|
|
+static int voice_send_cvp_ecns_enable_cmd(struct voice_data *v,
|
|
|
+ uint32_t module_id, int enable);
|
|
|
+
|
|
|
static int is_cal_memory_allocated(void);
|
|
|
static bool is_cvd_version_queried(void);
|
|
|
static int is_voip_memory_allocated(void);
|
|
@@ -1544,6 +1548,124 @@ fail:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static int voice_send_cvp_ecns_enable_cmd(struct voice_data *v,
|
|
|
+ uint32_t module_id, int enable)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ struct cvp_set_channel_ecns_cmd_v2 cvp_set_ch_ecns_cmd;
|
|
|
+ void *apr_cvp;
|
|
|
+ u16 cvp_handle;
|
|
|
+ struct vss_icommon_param_data_ecns_t *cvp_config_param_data =
|
|
|
+ &cvp_set_ch_ecns_cmd.
|
|
|
+ cvp_set_ecns.param_data;
|
|
|
+
|
|
|
+ if (v == NULL) {
|
|
|
+ pr_err("%s: v is NULL\n", __func__);
|
|
|
+ ret = -EINVAL;
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
+
|
|
|
+ apr_cvp = common.apr_q6_cvp;
|
|
|
+
|
|
|
+ if (!apr_cvp) {
|
|
|
+ pr_err("%s: apr_cvp is NULL\n", __func__);
|
|
|
+ ret = -EINVAL;
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
+
|
|
|
+ cvp_handle = voice_get_cvp_handle(v);
|
|
|
+ memset(&cvp_set_ch_ecns_cmd, 0,
|
|
|
+ sizeof(cvp_set_ch_ecns_cmd));
|
|
|
+
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.hdr_field =
|
|
|
+ APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
|
|
+ APR_HDR_LEN(APR_HDR_SIZE),
|
|
|
+ APR_PKT_VER);
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.pkt_size =
|
|
|
+ APR_PKT_SIZE(APR_HDR_SIZE,
|
|
|
+ sizeof(cvp_set_ch_ecns_cmd) - APR_HDR_SIZE);
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.src_svc = 0;
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.src_domain = APR_DOMAIN_APPS;
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.src_port =
|
|
|
+ voice_get_idx_for_session(v->session_id);
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.dest_svc = 0;
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.dest_domain = APR_DOMAIN_ADSP;
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.dest_port = cvp_handle;
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.token = 0;
|
|
|
+ cvp_set_ch_ecns_cmd.hdr.opcode = VSS_ICOMMON_CMD_SET_PARAM_V2;
|
|
|
+ cvp_set_ch_ecns_cmd.cvp_set_ecns.mem_size =
|
|
|
+ sizeof(struct vss_icommon_param_data_ecns_t);
|
|
|
+
|
|
|
+ cvp_config_param_data->module_id = module_id;
|
|
|
+ cvp_config_param_data->param_id = VOICE_PARAM_MOD_ENABLE;
|
|
|
+ cvp_config_param_data->param_size = MOD_ENABLE_PARAM_LEN;
|
|
|
+ cvp_config_param_data->reserved = 0;
|
|
|
+ cvp_config_param_data->enable = enable;
|
|
|
+
|
|
|
+ v->cvp_state = CMD_STATUS_FAIL;
|
|
|
+ v->async_err = 0;
|
|
|
+ ret = apr_send_pkt(apr_cvp, (uint32_t *)&cvp_set_ch_ecns_cmd);
|
|
|
+
|
|
|
+ if (ret < 0) {
|
|
|
+ pr_err("%s: Failed to send VSS_ICOMMON_CMD_SET_PARAM_V2 %d\n",
|
|
|
+ __func__, ret);
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
+ ret = wait_event_timeout(v->cvp_wait,
|
|
|
+ (v->cvp_state == CMD_STATUS_SUCCESS),
|
|
|
+ msecs_to_jiffies(TIMEOUT_MS));
|
|
|
+
|
|
|
+ if (!ret) {
|
|
|
+ pr_err("%s: wait_event timeout\n", __func__);
|
|
|
+ ret = -ETIMEDOUT;
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (v->async_err > 0) {
|
|
|
+ pr_err("%s: DSP returned error[%s] handle = %d\n", __func__,
|
|
|
+ adsp_err_get_err_str(v->async_err), cvp_handle);
|
|
|
+ ret = adsp_err_get_lnx_err_code(v->async_err);
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
+ ret = 0;
|
|
|
+done:
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * voc_set_ecns_enable -
|
|
|
+ * Command to set ECNS for voice module
|
|
|
+ *
|
|
|
+ * @session_id: voice session ID to send this command
|
|
|
+ * @module_id: voice module id
|
|
|
+ * @enable: enable/disable flag
|
|
|
+ *
|
|
|
+ * Returns 0 on success or error on failure
|
|
|
+ */
|
|
|
+int voc_set_ecns_enable(uint32_t session_id, uint32_t module_id,
|
|
|
+ uint32_t enable)
|
|
|
+{
|
|
|
+ struct voice_data *v = voice_get_session(session_id);
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ if (v == NULL) {
|
|
|
+ pr_err("%s: invalid session_id 0x%x\n", __func__, session_id);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+ mutex_lock(&v->lock);
|
|
|
+ v->ecns_enable = enable;
|
|
|
+ v->ecns_module_id = module_id;
|
|
|
+
|
|
|
+ if (is_voc_state_active(v->voc_state))
|
|
|
+ ret = voice_send_cvp_ecns_enable_cmd(v,
|
|
|
+ v->ecns_module_id, v->ecns_enable);
|
|
|
+
|
|
|
+ mutex_unlock(&v->lock);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(voc_set_ecns_enable);
|
|
|
+
|
|
|
static int voice_send_set_pp_enable_cmd(
|
|
|
struct voice_data *v, struct module_instance_info mod_inst_info,
|
|
|
int enable)
|
|
@@ -4420,6 +4542,10 @@ static int voice_setup_vocproc(struct voice_data *v)
|
|
|
if (v->dtmf_rx_detect_en)
|
|
|
voice_send_dtmf_rx_detection_cmd(v, v->dtmf_rx_detect_en);
|
|
|
|
|
|
+ if (v->ecns_enable)
|
|
|
+ voice_send_cvp_ecns_enable_cmd(v, v->ecns_module_id,
|
|
|
+ v->ecns_enable);
|
|
|
+
|
|
|
if (v->hd_enable)
|
|
|
voice_send_hd_cmd(v, v->hd_enable);
|
|
|
|
|
@@ -5076,6 +5202,9 @@ static int voice_destroy_vocproc(struct voice_data *v)
|
|
|
if (v->dtmf_rx_detect_en)
|
|
|
voice_send_dtmf_rx_detection_cmd(v, 0);
|
|
|
|
|
|
+ if (v->ecns_enable)
|
|
|
+ voice_send_cvp_ecns_enable_cmd(v, v->ecns_module_id, 0);
|
|
|
+
|
|
|
/* detach VOCPROC and wait for response from mvm */
|
|
|
mvm_d_vocproc_cmd.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
|
|
APR_HDR_LEN(APR_HDR_SIZE),
|