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

Commit e831b6b1 authored by Vatsal Bucha's avatar Vatsal Bucha Committed by Gerrit - the friendly Code Review server
Browse files

asoc: codecs: wcd937x: Read and store mic bias value



Mic bias value is needed in case of special headset
detection logic and the same needs to be read and stored
from device tree to be used by mbhc driver.

Change-Id: I0b120b8bb130a4d101c97e118395a11e74c921af
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent 82629d82
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -537,6 +537,7 @@ struct wcd_mbhc {
	bool gnd_swh; /*track GND switch NC / NO */
	u32 hs_thr;
	u32 hph_thr;
	u32 micb_mv;
	u32 swap_thr;
	u32 moist_vref;
	u32 moist_iref;
+10 −0
Original line number Diff line number Diff line
@@ -1031,6 +1031,7 @@ int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc, struct snd_soc_codec *codec,
{
	struct wcd937x_mbhc *wcd937x_mbhc = NULL;
	struct wcd_mbhc *wcd_mbhc = NULL;
	struct wcd937x_pdata *pdata;
	int ret = 0;

	if (!codec) {
@@ -1056,6 +1057,15 @@ int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc, struct snd_soc_codec *codec,
	/* Setting default mbhc detection logic to ADC */
	wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_ADC;

	pdata = dev_get_platdata(codec->dev);
	if (!pdata) {
		dev_err(codec->dev, "%s: pdata pointer is NULL\n",
			__func__);
		ret = -EINVAL;
		goto err;
	}
	wcd_mbhc->micb_mv = pdata->micbias.micb2_mv;

	ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb,
				&intr_ids, wcd_mbhc_registers,
				WCD937X_ZDET_SUPPORTED);