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

Commit eb039296 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: WCD9XXX: Add configurable micbias option for headset detection"

parents 7a8b9a31 1e6369d2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2692,6 +2692,12 @@ static int msm8x10_wcd_enable_ext_mb_source(struct snd_soc_codec *codec,
	return ret;
}

static void msm8x10_wcd_micb_internal(struct snd_soc_codec *codec, bool on)
{
	snd_soc_update_bits(codec, MSM8X10_WCD_A_MICB_1_INT_RBIAS,
			    0x1C, on ? 0x14 : 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,
@@ -2704,6 +2710,7 @@ static const struct wcd9xxx_mbhc_cb mbhc_cb = {
	.enable_clock_gate = msm8x10_wcd_mbhc_clk_gate,
	.enable_mbhc_txfe = msm8x10_wcd_mbhc_txfe,
	.enable_mb_source = msm8x10_wcd_enable_ext_mb_source,
	.setup_int_rbias = msm8x10_wcd_micb_internal,
};

static void delayed_hs_detect_fn(struct work_struct *work)
+12 −0
Original line number Diff line number Diff line
@@ -3948,6 +3948,18 @@ int wcd9xxx_mbhc_start(struct wcd9xxx_mbhc *mbhc,
		snd_soc_update_bits(codec, mbhc->mbhc_bias_regs.cfilt_ctl,
		0x40, WCD9XXX_CFILT_FAST_MODE);

	/*
	 * setup internal micbias if codec uses internal micbias for
	 * headset detection
	 */
	if (mbhc->mbhc_cfg->use_int_rbias) {
		if (mbhc->mbhc_cb && mbhc->mbhc_cb->setup_int_rbias)
			mbhc->mbhc_cb->setup_int_rbias(codec, true);
		else
			pr_info("%s: internal bias is requested but codec did not provide callback\n",
				__func__);
	}

	/*
	 * If codec has specific clock gating for MBHC,
	 * remove the clock gate
+2 −0
Original line number Diff line number Diff line
@@ -227,6 +227,7 @@ struct wcd9xxx_mbhc_config {
	/* swap_gnd_mic returns true if extern GND/MIC swap switch toggled */
	bool (*swap_gnd_mic) (struct snd_soc_codec *);
	unsigned long cs_enable_flags;
	bool use_int_rbias;
};

struct wcd9xxx_cfilt_mode {
@@ -252,6 +253,7 @@ struct wcd9xxx_mbhc_cb {
	void (*compute_impedance) (s16 *, s16 *, uint32_t *, uint32_t *);
	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);
};

struct wcd9xxx_mbhc {