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

Commit ddea8d00 authored by Bhalchandra Gajare's avatar Bhalchandra Gajare
Browse files

ASoC: wcd9xxx: Add codec specific settings to switch micbias to vddio



Micbias to the codec is sourced from LDO (either internal or external to
the codec). Micbias can also be enabled by switching the micbias to
vddio rail in the codec. The register settings changes between codecs.
Add capability to perform this setting specific to codec.

CRs-fixed: 539445
Change-Id: Ie55784ea990df5eba6ca35a97b431bbf93f0c945
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent b5214389
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2698,6 +2698,12 @@ static void msm8x10_wcd_micb_internal(struct snd_soc_codec *codec, bool on)
			    0x1C, on ? 0x14 : 0x00);
}

static void msm8x10_wcd_enable_mb_vddio(struct snd_soc_codec *codec, bool on)
{
	snd_soc_update_bits(codec, MSM8X10_WCD_A_MICB_CFILT_1_CTL,
			    0x40, on ? 0x40 : 0x00);
}

static const struct wcd9xxx_mbhc_cb mbhc_cb = {
	.enable_mux_bias_block = msm8x10_wcd_enable_mux_bias_block,
	.cfilt_fast_mode = msm8x10_wcd_put_cfilt_fast_mode,
@@ -2711,6 +2717,7 @@ static const struct wcd9xxx_mbhc_cb mbhc_cb = {
	.enable_mbhc_txfe = msm8x10_wcd_mbhc_txfe,
	.enable_mb_source = msm8x10_wcd_enable_ext_mb_source,
	.setup_int_rbias = msm8x10_wcd_micb_internal,
	.pull_mb_to_vddio = msm8x10_wcd_enable_mb_vddio,
};

static void delayed_hs_detect_fn(struct work_struct *work)
+12 −0
Original line number Diff line number Diff line
@@ -1224,6 +1224,12 @@ static void wcd9xxx_codec_hphr_gnd_switch(struct snd_soc_codec *codec, bool on)
static void wcd9xxx_onoff_vddio_switch(struct wcd9xxx_mbhc *mbhc, bool on)
{
	pr_debug("%s: vddio %d\n", __func__, on);

	if (mbhc->mbhc_cb && mbhc->mbhc_cb->pull_mb_to_vddio) {
		mbhc->mbhc_cb->pull_mb_to_vddio(mbhc->codec, on);
		goto exit;
	}

	if (on) {
		snd_soc_update_bits(mbhc->codec, mbhc->mbhc_bias_regs.mbhc_reg,
				    1 << 7, 1 << 7);
@@ -1235,6 +1241,12 @@ static void wcd9xxx_onoff_vddio_switch(struct wcd9xxx_mbhc *mbhc, bool on)
		snd_soc_update_bits(mbhc->codec, mbhc->mbhc_bias_regs.mbhc_reg,
				    1 << 7, 0);
	}

exit:
	/*
	 * Wait for the micbias to settle down to vddio
	 * when the micbias to vddio switch is enabled.
	 */
	if (on)
		usleep_range(10000, 10000);
}
+1 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ struct wcd9xxx_mbhc_cb {
	void (*enable_mbhc_txfe) (struct snd_soc_codec *, bool);
	int (*enable_mb_source) (struct snd_soc_codec *, bool);
	void (*setup_int_rbias) (struct snd_soc_codec *, bool);
	void (*pull_mb_to_vddio) (struct snd_soc_codec *, bool);
};

struct wcd9xxx_mbhc {