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

Commit 16bfcd8c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "asoc: Add HiFi Filter support in driver"

parents 203c6c4e b6ef9e03
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ static int msm_route_ext_ec_ref;
static bool is_custom_stereo_on;
static bool is_ds2_on;
static bool swap_ch;
static bool hifi_filter_enabled;
static int aanc_level;
static int num_app_cfg_types;
static int msm_ec_ref_port_id;
@@ -1524,6 +1525,9 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
				topology = COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY;
			pr_debug("%s: Before adm open topology %d\n", __func__,
				topology);
			if (hifi_filter_enabled)
				bit_width = msm_routing_get_bit_width(
						SNDRV_PCM_FORMAT_S32_LE);
			copp_idx =
				adm_open(port_id, path_type, sample_rate,
@@ -1869,6 +1873,9 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
			topology = msm_routing_get_adm_topology(fedai_id,
								session_type,
								i);
			if (hifi_filter_enabled)
				bits_per_sample = msm_routing_get_bit_width(
							SNDRV_PCM_FORMAT_S32_LE);
			copp_idx = adm_open(port_id, path_type,
					    sample_rate, channels, topology,
					    perf_mode, bits_per_sample,
@@ -2136,6 +2143,9 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
								reg);
			acdb_dev_id =
			fe_dai_app_type_cfg[val][session_type][reg].acdb_dev_id;
			if (hifi_filter_enabled)
				bits_per_sample = msm_routing_get_bit_width(
							SNDRV_PCM_FORMAT_S32_LE);
			copp_idx = adm_open(port_id, path_type,
					    sample_rate, channels, topology,
					    fdai->perf_mode, bits_per_sample,
@@ -21746,6 +21756,28 @@ static const struct snd_kcontrol_new use_ds1_or_ds2_controls[] = {
	msm_routing_put_use_ds1_or_ds2_control),
};
static int msm_routing_get_hifi_filter_control(
					struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.integer.value[0] = hifi_filter_enabled;
	return 0;
}
static int msm_routing_put_hifi_filter_control(
					struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	hifi_filter_enabled = ucontrol->value.integer.value[0];
	return 0;
}
static const struct snd_kcontrol_new hifi_filter_controls[] = {
	SOC_SINGLE_EXT("HiFi Filter", SND_SOC_NOPM, 0,
		1, 0, msm_routing_get_hifi_filter_control,
		msm_routing_put_hifi_filter_control),
};
int msm_routing_get_rms_value_control(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol) {
	int rc = 0;
@@ -28450,6 +28482,9 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
				|| (fdai->passthr_mode == COMPRESSED_PASSTHROUGH_IEC61937))
				topology = COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY;
			if (hifi_filter_enabled)
				bits_per_sample = msm_routing_get_bit_width(
							SNDRV_PCM_FORMAT_S32_LE);
			copp_idx = adm_open(port_id, path_type,
					    sample_rate, channels, topology,
					    fdai->perf_mode, bits_per_sample,
@@ -29049,6 +29084,10 @@ static int msm_routing_probe(struct snd_soc_component *component)
			use_ds1_or_ds2_controls,
			ARRAY_SIZE(use_ds1_or_ds2_controls));
	snd_soc_add_component_controls(component,
			hifi_filter_controls,
			ARRAY_SIZE(hifi_filter_controls));
	snd_soc_add_component_controls(component,
				device_pp_params_mixer_controls,
				ARRAY_SIZE(device_pp_params_mixer_controls));