Merge "dsp: add support for mic break detection"
diff --git a/asoc/codecs/wcd9335.c b/asoc/codecs/wcd9335.c
index 8564ac1..3ec94fe 100644
--- a/asoc/codecs/wcd9335.c
+++ b/asoc/codecs/wcd9335.c
@@ -2372,10 +2372,10 @@
 
 	mutex_lock(&tasha_p->codec_mutex);
 
-	if (tasha_p->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
-		if (dai_id != AIF1_CAP) {
-			dev_err(codec->dev, "%s: invalid AIF for I2C mode\n",
-				__func__);
+	if (tasha_p->intf_type == WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
+		if (dai_id >= ARRAY_SIZE(vport_slim_check_table)) {
+			dev_err(codec->dev, "%s: dai_id: %d, out of bounds\n",
+				__func__, dai_id);
 			mutex_unlock(&tasha_p->codec_mutex);
 			return -EINVAL;
 		}
diff --git a/asoc/msm-dai-q6-v2.c b/asoc/msm-dai-q6-v2.c
index 19952c8..742457c 100644
--- a/asoc/msm-dai-q6-v2.c
+++ b/asoc/msm-dai-q6-v2.c
@@ -1212,6 +1212,29 @@
 	return rc;
 }
 
+/*
+ * For single CPU DAI registration, the dai id needs to be
+ * set explicitly in the dai probe as ASoC does not read
+ * the cpu->driver->id field rather it assigns the dai id
+ * from the device name that is in the form %s.%d. This dai
+ * id should be assigned to back-end AFE port id and used
+ * during dai prepare. For multiple dai registration, it
+ * is not required to call this function, however the dai->
+ * driver->id field must be defined and set to corresponding
+ * AFE Port id.
+ */
+static inline void msm_dai_q6_set_dai_id(struct snd_soc_dai *dai)
+{
+	if (!dai->driver) {
+		dev_err(dai->dev, "DAI driver is not set\n");
+		return;
+	}
+	if (!dai->driver->id) {
+		dev_dbg(dai->dev, "DAI driver id is not set\n");
+		return;
+	}
+	dai->id = dai->driver->id;
+}
 
 static int msm_dai_q6_aux_pcm_probe(struct snd_soc_dai *dai)
 {
@@ -1226,11 +1249,8 @@
 		pr_err("%s: Invalid params dai dev\n", __func__);
 		return -EINVAL;
 	}
-	if (!dai->driver->id) {
-		dev_warn(dai->dev, "DAI driver id is not set\n");
-		return -EINVAL;
-	}
-	dai->id = dai->driver->id;
+
+	msm_dai_q6_set_dai_id(dai);
 	dai_data = dev_get_drvdata(dai->dev);
 
 	if (dai_data->is_island_dai)
@@ -1725,15 +1745,20 @@
 		pr_err("%s: dai not found!!\n", __func__);
 		return -EINVAL;
 	}
+	if (!dai->dev) {
+		pr_err("%s: Invalid params dai dev\n", __func__);
+		return -EINVAL;
+	}
+
 	dai_data = kzalloc(sizeof(struct msm_dai_q6_spdif_dai_data),
 			GFP_KERNEL);
 
-	if (!dai_data) {
-		rc = -ENOMEM;
-	} else
+	if (!dai_data)
+		return -ENOMEM;
+	else
 		dev_set_drvdata(dai->dev, dai_data);
 
-	dai->id = dai->driver->id;
+	msm_dai_q6_set_dai_id(dai);
 	dai_data->port_id = dai->id;
 
 	switch (dai->id) {
@@ -2530,26 +2555,6 @@
 	.set_channel_map = msm_dai_q6_set_channel_map,
 };
 
-/*
- * For single CPU DAI registration, the dai id needs to be
- * set explicitly in the dai probe as ASoC does not read
- * the cpu->driver->id field rather it assigns the dai id
- * from the device name that is in the form %s.%d. This dai
- * id should be assigned to back-end AFE port id and used
- * during dai prepare. For multiple dai registration, it
- * is not required to call this function, however the dai->
- * driver->id field must be defined and set to corresponding
- * AFE Port id.
- */
-static inline void msm_dai_q6_set_dai_id(struct snd_soc_dai *dai)
-{
-	if (!dai->driver->id) {
-		dev_warn(dai->dev, "DAI driver id is not set\n");
-		return;
-	}
-	dai->id = dai->driver->id;
-}
-
 static int msm_dai_q6_cal_info_put(struct snd_kcontrol *kcontrol,
 				    struct snd_ctl_elem_value *ucontrol)
 {
@@ -3188,7 +3193,7 @@
 	dai_data = kzalloc(sizeof(struct msm_dai_q6_dai_data), GFP_KERNEL);
 
 	if (!dai_data)
-		rc = -ENOMEM;
+		return -ENOMEM;
 	else
 		dev_set_drvdata(dai->dev, dai_data);
 
@@ -6978,8 +6983,7 @@
 static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai)
 {
 	int rc = 0;
-	struct msm_dai_q6_tdm_dai_data *tdm_dai_data =
-			dev_get_drvdata(dai->dev);
+	struct msm_dai_q6_tdm_dai_data *tdm_dai_data = NULL;
 	struct snd_kcontrol *data_format_kcontrol = NULL;
 	struct snd_kcontrol *header_type_kcontrol = NULL;
 	struct snd_kcontrol *header_kcontrol = NULL;
@@ -6988,6 +6992,8 @@
 	const struct snd_kcontrol_new *header_type_ctrl = NULL;
 	const struct snd_kcontrol_new *header_ctrl = NULL;
 
+	tdm_dai_data = dev_get_drvdata(dai->dev);
+
 	msm_dai_q6_set_dai_id(dai);
 
 	port_idx = msm_dai_q6_get_port_idx(dai->id);
diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c
index 8ae85b7..f40769b 100644
--- a/asoc/msm-pcm-q6-v2.c
+++ b/asoc/msm-pcm-q6-v2.c
@@ -704,7 +704,10 @@
 	prtd->set_channel_map = false;
 	prtd->reset_event = false;
 	runtime->private_data = prtd;
-	msm_adsp_init_mixer_ctl_pp_event_queue(soc_prtd);
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		msm_adsp_init_mixer_ctl_pp_event_queue(soc_prtd);
+
 	/* Vote to update the Rx thread priority to RT Thread for playback */
 	if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
 	    (pdata->perf_mode == LOW_LATENCY_PCM_MODE))
diff --git a/dsp/msm_mdf.c b/dsp/msm_mdf.c
index 849b76c..9c73e55 100644
--- a/dsp/msm_mdf.c
+++ b/dsp/msm_mdf.c
@@ -34,13 +34,15 @@
 #include <soc/qcom/secure_buffer.h>
 #include <soc/qcom/subsystem_notif.h>
 #include <soc/qcom/subsystem_restart.h>
+#include <soc/qcom/scm.h>
 #include <dsp/q6audio-v2.h>
 #include <dsp/q6core.h>
+#include <asm/cacheflush.h>
 
 #define VMID_SSC_Q6     5
 #define VMID_LPASS      6
 #define VMID_MSS_MSA    15
-#define VMID_CDSP	8
+#define VMID_CDSP       30
 
 #define MSM_MDF_PROBED         (1 << 0)
 #define MSM_MDF_INITIALIZED    (1 << 1)
@@ -56,6 +58,13 @@
 
 #define ADSP_STATE_READY_TIMEOUT_MS 3000
 
+/* mem protection defines */
+#define TZ_MPU_LOCK_NS_REGION 0x00000025
+#define MEM_PROTECT_AC_PERM_READ 0x4
+#define MEM_PROTECT_AC_PERM_WRITE 0x2
+
+#define MSM_AUDIO_SMMU_SID_OFFSET 32
+
 enum {
 	SUBSYS_ADSP, /* Audio DSP must have index 0 */
 	SUBSYS_SCC,  /* Sensor DSP */
@@ -64,6 +73,24 @@
 	SUBSYS_MAX,
 };
 
+struct msm_mdf_dest_vm_and_perm_info {
+	uint32_t dst_vm;
+	/* Destination VM defined by ACVirtualMachineId. */
+	uint32_t dst_vm_perm;
+	/* Permissions of the IPA to be mapped to VM, bitwise OR of AC_PERM. */
+	uint64_t ctx;
+	/* Destination of the VM-specific context information. */
+	uint32_t ctx_size;
+	/* Size of context buffer in bytes. */
+};
+
+struct msm_mdf_protect_mem {
+	uint64_t dma_start_address;
+	uint64_t dma_end_address;
+	struct msm_mdf_dest_vm_and_perm_info dest_info[SUBSYS_MAX];
+	uint32_t dest_info_size;
+};
+
 struct msm_mdf_mem {
 	struct device *dev;
 	uint8_t device_status;
@@ -180,8 +207,8 @@
 				return -ENODEV;
 		}
 
-		smmu->pa = dma_map_single(smmu->cb_dev, mem->va,
-					  mem->size, DMA_BIDIRECTIONAL);
+		smmu->pa = dma_map_single_attrs(smmu->cb_dev, mem->va,
+			mem->size, DMA_BIDIRECTIONAL, DMA_ATTR_SKIP_CPU_SYNC);
 		if (dma_mapping_error(smmu->cb_dev, smmu->pa)) {
 			rc = -ENOMEM;
 			pr_err("%s: failed to map single, rc = %d\n",
@@ -223,8 +250,8 @@
 		return -ENODEV;
 	}
 
-	mem->va = dma_alloc_coherent(mem->dev, mem->size,
-			&mem->dma_addr, GFP_KERNEL);
+	mem->va = dma_alloc_attrs(mem->dev, mem->size,
+			&mem->dma_addr, GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
 	if (IS_ERR_OR_NULL(mem->va)) {
 		pr_err("%s: failed to allocate dma memory, rc = %d\n",
 			__func__, rc);
@@ -319,6 +346,51 @@
 	}
 }
 
+static int msm_mdf_assign_memory_to_subsys(struct msm_mdf_mem *mem)
+{
+	int ret = 0, i;
+	struct scm_desc desc = {0};
+	struct msm_mdf_protect_mem *scm_buffer;
+	uint32_t fnid;
+
+	scm_buffer = kzalloc(sizeof(struct msm_mdf_protect_mem), GFP_KERNEL);
+	if (!scm_buffer)
+		return -ENOMEM;
+
+	scm_buffer->dma_start_address = mem->dma_addr;
+	scm_buffer->dma_end_address = mem->dma_addr + buf_page_size(mem->size);
+	for (i = 0; i < SUBSYS_MAX; i++) {
+		scm_buffer->dest_info[i].dst_vm = mdf_smmu_data[i].vmid;
+		scm_buffer->dest_info[i].dst_vm_perm =
+			MEM_PROTECT_AC_PERM_READ | MEM_PROTECT_AC_PERM_WRITE;
+		scm_buffer->dest_info[i].ctx = 0;
+		scm_buffer->dest_info[i].ctx_size = 0;
+	}
+	scm_buffer->dest_info_size =
+		sizeof(struct msm_mdf_dest_vm_and_perm_info) * SUBSYS_MAX;
+
+	/* flush cache required by scm_call2 */
+	dmac_flush_range(scm_buffer, ((void *)scm_buffer) +
+					sizeof(struct msm_mdf_protect_mem));
+
+	desc.args[0] = scm_buffer->dma_start_address;
+	desc.args[1] = scm_buffer->dma_end_address;
+	desc.args[2] = virt_to_phys(&(scm_buffer->dest_info[0]));
+	desc.args[3] = scm_buffer->dest_info_size;
+
+	desc.arginfo = SCM_ARGS(4, SCM_VAL, SCM_VAL, SCM_RO, SCM_VAL);
+
+	fnid = SCM_SIP_FNID(SCM_SVC_MP, TZ_MPU_LOCK_NS_REGION);
+	ret = scm_call2(fnid, &desc);
+	if (ret < 0) {
+		pr_err("%s: SCM call2 failed, ret %d scm_resp %llu\n",
+			__func__, ret, desc.ret[0]);
+	}
+	/* No More need for scm_buffer, freeing the same */
+	kfree(scm_buffer);
+	return ret;
+}
+
 /**
  * msm_mdf_mem_init - Initializes MDF memory pool and
  * map memory to subsystem
@@ -378,6 +450,13 @@
 			}
 		}
 
+		rc = msm_mdf_assign_memory_to_subsys(mem);
+		if (rc) {
+			pr_err("%s: msm_mdf_assign_memory_to_subsys failed\n",
+			__func__);
+			goto err;
+		}
+
 		for (j = 0; j < SUBSYS_MAX; j++) {
 			smmu = &mdf_smmu_data[j];
 			rc = msm_mdf_map_memory_to_subsys(mem, smmu);
@@ -479,6 +558,9 @@
 static int msm_mdf_cb_probe(struct device *dev)
 {
 	struct msm_mdf_smmu *smmu;
+	u64 smmu_sid = 0;
+	u64 smmu_sid_mask = 0;
+	struct of_phandle_args iommuspec;
 	const char *subsys;
 	int rc = 0, i;
 
@@ -511,22 +593,31 @@
 		smmu->subsys);
 
 	if (smmu->enabled) {
-		if (!strcmp("adsp", smmu->subsys)) {
-			/* Get SMMU info from audio ION */
-			rc = msm_audio_ion_get_smmu_info(&smmu->cb_dev,
-					&smmu->sid);
-			if (rc) {
-				dev_err(dev, "%s: msm_audio_ion_get_smmu_info failed, rc = %d\n",
-					__func__, rc);
-				goto err;
-			}
+		/* Get SMMU SID information from Devicetree */
+		rc = of_property_read_u64(dev->of_node,
+					"qcom,smmu-sid-mask",
+					&smmu_sid_mask);
+		if (rc) {
+			dev_err(dev,
+				"%s: qcom,smmu-sid-mask missing in DT node, using default\n",
+				__func__);
+			smmu_sid_mask = 0xFFFFFFFFFFFFFFFF;
 		}
-	} else {
-		/* Setup SMMU CB if enabled for subsys other than ADSP */
+
+		rc = of_parse_phandle_with_args(dev->of_node, "iommus",
+					"#iommu-cells", 0, &iommuspec);
+		if (rc)
+			dev_err(dev, "%s: could not get smmu SID, ret = %d\n",
+				__func__, rc);
+		else
+			smmu_sid = (iommuspec.args[0] & smmu_sid_mask);
+
+		smmu->sid =
+			smmu_sid << MSM_AUDIO_SMMU_SID_OFFSET;
+
+		smmu->cb_dev = dev;
 	}
 	return 0;
-err:
-	return rc;
 }
 
 static int msm_mdf_remove(struct platform_device *pdev)
diff --git a/dsp/q6afe.c b/dsp/q6afe.c
index 9eb8599..f5e7267 100644
--- a/dsp/q6afe.c
+++ b/dsp/q6afe.c
@@ -2292,7 +2292,7 @@
 			goto exit;
 		}
 	}
-	pr_err("%s: no matching cal_block found\n", __func__);
+	pr_debug("%s: no matching cal_block found\n", __func__);
 	cal_block = NULL;
 
 exit:
@@ -3735,7 +3735,9 @@
 		goto exit;
 	}
 
-	if (format == ASM_MEDIA_FMT_LDAC || format == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
+	if ((format == ASM_MEDIA_FMT_LDAC &&
+	     cfg->ldac_config.abr_config.is_abr_enabled) ||
+	     format == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
 		pr_debug("%s:sending AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP to DSP payload",
 			__func__);
 		param_hdr.param_id = AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP;
diff --git a/dsp/rtac.c b/dsp/rtac.c
index 7102ae2..c6bca98 100644
--- a/dsp/rtac.c
+++ b/dsp/rtac.c
@@ -54,6 +54,7 @@
 struct rtac_common_data {
 	atomic_t			usage_count;
 	atomic_t			apr_err_code;
+	struct mutex			rtac_fops_mutex;
 };
 
 static struct rtac_common_data		rtac_common;
@@ -122,10 +123,6 @@
 struct mutex			rtac_voice_mutex;
 struct mutex			rtac_voice_apr_mutex;
 struct mutex			rtac_afe_apr_mutex;
-struct mutex			rtac_asm_cal_mutex;
-struct mutex			rtac_adm_cal_mutex;
-struct mutex			rtac_afe_cal_mutex;
-struct mutex			rtac_voice_cal_mutex;
 
 int rtac_clear_mapping(uint32_t cal_type)
 {
@@ -322,7 +319,9 @@
 
 	pr_debug("%s\n", __func__);
 
+	mutex_lock(&rtac_common.rtac_fops_mutex);
 	atomic_inc(&rtac_common.usage_count);
+	mutex_unlock(&rtac_common.rtac_fops_mutex);
 	return result;
 }
 
@@ -334,12 +333,15 @@
 
 	pr_debug("%s\n", __func__);
 
+	mutex_lock(&rtac_common.rtac_fops_mutex);
 	atomic_dec(&rtac_common.usage_count);
 	pr_debug("%s: ref count %d!\n", __func__,
 		atomic_read(&rtac_common.usage_count));
 
-	if (atomic_read(&rtac_common.usage_count) > 0)
+	if (atomic_read(&rtac_common.usage_count) > 0) {
+		mutex_unlock(&rtac_common.rtac_fops_mutex);
 		goto done;
+	}
 
 	for (i = 0; i < MAX_RTAC_BLOCKS; i++) {
 		result2 = rtac_unmap_cal_buffer(i);
@@ -356,6 +358,7 @@
 			result = result2;
 		}
 	}
+	mutex_unlock(&rtac_common.rtac_fops_mutex);
 done:
 	return result;
 }
@@ -1807,84 +1810,64 @@
 	}
 
 	case AUDIO_GET_RTAC_ADM_CAL:
-		mutex_lock(&rtac_adm_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 ADM_CMD_GET_PP_PARAMS_V6 :
 				 ADM_CMD_GET_PP_PARAMS_V5;
 		result = send_adm_apr((void *) arg, opcode);
-		mutex_unlock(&rtac_adm_cal_mutex);
 		break;
 	case AUDIO_SET_RTAC_ADM_CAL:
-		mutex_lock(&rtac_adm_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 ADM_CMD_SET_PP_PARAMS_V6 :
 				 ADM_CMD_SET_PP_PARAMS_V5;
 		result = send_adm_apr((void *) arg, opcode);
-		mutex_unlock(&rtac_adm_cal_mutex);
 		break;
 	case AUDIO_GET_RTAC_ASM_CAL:
-		mutex_lock(&rtac_asm_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 ASM_STREAM_CMD_GET_PP_PARAMS_V3 :
 				 ASM_STREAM_CMD_GET_PP_PARAMS_V2;
 		result = send_rtac_asm_apr((void *) arg, opcode);
-		mutex_unlock(&rtac_asm_cal_mutex);
 		break;
 	case AUDIO_SET_RTAC_ASM_CAL:
-		mutex_lock(&rtac_asm_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 ASM_STREAM_CMD_SET_PP_PARAMS_V3 :
 				 ASM_STREAM_CMD_SET_PP_PARAMS_V2;
 		result = send_rtac_asm_apr((void *) arg, opcode);
-		mutex_unlock(&rtac_asm_cal_mutex);
 		break;
 	case AUDIO_GET_RTAC_CVS_CAL:
-		mutex_lock(&rtac_voice_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 VSS_ICOMMON_CMD_GET_PARAM_V3 :
 				 VSS_ICOMMON_CMD_GET_PARAM_V2;
 		result = send_voice_apr(RTAC_CVS, (void *) arg, opcode);
-		mutex_unlock(&rtac_voice_cal_mutex);
 		break;
 	case AUDIO_SET_RTAC_CVS_CAL:
-		mutex_lock(&rtac_voice_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 VSS_ICOMMON_CMD_SET_PARAM_V3 :
 				 VSS_ICOMMON_CMD_SET_PARAM_V2;
 		result = send_voice_apr(RTAC_CVS, (void *) arg, opcode);
-		mutex_unlock(&rtac_voice_cal_mutex);
 		break;
 	case AUDIO_GET_RTAC_CVP_CAL:
-		mutex_lock(&rtac_voice_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 VSS_ICOMMON_CMD_GET_PARAM_V3 :
 				 VSS_ICOMMON_CMD_GET_PARAM_V2;
 		result = send_voice_apr(RTAC_CVP, (void *) arg, opcode);
-		mutex_unlock(&rtac_voice_cal_mutex);
 		break;
 	case AUDIO_SET_RTAC_CVP_CAL:
-		mutex_lock(&rtac_voice_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 VSS_ICOMMON_CMD_SET_PARAM_V3 :
 				 VSS_ICOMMON_CMD_SET_PARAM_V2;
 		result = send_voice_apr(RTAC_CVP, (void *) arg, opcode);
-		mutex_unlock(&rtac_voice_cal_mutex);
 		break;
 	case AUDIO_GET_RTAC_AFE_CAL:
-		mutex_lock(&rtac_afe_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 AFE_PORT_CMD_GET_PARAM_V3 :
 				 AFE_PORT_CMD_GET_PARAM_V2;
 		result = send_rtac_afe_apr((void __user *) arg, opcode);
-		mutex_unlock(&rtac_afe_cal_mutex);
 		break;
 	case AUDIO_SET_RTAC_AFE_CAL:
-		mutex_lock(&rtac_afe_cal_mutex);
 		opcode = q6common_is_instance_id_supported() ?
 				 AFE_PORT_CMD_SET_PARAM_V3 :
 				 AFE_PORT_CMD_SET_PARAM_V2;
 		result = send_rtac_afe_apr((void __user *) arg, opcode);
-		mutex_unlock(&rtac_afe_cal_mutex);
 		break;
 	default:
 		pr_err("%s: Invalid IOCTL, command = %d!\n",
@@ -1900,6 +1883,7 @@
 {
 	int result = 0;
 
+	mutex_lock(&rtac_common.rtac_fops_mutex);
 	if (!arg) {
 		pr_err("%s: No data sent to driver!\n", __func__);
 		result = -EFAULT;
@@ -1907,6 +1891,7 @@
 		result = rtac_ioctl_shared(f, cmd, (void __user *)arg);
 	}
 
+	mutex_unlock(&rtac_common.rtac_fops_mutex);
 	return result;
 }
 
@@ -1929,6 +1914,7 @@
 {
 	int result = 0;
 
+	mutex_lock(&rtac_common.rtac_fops_mutex);
 	if (!arg) {
 		pr_err("%s: No data sent to driver!\n", __func__);
 		result = -EINVAL;
@@ -1981,6 +1967,7 @@
 		break;
 	}
 done:
+	mutex_unlock(&rtac_common.rtac_fops_mutex);
 	return result;
 }
 #else
@@ -2008,6 +1995,7 @@
 	/* Driver */
 	atomic_set(&rtac_common.usage_count, 0);
 	atomic_set(&rtac_common.apr_err_code, 0);
+	mutex_init(&rtac_common.rtac_fops_mutex);
 
 	/* ADM */
 	memset(&rtac_adm_data, 0, sizeof(rtac_adm_data));
@@ -2016,7 +2004,6 @@
 	init_waitqueue_head(&rtac_adm_apr_data.cmd_wait);
 	mutex_init(&rtac_adm_mutex);
 	mutex_init(&rtac_adm_apr_mutex);
-	mutex_init(&rtac_adm_cal_mutex);
 
 	rtac_adm_buffer = kzalloc(
 		rtac_cal[ADM_RTAC_CAL].map_data.map_size, GFP_KERNEL);
@@ -2030,7 +2017,6 @@
 		init_waitqueue_head(&rtac_asm_apr_data[i].cmd_wait);
 	}
 	mutex_init(&rtac_asm_apr_mutex);
-	mutex_init(&rtac_asm_cal_mutex);
 
 	rtac_asm_buffer = kzalloc(
 		rtac_cal[ASM_RTAC_CAL].map_data.map_size, GFP_KERNEL);
@@ -2044,7 +2030,6 @@
 	atomic_set(&rtac_afe_apr_data.cmd_state, 0);
 	init_waitqueue_head(&rtac_afe_apr_data.cmd_wait);
 	mutex_init(&rtac_afe_apr_mutex);
-	mutex_init(&rtac_afe_cal_mutex);
 
 	rtac_afe_buffer = kzalloc(
 		rtac_cal[AFE_RTAC_CAL].map_data.map_size, GFP_KERNEL);
@@ -2063,7 +2048,6 @@
 	}
 	mutex_init(&rtac_voice_mutex);
 	mutex_init(&rtac_voice_apr_mutex);
-	mutex_init(&rtac_voice_cal_mutex);
 
 	rtac_voice_buffer = kzalloc(
 		rtac_cal[VOICE_RTAC_CAL].map_data.map_size, GFP_KERNEL);
diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h
index e4f0c3b..1342819 100644
--- a/include/dsp/apr_audio-v2.h
+++ b/include/dsp/apr_audio-v2.h
@@ -3522,6 +3522,10 @@
 	 * Information to set up IMC between decoder and encoder.
 	 */
 	struct afe_imc_dec_enc_info imc_info;
+	/*
+	 * Flag to indicate whether ABR is enabled.
+	 */
+	bool is_abr_enabled;
 } __packed;
 
 #define AFE_PARAM_ID_APTX_SYNC_MODE  0x00013205