From 39e74d93ad75c0d2a3e83d92c5e5c5a0dbb6ea54 Mon Sep 17 00:00:00 2001 From: Florian Muller Date: Fri, 22 Jul 2022 12:51:43 -0700 Subject: mic: enable MIC BIAS1 (mic power rail) at probe time on some eos HW This is to enable the mic power rail by default at besbev probe time on eos-nff-v2.0 and p11-nff-v1.1. On future HW, the mic power rail is directly hooked to an always-on rail, so there is no need for this. Test: Manual Bug: 219605378 Bug: 230784223 Signed-off-by: Florian Muller Change-Id: Iaff96ec65838763a78aacbd17dcea360705dc7eb --- asoc/codecs/besbev/besbev.c | 15 +++++++++++++++ asoc/codecs/besbev/internal.h | 5 +++++ 2 files changed, 20 insertions(+) (limited to 'asoc') diff --git a/asoc/codecs/besbev/besbev.c b/asoc/codecs/besbev/besbev.c index f510fb25..19c5bd8a 100644 --- a/asoc/codecs/besbev/besbev.c +++ b/asoc/codecs/besbev/besbev.c @@ -2066,6 +2066,10 @@ static int besbev_soc_codec_probe(struct snd_soc_component *component) besbev->low_soc = false; besbev->dev_up = true; +#ifdef CONFIG_GOOGLE_EOS_AUDIO + if (besbev->mic_bias1_always_on) + besbev_micbias_control(component, MIC_BIAS_1, MICB_ENABLE, true); +#endif /* Register notifier to change gain based on state of charge */ INIT_WORK(&besbev->soc_eval_work, besbev_evaluate_soc); besbev->psy_nb.notifier_call = besbev_battery_supply_cb; @@ -2303,6 +2307,14 @@ struct besbev_pdata *besbev_populate_dt_data(struct device *dev) besbev_dt_parse_micbias_info(dev, &pdata->micbias); +#ifdef CONFIG_GOOGLE_EOS_AUDIO + /* + * On some HW revisions we want to always enable MIC BIAS1. + */ + pdata->mic_bias1_always_on = of_property_read_bool(dev->of_node, + "google,mic-bias1-always-on"); +#endif + return pdata; } @@ -2386,6 +2398,9 @@ static int besbev_bind(struct device *dev) besbev->reset_reg = pdata->reset_reg; besbev->foundry_id_reg = pdata->foundry_id_reg; besbev->speaker_present = pdata->speaker_present; +#ifdef CONFIG_GOOGLE_EOS_AUDIO + besbev->mic_bias1_always_on = pdata->mic_bias1_always_on; +#endif ret = msm_cdc_init_supplies(dev, &besbev->supplies, pdata->regulator, pdata->num_supplies); if (!besbev->supplies) { diff --git a/asoc/codecs/besbev/internal.h b/asoc/codecs/besbev/internal.h index f585f0de..7edbc6cb 100644 --- a/asoc/codecs/besbev/internal.h +++ b/asoc/codecs/besbev/internal.h @@ -59,6 +59,7 @@ struct besbev_priv { #ifdef CONFIG_GOOGLE_EOS_AUDIO int micbias_en[BESBEV_MAX_MICBIAS]; + bool mic_bias1_always_on; #endif int variant; int pa_mute; @@ -161,6 +162,10 @@ struct besbev_pdata { int reset_reg; int foundry_id_reg; bool speaker_present; + +#ifdef CONFIG_GOOGLE_EOS_AUDIO + bool mic_bias1_always_on; +#endif }; struct wcd_ctrl_platform_data { -- cgit v1.2.3