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

Commit 7ecb74d2 authored by Maya Erez's avatar Maya Erez
Browse files

wil6210: ignore HALP ICR if already handled



HALP ICR is set as long as the FW should stay awake.
To prevent its multiple handling the driver masks this IRQ bit.
However, if there is a different MISC ICR before the driver clears
this bit, there is a risk of race condition between HALP mask and
unmask. This race leads to HALP timeout, in case it is mistakenly
masked.
Add an atomic flag to indicate if HALP ICR should be handled.

Change-Id: Ieb8765615de87001aaacd2e6ae6c0dbf96811614
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent c106d73a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -575,11 +575,15 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
	}

	if (isr & BIT_DMA_EP_MISC_ICR_HALP) {
		isr &= ~BIT_DMA_EP_MISC_ICR_HALP;
		if (atomic_read(&wil->halp.handle_icr)) {
			/* no need to handle HALP ICRs until next vote */
			atomic_set(&wil->halp.handle_icr, 0);
			wil_dbg_irq(wil, "irq_misc: HALP IRQ invoked\n");
			wil6210_mask_halp(wil);
		isr &= ~BIT_DMA_EP_MISC_ICR_HALP;
			complete(&wil->halp.comp);
		}
	}

	wil->isr_misc = isr;

+2 −0
Original line number Diff line number Diff line
@@ -1858,6 +1858,8 @@ void wil_halp_vote(struct wil6210_priv *wil)

	if (++wil->halp.ref_cnt == 1) {
		reinit_completion(&wil->halp.comp);
		/* mark to IRQ context to handle HALP ICR */
		atomic_set(&wil->halp.handle_icr, 1);
		wil6210_set_halp(wil);
		rc = wait_for_completion_timeout(&wil->halp.comp, to_jiffies);
		if (!rc) {
+1 −0
Original line number Diff line number Diff line
@@ -795,6 +795,7 @@ struct wil_halp {
	struct mutex		lock; /* protect halp ref_cnt */
	unsigned int		ref_cnt;
	struct completion	comp;
	atomic_t		handle_icr;
};

struct wil_blob_wrapper {