Browse Source

asoc: msm-pcm-routing: add msm_pcm_routing_get_pp_ch_cnt

Based on the type of pre/post processing, it is possible that
the processed channel count could be different from the input
channel count. As an example, the FFECNS processing block
could accept 3 channel input and has the ability to output
upto 9 channels of processed data. In cases like these, the
stream side needs to know the processed channel count to set
up its own configuration. Change adds functionality in
routing driver to read the processed channel count.

Change-Id: I06c365f8c53270712709631bc23649d37434f405
Signed-off-by: Bhalchandra Gajare <[email protected]>
Bhalchandra Gajare 6 years ago
parent
commit
3b1c926e42
2 changed files with 34 additions and 0 deletions
  1. 33 0
      asoc/msm-pcm-routing-v2.c
  2. 1 0
      asoc/msm-pcm-routing-v2.h

+ 33 - 0
asoc/msm-pcm-routing-v2.c

@@ -1197,6 +1197,39 @@ static bool route_check_fe_id_adm_support(int fe_id)
 	return rc;
 }
 
+/*
+ * msm_pcm_routing_get_pp_ch_cnt:
+ *	Read the processed channel count
+ *
+ * @fe_id: Front end ID
+ * @session_type: Inidicates RX or TX session type
+ */
+int msm_pcm_routing_get_pp_ch_cnt(int fe_id, int session_type)
+{
+	struct msm_pcm_stream_app_type_cfg cfg_data;
+	int be_id = 0, app_type_idx = 0, app_type = 0;
+	int ret;
+
+	memset(&cfg_data, 0, sizeof(cfg_data));
+
+	if (!is_mm_lsm_fe_id(fe_id)) {
+		pr_err("%s: bad MM ID\n", __func__);
+		return -EINVAL;
+	}
+
+	ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type,
+						      &be_id, &cfg_data);
+	if (ret) {
+		pr_err("%s: cannot get stream app type cfg\n");
+		return ret;
+	}
+
+	app_type = cfg_data.app_type;
+	app_type_idx = msm_pcm_routing_get_lsm_app_type_idx(app_type);
+	return lsm_app_type_cfg[app_type_idx].num_out_channels;
+}
+EXPORT_SYMBOL(msm_pcm_routing_get_pp_ch_cnt);
+
 int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
 					  int dspst_id, int stream_type,
 					  uint32_t passthr_mode)

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

@@ -549,4 +549,5 @@ int msm_pcm_routing_get_stream_app_type_cfg(
 int msm_pcm_routing_send_chmix_cfg(int fe_id, int ip_channel_cnt,
 	int op_channel_cnt, int *ch_wght_coeff,
 	int session_type, int stream_type);
+int msm_pcm_routing_get_pp_ch_cnt(int fe_id, int session_type);
 #endif /*_MSM_PCM_H*/