Loading drivers/soc/qcom/qdsp6v2/audio-anc-dev-mgr.c +38 −31 Original line number Diff line number Diff line Loading @@ -53,8 +53,6 @@ struct anc_tdm_group_set_info { struct anc_dev_drv_info { uint32_t state; uint32_t rpm; uint32_t bypass_mode; uint32_t algo_module_id; }; Loading Loading @@ -311,52 +309,68 @@ static int anc_dev_port_stop(int32_t which_port) int msm_anc_dev_set_info(void *info_p, int32_t anc_cmd) { int rc = 0; int rc = -EINVAL; switch (anc_cmd) { case ANC_CMD_RPM: { struct audio_anc_rpm_info *rpm_info_p = (struct audio_anc_rpm_info *)info_p; case ANC_CMD_ALGO_MODULE: { struct audio_anc_algo_module_info *module_info_p = (struct audio_anc_algo_module_info *)info_p; rc = 0; if (this_anc_dev_info.state) rc = anc_if_set_rpm( rc = anc_if_set_algo_module_id( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, rpm_info_p->rpm); module_info_p->module_id); else this_anc_dev_info.rpm = 0; this_anc_dev_info.algo_module_id = module_info_p->module_id; break; } case ANC_CMD_BYPASS_MODE: { struct audio_anc_bypass_mode *bypass_mode_p = (struct audio_anc_bypass_mode *)info_p; case ANC_CMD_ALGO_CALIBRATION: { rc = -EINVAL; if (this_anc_dev_info.state) rc = anc_if_set_bypass_mode( rc = anc_if_set_algo_module_cali_data( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, bypass_mode_p->mode); info_p); else this_anc_dev_info.bypass_mode = bypass_mode_p->mode; pr_err("%s: ANC is not running yet\n", __func__); break; } default: pr_err("%s: ANC cmd wrong\n", __func__); break; } case ANC_CMD_ALGO_MODULE: { struct audio_anc_algo_module_info *module_info_p = (struct audio_anc_algo_module_info *)info_p; return rc; } int msm_anc_dev_get_info(void *info_p, int32_t anc_cmd) { int rc = -EINVAL; switch (anc_cmd) { case ANC_CMD_ALGO_CALIBRATION: { if (this_anc_dev_info.state) rc = anc_if_set_algo_module_id( rc = anc_if_get_algo_module_cali_data( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, module_info_p->module_id); info_p); else this_anc_dev_info.algo_module_id = module_info_p->module_id; pr_err("%s: ANC is not running yet\n", __func__); break; } default: pr_err("%s: ANC cmd wrong\n", __func__); break; } return rc; } int msm_anc_dev_start(void) { int rc = 0; Loading Loading @@ -514,11 +528,6 @@ int msm_anc_dev_start(void) anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, this_anc_dev_info.algo_module_id); if (this_anc_dev_info.bypass_mode != 0) rc = anc_if_set_bypass_mode( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, this_anc_dev_info.bypass_mode); group_id = get_group_id_from_port_id( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id); Loading Loading @@ -612,8 +621,6 @@ int msm_anc_dev_stop(void) this_anc_dev_info.state = 0; this_anc_dev_info.algo_module_id = 0; this_anc_dev_info.rpm = 0; this_anc_dev_info.bypass_mode = 0; pr_debug("%s: ANC devices stop successfully!\n", __func__); Loading drivers/soc/qcom/qdsp6v2/audio_anc.c +5 −12 Original line number Diff line number Diff line Loading @@ -44,17 +44,11 @@ static size_t get_user_anc_cmd_size(int32_t anc_cmd) case ANC_CMD_STOP: size = 0; break; case ANC_CMD_RPM: size = sizeof(struct audio_anc_rpm_info); break; case ANC_CMD_BYPASS_MODE: size = sizeof(struct audio_anc_bypass_mode); break; case ANC_CMD_ALGO_MODULE: size = sizeof(struct audio_anc_algo_module_info); break; case ANC_CMD_ALGO_CALIBRATION: size = sizeof(struct audio_anc_algo_calibration_info); size = sizeof(struct audio_anc_algo_calibration_header); break; default: pr_err("%s:Invalid anc cmd %d!", Loading @@ -77,8 +71,6 @@ static int call_set_anc(int32_t anc_cmd, case ANC_CMD_STOP: ret = msm_anc_dev_stop(); break; case ANC_CMD_RPM: case ANC_CMD_BYPASS_MODE: case ANC_CMD_ALGO_MODULE: case ANC_CMD_ALGO_CALIBRATION: ret = msm_anc_dev_set_info(data, anc_cmd); Loading @@ -98,7 +90,8 @@ static int call_get_anc(int32_t anc_cmd, int ret = 0; switch (anc_cmd) { case ANC_CMD_RPM: case ANC_CMD_ALGO_CALIBRATION: ret = msm_anc_dev_get_info(data, anc_cmd); break; default: break; Loading Loading @@ -146,9 +139,9 @@ static long audio_anc_shared_ioctl(struct file *file, unsigned int cmd, pr_err("%s: Could not copy size value from user\n", __func__); ret = -EFAULT; goto done; } else if (size < sizeof(struct audio_anc_packet)) { } else if (size < sizeof(struct audio_anc_header)) { pr_err("%s: Invalid size sent to driver: %d, min size is %zd\n", __func__, size, sizeof(struct audio_anc_packet)); __func__, size, sizeof(struct audio_anc_header)); ret = -EINVAL; goto done; } Loading drivers/soc/qcom/qdsp6v2/sdsp-anc.c +143 −100 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ struct anc_if_ctl { atomic_t status; wait_queue_head_t wait[AFE_MAX_PORTS]; struct task_struct *task; struct anc_get_rpm_resp rpm_calib_data; struct anc_get_algo_module_cali_data_resp cali_data_resp; uint32_t mmap_handle; struct mutex afe_cmd_lock; }; Loading @@ -48,34 +48,24 @@ static struct anc_if_ctl this_anc_if; static int32_t anc_get_param_callback(uint32_t *payload, uint32_t payload_size) { u32 param_id; struct anc_get_rpm_resp *resp = (struct anc_get_rpm_resp *) payload; if (!(&(resp->pdata))) { pr_err("%s: Error: resp pdata is NULL\n", __func__); return -EINVAL; } param_id = resp->pdata.param_id; if (param_id == AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_RPM) { if (payload_size < sizeof(this_anc_if.rpm_calib_data)) { if ((payload_size < (sizeof(uint32_t) + sizeof(this_anc_if.cali_data_resp.pdata))) || (payload_size > sizeof(this_anc_if.cali_data_resp))) { pr_err("%s: Error: received size %d, calib_data size %zu\n", __func__, payload_size, sizeof(this_anc_if.rpm_calib_data)); sizeof(this_anc_if.cali_data_resp)); return -EINVAL; } memcpy(&this_anc_if.rpm_calib_data, payload, sizeof(this_anc_if.rpm_calib_data)); if (!this_anc_if.rpm_calib_data.status) { memcpy(&this_anc_if.cali_data_resp, payload, payload_size); if (!this_anc_if.cali_data_resp.status) { atomic_set(&this_anc_if.state, 0); } else { pr_debug("%s: calib resp status: %d", __func__, this_anc_if.rpm_calib_data.status); this_anc_if.cali_data_resp.status); atomic_set(&this_anc_if.state, -1); } } return 0; } Loading Loading @@ -465,7 +455,7 @@ int anc_if_tdm_port_stop(u16 port_id) return anc_if_send_cmd_port_stop(port_id); } int anc_if_set_rpm(u16 port_id, u32 rpm) int anc_if_set_algo_module_id(u16 port_id, u32 module_id) { int ret = 0; int index; Loading @@ -479,7 +469,7 @@ int anc_if_set_rpm(u16 port_id, u32 rpm) index = q6audio_get_port_index(port_id); { struct anc_set_rpm_command config; struct anc_set_algo_module_id_command config; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, Loading @@ -496,16 +486,16 @@ int anc_if_set_rpm(u16 port_id, u32 rpm) config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_RPM; config.pdata.param_size = sizeof(config.set_rpm); config.set_rpm.minor_version = AUD_MSVC_API_VERSION_DEV_ANC_ALGO_RPM; config.set_rpm.rpm = rpm; config.pdata.module_id = AFE_MODULE_AUDIO_DEV_INTERFACE; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_MODULE_ID; config.pdata.param_size = sizeof(config.set_algo_module_id); config.set_algo_module_id.minor_version = 1; config.set_algo_module_id.module_id = module_id; ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: share resource for port 0x%x failed ret = %d\n", pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", __func__, port_id, ret); } } Loading @@ -513,10 +503,10 @@ int anc_if_set_rpm(u16 port_id, u32 rpm) return ret; } int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) int anc_if_set_anc_mic_spkr_layout(u16 port_id, struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p) { int ret = 0; int index; ret = anc_sdsp_interface_prepare(); Loading @@ -528,7 +518,7 @@ int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) index = q6audio_get_port_index(port_id); { struct anc_set_bypass_mode_command config; struct anc_set_mic_spkr_layout_info_command config; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, Loading @@ -545,17 +535,16 @@ int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.module_id = AFE_MODULE_AUDIO_DEV_INTERFACE; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_BYPASS_MODE; config.pdata.param_size = sizeof(config.set_bypass_mode); config.set_bypass_mode.minor_version = AUD_MSVC_API_VERSION_DEV_ANC_ALGO_BYPASS_MODE; config.set_bypass_mode.bypass_mode = bypass_mode; AUD_MSVC_PARAM_ID_PORT_ANC_MIC_SPKR_LAYOUT_INFO; config.pdata.param_size = sizeof(config.set_mic_spkr_layout); memcpy(&config.set_mic_spkr_layout, set_mic_spkr_layout_p, sizeof(config.set_mic_spkr_layout)); ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: share resource for port 0x%x failed ret = %d\n", pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", __func__, port_id, ret); } } Loading @@ -563,10 +552,10 @@ int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) return ret; } int anc_if_set_algo_module_id(u16 port_id, u32 module_id) int anc_if_set_algo_module_cali_data(u16 port_id, void *data_p) { int ret = 0; int index; ret = anc_sdsp_interface_prepare(); Loading @@ -578,45 +567,67 @@ int anc_if_set_algo_module_id(u16 port_id, u32 module_id) index = q6audio_get_port_index(port_id); { struct anc_set_algo_module_id_command config; struct anc_set_algo_module_cali_data_command *cali_data_cfg_p; void *config_p = NULL; int cmd_size = 0; void *out_payload_p = NULL; uint32_t *in_payload_p = (uint32_t *)data_p; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, uint32_t module_id = *in_payload_p; uint32_t param_id = *(in_payload_p + 1); uint32_t payload_size = *(in_payload_p + 2); cmd_size = sizeof(struct anc_set_algo_module_cali_data_command) + payload_size; config_p = kzalloc(cmd_size, GFP_KERNEL); if (!config_p) { ret = -ENOMEM; return ret; } memset(config_p, 0, cmd_size); out_payload_p = config_p + sizeof(struct anc_set_algo_module_cali_data_command); cali_data_cfg_p = (struct anc_set_algo_module_cali_data_command *)config_p; cali_data_cfg_p->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); config.hdr.pkt_size = sizeof(config); config.hdr.src_port = 0; config.hdr.dest_port = 0; config.hdr.token = index; config.hdr.opcode = AFE_PORT_CMD_SET_PARAM_V2; config.param.port_id = q6audio_get_port_id(port_id); config.param.payload_size = sizeof(config) - cali_data_cfg_p->hdr.pkt_size = cmd_size; cali_data_cfg_p->hdr.src_port = 0; cali_data_cfg_p->hdr.dest_port = 0; cali_data_cfg_p->hdr.token = index; cali_data_cfg_p->hdr.opcode = AFE_PORT_CMD_SET_PARAM_V2; cali_data_cfg_p->param.port_id = q6audio_get_port_id(port_id); cali_data_cfg_p->param.payload_size = cmd_size - sizeof(struct apr_hdr) - sizeof(config.param); config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_MODULE_ID; config.pdata.param_size = sizeof(config.set_algo_module_id); config.set_algo_module_id.minor_version = 1; config.set_algo_module_id.module_id = module_id; ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", sizeof(struct aud_msvc_port_cmd_set_param_v2); cali_data_cfg_p->param.payload_address_lsw = 0x00; cali_data_cfg_p->param.payload_address_msw = 0x00; cali_data_cfg_p->param.mem_map_handle = 0x00; cali_data_cfg_p->pdata.module_id = module_id; cali_data_cfg_p->pdata.param_id = param_id; cali_data_cfg_p->pdata.param_size = payload_size; memcpy(out_payload_p, (in_payload_p + 3), payload_size); ret = anc_if_apr_send_pkt(cali_data_cfg_p, &this_anc_if.wait[index]); if (ret) pr_err("%s: anc algo module calibration data for port 0x%x failed ret = %d\n", __func__, port_id, ret); } kfree(config_p); } return ret; } int anc_if_set_anc_mic_spkr_layout(u16 port_id, struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p) int anc_if_get_algo_module_cali_data(u16 port_id, void *data_p) { int ret = 0; int index; ret = anc_sdsp_interface_prepare(); Loading @@ -628,35 +639,68 @@ struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p) index = q6audio_get_port_index(port_id); { struct anc_set_mic_spkr_layout_info_command config; struct anc_get_algo_module_cali_data_command *cali_data_cfg_p; void *config_p = NULL; int cmd_size = 0; void *out_payload_p = NULL; uint32_t *in_payload_p = (uint32_t *)data_p; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, uint32_t module_id = *in_payload_p; uint32_t param_id = *(in_payload_p + 1); uint32_t payload_size = *(in_payload_p + 2); cmd_size = sizeof(struct anc_get_algo_module_cali_data_command) + payload_size; config_p = kzalloc(cmd_size, GFP_KERNEL); if (!config_p) { ret = -ENOMEM; return ret; } memset(config_p, 0, cmd_size); out_payload_p = config_p + sizeof(struct anc_set_algo_module_cali_data_command); cali_data_cfg_p = (struct anc_get_algo_module_cali_data_command *)config_p; cali_data_cfg_p->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); config.hdr.pkt_size = sizeof(config); config.hdr.src_port = 0; config.hdr.dest_port = 0; config.hdr.token = index; config.hdr.opcode = AFE_PORT_CMD_SET_PARAM_V2; config.param.port_id = q6audio_get_port_id(port_id); config.param.payload_size = sizeof(config) - cali_data_cfg_p->hdr.pkt_size = cmd_size; cali_data_cfg_p->hdr.src_port = 0; cali_data_cfg_p->hdr.dest_port = 0; cali_data_cfg_p->hdr.token = index; cali_data_cfg_p->hdr.opcode = AFE_PORT_CMD_GET_PARAM_V2; cali_data_cfg_p->param.port_id = q6audio_get_port_id(port_id); cali_data_cfg_p->param.payload_size = cmd_size - sizeof(struct apr_hdr) - sizeof(config.param); config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_MIC_SPKR_LAYOUT_INFO; config.pdata.param_size = sizeof(config.set_mic_spkr_layout); memcpy(&config.set_mic_spkr_layout, set_mic_spkr_layout_p, sizeof(config.set_mic_spkr_layout)); ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", sizeof(struct aud_msvc_port_cmd_get_param_v2); cali_data_cfg_p->param.payload_address_lsw = 0x00; cali_data_cfg_p->param.payload_address_msw = 0x00; cali_data_cfg_p->param.mem_map_handle = 0x00; cali_data_cfg_p->param.module_id = module_id; cali_data_cfg_p->param.param_id = param_id; cali_data_cfg_p->pdata.param_size = 0; cali_data_cfg_p->pdata.module_id = 0; cali_data_cfg_p->pdata.param_id = 0; ret = anc_if_apr_send_pkt(cali_data_cfg_p, &this_anc_if.wait[index]); if (ret) pr_err("%s: anc algo module calibration data for port 0x%x failed ret = %d\n", __func__, port_id, ret); } memcpy((in_payload_p + 3), &this_anc_if.cali_data_resp.payload[0], payload_size); *in_payload_p = this_anc_if.cali_data_resp.pdata.module_id; *(in_payload_p + 1) = this_anc_if.cali_data_resp.pdata.param_id; *(in_payload_p + 2) = this_anc_if.cali_data_resp.pdata.param_size; kfree(config_p); } return ret; Loading Loading @@ -700,7 +744,6 @@ int anc_if_cmd_memory_map(int port_id, phys_addr_t dma_addr_p, mmap_region_cmd = kzalloc(cmd_size, GFP_KERNEL); if (!mmap_region_cmd) { ret = -ENOMEM; pr_err("%s: allocate mmap_region_cmd failed\n", __func__); return ret; } Loading include/linux/qdsp6v2/audio-anc-dev-mgr.h +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ int msm_anc_dev_stop(void); int msm_anc_dev_set_info(void *info_p, int32_t anc_cmd); int msm_anc_dev_get_info(void *info_p, int32_t anc_cmd); int msm_anc_dev_create(struct platform_device *pdev); int msm_anc_dev_destroy(struct platform_device *pdev); Loading include/linux/qdsp6v2/sdsp_anc.h +33 −64 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ #include <sound/q6afe-v2.h> #include <sound/apr_audio-v2.h> #define AUD_MSVC_MODULE_AUDIO_DEV_RESOURCE_SHARE 0x0001028A #define AUD_MSVC_PARAM_ID_PORT_SHARE_RESOURCE_CONFIG 0x00010297 #define AUD_MSVC_API_VERSION_SHARE_RESOURCE_CONFIG 0x1 Loading @@ -23,8 +22,6 @@ #define AUD_MSVC_PARAM_ID_DEV_ANC_REFS_CONFIG 0x00010286 #define AUD_MSVC_API_VERSION_DEV_ANC_REFS_CONFIG 0x1 #define AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO 0x00010234 #define AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_RPM 0x00010235 #define AUD_MSVC_API_VERSION_DEV_ANC_ALGO_RPM 0x1 struct aud_msvc_port_param_data_v2 { /* ID of the module to be configured. Loading Loading @@ -162,13 +159,6 @@ struct aud_msvc_param_id_dev_share_resource_cfg { u32 lpm_length; } __packed; struct aud_msvc_param_id_dev_anc_algo_rpm { u32 minor_version; u32 rpm; } __packed; struct aud_msvc_param_id_dev_anc_refs_cfg { u32 minor_version; u16 port_id; Loading @@ -177,7 +167,6 @@ struct aud_msvc_param_id_dev_anc_refs_cfg { u32 bit_width; } __packed; struct anc_share_resource_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; Loading @@ -185,7 +174,6 @@ struct anc_share_resource_command { struct aud_msvc_param_id_dev_share_resource_cfg resource; } __packed; struct anc_config_ref_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; Loading @@ -193,49 +181,6 @@ struct anc_config_ref_command { struct aud_msvc_param_id_dev_anc_refs_cfg refs; } __packed; struct anc_set_rpm_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_rpm set_rpm; } __packed; struct anc_get_rpm_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_get_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_rpm get_rpm; } __packed; struct anc_get_rpm_resp { uint32_t status; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_rpm res_rpm; } __packed; #define AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_BYPASS_MODE 0x0001029B #define AUD_MSVC_API_VERSION_DEV_ANC_ALGO_BYPASS_MODE 0x1 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_NO 0x0 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_REFS_TO_ANC_SPKR 0x1 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_ANC_MIC_TO_ANC_SPKR 0x2 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_REFS_MIXED_ANC_MIC_TO_ANC_SPKR 0x3 struct aud_msvc_param_id_dev_anc_algo_bypass_mode { uint32_t minor_version; uint32_t bypass_mode; } __packed; struct anc_set_bypass_mode_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_bypass_mode set_bypass_mode; } __packed; #define AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_MODULE_ID 0x0001023A struct aud_msvc_param_id_dev_anc_algo_module_id { Loading Loading @@ -276,6 +221,30 @@ struct anc_set_mic_spkr_layout_info_command { set_mic_spkr_layout; } __packed; struct anc_set_algo_module_cali_data_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; /* * calibration data payload followed */ } __packed; struct anc_get_algo_module_cali_data_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_get_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; /* * calibration data payload followed */ } __packed; struct anc_get_algo_module_cali_data_resp { uint32_t status; struct aud_msvc_port_param_data_v2 pdata; uint32_t payload[128]; } __packed; int anc_if_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port); int anc_if_tdm_port_stop(u16 port_id); Loading @@ -286,15 +255,15 @@ int anc_if_share_resource(u16 port_id, u16 rddma_idx, u16 wrdma_idx, int anc_if_config_ref(u16 port_id, u32 sample_rate, u32 bit_width, u16 num_channel); int anc_if_set_rpm(u16 port_id, u32 rpm); int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode); int anc_if_set_algo_module_id(u16 port_id, u32 module_id); int anc_if_set_anc_mic_spkr_layout(u16 port_id, struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p); int anc_if_set_algo_module_cali_data(u16 port_id, void *data_p); int anc_if_get_algo_module_cali_data(u16 port_id, void *data_p); int anc_if_shared_mem_map(void); int anc_if_shared_mem_unmap(void); Loading Loading
drivers/soc/qcom/qdsp6v2/audio-anc-dev-mgr.c +38 −31 Original line number Diff line number Diff line Loading @@ -53,8 +53,6 @@ struct anc_tdm_group_set_info { struct anc_dev_drv_info { uint32_t state; uint32_t rpm; uint32_t bypass_mode; uint32_t algo_module_id; }; Loading Loading @@ -311,52 +309,68 @@ static int anc_dev_port_stop(int32_t which_port) int msm_anc_dev_set_info(void *info_p, int32_t anc_cmd) { int rc = 0; int rc = -EINVAL; switch (anc_cmd) { case ANC_CMD_RPM: { struct audio_anc_rpm_info *rpm_info_p = (struct audio_anc_rpm_info *)info_p; case ANC_CMD_ALGO_MODULE: { struct audio_anc_algo_module_info *module_info_p = (struct audio_anc_algo_module_info *)info_p; rc = 0; if (this_anc_dev_info.state) rc = anc_if_set_rpm( rc = anc_if_set_algo_module_id( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, rpm_info_p->rpm); module_info_p->module_id); else this_anc_dev_info.rpm = 0; this_anc_dev_info.algo_module_id = module_info_p->module_id; break; } case ANC_CMD_BYPASS_MODE: { struct audio_anc_bypass_mode *bypass_mode_p = (struct audio_anc_bypass_mode *)info_p; case ANC_CMD_ALGO_CALIBRATION: { rc = -EINVAL; if (this_anc_dev_info.state) rc = anc_if_set_bypass_mode( rc = anc_if_set_algo_module_cali_data( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, bypass_mode_p->mode); info_p); else this_anc_dev_info.bypass_mode = bypass_mode_p->mode; pr_err("%s: ANC is not running yet\n", __func__); break; } default: pr_err("%s: ANC cmd wrong\n", __func__); break; } case ANC_CMD_ALGO_MODULE: { struct audio_anc_algo_module_info *module_info_p = (struct audio_anc_algo_module_info *)info_p; return rc; } int msm_anc_dev_get_info(void *info_p, int32_t anc_cmd) { int rc = -EINVAL; switch (anc_cmd) { case ANC_CMD_ALGO_CALIBRATION: { if (this_anc_dev_info.state) rc = anc_if_set_algo_module_id( rc = anc_if_get_algo_module_cali_data( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, module_info_p->module_id); info_p); else this_anc_dev_info.algo_module_id = module_info_p->module_id; pr_err("%s: ANC is not running yet\n", __func__); break; } default: pr_err("%s: ANC cmd wrong\n", __func__); break; } return rc; } int msm_anc_dev_start(void) { int rc = 0; Loading Loading @@ -514,11 +528,6 @@ int msm_anc_dev_start(void) anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, this_anc_dev_info.algo_module_id); if (this_anc_dev_info.bypass_mode != 0) rc = anc_if_set_bypass_mode( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, this_anc_dev_info.bypass_mode); group_id = get_group_id_from_port_id( anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id); Loading Loading @@ -612,8 +621,6 @@ int msm_anc_dev_stop(void) this_anc_dev_info.state = 0; this_anc_dev_info.algo_module_id = 0; this_anc_dev_info.rpm = 0; this_anc_dev_info.bypass_mode = 0; pr_debug("%s: ANC devices stop successfully!\n", __func__); Loading
drivers/soc/qcom/qdsp6v2/audio_anc.c +5 −12 Original line number Diff line number Diff line Loading @@ -44,17 +44,11 @@ static size_t get_user_anc_cmd_size(int32_t anc_cmd) case ANC_CMD_STOP: size = 0; break; case ANC_CMD_RPM: size = sizeof(struct audio_anc_rpm_info); break; case ANC_CMD_BYPASS_MODE: size = sizeof(struct audio_anc_bypass_mode); break; case ANC_CMD_ALGO_MODULE: size = sizeof(struct audio_anc_algo_module_info); break; case ANC_CMD_ALGO_CALIBRATION: size = sizeof(struct audio_anc_algo_calibration_info); size = sizeof(struct audio_anc_algo_calibration_header); break; default: pr_err("%s:Invalid anc cmd %d!", Loading @@ -77,8 +71,6 @@ static int call_set_anc(int32_t anc_cmd, case ANC_CMD_STOP: ret = msm_anc_dev_stop(); break; case ANC_CMD_RPM: case ANC_CMD_BYPASS_MODE: case ANC_CMD_ALGO_MODULE: case ANC_CMD_ALGO_CALIBRATION: ret = msm_anc_dev_set_info(data, anc_cmd); Loading @@ -98,7 +90,8 @@ static int call_get_anc(int32_t anc_cmd, int ret = 0; switch (anc_cmd) { case ANC_CMD_RPM: case ANC_CMD_ALGO_CALIBRATION: ret = msm_anc_dev_get_info(data, anc_cmd); break; default: break; Loading Loading @@ -146,9 +139,9 @@ static long audio_anc_shared_ioctl(struct file *file, unsigned int cmd, pr_err("%s: Could not copy size value from user\n", __func__); ret = -EFAULT; goto done; } else if (size < sizeof(struct audio_anc_packet)) { } else if (size < sizeof(struct audio_anc_header)) { pr_err("%s: Invalid size sent to driver: %d, min size is %zd\n", __func__, size, sizeof(struct audio_anc_packet)); __func__, size, sizeof(struct audio_anc_header)); ret = -EINVAL; goto done; } Loading
drivers/soc/qcom/qdsp6v2/sdsp-anc.c +143 −100 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ struct anc_if_ctl { atomic_t status; wait_queue_head_t wait[AFE_MAX_PORTS]; struct task_struct *task; struct anc_get_rpm_resp rpm_calib_data; struct anc_get_algo_module_cali_data_resp cali_data_resp; uint32_t mmap_handle; struct mutex afe_cmd_lock; }; Loading @@ -48,34 +48,24 @@ static struct anc_if_ctl this_anc_if; static int32_t anc_get_param_callback(uint32_t *payload, uint32_t payload_size) { u32 param_id; struct anc_get_rpm_resp *resp = (struct anc_get_rpm_resp *) payload; if (!(&(resp->pdata))) { pr_err("%s: Error: resp pdata is NULL\n", __func__); return -EINVAL; } param_id = resp->pdata.param_id; if (param_id == AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_RPM) { if (payload_size < sizeof(this_anc_if.rpm_calib_data)) { if ((payload_size < (sizeof(uint32_t) + sizeof(this_anc_if.cali_data_resp.pdata))) || (payload_size > sizeof(this_anc_if.cali_data_resp))) { pr_err("%s: Error: received size %d, calib_data size %zu\n", __func__, payload_size, sizeof(this_anc_if.rpm_calib_data)); sizeof(this_anc_if.cali_data_resp)); return -EINVAL; } memcpy(&this_anc_if.rpm_calib_data, payload, sizeof(this_anc_if.rpm_calib_data)); if (!this_anc_if.rpm_calib_data.status) { memcpy(&this_anc_if.cali_data_resp, payload, payload_size); if (!this_anc_if.cali_data_resp.status) { atomic_set(&this_anc_if.state, 0); } else { pr_debug("%s: calib resp status: %d", __func__, this_anc_if.rpm_calib_data.status); this_anc_if.cali_data_resp.status); atomic_set(&this_anc_if.state, -1); } } return 0; } Loading Loading @@ -465,7 +455,7 @@ int anc_if_tdm_port_stop(u16 port_id) return anc_if_send_cmd_port_stop(port_id); } int anc_if_set_rpm(u16 port_id, u32 rpm) int anc_if_set_algo_module_id(u16 port_id, u32 module_id) { int ret = 0; int index; Loading @@ -479,7 +469,7 @@ int anc_if_set_rpm(u16 port_id, u32 rpm) index = q6audio_get_port_index(port_id); { struct anc_set_rpm_command config; struct anc_set_algo_module_id_command config; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, Loading @@ -496,16 +486,16 @@ int anc_if_set_rpm(u16 port_id, u32 rpm) config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_RPM; config.pdata.param_size = sizeof(config.set_rpm); config.set_rpm.minor_version = AUD_MSVC_API_VERSION_DEV_ANC_ALGO_RPM; config.set_rpm.rpm = rpm; config.pdata.module_id = AFE_MODULE_AUDIO_DEV_INTERFACE; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_MODULE_ID; config.pdata.param_size = sizeof(config.set_algo_module_id); config.set_algo_module_id.minor_version = 1; config.set_algo_module_id.module_id = module_id; ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: share resource for port 0x%x failed ret = %d\n", pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", __func__, port_id, ret); } } Loading @@ -513,10 +503,10 @@ int anc_if_set_rpm(u16 port_id, u32 rpm) return ret; } int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) int anc_if_set_anc_mic_spkr_layout(u16 port_id, struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p) { int ret = 0; int index; ret = anc_sdsp_interface_prepare(); Loading @@ -528,7 +518,7 @@ int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) index = q6audio_get_port_index(port_id); { struct anc_set_bypass_mode_command config; struct anc_set_mic_spkr_layout_info_command config; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, Loading @@ -545,17 +535,16 @@ int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.module_id = AFE_MODULE_AUDIO_DEV_INTERFACE; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_BYPASS_MODE; config.pdata.param_size = sizeof(config.set_bypass_mode); config.set_bypass_mode.minor_version = AUD_MSVC_API_VERSION_DEV_ANC_ALGO_BYPASS_MODE; config.set_bypass_mode.bypass_mode = bypass_mode; AUD_MSVC_PARAM_ID_PORT_ANC_MIC_SPKR_LAYOUT_INFO; config.pdata.param_size = sizeof(config.set_mic_spkr_layout); memcpy(&config.set_mic_spkr_layout, set_mic_spkr_layout_p, sizeof(config.set_mic_spkr_layout)); ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: share resource for port 0x%x failed ret = %d\n", pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", __func__, port_id, ret); } } Loading @@ -563,10 +552,10 @@ int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode) return ret; } int anc_if_set_algo_module_id(u16 port_id, u32 module_id) int anc_if_set_algo_module_cali_data(u16 port_id, void *data_p) { int ret = 0; int index; ret = anc_sdsp_interface_prepare(); Loading @@ -578,45 +567,67 @@ int anc_if_set_algo_module_id(u16 port_id, u32 module_id) index = q6audio_get_port_index(port_id); { struct anc_set_algo_module_id_command config; struct anc_set_algo_module_cali_data_command *cali_data_cfg_p; void *config_p = NULL; int cmd_size = 0; void *out_payload_p = NULL; uint32_t *in_payload_p = (uint32_t *)data_p; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, uint32_t module_id = *in_payload_p; uint32_t param_id = *(in_payload_p + 1); uint32_t payload_size = *(in_payload_p + 2); cmd_size = sizeof(struct anc_set_algo_module_cali_data_command) + payload_size; config_p = kzalloc(cmd_size, GFP_KERNEL); if (!config_p) { ret = -ENOMEM; return ret; } memset(config_p, 0, cmd_size); out_payload_p = config_p + sizeof(struct anc_set_algo_module_cali_data_command); cali_data_cfg_p = (struct anc_set_algo_module_cali_data_command *)config_p; cali_data_cfg_p->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); config.hdr.pkt_size = sizeof(config); config.hdr.src_port = 0; config.hdr.dest_port = 0; config.hdr.token = index; config.hdr.opcode = AFE_PORT_CMD_SET_PARAM_V2; config.param.port_id = q6audio_get_port_id(port_id); config.param.payload_size = sizeof(config) - cali_data_cfg_p->hdr.pkt_size = cmd_size; cali_data_cfg_p->hdr.src_port = 0; cali_data_cfg_p->hdr.dest_port = 0; cali_data_cfg_p->hdr.token = index; cali_data_cfg_p->hdr.opcode = AFE_PORT_CMD_SET_PARAM_V2; cali_data_cfg_p->param.port_id = q6audio_get_port_id(port_id); cali_data_cfg_p->param.payload_size = cmd_size - sizeof(struct apr_hdr) - sizeof(config.param); config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_MODULE_ID; config.pdata.param_size = sizeof(config.set_algo_module_id); config.set_algo_module_id.minor_version = 1; config.set_algo_module_id.module_id = module_id; ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", sizeof(struct aud_msvc_port_cmd_set_param_v2); cali_data_cfg_p->param.payload_address_lsw = 0x00; cali_data_cfg_p->param.payload_address_msw = 0x00; cali_data_cfg_p->param.mem_map_handle = 0x00; cali_data_cfg_p->pdata.module_id = module_id; cali_data_cfg_p->pdata.param_id = param_id; cali_data_cfg_p->pdata.param_size = payload_size; memcpy(out_payload_p, (in_payload_p + 3), payload_size); ret = anc_if_apr_send_pkt(cali_data_cfg_p, &this_anc_if.wait[index]); if (ret) pr_err("%s: anc algo module calibration data for port 0x%x failed ret = %d\n", __func__, port_id, ret); } kfree(config_p); } return ret; } int anc_if_set_anc_mic_spkr_layout(u16 port_id, struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p) int anc_if_get_algo_module_cali_data(u16 port_id, void *data_p) { int ret = 0; int index; ret = anc_sdsp_interface_prepare(); Loading @@ -628,35 +639,68 @@ struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p) index = q6audio_get_port_index(port_id); { struct anc_set_mic_spkr_layout_info_command config; struct anc_get_algo_module_cali_data_command *cali_data_cfg_p; void *config_p = NULL; int cmd_size = 0; void *out_payload_p = NULL; uint32_t *in_payload_p = (uint32_t *)data_p; memset(&config, 0, sizeof(config)); config.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, uint32_t module_id = *in_payload_p; uint32_t param_id = *(in_payload_p + 1); uint32_t payload_size = *(in_payload_p + 2); cmd_size = sizeof(struct anc_get_algo_module_cali_data_command) + payload_size; config_p = kzalloc(cmd_size, GFP_KERNEL); if (!config_p) { ret = -ENOMEM; return ret; } memset(config_p, 0, cmd_size); out_payload_p = config_p + sizeof(struct anc_set_algo_module_cali_data_command); cali_data_cfg_p = (struct anc_get_algo_module_cali_data_command *)config_p; cali_data_cfg_p->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); config.hdr.pkt_size = sizeof(config); config.hdr.src_port = 0; config.hdr.dest_port = 0; config.hdr.token = index; config.hdr.opcode = AFE_PORT_CMD_SET_PARAM_V2; config.param.port_id = q6audio_get_port_id(port_id); config.param.payload_size = sizeof(config) - cali_data_cfg_p->hdr.pkt_size = cmd_size; cali_data_cfg_p->hdr.src_port = 0; cali_data_cfg_p->hdr.dest_port = 0; cali_data_cfg_p->hdr.token = index; cali_data_cfg_p->hdr.opcode = AFE_PORT_CMD_GET_PARAM_V2; cali_data_cfg_p->param.port_id = q6audio_get_port_id(port_id); cali_data_cfg_p->param.payload_size = cmd_size - sizeof(struct apr_hdr) - sizeof(config.param); config.param.payload_address_lsw = 0x00; config.param.payload_address_msw = 0x00; config.param.mem_map_handle = 0x00; config.pdata.module_id = AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO; config.pdata.param_id = AUD_MSVC_PARAM_ID_PORT_ANC_MIC_SPKR_LAYOUT_INFO; config.pdata.param_size = sizeof(config.set_mic_spkr_layout); memcpy(&config.set_mic_spkr_layout, set_mic_spkr_layout_p, sizeof(config.set_mic_spkr_layout)); ret = anc_if_apr_send_pkt(&config, &this_anc_if.wait[index]); if (ret) { pr_err("%s: anc algo module ID for port 0x%x failed ret = %d\n", sizeof(struct aud_msvc_port_cmd_get_param_v2); cali_data_cfg_p->param.payload_address_lsw = 0x00; cali_data_cfg_p->param.payload_address_msw = 0x00; cali_data_cfg_p->param.mem_map_handle = 0x00; cali_data_cfg_p->param.module_id = module_id; cali_data_cfg_p->param.param_id = param_id; cali_data_cfg_p->pdata.param_size = 0; cali_data_cfg_p->pdata.module_id = 0; cali_data_cfg_p->pdata.param_id = 0; ret = anc_if_apr_send_pkt(cali_data_cfg_p, &this_anc_if.wait[index]); if (ret) pr_err("%s: anc algo module calibration data for port 0x%x failed ret = %d\n", __func__, port_id, ret); } memcpy((in_payload_p + 3), &this_anc_if.cali_data_resp.payload[0], payload_size); *in_payload_p = this_anc_if.cali_data_resp.pdata.module_id; *(in_payload_p + 1) = this_anc_if.cali_data_resp.pdata.param_id; *(in_payload_p + 2) = this_anc_if.cali_data_resp.pdata.param_size; kfree(config_p); } return ret; Loading Loading @@ -700,7 +744,6 @@ int anc_if_cmd_memory_map(int port_id, phys_addr_t dma_addr_p, mmap_region_cmd = kzalloc(cmd_size, GFP_KERNEL); if (!mmap_region_cmd) { ret = -ENOMEM; pr_err("%s: allocate mmap_region_cmd failed\n", __func__); return ret; } Loading
include/linux/qdsp6v2/audio-anc-dev-mgr.h +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ int msm_anc_dev_stop(void); int msm_anc_dev_set_info(void *info_p, int32_t anc_cmd); int msm_anc_dev_get_info(void *info_p, int32_t anc_cmd); int msm_anc_dev_create(struct platform_device *pdev); int msm_anc_dev_destroy(struct platform_device *pdev); Loading
include/linux/qdsp6v2/sdsp_anc.h +33 −64 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ #include <sound/q6afe-v2.h> #include <sound/apr_audio-v2.h> #define AUD_MSVC_MODULE_AUDIO_DEV_RESOURCE_SHARE 0x0001028A #define AUD_MSVC_PARAM_ID_PORT_SHARE_RESOURCE_CONFIG 0x00010297 #define AUD_MSVC_API_VERSION_SHARE_RESOURCE_CONFIG 0x1 Loading @@ -23,8 +22,6 @@ #define AUD_MSVC_PARAM_ID_DEV_ANC_REFS_CONFIG 0x00010286 #define AUD_MSVC_API_VERSION_DEV_ANC_REFS_CONFIG 0x1 #define AUD_MSVC_MODULE_AUDIO_DEV_ANC_ALGO 0x00010234 #define AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_RPM 0x00010235 #define AUD_MSVC_API_VERSION_DEV_ANC_ALGO_RPM 0x1 struct aud_msvc_port_param_data_v2 { /* ID of the module to be configured. Loading Loading @@ -162,13 +159,6 @@ struct aud_msvc_param_id_dev_share_resource_cfg { u32 lpm_length; } __packed; struct aud_msvc_param_id_dev_anc_algo_rpm { u32 minor_version; u32 rpm; } __packed; struct aud_msvc_param_id_dev_anc_refs_cfg { u32 minor_version; u16 port_id; Loading @@ -177,7 +167,6 @@ struct aud_msvc_param_id_dev_anc_refs_cfg { u32 bit_width; } __packed; struct anc_share_resource_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; Loading @@ -185,7 +174,6 @@ struct anc_share_resource_command { struct aud_msvc_param_id_dev_share_resource_cfg resource; } __packed; struct anc_config_ref_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; Loading @@ -193,49 +181,6 @@ struct anc_config_ref_command { struct aud_msvc_param_id_dev_anc_refs_cfg refs; } __packed; struct anc_set_rpm_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_rpm set_rpm; } __packed; struct anc_get_rpm_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_get_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_rpm get_rpm; } __packed; struct anc_get_rpm_resp { uint32_t status; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_rpm res_rpm; } __packed; #define AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_BYPASS_MODE 0x0001029B #define AUD_MSVC_API_VERSION_DEV_ANC_ALGO_BYPASS_MODE 0x1 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_NO 0x0 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_REFS_TO_ANC_SPKR 0x1 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_ANC_MIC_TO_ANC_SPKR 0x2 #define AUD_MSVC_ANC_ALGO_BYPASS_MODE_REFS_MIXED_ANC_MIC_TO_ANC_SPKR 0x3 struct aud_msvc_param_id_dev_anc_algo_bypass_mode { uint32_t minor_version; uint32_t bypass_mode; } __packed; struct anc_set_bypass_mode_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; struct aud_msvc_param_id_dev_anc_algo_bypass_mode set_bypass_mode; } __packed; #define AUD_MSVC_PARAM_ID_PORT_ANC_ALGO_MODULE_ID 0x0001023A struct aud_msvc_param_id_dev_anc_algo_module_id { Loading Loading @@ -276,6 +221,30 @@ struct anc_set_mic_spkr_layout_info_command { set_mic_spkr_layout; } __packed; struct anc_set_algo_module_cali_data_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_set_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; /* * calibration data payload followed */ } __packed; struct anc_get_algo_module_cali_data_command { struct apr_hdr hdr; struct aud_msvc_port_cmd_get_param_v2 param; struct aud_msvc_port_param_data_v2 pdata; /* * calibration data payload followed */ } __packed; struct anc_get_algo_module_cali_data_resp { uint32_t status; struct aud_msvc_port_param_data_v2 pdata; uint32_t payload[128]; } __packed; int anc_if_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port); int anc_if_tdm_port_stop(u16 port_id); Loading @@ -286,15 +255,15 @@ int anc_if_share_resource(u16 port_id, u16 rddma_idx, u16 wrdma_idx, int anc_if_config_ref(u16 port_id, u32 sample_rate, u32 bit_width, u16 num_channel); int anc_if_set_rpm(u16 port_id, u32 rpm); int anc_if_set_bypass_mode(u16 port_id, u32 bypass_mode); int anc_if_set_algo_module_id(u16 port_id, u32 module_id); int anc_if_set_anc_mic_spkr_layout(u16 port_id, struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info *set_mic_spkr_layout_p); int anc_if_set_algo_module_cali_data(u16 port_id, void *data_p); int anc_if_get_algo_module_cali_data(u16 port_id, void *data_p); int anc_if_shared_mem_map(void); int anc_if_shared_mem_unmap(void); Loading