|
@@ -2179,66 +2179,6 @@ fail_cmd:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * afe_send_cps_config -
|
|
|
- * to send cps speaker protection configuration
|
|
|
- *
|
|
|
- * @src_port: source port to send configuration to
|
|
|
- * @cps_config: cps speaker protection v4 configuration
|
|
|
- * @param_size: size of payload
|
|
|
- *
|
|
|
- * Returns 0 on success or error value on failure.
|
|
|
- */
|
|
|
-int afe_send_cps_config(int src_port,
|
|
|
- struct afe_cps_hw_intf_cfg *cps_config,
|
|
|
- int param_size)
|
|
|
-{
|
|
|
- struct param_hdr_v3 param_info;
|
|
|
- int ret = -EINVAL;
|
|
|
- u8 *packed_payload = NULL;
|
|
|
- int cpy_size = 0;
|
|
|
-
|
|
|
- ret = q6audio_validate_port(src_port);
|
|
|
- if (ret < 0) {
|
|
|
- pr_err("%s: Invalid src port 0x%x ret %d", __func__,
|
|
|
- src_port, ret);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- packed_payload = kzalloc(param_size, GFP_KERNEL);
|
|
|
- if (packed_payload == NULL)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- cpy_size = sizeof(struct afe_cps_hw_intf_cfg) -
|
|
|
- sizeof(cps_config->spkr_dep_cfg);
|
|
|
- memcpy(packed_payload, cps_config, cpy_size);
|
|
|
- memcpy(packed_payload + cpy_size, cps_config->spkr_dep_cfg,
|
|
|
- sizeof(struct lpass_swr_spkr_dep_cfg_t)
|
|
|
- * cps_config->hw_reg_cfg.num_spkr);
|
|
|
-
|
|
|
- memset(¶m_info, 0, sizeof(param_info));
|
|
|
-
|
|
|
- mutex_lock(&this_afe.afe_cmd_lock);
|
|
|
- param_info.module_id = AFE_MODULE_SPEAKER_PROTECTION_V4_RX;
|
|
|
- param_info.instance_id = INSTANCE_ID_0;
|
|
|
- param_info.param_id = AFE_PARAM_ID_CPS_LPASS_HW_INTF_CFG;
|
|
|
- param_info.param_size = param_size;
|
|
|
-
|
|
|
- ret = q6afe_pack_and_set_param_in_band(src_port,
|
|
|
- q6audio_get_port_index(src_port),
|
|
|
- param_info, packed_payload);
|
|
|
- if (ret)
|
|
|
- pr_err("%s: port = 0x%x param = 0x%x failed %d\n", __func__,
|
|
|
- src_port, param_info.param_id, ret);
|
|
|
-
|
|
|
- mutex_unlock(&this_afe.afe_cmd_lock);
|
|
|
- pr_debug("%s: config.pdata.param_id 0x%x status %d 0x%x\n", __func__,
|
|
|
- param_info.param_id, ret, src_port);
|
|
|
- kfree(packed_payload);
|
|
|
- return ret;
|
|
|
-}
|
|
|
-EXPORT_SYMBOL(afe_send_cps_config);
|
|
|
-
|
|
|
static int afe_spk_prot_prepare(int src_port, int dst_port, int param_id,
|
|
|
union afe_spkr_prot_config *prot_config, uint32_t param_size)
|
|
|
{
|