浏览代码

asoc: codecs: wcd938x: 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: I11c8ac6b0abc7ba04b6750c59405794bc768dc42
Signed-off-by: Karthikeyan Mani <[email protected]>
Karthikeyan Mani 6 年之前
父节点
当前提交
c3d8c9f2c3
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      asoc/codecs/wcd938x/wcd938x-mbhc.c

+ 10 - 0
asoc/codecs/wcd938x/wcd938x-mbhc.c

@@ -1032,6 +1032,7 @@ int wcd938x_mbhc_init(struct wcd938x_mbhc **mbhc,
 	struct wcd938x_mbhc *wcd938x_mbhc = NULL;
 	struct wcd938x_mbhc *wcd938x_mbhc = NULL;
 	struct wcd_mbhc *wcd_mbhc = NULL;
 	struct wcd_mbhc *wcd_mbhc = NULL;
 	int ret = 0;
 	int ret = 0;
+	struct wcd938x_pdata *pdata;
 
 
 	if (!component) {
 	if (!component) {
 		pr_err("%s: component is NULL\n", __func__);
 		pr_err("%s: component is NULL\n", __func__);
@@ -1055,6 +1056,15 @@ int wcd938x_mbhc_init(struct wcd938x_mbhc **mbhc,
 	/* Setting default mbhc detection logic to ADC */
 	/* Setting default mbhc detection logic to ADC */
 	wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_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,
 	ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb,
 				&intr_ids, wcd_mbhc_registers,
 				&intr_ids, wcd_mbhc_registers,
 				WCD938X_ZDET_SUPPORTED);
 				WCD938X_ZDET_SUPPORTED);