asoc: codecs: Fix button interrupts issue in rouleur

Current source mode in rouleur does not work
properly leading to issues in button interrupts
and fake electrical removal interrupts.
Enable pull up mode instead of current source
mode to fix these issues. Modify the headset
max vref voltage to 1.7 volts and micbias
calculation logic.

Change-Id: If3e4a2fdcf080b07fe3c363b6eb6115f101b91f4
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:
Aditya Bavanari
2020-04-23 18:57:27 +05:30
committad av Gerrit - the friendly Code Review server
förälder 1db5a7d432
incheckning c3fd6cc305
6 ändrade filer med 118 tillägg och 19 borttagningar

Visa fil

@@ -80,11 +80,17 @@ static void wcd_program_hs_vref(struct wcd_mbhc *mbhc)
struct snd_soc_component *component = mbhc->component;
u32 reg_val;
plug_type_cfg = WCD_MBHC_CAL_PLUG_TYPE_PTR(mbhc->mbhc_cfg->calibration);
reg_val = ((plug_type_cfg->v_hs_max - HS_VREF_MIN_VAL) / 100);
if (mbhc->mbhc_cb->hs_vref_max_update) {
mbhc->mbhc_cb->hs_vref_max_update(mbhc);
} else {
plug_type_cfg = WCD_MBHC_CAL_PLUG_TYPE_PTR(
mbhc->mbhc_cfg->calibration);
reg_val = ((plug_type_cfg->v_hs_max - HS_VREF_MIN_VAL) / 100);
dev_dbg(component->dev, "%s: reg_val = %x\n", __func__, reg_val);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_VREF, reg_val);
dev_dbg(component->dev, "%s: reg_val = %x\n",
__func__, reg_val);
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_VREF, reg_val);
}
}
static void wcd_program_btn_threshold(const struct wcd_mbhc *mbhc, bool micbias)
@@ -993,6 +999,14 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
mbhc->mbhc_cb->enable_mb_source(mbhc, true);
mbhc->btn_press_intr = false;
mbhc->is_btn_press = false;
/*
* When current source mode doesn't work properly
* use mic bias pull up mode for button interrupts
* to function properly
*/
if (mbhc->mbhc_cb->mbhc_micb_pullup_control)
mbhc->mbhc_cb->mbhc_micb_pullup_control(component,
true);
if (mbhc->mbhc_fn)
mbhc->mbhc_fn->wcd_mbhc_detect_plug_type(mbhc);
} else if ((mbhc->current_plug != MBHC_PLUG_TYPE_NONE)
@@ -1070,6 +1084,10 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
false);
}
if (mbhc->mbhc_cb->mbhc_micb_pullup_control)
mbhc->mbhc_cb->mbhc_micb_pullup_control(component,
false);
} else if (!detection_type) {
/* Disable external voltage source to micbias if present */
if (mbhc->mbhc_cb->enable_mb_source)