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

Commit d4c49032 authored by Hongtao Peng's avatar Hongtao Peng Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: extend audio stream app type cfg mixer with bit width



With above extended mixer commands, bit width can be achieved
from fe_dai_app_type_cfg by FE, BE and session type.

Change-Id: I09596ac27b4327a94139b9da0e04befac45c3f30
Signed-off-by: default avatarHongtao Peng <hongtaop@codeaurora.org>
parent d48f0b5e
Loading
Loading
Loading
Loading

asoc/msm-pcm-loopback-v2.c

100755 → 100644
+22 −14
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
	u64 fe_id = kcontrol->private_value;
	int session_type = SESSION_TYPE_RX;
	int be_id = ucontrol->value.integer.value[3];
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0};
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
	int ret = 0;

	cfg_data.app_type = ucontrol->value.integer.value[0];
@@ -692,10 +692,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
		cfg_data.sample_rate = ucontrol->value.integer.value[2];
	if (ucontrol->value.integer.value[4] != 0)
		cfg_data.copp_token = ucontrol->value.integer.value[4];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
	if (ucontrol->value.integer.value[5] != 0)
		cfg_data.bit_width = ucontrol->value.integer.value[5];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
		cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
	ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
						      be_id, &cfg_data);
	if (ret < 0)
@@ -727,10 +729,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
	ucontrol->value.integer.value[2] = cfg_data.sample_rate;
	ucontrol->value.integer.value[3] = be_id;
	ucontrol->value.integer.value[4] = cfg_data.copp_token;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
	ucontrol->value.integer.value[5] = cfg_data.bit_width;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
		cfg_data.copp_token, cfg_data.bit_width);

done:
	return ret;
@@ -742,7 +746,7 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
	u64 fe_id = kcontrol->private_value;
	int session_type = SESSION_TYPE_TX;
	int be_id = ucontrol->value.integer.value[3];
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0};
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
	int ret = 0;

	cfg_data.app_type = ucontrol->value.integer.value[0];
@@ -751,10 +755,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
		cfg_data.sample_rate = ucontrol->value.integer.value[2];
	if (ucontrol->value.integer.value[4] != 0)
		cfg_data.copp_token = ucontrol->value.integer.value[4];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
	if (ucontrol->value.integer.value[5] != 0)
		cfg_data.bit_width = ucontrol->value.integer.value[5];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
		cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
	ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
						      be_id, &cfg_data);
	if (ret < 0)
@@ -786,10 +792,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
	ucontrol->value.integer.value[2] = cfg_data.sample_rate;
	ucontrol->value.integer.value[3] = be_id;
	ucontrol->value.integer.value[4] = cfg_data.copp_token;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
	ucontrol->value.integer.value[5] = cfg_data.bit_width;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
		cfg_data.copp_token, cfg_data.bit_width);
done:
	return ret;
}

asoc/msm-pcm-q6-v2.c

100755 → 100644
+24 −18
Original line number Diff line number Diff line
@@ -2091,7 +2091,7 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
	u64 fe_id = kcontrol->private_value;
	int session_type = SESSION_TYPE_RX;
	int be_id = ucontrol->value.integer.value[3];
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0};
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
	int ret = 0;

	cfg_data.app_type = ucontrol->value.integer.value[0];
@@ -2100,10 +2100,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
		cfg_data.sample_rate = ucontrol->value.integer.value[2];
	if (ucontrol->value.integer.value[4] != 0)
		cfg_data.copp_token = ucontrol->value.integer.value[4];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
	if (ucontrol->value.integer.value[5] != 0)
		cfg_data.bit_width = ucontrol->value.integer.value[5];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
		cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
	ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
						      be_id, &cfg_data);
	if (ret < 0)
@@ -2135,10 +2137,11 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
	ucontrol->value.integer.value[2] = cfg_data.sample_rate;
	ucontrol->value.integer.value[3] = be_id;
	ucontrol->value.integer.value[4] = cfg_data.copp_token;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
	ucontrol->value.integer.value[5] = cfg_data.bit_width;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
		cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
done:
	return ret;
}
@@ -2149,7 +2152,7 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
	u64 fe_id = kcontrol->private_value;
	int session_type = SESSION_TYPE_TX;
	int be_id = ucontrol->value.integer.value[3];
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0};
	struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
	int ret = 0;

	cfg_data.app_type = ucontrol->value.integer.value[0];
@@ -2158,10 +2161,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
		cfg_data.sample_rate = ucontrol->value.integer.value[2];
	if (ucontrol->value.integer.value[4] != 0)
		cfg_data.copp_token = ucontrol->value.integer.value[4];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
	if (ucontrol->value.integer.value[5] != 0)
		cfg_data.bit_width = ucontrol->value.integer.value[5];
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
		cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
	ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
						      be_id, &cfg_data);
	if (ret < 0)
@@ -2193,10 +2198,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
	ucontrol->value.integer.value[2] = cfg_data.sample_rate;
	ucontrol->value.integer.value[3] = be_id;
	ucontrol->value.integer.value[4] = cfg_data.copp_token;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n",
		__func__, fe_id, session_type, be_id,
		cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
		cfg_data.copp_token);
	ucontrol->value.integer.value[5] = cfg_data.bit_width;
	pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
		"sample_rate- %d copp_token- %d bit_width- %d\n",
		__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
		cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
done:
	return ret;
}
+16 −4
Original line number Diff line number Diff line
@@ -1480,10 +1480,12 @@ int msm_pcm_routing_reg_stream_app_type_cfg(
		goto done;
	}
	pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d copp_token %d\n",
	pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d,"
		"sample_rate %d, copp_token %d, bit_width %d\n",
		__func__, fedai_id, session_type, be_id,
		cfg_data->app_type, cfg_data->acdb_dev_id,
		cfg_data->sample_rate, cfg_data->copp_token);
		cfg_data->sample_rate, cfg_data->copp_token,
		cfg_data->bit_width);
	if (!is_mm_lsm_fe_id(fedai_id)) {
		pr_err("%s: Invalid machine driver ID %d\n",
@@ -1566,10 +1568,12 @@ int msm_pcm_routing_get_stream_app_type_cfg(
	*bedai_id = be_id;
	*cfg_data = fe_dai_app_type_cfg[fedai_id][session_type][be_id];
	pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d copp_token %d\n",
	pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d,"
		"sample_rate %d, copp_token %d, bit_width %d\n",
		__func__, fedai_id, session_type, *bedai_id,
		cfg_data->app_type, cfg_data->acdb_dev_id,
		cfg_data->sample_rate, cfg_data->copp_token);
		cfg_data->sample_rate, cfg_data->copp_token,
		cfg_data->bit_width);
done:
	return ret;
}
@@ -1990,6 +1994,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
				sample_rate =
			fe_dai_app_type_cfg[fe_id][session_type][i].sample_rate;
				bit_width =
					(fe_dai_app_type_cfg[fe_id][session_type][i].bit_width) ?
					fe_dai_app_type_cfg[fe_id][session_type][i].bit_width :
					app_type_cfg[app_type_idx].bit_width;
				copp_token =
			fe_dai_app_type_cfg[fe_id][session_type][i].copp_token;
@@ -2362,6 +2368,8 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
				fe_dai_app_type_cfg[fedai_id][session_type][i]
					.sample_rate;
				bits_per_sample =
					(fe_dai_app_type_cfg[fedai_id][session_type][i].bit_width) ?
					fe_dai_app_type_cfg[fedai_id][session_type][i].bit_width :
					app_type_cfg[app_type_idx].bit_width;
				copp_token =
				fe_dai_app_type_cfg[fedai_id][session_type][i]
@@ -2674,6 +2682,8 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
				fe_dai_app_type_cfg[val][session_type][reg]
					.sample_rate;
				bits_per_sample =
					(fe_dai_app_type_cfg[val][session_type][reg].bit_width) ?
					fe_dai_app_type_cfg[val][session_type][reg].bit_width :
					app_type_cfg[app_type_idx].bit_width;
				copp_token =
				fe_dai_app_type_cfg[val][session_type][reg]
@@ -41457,6 +41467,8 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
					fe_dai_app_type_cfg[i][session_type]
							   [be_id].sample_rate;
				bits_per_sample =
					(fe_dai_app_type_cfg[i][session_type][be_id].bit_width) ?
					fe_dai_app_type_cfg[i][session_type][be_id].bit_width :
					app_type_cfg[app_type_idx].bit_width;
				copp_token =
					fe_dai_app_type_cfg[i][session_type]
+1 −0
Original line number Diff line number Diff line
@@ -742,6 +742,7 @@ struct msm_pcm_stream_app_type_cfg {
	int acdb_dev_id;
	int sample_rate;
	uint32_t copp_token;
	int bit_width;
};

/* dai_id: front-end ID,