Browse Source

lpass-cdc: apply digital unmute after PA is enabled

Unmute digital volume after analog PA is enabled to reduce
pop issues.

Change-Id: Iae4a5b6df3c258e1ab9976bb0a47946c5a681b08
Phani Kumar Uppalapati 2 years ago
parent
commit
35ae7a451e

+ 21 - 9
asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c

@@ -859,6 +859,26 @@ static int lpass_cdc_wsa_macro_get_channel_map(struct snd_soc_dai *dai,
 	return 0;
 }
 
+static void lpass_cdc_wsa_unmute_interpolator(struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	uint16_t j = 0, reg = 0, mix_reg = 0;
+
+	switch (dai->id) {
+	case LPASS_CDC_WSA_MACRO_AIF1_PB:
+	case LPASS_CDC_WSA_MACRO_AIF_MIX1_PB:
+		for (j = 0; j < NUM_INTERPOLATORS; ++j) {
+			reg = LPASS_CDC_WSA_RX0_RX_PATH_CTL +
+				(j * LPASS_CDC_WSA_MACRO_RX_PATH_OFFSET);
+			mix_reg = LPASS_CDC_WSA_RX0_RX_PATH_MIX_CTL +
+				(j * LPASS_CDC_WSA_MACRO_RX_PATH_OFFSET);
+
+			snd_soc_component_update_bits(component, reg, 0x10, 0x00);
+			snd_soc_component_update_bits(component, mix_reg, 0x10, 0x00);
+		}
+	}
+}
+
 static int lpass_cdc_wsa_macro_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 {
 	struct snd_soc_component *component = dai->component;
@@ -905,6 +925,7 @@ static int lpass_cdc_wsa_macro_mute_stream(struct snd_soc_dai *dai, int mute, in
 		}
 	}
 	lpass_cdc_wsa_pa_on(wsa_dev, adie_lb);
+	lpass_cdc_wsa_unmute_interpolator(dai);
 	lpass_cdc_wsa_macro_enable_vi_decimator(component);
 		break;
 	default:
@@ -1841,20 +1862,15 @@ static int lpass_cdc_wsa_macro_spk_boost_event(struct snd_soc_dapm_widget *w,
 	struct snd_soc_component *component =
 				snd_soc_dapm_to_component(w->dapm);
 	u16 boost_path_ctl, boost_path_cfg1;
-	u16 reg, reg_mix;
 
 	dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
 
 	if (!strcmp(w->name, "WSA_RX INT0 CHAIN")) {
 		boost_path_ctl = LPASS_CDC_WSA_BOOST0_BOOST_PATH_CTL;
 		boost_path_cfg1 = LPASS_CDC_WSA_RX0_RX_PATH_CFG1;
-		reg = LPASS_CDC_WSA_RX0_RX_PATH_CTL;
-		reg_mix = LPASS_CDC_WSA_RX0_RX_PATH_MIX_CTL;
 	} else if (!strcmp(w->name, "WSA_RX INT1 CHAIN")) {
 		boost_path_ctl = LPASS_CDC_WSA_BOOST1_BOOST_PATH_CTL;
 		boost_path_cfg1 = LPASS_CDC_WSA_RX1_RX_PATH_CFG1;
-		reg = LPASS_CDC_WSA_RX1_RX_PATH_CTL;
-		reg_mix = LPASS_CDC_WSA_RX1_RX_PATH_MIX_CTL;
 	} else {
 		dev_err_ratelimited(component->dev, "%s: unknown widget: %s\n",
 			__func__, w->name);
@@ -1867,12 +1883,8 @@ static int lpass_cdc_wsa_macro_spk_boost_event(struct snd_soc_dapm_widget *w,
 						0x01, 0x01);
 		snd_soc_component_update_bits(component, boost_path_ctl,
 						0x10, 0x10);
-		if ((snd_soc_component_read(component, reg_mix)) & 0x10)
-			snd_soc_component_update_bits(component, reg_mix,
-						0x10, 0x00);
 		break;
 	case SND_SOC_DAPM_POST_PMU:
-		snd_soc_component_update_bits(component, reg, 0x10, 0x00);
 		break;
 	case SND_SOC_DAPM_POST_PMD:
 		snd_soc_component_update_bits(component, boost_path_ctl,

+ 21 - 9
asoc/codecs/lpass-cdc/lpass-cdc-wsa2-macro.c

@@ -858,6 +858,26 @@ static int lpass_cdc_wsa2_macro_get_channel_map(struct snd_soc_dai *dai,
 	return 0;
 }
 
+static void lpass_cdc_wsa2_unmute_interpolator(struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	uint16_t j = 0, reg = 0, mix_reg = 0;
+
+	switch (dai->id) {
+	case LPASS_CDC_WSA2_MACRO_AIF1_PB:
+	case LPASS_CDC_WSA2_MACRO_AIF_MIX1_PB:
+		for (j = 0; j < NUM_INTERPOLATORS; ++j) {
+			reg = LPASS_CDC_WSA2_RX0_RX_PATH_CTL +
+				(j * LPASS_CDC_WSA2_MACRO_RX_PATH_OFFSET);
+			mix_reg = LPASS_CDC_WSA2_RX0_RX_PATH_MIX_CTL +
+				(j * LPASS_CDC_WSA2_MACRO_RX_PATH_OFFSET);
+
+			snd_soc_component_update_bits(component, reg, 0x10, 0x00);
+			snd_soc_component_update_bits(component, mix_reg, 0x10, 0x00);
+		}
+	}
+}
+
 static int lpass_cdc_wsa2_macro_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 {
 	struct snd_soc_component *component = dai->component;
@@ -904,6 +924,7 @@ static int lpass_cdc_wsa2_macro_mute_stream(struct snd_soc_dai *dai, int mute, i
 		}
 	}
 	lpass_cdc_wsa_pa_on(wsa2_dev, adie_lb);
+	lpass_cdc_wsa2_unmute_interpolator(dai);
 	lpass_cdc_wsa2_macro_enable_vi_decimator(component);
 		break;
 	default:
@@ -1841,20 +1862,15 @@ static int lpass_cdc_wsa2_macro_spk_boost_event(struct snd_soc_dapm_widget *w,
 	struct snd_soc_component *component =
 				snd_soc_dapm_to_component(w->dapm);
 	u16 boost_path_ctl, boost_path_cfg1;
-	u16 reg, reg_mix;
 
 	dev_dbg(component->dev, "%s %s %d\n", __func__, w->name, event);
 
 	if (!strcmp(w->name, "WSA2_RX INT0 CHAIN")) {
 		boost_path_ctl = LPASS_CDC_WSA2_BOOST0_BOOST_PATH_CTL;
 		boost_path_cfg1 = LPASS_CDC_WSA2_RX0_RX_PATH_CFG1;
-		reg = LPASS_CDC_WSA2_RX0_RX_PATH_CTL;
-		reg_mix = LPASS_CDC_WSA2_RX0_RX_PATH_MIX_CTL;
 	} else if (!strcmp(w->name, "WSA2_RX INT1 CHAIN")) {
 		boost_path_ctl = LPASS_CDC_WSA2_BOOST1_BOOST_PATH_CTL;
 		boost_path_cfg1 = LPASS_CDC_WSA2_RX1_RX_PATH_CFG1;
-		reg = LPASS_CDC_WSA2_RX1_RX_PATH_CTL;
-		reg_mix = LPASS_CDC_WSA2_RX1_RX_PATH_MIX_CTL;
 	} else {
 		dev_err_ratelimited(component->dev, "%s: unknown widget: %s\n",
 			__func__, w->name);
@@ -1867,12 +1883,8 @@ static int lpass_cdc_wsa2_macro_spk_boost_event(struct snd_soc_dapm_widget *w,
 						0x01, 0x01);
 		snd_soc_component_update_bits(component, boost_path_ctl,
 						0x10, 0x10);
-		if ((snd_soc_component_read(component, reg_mix)) & 0x10)
-			snd_soc_component_update_bits(component, reg_mix,
-						0x10, 0x00);
 		break;
 	case SND_SOC_DAPM_POST_PMU:
-		snd_soc_component_update_bits(component, reg, 0x10, 0x00);
 		break;
 	case SND_SOC_DAPM_POST_PMD:
 		snd_soc_component_update_bits(component, boost_path_ctl,