From cad43d67ca5b4c189a3c29ea46ad4805fde592c2 Mon Sep 17 00:00:00 2001 From: "Vangala, Amarnath" Date: Wed, 19 Aug 2020 02:36:28 +0530 Subject: [PATCH] asoc: holi: add wcd937x mbhc detection at probe Add support for wcd937x mbhc detetion at probe. Change-Id: Ibcd04d2670ff1d9c8535d098e11f58448cf3c15e Signed-off-by: Vangala, Amarnath --- asoc/holi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/asoc/holi.c b/asoc/holi.c index b5fa3d0b34..b9cfbf7cf8 100644 --- a/asoc/holi.c +++ b/asoc/holi.c @@ -6368,6 +6368,7 @@ static int msm_aux_codec_init(struct snd_soc_pcm_runtime *rtd) struct snd_info_entry *entry; struct snd_card *card = NULL; struct msm_asoc_mach_data *pdata; + bool is_wcd938x = false; pdata = snd_soc_card_get_drvdata(rtd->card); if(!pdata) @@ -6387,9 +6388,11 @@ static int msm_aux_codec_init(struct snd_soc_pcm_runtime *rtd) } component = snd_soc_rtdcom_lookup(rtd, WCD938X_DRV_NAME); - if (!component) { + if (!component) component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME); - } + else + is_wcd938x = true; + if (!component) { pr_err("%s component is NULL\n", __func__); return -EINVAL; @@ -6460,7 +6463,12 @@ mbhc_cfg_cal: if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; - ret = wcd938x_mbhc_hs_detect(component, &wcd_mbhc_cfg); + + if (is_wcd938x) + ret = wcd938x_mbhc_hs_detect(component, &wcd_mbhc_cfg); + else + ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); + if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret);