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

Commit b4eedf3c authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9335: Define callback function for hph pull down



Define callback function to control headphone auto
pull down for wcd9335. It is required for mbhc to
disable/enable the pull down on headphone when plug
detection is in progress.

Change-Id: I63774a9187124ea69a2baff9099102348d719c52
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent a728decb
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -1304,6 +1304,26 @@ static void tasha_mbhc_gnd_det_ctrl(struct snd_soc_codec *codec, bool enable)
	}
}

static void tasha_mbhc_hph_pull_down_ctrl(struct snd_soc_codec *codec,
					  bool enable)
{
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);

	if (enable) {
		snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
				    0x40, 0x40);
		if (TASHA_IS_2_0(tasha->wcd9xxx->version))
			snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
					    0x10, 0x10);
	} else {
		snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
				    0x40, 0x00);
		if (TASHA_IS_2_0(tasha->wcd9xxx->version))
			snd_soc_update_bits(codec, WCD9335_HPH_PA_CTL2,
					    0x10, 0x00);
	}
}

static const struct wcd_mbhc_cb mbhc_cb = {
	.request_irq = tasha_mbhc_request_irq,
	.irq_control = tasha_mbhc_irq_control,
@@ -1323,6 +1343,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
	.mbhc_micb_ctrl_thr_mic = tasha_mbhc_micb_ctrl_threshold_mic,
	.compute_impedance = tasha_wcd_mbhc_calc_impedance,
	.mbhc_gnd_det_ctrl = tasha_mbhc_gnd_det_ctrl,
	.hph_pull_down_ctrl = tasha_mbhc_hph_pull_down_ctrl,
};

static int tasha_get_anc_slot(struct snd_kcontrol *kcontrol,
@@ -8941,7 +8962,6 @@ static const struct tasha_reg_mask_val tasha_codec_reg_init_1_x_val[] = {
	{WCD9335_CDC_RX6_RX_PATH_MIX_CFG, 0x01, 0x01},
	{WCD9335_CDC_RX7_RX_PATH_MIX_CFG, 0x01, 0x01},
	{WCD9335_CDC_RX8_RX_PATH_MIX_CFG, 0x01, 0x01},
	{WCD9335_HPH_PA_CTL2, 0x40, 0x00},
};

static void tasha_update_reg_reset_values(struct snd_soc_codec *codec)