From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC417158D80; Tue, 23 Jan 2024 00:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969740; cv=none; b=PPWcSHJiPgdhkgiYtUlvFhGxT57LbbeWyIgwehgrjgLs+upgatbThXElOMoJxnJdzv6cSimVEs39lV46r6W8DAJtNsZ/Y0vw7M0cHnopclUg7L9CfcytzewbWL1iR9jwZZPcZmJRNPqnl0EME48P9DtSIPtyvlFhjrilixOsPa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969740; c=relaxed/simple; bh=7x6FOCtCntJEgjMDJxKm9lho0t0CO3HFLCxcbEeUGUY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m4sxe5T7ZaEuMpORa9Ai5+QVcCfVixYPLSYdSWGHoBMO4U+jedNQaGQkbGVKNZW3Zzwk7dDTuitgUSLtv4p183lLH0U9RbbIgEPgBFb1Oj+XPGd9TX+EBSz5OmwusOZbLvA5M8gSEt0TzZdqxRQ19o6AsYmudIEBA9wZy0/chHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Moi64dVR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Moi64dVR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F17EDC433F1; Tue, 23 Jan 2024 00:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705969740; bh=7x6FOCtCntJEgjMDJxKm9lho0t0CO3HFLCxcbEeUGUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Moi64dVRQQDmLiqgor4fhxlimiJ7EhkVqwXwG/RXQQnP9qo6mkOxsFNYq8WUT3/BE tzFXPRdsjBnybHRb0Wqtq6slIYJv2R/Ucaaw6W6Z0M9+lh/uU9nGBiVou5MP4/U60f QcVFt3UOQt8xrNWcEvpc14ECUctRU4QJE8jMgArE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Chen , Xu Yang , Li Jun Subject: [PATCH 6.7 401/641] usb: chipidea: wait controller resume finished for wakeup irq Date: Mon, 22 Jan 2024 15:55:05 -0800 Message-ID: <20240122235830.520880708@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235818.091081209@linuxfoundation.org> References: <20240122235818.091081209@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xu Yang commit 128d849074d05545becf86e713715ce7676fc074 upstream. After the chipidea driver introduce extcon for id and vbus, it's able to wakeup from another irq source, in case the system with extcon ID cable, wakeup from usb ID cable and device removal, the usb device disconnect irq may come firstly before the extcon notifier while system resume, so we will get 2 "wakeup" irq, one for usb device disconnect; and one for extcon ID cable change(real wakeup event), current driver treat them as 2 successive wakeup irq so can't handle it correctly, then finally the usb irq can't be enabled. This patch adds a check to bypass further usb events before controller resume finished to fix it. Fixes: 1f874edcb731 ("usb: chipidea: add runtime power management support") cc: Acked-by: Peter Chen Signed-off-by: Xu Yang Signed-off-by: Li Jun Link: https://lore.kernel.org/r/20231228110753.1755756-2-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/chipidea/core.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -523,6 +523,13 @@ static irqreturn_t ci_irq_handler(int ir u32 otgsc = 0; if (ci->in_lpm) { + /* + * If we already have a wakeup irq pending there, + * let's just return to wait resume finished firstly. + */ + if (ci->wakeup_int) + return IRQ_HANDLED; + disable_irq_nosync(irq); ci->wakeup_int = true; pm_runtime_get(ci->dev);