Merge "ASoC: wcd-mbhc: fix inconsistent detection of euro headset"
This commit is contained in:
commit
e638fbdb05
1 changed files with 18 additions and 24 deletions
|
@ -1166,6 +1166,8 @@ static void wcd_correct_swch_plug(struct work_struct *work)
|
||||||
bool micbias1 = false;
|
bool micbias1 = false;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int rc, spl_hs_count = 0;
|
int rc, spl_hs_count = 0;
|
||||||
|
int cross_conn;
|
||||||
|
int try = 0;
|
||||||
|
|
||||||
pr_debug("%s: enter\n", __func__);
|
pr_debug("%s: enter\n", __func__);
|
||||||
|
|
||||||
|
@ -1183,11 +1185,6 @@ static void wcd_correct_swch_plug(struct work_struct *work)
|
||||||
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);
|
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);
|
||||||
|
|
||||||
|
|
||||||
if (mbhc->current_plug == MBHC_PLUG_TYPE_GND_MIC_SWAP) {
|
|
||||||
mbhc->current_plug = MBHC_PLUG_TYPE_NONE;
|
|
||||||
goto correct_plug_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enable HW FSM */
|
/* Enable HW FSM */
|
||||||
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);
|
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);
|
||||||
/*
|
/*
|
||||||
|
@ -1215,8 +1212,23 @@ static void wcd_correct_swch_plug(struct work_struct *work)
|
||||||
plug_type = MBHC_PLUG_TYPE_INVALID;
|
plug_type = MBHC_PLUG_TYPE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("%s: Valid plug found, plug type is %d\n",
|
do {
|
||||||
|
cross_conn = wcd_check_cross_conn(mbhc);
|
||||||
|
try++;
|
||||||
|
} while (try < GND_MIC_SWAP_THRESHOLD);
|
||||||
|
/*
|
||||||
|
* check for cross coneection 4 times.
|
||||||
|
* conisder the result of the fourth iteration.
|
||||||
|
*/
|
||||||
|
if (cross_conn > 0) {
|
||||||
|
pr_debug("%s: cross con found, start polling\n",
|
||||||
|
__func__);
|
||||||
|
plug_type = MBHC_PLUG_TYPE_GND_MIC_SWAP;
|
||||||
|
pr_debug("%s: Plug found, plug type is %d\n",
|
||||||
__func__, plug_type);
|
__func__, plug_type);
|
||||||
|
goto correct_plug_type;
|
||||||
|
}
|
||||||
|
|
||||||
if ((plug_type == MBHC_PLUG_TYPE_HEADSET ||
|
if ((plug_type == MBHC_PLUG_TYPE_HEADSET ||
|
||||||
plug_type == MBHC_PLUG_TYPE_HEADPHONE) &&
|
plug_type == MBHC_PLUG_TYPE_HEADPHONE) &&
|
||||||
(!wcd_swch_level_remove(mbhc))) {
|
(!wcd_swch_level_remove(mbhc))) {
|
||||||
|
@ -1456,10 +1468,7 @@ exit:
|
||||||
static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
|
static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = mbhc->codec;
|
struct snd_soc_codec *codec = mbhc->codec;
|
||||||
enum wcd_mbhc_plug_type plug_type;
|
|
||||||
bool micbias1 = false;
|
bool micbias1 = false;
|
||||||
int cross_conn;
|
|
||||||
int try = 0;
|
|
||||||
|
|
||||||
pr_debug("%s: enter\n", __func__);
|
pr_debug("%s: enter\n", __func__);
|
||||||
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
|
WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
|
||||||
|
@ -1480,21 +1489,6 @@ static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
|
||||||
else
|
else
|
||||||
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);
|
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);
|
||||||
|
|
||||||
do {
|
|
||||||
cross_conn = wcd_check_cross_conn(mbhc);
|
|
||||||
try++;
|
|
||||||
} while (try < GND_MIC_SWAP_THRESHOLD);
|
|
||||||
|
|
||||||
if (cross_conn > 0) {
|
|
||||||
pr_debug("%s: cross con found, start polling\n",
|
|
||||||
__func__);
|
|
||||||
plug_type = MBHC_PLUG_TYPE_GND_MIC_SWAP;
|
|
||||||
if (!mbhc->current_plug)
|
|
||||||
mbhc->current_plug = plug_type;
|
|
||||||
pr_debug("%s: Plug found, plug type is %d\n",
|
|
||||||
__func__, plug_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Re-initialize button press completion object */
|
/* Re-initialize button press completion object */
|
||||||
reinit_completion(&mbhc->btn_press_compl);
|
reinit_completion(&mbhc->btn_press_compl);
|
||||||
wcd_schedule_hs_detect_plug(mbhc, &mbhc->correct_plug_swch);
|
wcd_schedule_hs_detect_plug(mbhc, &mbhc->correct_plug_swch);
|
||||||
|
|
Loading…
Add table
Reference in a new issue