diff --git a/asoc/bengal.c b/asoc/bengal.c index bbf5413be8..22677cb258 100644 --- a/asoc/bengal.c +++ b/asoc/bengal.c @@ -31,8 +31,10 @@ #include "asoc/msm-cdc-pinctrl.h" #include "asoc/wcd-mbhc-v2.h" #include "codecs/wcd937x/wcd937x-mbhc.h" +#include "codecs/rouleur/rouleur-mbhc.h" #include "codecs/wsa881x-analog.h" #include "codecs/wcd937x/wcd937x.h" +#include "codecs/rouleur/rouleur.h" #include "codecs/bolero/bolero-cdc.h" #include #include "bengal-port-config.h" @@ -6054,9 +6056,13 @@ static int msm_aux_codec_init(struct snd_soc_component *component) struct snd_info_entry *entry; struct snd_card *card = component->card->snd_card; struct msm_asoc_mach_data *pdata; + struct platform_device *pdev = NULL; + char *data = NULL; + int i = 0; snd_soc_dapm_ignore_suspend(dapm, "EAR"); snd_soc_dapm_ignore_suspend(dapm, "AUX"); + snd_soc_dapm_ignore_suspend(dapm, "LO"); snd_soc_dapm_ignore_suspend(dapm, "HPHL"); snd_soc_dapm_ignore_suspend(dapm, "HPHR"); snd_soc_dapm_ignore_suspend(dapm, "AMIC1"); @@ -6077,14 +6083,49 @@ static int msm_aux_codec_init(struct snd_soc_component *component) } pdata->codec_root = entry; } - wcd937x_info_create_codec_entry(pdata->codec_root, component); + + for (i = 0; i < component->card->num_aux_devs; i++) + { + if (msm_aux_dev[i].name != NULL ) { + if (strstr(msm_aux_dev[i].name, "wsa")) + continue; + } + + if (msm_aux_dev[i].codec_of_node) { + pdev = of_find_device_by_node( + msm_aux_dev[i].codec_of_node); + if (pdev) + data = (char*) of_device_get_match_data( + &pdev->dev); + + if (data != NULL) { + if (!strncmp(data, "wcd937x", + sizeof("wcd937x"))) { + wcd937x_info_create_codec_entry( + pdata->codec_root, component); + break; + } else if (!strncmp(data, "rouleur", + sizeof("rouleur"))) { + rouleur_info_create_codec_entry( + pdata->codec_root, component); + break; + } + } + } + } mbhc_cfg_cal: mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; - ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); + if (data != NULL) { + if (!strncmp(data, "wcd937x", sizeof("wcd937x"))) + ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); + else if (!strncmp( data, "rouleur", sizeof("rouleur"))) + ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg); + } + if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); diff --git a/asoc/codecs/rouleur/rouleur-mbhc.c b/asoc/codecs/rouleur/rouleur-mbhc.c index 3e3ef51140..2e1db78df6 100644 --- a/asoc/codecs/rouleur/rouleur-mbhc.c +++ b/asoc/codecs/rouleur/rouleur-mbhc.c @@ -291,14 +291,14 @@ static void rouleur_mbhc_hph_l_pull_up_control( /* Default pull up current to 2uA */ if (pull_up_cur < I_OFF || pull_up_cur > I_3P0_UA || pull_up_cur == I_DEFAULT) - pull_up_cur = I_2P0_UA; + pull_up_cur = I_3P0_UA; dev_dbg(component->dev, "%s: HS pull up current:%d\n", __func__, pull_up_cur); snd_soc_component_update_bits(component, ROULEUR_ANA_MBHC_PLUG_DETECT_CTL, - 0xC0, pull_up_cur); + 0xC0, pull_up_cur << 6); } static int rouleur_mbhc_request_micbias(struct snd_soc_component *component, diff --git a/asoc/codecs/rouleur/rouleur-regmap.c b/asoc/codecs/rouleur/rouleur-regmap.c index 62502140ee..39982bd205 100644 --- a/asoc/codecs/rouleur/rouleur-regmap.c +++ b/asoc/codecs/rouleur/rouleur-regmap.c @@ -134,13 +134,11 @@ static bool rouleur_volatile_register(struct device *dev, unsigned int reg) if ((rouleur_reg_access_analog[ROULEUR_REG(reg)] & RD_REG) && !(rouleur_reg_access_analog[ROULEUR_REG(reg)] & WR_REG)) return true; - return false; if (reg > ROULEUR_DIG_BASE_ADDR && reg < ROULEUR_DIGITAL_REGISTERS_MAX_SIZE) if ((rouleur_reg_access_digital[ROULEUR_REG(reg)] & RD_REG) && !(rouleur_reg_access_digital[ROULEUR_REG(reg)] & WR_REG)) return true; - return false; return 0; } diff --git a/asoc/codecs/rouleur/rouleur.c b/asoc/codecs/rouleur/rouleur.c index 14dfd52f49..768b5e3455 100644 --- a/asoc/codecs/rouleur/rouleur.c +++ b/asoc/codecs/rouleur/rouleur.c @@ -2392,7 +2392,7 @@ static void rouleur_unbind(struct device *dev) } static const struct of_device_id rouleur_dt_match[] = { - { .compatible = "qcom,rouleur-codec" }, + { .compatible = "qcom,rouleur-codec" , .data = "rouleur" }, {} }; diff --git a/asoc/codecs/wcd937x/wcd937x.c b/asoc/codecs/wcd937x/wcd937x.c index c14480ac6c..725fef85b4 100644 --- a/asoc/codecs/wcd937x/wcd937x.c +++ b/asoc/codecs/wcd937x/wcd937x.c @@ -3132,7 +3132,7 @@ static void wcd937x_unbind(struct device *dev) } static const struct of_device_id wcd937x_dt_match[] = { - { .compatible = "qcom,wcd937x-codec" }, + { .compatible = "qcom,wcd937x-codec" , .data = "wcd937x" }, {} };