From 75fbc2d27dc033cd859d96efdb111f54436ccf4b Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Mon, 8 Jul 2019 11:59:32 +0530 Subject: [PATCH] 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: Vatsal Bucha --- asoc/codecs/wcd937x/wcd937x-mbhc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/asoc/codecs/wcd937x/wcd937x-mbhc.c b/asoc/codecs/wcd937x/wcd937x-mbhc.c index 4ad8683a49..5ac7245a0f 100644 --- a/asoc/codecs/wcd937x/wcd937x-mbhc.c +++ b/asoc/codecs/wcd937x/wcd937x-mbhc.c @@ -1051,6 +1051,7 @@ int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc, { struct wcd937x_mbhc *wcd937x_mbhc = NULL; struct wcd_mbhc *wcd_mbhc = NULL; + struct wcd937x_pdata *pdata; int ret = 0; if (!component) { @@ -1076,6 +1077,15 @@ int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc, /* Setting default mbhc detection logic to ADC */ wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_ADC; + pdata = dev_get_platdata(component->dev); + if (!pdata) { + dev_err(component->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, component, &mbhc_cb, &intr_ids, wcd_mbhc_registers, WCD937X_ZDET_SUPPORTED);