Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7aefc8a authored by Amit Shekhar's avatar Amit Shekhar
Browse files

ASoC: msm: qdsp6v2: Support adm open at multiple sample rate



Currently, "Audio Stream NN App type Cfg" mixer control receives
acdb id and app type only. Using these info, adm opens at only one
fixed sampling rate. By receiving sample rate in mixer control
command, adm topology selection and adm open is done at appropriate
sample rate along with other parameters. Audio calibration is also
sent and queried for the given sample rate.

Change-Id: I81da6f1a01472016ad420e7e02bb28602e8d518e
Signed-off-by: default avatarAmit Shekhar <ashekhar@codeaurora.org>
parent 3c4a9994
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ struct route_payload {
	unsigned int port_id[MAX_COPPS_PER_PORT];
	int app_type;
	int acdb_dev_id;
	int sample_rate;
	unsigned short num_copps;
	unsigned int session_id;
};
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ struct audio_cal_info_adm_top {
	/* RX_DEVICE or TX_DEVICE */
	int32_t		path;
	int32_t		app_type;
	int32_t         sample_rate;
};

struct audio_cal_info_audproc {
+6 −2
Original line number Diff line number Diff line
@@ -2017,6 +2017,7 @@ static int msm_compr_app_type_cfg_put(struct snd_kcontrol *kcontrol,
	u64 fe_id = kcontrol->private_value;
	int app_type;
	int acdb_dev_id;
	int sample_rate;

	pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
@@ -2027,9 +2028,12 @@ static int msm_compr_app_type_cfg_put(struct snd_kcontrol *kcontrol,

	app_type = ucontrol->value.integer.value[0];
	acdb_dev_id = ucontrol->value.integer.value[1];
	sample_rate = ucontrol->value.integer.value[2];
	pr_debug("%s: app_type- %d\n", __func__, app_type);
	pr_debug("%s: acdb_dev_id- %d\n", __func__, acdb_dev_id);
	msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id);
	pr_debug("%s: sample_rate- %d\n", __func__, sample_rate);
	msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type,
						acdb_dev_id, sample_rate);

	return 0;
}
@@ -2107,7 +2111,7 @@ static int msm_compr_app_type_cfg_info(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 4;
	uinfo->count = 5;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 0xFFFFFFFF;
	return 0;
+5 −1
Original line number Diff line number Diff line
@@ -1101,6 +1101,7 @@ static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
	u64 fe_id = kcontrol->private_value;
	int app_type;
	int acdb_dev_id;
	int sample_rate;

	pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
@@ -1111,9 +1112,12 @@ static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,

	app_type = ucontrol->value.integer.value[0];
	acdb_dev_id = ucontrol->value.integer.value[1];
	sample_rate = ucontrol->value.integer.value[2];
	pr_debug("%s: app_type- %d\n", __func__, app_type);
	pr_debug("%s: acdb_dev_id- %d\n", __func__, acdb_dev_id);
	msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id);
	pr_debug("%s: sample_rate- %d\n", __func__, sample_rate);
	msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type,
						acdb_dev_id, sample_rate);

	return 0;
}
+19 −12
Original line number Diff line number Diff line
@@ -307,10 +307,10 @@ static int msm_pcm_routing_get_app_type_idx(int app_type)
}

void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
	int acdb_dev_id)
	int acdb_dev_id, int sample_rate)
{
	pr_debug("%s: fedai_id- %d, app_type: %d\n", __func__, fedai_id,
		 app_type);
	pr_debug("%s: fedai_id %d, app_type %d, sample_rate %d\n",
		__func__, fedai_id, app_type, sample_rate);
	if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
		/* bad ID assigned in machine driver */
		pr_err("%s: bad MM ID %d\n", __func__, fedai_id);
@@ -318,6 +318,7 @@ void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
	}
	fe_dai_app_type_cfg[fedai_id].app_type = app_type;
	fe_dai_app_type_cfg[fedai_id].acdb_dev_id = acdb_dev_id;
	fe_dai_app_type_cfg[fedai_id].sample_rate = sample_rate;
}


@@ -344,7 +345,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 sample_rate)
{
	struct list_head		*ptr, *next;
	struct cal_block_data		*cal_block = NULL;
@@ -361,12 +363,13 @@ static struct cal_block_data *msm_routing_find_topology(int path,
			cal_block->cal_info;
		if ((cal_info->path == path)  &&
			(cal_info->app_type == app_type) &&
			(cal_info->acdb_id == acdb_id)) {
			(cal_info->acdb_id == acdb_id) &&
			(cal_info->sample_rate == sample_rate)) {
			return cal_block;
		}
	}
	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);
	pr_debug("%s: Can't find topology for path %d, app %d, acdb_id %d sample_rate %d defaulting to search by path\n",
		__func__, path, app_type, acdb_id, sample_rate);
	return msm_routing_find_topology_by_path(path);
}

@@ -374,7 +377,7 @@ static int msm_routing_get_adm_topology(int path, int fedai_id)
{
	int				topology = NULL_COPP_TOPOLOGY;
	struct cal_block_data		*cal_block = NULL;
	int app_type = 0, acdb_dev_id = 0;
	int app_type = 0, acdb_dev_id = 0, sample_rate = 0;
	pr_debug("%s\n", __func__);

	path = get_cal_path(path);
@@ -386,8 +389,10 @@ static int msm_routing_get_adm_topology(int path, int fedai_id)
	if (path == RX_DEVICE) {
		app_type = fe_dai_app_type_cfg[fedai_id].app_type;
		acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id;
		sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate;
	}
	cal_block = msm_routing_find_topology(path, app_type, acdb_dev_id);
	cal_block = msm_routing_find_topology(path, app_type,
					      acdb_dev_id, sample_rate);
	if (cal_block == NULL)
		goto unlock;

@@ -441,6 +446,7 @@ static void msm_pcm_routing_build_matrix(int fedai_id, int sess_type,
		payload.session_id = fe_dai_map[fedai_id][sess_type].strm_id;
		payload.app_type = fe_dai_app_type_cfg[fedai_id].app_type;
		payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id;
		payload.sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate;
		adm_matrix_map(path_type, payload, perf_mode);
		msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode);
	}
@@ -537,7 +543,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
				app_type_idx =
				msm_pcm_routing_get_app_type_idx(app_type);
				sample_rate =
					app_type_cfg[app_type_idx].sample_rate;
				fe_dai_app_type_cfg[fedai_id].sample_rate;
				bits_per_sample =
					app_type_cfg[app_type_idx].bit_width;
			} else
@@ -584,6 +590,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
		payload.session_id = fe_dai_map[fedai_id][session_type].strm_id;
		payload.app_type = fe_dai_app_type_cfg[fedai_id].app_type;
		payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id;
		payload.sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate;
		adm_matrix_map(path_type, payload, perf_mode);
		msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode);
	}
@@ -742,7 +749,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
				app_type_idx =
				msm_pcm_routing_get_app_type_idx(app_type);
				sample_rate =
					app_type_cfg[app_type_idx].sample_rate;
					fe_dai_app_type_cfg[val].sample_rate;
				bits_per_sample =
					app_type_cfg[app_type_idx].bit_width;
			} else
@@ -5084,7 +5091,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
				app_type_idx =
				msm_pcm_routing_get_app_type_idx(app_type);
				sample_rate =
					app_type_cfg[app_type_idx].sample_rate;
					fe_dai_app_type_cfg[i].sample_rate;
				bits_per_sample =
					app_type_cfg[app_type_idx].bit_width;
			} else
Loading