Browse Source

Merge "dsp: add support for new ADM LSM cal types"

Linux Build Service Account 7 years ago
parent
commit
9c81253780

+ 71 - 30
asoc/msm-pcm-routing-v2.c

@@ -57,7 +57,7 @@
 
 static struct mutex routing_lock;
 
-static struct cal_type_data *cal_data;
+static struct cal_type_data *cal_data[MAX_ROUTING_CAL_TYPES];
 
 static int fm_switch_enable;
 static int hfp_switch_enable;
@@ -883,21 +883,21 @@ done:
 }
 EXPORT_SYMBOL(msm_pcm_routing_get_stream_app_type_cfg);
 
-static struct cal_block_data *msm_routing_find_topology_by_path(int path)
+static struct cal_block_data *msm_routing_find_topology_by_path(int path,
+								int cal_index)
 {
-	struct list_head *ptr, *next;
-	struct cal_block_data *cal_block = NULL;
-
+	struct list_head		*ptr, *next;
+	struct cal_block_data		*cal_block = NULL;
 	pr_debug("%s\n", __func__);
 
 	list_for_each_safe(ptr, next,
-		&cal_data->cal_blocks) {
+		&cal_data[cal_index]->cal_blocks) {
 
 		cal_block = list_entry(ptr,
 			struct cal_block_data, list);
 
-		if (((struct audio_cal_info_adm_top *)cal_block->cal_info)
-			->path == path) {
+		if (((struct audio_cal_info_adm_top *)cal_block
+			->cal_info)->path == path) {
 			return cal_block;
 		}
 	}
@@ -907,7 +907,8 @@ static struct cal_block_data *msm_routing_find_topology_by_path(int path)
 
 static struct cal_block_data *msm_routing_find_topology(int path,
 							int app_type,
-							int acdb_id)
+							int acdb_id,
+							int cal_index)
 {
 	struct list_head *ptr, *next;
 	struct cal_block_data *cal_block = NULL;
@@ -916,7 +917,7 @@ static struct cal_block_data *msm_routing_find_topology(int path,
 	pr_debug("%s\n", __func__);
 
 	list_for_each_safe(ptr, next,
-		&cal_data->cal_blocks) {
+		&cal_data[cal_index]->cal_blocks) {
 
 		cal_block = list_entry(ptr,
 			struct cal_block_data, list);
@@ -931,7 +932,7 @@ static struct cal_block_data *msm_routing_find_topology(int path,
 	}
 	pr_debug("%s: Can't find topology for path %d, app %d, acdb_id %d defaulting to search by path\n",
 		__func__, path, app_type, acdb_id);
-	return msm_routing_find_topology_by_path(path);
+	return msm_routing_find_topology_by_path(cal_index, path);
 }
 
 static int msm_routing_get_adm_topology(int fedai_id, int session_type,
@@ -941,28 +942,37 @@ static int msm_routing_get_adm_topology(int fedai_id, int session_type,
 	struct cal_block_data *cal_block = NULL;
 	int app_type = 0, acdb_dev_id = 0;
 
-
 	pr_debug("%s: fedai_id %d, session_type %d, be_id %d\n",
 	       __func__, fedai_id, session_type, be_id);
 
 	if (cal_data == NULL)
 		goto done;
 
-	mutex_lock(&cal_data->lock);
-
 	app_type = fe_dai_app_type_cfg[fedai_id][session_type][be_id].app_type;
 	acdb_dev_id =
 		fe_dai_app_type_cfg[fedai_id][session_type][be_id].acdb_dev_id;
 
+	mutex_lock(&cal_data[ADM_TOPOLOGY_CAL_TYPE_IDX]->lock);
 	cal_block = msm_routing_find_topology(session_type, app_type,
-					      acdb_dev_id);
-	if (cal_block == NULL)
-		goto unlock;
-
-	topology = ((struct audio_cal_info_adm_top *)
-		cal_block->cal_info)->topology;
-unlock:
-	mutex_unlock(&cal_data->lock);
+					      acdb_dev_id,
+					      ADM_TOPOLOGY_CAL_TYPE_IDX);
+	if (cal_block != NULL)
+		topology = ((struct audio_cal_info_adm_top *)
+			cal_block->cal_info)->topology;
+	mutex_unlock(&cal_data[ADM_TOPOLOGY_CAL_TYPE_IDX]->lock);
+
+	if (cal_block == NULL) {
+		pr_debug("%s: Check for LSM topology\n", __func__);
+		mutex_lock(&cal_data[ADM_LSM_TOPOLOGY_CAL_TYPE_IDX]->lock);
+		cal_block = msm_routing_find_topology(session_type, app_type,
+						acdb_dev_id,
+						ADM_LSM_TOPOLOGY_CAL_TYPE_IDX);
+		if (cal_block != NULL)
+			topology = ((struct audio_cal_info_adm_top *)
+				cal_block->cal_info)->topology;
+		mutex_unlock(&cal_data[ADM_LSM_TOPOLOGY_CAL_TYPE_IDX]->lock);
+	}
+
 done:
 	pr_debug("%s: Using topology %d\n", __func__, topology);
 	return topology;
@@ -2562,6 +2572,7 @@ static int msm_routing_lsm_func_put(struct snd_kcontrol *kcontrol,
 
 	pr_debug("%s: port_id 0x%x, mad_type %d\n", __func__, port_id,
 		 mad_type);
+	adm_set_lsm_port_id(port_id);
 	return afe_port_set_mad_type(port_id, mad_type);
 }
 
@@ -16936,14 +16947,39 @@ int msm_routing_check_backend_enabled(int fedai_id)
 	return 0;
 }
 
+static int get_cal_type_index(int32_t cal_type)
+{
+	int ret = -EINVAL;
+
+	switch (cal_type) {
+	case ADM_TOPOLOGY_CAL_TYPE:
+		ret = ADM_TOPOLOGY_CAL_TYPE_IDX;
+		break;
+	case ADM_LSM_TOPOLOGY_CAL_TYPE:
+		ret = ADM_LSM_TOPOLOGY_CAL_TYPE_IDX;
+		break;
+	default:
+		pr_err("%s: Invalid cal type %d\n", __func__, cal_type);
+	}
+	return ret;
+}
+
 static int msm_routing_set_cal(int32_t cal_type,
 					size_t data_size, void *data)
 {
 	int ret = 0;
-
+	int cal_index;
 	pr_debug("%s\n", __func__);
 
-	ret = cal_utils_set_cal(data_size, data, cal_data, 0, NULL);
+	cal_index = get_cal_type_index(cal_type);
+	if (cal_index < 0) {
+		pr_err("%s: Could not get cal index %d\n",
+			__func__, cal_index);
+		ret = -EINVAL;
+		goto done;
+	}
+
+	ret = cal_utils_set_cal(data_size, data, cal_data[cal_index], 0, NULL);
 	if (ret < 0) {
 		pr_err("%s: cal_utils_set_cal failed, ret = %d, cal type = %d!\n",
 			__func__, ret, cal_type);
@@ -16958,22 +16994,27 @@ static void msm_routing_delete_cal_data(void)
 {
 	pr_debug("%s\n", __func__);
 
-	cal_utils_destroy_cal_types(1, &cal_data);
+	cal_utils_destroy_cal_types(MAX_ROUTING_CAL_TYPES, &cal_data[0]);
 }
 
 static int msm_routing_init_cal_data(void)
 {
 	int ret = 0;
-	struct cal_type_info cal_type_info = {
-		{ADM_TOPOLOGY_CAL_TYPE,
+	struct cal_type_info cal_type_info[] = {
+		{{ADM_TOPOLOGY_CAL_TYPE,
+		{NULL, NULL, NULL,
+		msm_routing_set_cal, NULL, NULL} },
+		{NULL, NULL, cal_utils_match_buf_num} },
+
+		{{ADM_LSM_TOPOLOGY_CAL_TYPE,
 		{NULL, NULL, NULL,
 		msm_routing_set_cal, NULL, NULL} },
-		{NULL, NULL, cal_utils_match_buf_num}
+		{NULL, NULL, cal_utils_match_buf_num} },
 	};
 	pr_debug("%s\n", __func__);
 
-	ret = cal_utils_create_cal_types(1, &cal_data,
-		&cal_type_info);
+	ret = cal_utils_create_cal_types(MAX_ROUTING_CAL_TYPES, &cal_data[0],
+		&cal_type_info[0]);
 	if (ret < 0) {
 		pr_err("%s: could not create cal type!\n",
 			__func__);

+ 6 - 0
asoc/msm-pcm-routing-v2.h

@@ -433,6 +433,12 @@ enum {
 #define BE_DAI_PORT_SESSIONS_IDX_MAX		4
 #define BE_DAI_FE_SESSIONS_IDX_MAX		2
 
+enum {
+	ADM_TOPOLOGY_CAL_TYPE_IDX = 0,
+	ADM_LSM_TOPOLOGY_CAL_TYPE_IDX,
+	MAX_ROUTING_CAL_TYPES
+};
+
 struct msm_pcm_routing_evt {
 	void (*event_func)(enum msm_pcm_routing_event, void *);
 	void *priv_data;

+ 8 - 0
dsp/audio_cal_utils.c

@@ -54,6 +54,7 @@ size_t get_cal_info_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_info_voc_col);
 		break;
 	case ADM_TOPOLOGY_CAL_TYPE:
+	case ADM_LSM_TOPOLOGY_CAL_TYPE:
 		size = sizeof(struct audio_cal_info_adm_top);
 		break;
 	case ADM_CUST_TOPOLOGY_CAL_TYPE:
@@ -61,6 +62,7 @@ size_t get_cal_info_size(int32_t cal_type)
 		size = 0;
 		break;
 	case ADM_AUDPROC_CAL_TYPE:
+	case ADM_LSM_AUDPROC_CAL_TYPE:
 		size = sizeof(struct audio_cal_info_audproc);
 		break;
 	case ADM_AUDVOL_CAL_TYPE:
@@ -77,6 +79,7 @@ size_t get_cal_info_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_info_audstrm);
 		break;
 	case AFE_TOPOLOGY_CAL_TYPE:
+	case AFE_LSM_TOPOLOGY_CAL_TYPE:
 		size = sizeof(struct audio_cal_info_afe_top);
 		break;
 	case AFE_CUST_TOPOLOGY_CAL_TYPE:
@@ -86,6 +89,7 @@ size_t get_cal_info_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_info_afe);
 		break;
 	case AFE_COMMON_TX_CAL_TYPE:
+	case AFE_LSM_TX_CAL_TYPE:
 		size = sizeof(struct audio_cal_info_afe);
 		break;
 	case AFE_FB_SPKR_PROT_CAL_TYPE:
@@ -200,6 +204,7 @@ size_t get_user_cal_type_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_type_voc_col);
 		break;
 	case ADM_TOPOLOGY_CAL_TYPE:
+	case ADM_LSM_TOPOLOGY_CAL_TYPE:
 		size = sizeof(struct audio_cal_type_adm_top);
 		break;
 	case ADM_CUST_TOPOLOGY_CAL_TYPE:
@@ -207,6 +212,7 @@ size_t get_user_cal_type_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_type_basic);
 		break;
 	case ADM_AUDPROC_CAL_TYPE:
+	case ADM_LSM_AUDPROC_CAL_TYPE:
 		size = sizeof(struct audio_cal_type_audproc);
 		break;
 	case ADM_AUDVOL_CAL_TYPE:
@@ -223,6 +229,7 @@ size_t get_user_cal_type_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_type_audstrm);
 		break;
 	case AFE_TOPOLOGY_CAL_TYPE:
+	case AFE_LSM_TOPOLOGY_CAL_TYPE:
 		size = sizeof(struct audio_cal_type_afe_top);
 		break;
 	case AFE_CUST_TOPOLOGY_CAL_TYPE:
@@ -232,6 +239,7 @@ size_t get_user_cal_type_size(int32_t cal_type)
 		size = sizeof(struct audio_cal_type_afe);
 		break;
 	case AFE_COMMON_TX_CAL_TYPE:
+	case AFE_LSM_TX_CAL_TYPE:
 		size = sizeof(struct audio_cal_type_afe);
 		break;
 	case AFE_FB_SPKR_PROT_CAL_TYPE:

+ 28 - 6
dsp/q6adm.c

@@ -104,6 +104,7 @@ struct adm_ctl {
 	int num_ec_ref_rx_chans;
 	int ec_ref_rx_bit_width;
 	int ec_ref_rx_sampling_rate;
+	int lsm_port_id;
 };
 
 static struct adm_ctl			this_adm;
@@ -2144,7 +2145,8 @@ static struct cal_block_data *adm_find_cal_by_path(int cal_index, int path)
 		cal_block = list_entry(ptr,
 			struct cal_block_data, list);
 
-		if (cal_index == ADM_AUDPROC_CAL) {
+		if (cal_index == ADM_AUDPROC_CAL ||
+		    cal_index == ADM_LSM_AUDPROC_CAL) {
 			audproc_cal_info = cal_block->cal_info;
 			if ((audproc_cal_info->path == path) &&
 			    (cal_block->cal_data.size > 0))
@@ -2177,7 +2179,8 @@ static struct cal_block_data *adm_find_cal_by_app_type(int cal_index, int path,
 		cal_block = list_entry(ptr,
 			struct cal_block_data, list);
 
-		if (cal_index == ADM_AUDPROC_CAL) {
+		if (cal_index == ADM_AUDPROC_CAL ||
+		    cal_index == ADM_LSM_AUDPROC_CAL) {
 			audproc_cal_info = cal_block->cal_info;
 			if ((audproc_cal_info->path == path) &&
 			    (audproc_cal_info->app_type == app_type) &&
@@ -2214,7 +2217,8 @@ static struct cal_block_data *adm_find_cal(int cal_index, int path,
 		cal_block = list_entry(ptr,
 			struct cal_block_data, list);
 
-		if (cal_index == ADM_AUDPROC_CAL) {
+		if (cal_index == ADM_AUDPROC_CAL ||
+		    cal_index == ADM_LSM_AUDPROC_CAL) {
 			audproc_cal_info = cal_block->cal_info;
 			if ((audproc_cal_info->path == path) &&
 			    (audproc_cal_info->app_type == app_type) &&
@@ -2295,13 +2299,22 @@ static int get_cal_path(int path)
 		return TX_DEVICE;
 }
 
+void adm_set_lsm_port_id(int port_id)
+{
+	this_adm.lsm_port_id = port_id;
+}
+
 static void send_adm_cal(int port_id, int copp_idx, int path, int perf_mode,
 			 int app_type, int acdb_id, int sample_rate)
 {
 	pr_debug("%s: port id 0x%x copp_idx %d\n", __func__, port_id, copp_idx);
 
-	send_adm_cal_type(ADM_AUDPROC_CAL, path, port_id, copp_idx, perf_mode,
-			  app_type, acdb_id, sample_rate);
+	if (port_id != this_adm.lsm_port_id)
+		send_adm_cal_type(ADM_AUDPROC_CAL, path, port_id, copp_idx,
+				perf_mode, app_type, acdb_id, sample_rate);
+	else
+		send_adm_cal_type(ADM_LSM_AUDPROC_CAL, path, port_id, copp_idx,
+				  perf_mode, app_type, acdb_id, sample_rate);
 	send_adm_cal_type(ADM_AUDVOL_CAL, path, port_id, copp_idx, perf_mode,
 			  app_type, acdb_id, sample_rate);
 }
@@ -3447,6 +3460,9 @@ static int get_cal_type_index(int32_t cal_type)
 	case ADM_AUDPROC_CAL_TYPE:
 		ret = ADM_AUDPROC_CAL;
 		break;
+	case ADM_LSM_AUDPROC_CAL_TYPE:
+		ret = ADM_LSM_AUDPROC_CAL;
+		break;
 	case ADM_AUDVOL_CAL_TYPE:
 		ret = ADM_AUDVOL_CAL;
 		break;
@@ -3654,6 +3670,12 @@ static int adm_init_cal_data(void)
 		{adm_map_cal_data, adm_unmap_cal_data,
 		cal_utils_match_buf_num} },
 
+		{{ADM_LSM_AUDPROC_CAL_TYPE,
+		{adm_alloc_cal, adm_dealloc_cal, NULL,
+		adm_set_cal, NULL, NULL} },
+		{adm_map_cal_data, adm_unmap_cal_data,
+		cal_utils_match_buf_num} },
+
 		{{ADM_AUDVOL_CAL_TYPE,
 		{adm_alloc_cal, adm_dealloc_cal, NULL,
 		adm_set_cal, NULL, NULL} },
@@ -4460,7 +4482,7 @@ int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
 		goto unlock;
 	}
 
-	if (cal_index == ADM_AUDPROC_CAL) {
+	if (cal_index == ADM_AUDPROC_CAL || cal_index == ADM_LSM_AUDPROC_CAL) {
 		if (cal_block->cal_data.size > AUD_PROC_BLOCK_SIZE) {
 			pr_err("%s:audproc:invalid size exp/actual[%zd, %d]\n",
 				__func__, cal_block->cal_data.size, *size);

+ 45 - 10
dsp/q6afe.c

@@ -30,12 +30,14 @@
 enum {
 	AFE_COMMON_RX_CAL = 0,
 	AFE_COMMON_TX_CAL,
+	AFE_LSM_TX_CAL,
 	AFE_AANC_CAL,
 	AFE_FB_SPKR_PROT_CAL,
 	AFE_HW_DELAY_CAL,
 	AFE_SIDETONE_CAL,
 	AFE_SIDETONE_IIR_CAL,
 	AFE_TOPOLOGY_CAL,
+	AFE_LSM_TOPOLOGY_CAL,
 	AFE_CUST_TOPOLOGY_CAL,
 	AFE_FB_SPKR_PROT_TH_VI_CAL,
 	AFE_FB_SPKR_PROT_EX_VI_CAL,
@@ -1396,14 +1398,15 @@ err_exit:
 	return NULL;
 }
 
-static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id)
+static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id,
+				   int cal_type_index)
 {
 	int ret = 0;
 
 	struct cal_block_data   *cal_block = NULL;
 	struct audio_cal_info_afe_top   *afe_top_info = NULL;
 
-	if (this_afe.cal_data[AFE_TOPOLOGY_CAL] == NULL) {
+	if (this_afe.cal_data[cal_type_index] == NULL) {
 		pr_err("%s: [AFE_TOPOLOGY_CAL] not initialized\n", __func__);
 		return -EINVAL;
 	}
@@ -1413,9 +1416,9 @@ static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id)
 	}
 	*topology_id = 0;
 
-	mutex_lock(&this_afe.cal_data[AFE_TOPOLOGY_CAL]->lock);
+	mutex_lock(&this_afe.cal_data[cal_type_index]->lock);
 	cal_block = afe_find_cal_topo_id_by_port(
-		this_afe.cal_data[AFE_TOPOLOGY_CAL], port_id);
+		this_afe.cal_data[cal_type_index], port_id);
 	if (cal_block == NULL) {
 		pr_err("%s: [AFE_TOPOLOGY_CAL] not initialized for this port %d\n",
 				__func__, port_id);
@@ -1437,7 +1440,7 @@ static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id)
 		__func__, port_id, afe_top_info->acdb_id,
 		afe_top_info->topology, ret);
 unlock:
-	mutex_unlock(&this_afe.cal_data[AFE_TOPOLOGY_CAL]->lock);
+	mutex_unlock(&this_afe.cal_data[cal_type_index]->lock);
 	return ret;
 }
 
@@ -1455,7 +1458,12 @@ static int afe_send_port_topology_id(u16 port_id)
 		return -EINVAL;
 	}
 
-	ret = afe_get_cal_topology_id(port_id, &topology_id);
+	ret = afe_get_cal_topology_id(port_id, &topology_id, AFE_TOPOLOGY_CAL);
+	if (ret < 0) {
+		pr_debug("%s: Check for LSM topology\n", __func__);
+		ret = afe_get_cal_topology_id(port_id, &topology_id,
+					      AFE_LSM_TOPOLOGY_CAL);
+	}
 	if (ret || !topology_id) {
 		pr_debug("%s: AFE port[%d] get_cal_topology[%d] invalid!\n",
 				__func__, port_id, topology_id);
@@ -1572,7 +1580,7 @@ exit:
 	return cal_block;
 }
 
-static void send_afe_cal_type(int cal_index, int port_id)
+static int send_afe_cal_type(int cal_index, int port_id)
 {
 	struct cal_block_data		*cal_block = NULL;
 	int ret;
@@ -1583,19 +1591,22 @@ static void send_afe_cal_type(int cal_index, int port_id)
 	if (this_afe.cal_data[cal_index] == NULL) {
 		pr_warn("%s: cal_index %d not allocated!\n",
 			__func__, cal_index);
+		ret = -EINVAL;
 		goto done;
 	}
 
 	if (afe_port_index < 0) {
 		pr_err("%s: Error getting AFE port index %d\n",
 			__func__, afe_port_index);
+		ret = -EINVAL;
 		goto done;
 	}
 
 	mutex_lock(&this_afe.cal_data[cal_index]->lock);
 
 	if (((cal_index == AFE_COMMON_RX_CAL) ||
-	     (cal_index == AFE_COMMON_TX_CAL)) &&
+	     (cal_index == AFE_COMMON_TX_CAL) ||
+	     (cal_index == AFE_LSM_TX_CAL)) &&
 	    (this_afe.dev_acdb_id[afe_port_index] > 0))
 		cal_block = afe_find_cal(cal_index, port_id);
 	else
@@ -1604,6 +1615,7 @@ static void send_afe_cal_type(int cal_index, int port_id)
 
 	if (cal_block == NULL) {
 		pr_err("%s cal_block not found!!\n", __func__);
+		ret = -EINVAL;
 		goto unlock;
 	}
 
@@ -1613,6 +1625,7 @@ static void send_afe_cal_type(int cal_index, int port_id)
 	if (ret) {
 		pr_err("%s: Remap_cal_data failed for cal %d!\n",
 			__func__, cal_index);
+		ret = -EINVAL;
 		goto unlock;
 	}
 	ret = afe_send_cal_block(port_id, cal_block);
@@ -1622,16 +1635,20 @@ static void send_afe_cal_type(int cal_index, int port_id)
 unlock:
 	mutex_unlock(&this_afe.cal_data[cal_index]->lock);
 done:
-	return;
+	return ret;
 }
 
 void afe_send_cal(u16 port_id)
 {
+	int ret;
+
 	pr_debug("%s: port_id=0x%x\n", __func__, port_id);
 
 	if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_TX) {
 		afe_send_cal_spkr_prot_tx(port_id);
-		send_afe_cal_type(AFE_COMMON_TX_CAL, port_id);
+		ret = send_afe_cal_type(AFE_COMMON_TX_CAL, port_id);
+		if (ret < 0)
+			send_afe_cal_type(AFE_LSM_TX_CAL, port_id);
 	} else if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_RX) {
 		afe_send_cal_spkr_prot_rx(port_id);
 		send_afe_cal_type(AFE_COMMON_RX_CAL, port_id);
@@ -6914,6 +6931,9 @@ static int get_cal_type_index(int32_t cal_type)
 	case AFE_COMMON_TX_CAL_TYPE:
 		ret = AFE_COMMON_TX_CAL;
 		break;
+	case AFE_LSM_TX_CAL_TYPE:
+		ret = AFE_LSM_TX_CAL;
+		break;
 	case AFE_AANC_CAL_TYPE:
 		ret = AFE_AANC_CAL;
 		break;
@@ -6932,6 +6952,9 @@ static int get_cal_type_index(int32_t cal_type)
 	case AFE_TOPOLOGY_CAL_TYPE:
 		ret = AFE_TOPOLOGY_CAL;
 		break;
+	case AFE_LSM_TOPOLOGY_CAL_TYPE:
+		ret = AFE_LSM_TOPOLOGY_CAL;
+		break;
 	case AFE_CUST_TOPOLOGY_CAL_TYPE:
 		ret = AFE_CUST_TOPOLOGY_CAL;
 		break;
@@ -7434,6 +7457,12 @@ static int afe_init_cal_data(void)
 		{afe_map_cal_data, afe_unmap_cal_data,
 		cal_utils_match_buf_num} },
 
+		{{AFE_LSM_TX_CAL_TYPE,
+		{afe_alloc_cal, afe_dealloc_cal, NULL,
+		afe_set_cal, NULL, NULL} },
+		{afe_map_cal_data, afe_unmap_cal_data,
+		cal_utils_match_buf_num} },
+
 		{{AFE_AANC_CAL_TYPE,
 		{afe_alloc_cal, afe_dealloc_cal, NULL,
 		afe_set_cal, NULL, NULL} },
@@ -7466,6 +7495,12 @@ static int afe_init_cal_data(void)
 		{NULL, NULL,
 		cal_utils_match_buf_num} },
 
+		{{AFE_LSM_TOPOLOGY_CAL_TYPE,
+		{NULL, NULL, NULL,
+		afe_set_cal, NULL, NULL} },
+		{NULL, NULL,
+		cal_utils_match_buf_num} },
+
 		{{AFE_CUST_TOPOLOGY_CAL_TYPE,
 		{afe_alloc_cal, afe_dealloc_cal, NULL,
 		afe_set_cal, NULL, NULL} },

+ 2 - 0
include/dsp/q6adm-v2.h

@@ -32,6 +32,7 @@
 enum {
 	ADM_CUSTOM_TOP_CAL = 0,
 	ADM_AUDPROC_CAL,
+	ADM_LSM_AUDPROC_CAL,
 	ADM_AUDVOL_CAL,
 	ADM_RTAC_INFO_CAL,
 	ADM_RTAC_APR_CAL,
@@ -186,4 +187,5 @@ int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id,
 			int channel_index);
 void msm_dts_srs_acquire_lock(void);
 void msm_dts_srs_release_lock(void);
+void adm_set_lsm_port_id(int port_id);
 #endif /* __Q6_ADM_V2_H__ */

+ 10 - 0
include/uapi/linux/msm_audio_calibration.h

@@ -99,6 +99,10 @@ enum {
 	AFE_FB_SPKR_PROT_TH_VI_CAL_TYPE,
 	AFE_FB_SPKR_PROT_EX_VI_CAL_TYPE,
 	AFE_SIDETONE_IIR_CAL_TYPE,
+	AFE_LSM_TOPOLOGY_CAL_TYPE,
+	AFE_LSM_TX_CAL_TYPE,
+	ADM_LSM_TOPOLOGY_CAL_TYPE,
+	ADM_LSM_AUDPROC_CAL_TYPE,
 	MAX_CAL_TYPES,
 };
 
@@ -107,6 +111,12 @@ enum {
 
 #define AFE_SIDETONE_IIR_CAL_TYPE AFE_SIDETONE_IIR_CAL_TYPE
 
+#define AFE_LSM_TOPOLOGY_CAL_TYPE AFE_LSM_TOPOLOGY_CAL_TYPE
+#define AFE_LSM_TX_CAL_TYPE AFE_LSM_TX_CAL_TYPE
+#define ADM_LSM_TOPOLOGY_CAL_TYPE ADM_LSM_TOPOLOGY_CAL_TYPE
+#define ADM_LSM_AUDPROC_CAL_TYPE ADM_LSM_AUDPROC_CAL_TYPE
+#define LSM_CAL_TYPES
+
 #define TOPOLOGY_SPECIFIC_CHANNEL_INFO
 #define MSM_SPKR_PROT_SPV3