Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9d66e47 authored by Santosh Mardi's avatar Santosh Mardi Committed by Yeleswarapu, Nagaradhesh
Browse files

ASoC: wcd9xxx: Cancel headset detect work while in IRQ handler



When the headset is inserted and removed with in no time, removal
interrupt handling is missed.

The reason behind missing the removal interrupt is for the insertion
interrupt a work queue is scheduled to detect the event type
there is latency in scheduling the work queue as a result the
removal IRQ followed is missed to process but the UI is not
notified about the IRQ miss and UI still thinks the headset is
connected.

Cancel the hs detect work queue as soon as entered the IRQ
and do not wait to cancel the work queue until the insertion or
removal event is detected

CRs-Fixed: 552760
Change-Id: I5c5fd8c55cca6a7137c389c19843c5178c8c9be8
Signed-off-by: default avatarSantosh Mardi <gsantosh@codeaurora.org>
parent 321f1af6
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -2842,6 +2842,10 @@ static void wcd9xxx_swch_irq_handler(struct wcd9xxx_mbhc *mbhc)
	if (wcd9xxx_cancel_btn_work(mbhc))
		pr_debug("%s: button press is canceled\n", __func__);

	/* cancel detect plug */
	wcd9xxx_cancel_hs_detect_plug(mbhc,
				      &mbhc->correct_plug_swch);

	insert = !wcd9xxx_swch_level_remove(mbhc);
	pr_debug("%s: Current plug type %d, insert %d\n", __func__,
		 mbhc->current_plug, insert);
@@ -2849,9 +2853,6 @@ static void wcd9xxx_swch_irq_handler(struct wcd9xxx_mbhc *mbhc)
		mbhc->lpi_enabled = false;
		wmb();

		/* cancel detect plug */
		wcd9xxx_cancel_hs_detect_plug(mbhc,
					      &mbhc->correct_plug_swch);
		if ((mbhc->current_plug != PLUG_TYPE_NONE) &&
		    !(snd_soc_read(codec, WCD9XXX_A_MBHC_INSERT_DETECT) &
				   (1 << 1)))
@@ -2866,10 +2867,6 @@ static void wcd9xxx_swch_irq_handler(struct wcd9xxx_mbhc *mbhc)
		mbhc->lpi_enabled = false;
		wmb();

		/* cancel detect plug */
		wcd9xxx_cancel_hs_detect_plug(mbhc,
					      &mbhc->correct_plug_swch);

		if (mbhc->current_plug == PLUG_TYPE_HEADPHONE) {
			wcd9xxx_report_plug(mbhc, 0, SND_JACK_HEADPHONE);
			is_removed = true;