mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
Merge "asoc: mbhc: fix for fake ins irq"
This commit is contained in:
commit
56f65ecca2
3 changed files with 21 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
#define WCD_MBHC_ADC_HS_THRESHOLD_MV 1700
|
||||
#define WCD_MBHC_ADC_HPH_THRESHOLD_MV 75
|
||||
#define WCD_MBHC_ADC_MICBIAS_MV 1800
|
||||
#define WCD_MBHC_FAKE_INS_RETRY 4
|
||||
|
||||
static int wcd_mbhc_get_micbias(struct wcd_mbhc *mbhc)
|
||||
{
|
||||
|
|
@ -1021,6 +1022,8 @@ exit:
|
|||
static irqreturn_t wcd_mbhc_adc_hs_ins_irq(int irq, void *data)
|
||||
{
|
||||
struct wcd_mbhc *mbhc = data;
|
||||
u8 clamp_state = 0;
|
||||
u8 clamp_retry = WCD_MBHC_FAKE_INS_RETRY;
|
||||
|
||||
pr_debug("%s: enter\n", __func__);
|
||||
|
||||
|
|
@ -1035,6 +1038,19 @@ static irqreturn_t wcd_mbhc_adc_hs_ins_irq(int irq, void *data)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
do {
|
||||
WCD_MBHC_REG_READ(WCD_MBHC_IN2P_CLAMP_STATE, clamp_state);
|
||||
if (clamp_state) {
|
||||
pr_debug("%s: fake insertion irq, leave\n", __func__);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
/*
|
||||
* check clamp for 120ms but at 30ms chunks to leave
|
||||
* room for other interrupts to be processed
|
||||
*/
|
||||
usleep_range(30000, 30100);
|
||||
} while (--clamp_retry);
|
||||
|
||||
WCD_MBHC_RSC_LOCK(mbhc);
|
||||
/*
|
||||
* If current plug is headphone then there is no chance to
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ enum wcd_mbhc_register_function {
|
|||
WCD_MBHC_BTN_DBNC,
|
||||
WCD_MBHC_HS_VREF,
|
||||
WCD_MBHC_HS_COMP_RESULT,
|
||||
WCD_MBHC_IN2P_CLAMP_STATE,
|
||||
WCD_MBHC_MIC_SCHMT_RESULT,
|
||||
WCD_MBHC_HPHL_SCHMT_RESULT,
|
||||
WCD_MBHC_HPHR_SCHMT_RESULT,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
|
@ -86,6 +86,8 @@ static struct wcd_mbhc_register
|
|||
WCD934X_MBHC_NEW_CTL_2, 0x03, 0, 0),
|
||||
WCD_MBHC_REGISTER("WCD_MBHC_HS_COMP_RESULT",
|
||||
WCD934X_ANA_MBHC_RESULT_3, 0x08, 3, 0),
|
||||
WCD_MBHC_REGISTER("WCD_MBHC_IN2P_CLAMP_STATE",
|
||||
WCD934X_ANA_MBHC_RESULT_3, 0x10, 4, 0),
|
||||
WCD_MBHC_REGISTER("WCD_MBHC_MIC_SCHMT_RESULT",
|
||||
WCD934X_ANA_MBHC_RESULT_3, 0x20, 5, 0),
|
||||
WCD_MBHC_REGISTER("WCD_MBHC_HPHL_SCHMT_RESULT",
|
||||
|
|
|
|||
Loading…
Reference in a new issue