From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A384BC433DF for ; Tue, 23 Jun 2020 21:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 786BC20702 for ; Tue, 23 Jun 2020 21:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592946929; bh=3G8GM4vO3Vdlqv9ViR3h8GbCYKBiWpfhwADZ7dBz5Jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=u0o5mq/GVE4kR3r6JCdlJx1JSSTERRYi1lQEj44rpkpS83dOebxYRwPm1uTIWr6uZ eQk+Nm55BnO7HpQcwHaTLtGBWE+OY1Xv/hv4lGZ0ulCaqVeZziSVBYfWmaiq5bLK9y aqUxSljvi/PGZfd3yWjMkPI1yUMhv8HjqNpSQSao= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393386AbgFWVP1 (ORCPT ); Tue, 23 Jun 2020 17:15:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:48192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389264AbgFWU2Z (ORCPT ); Tue, 23 Jun 2020 16:28:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 991542064B; Tue, 23 Jun 2020 20:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944105; bh=3G8GM4vO3Vdlqv9ViR3h8GbCYKBiWpfhwADZ7dBz5Jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tU4RzAJ0B1Lylh3TcANmMi9i7jiQ5ktFITVf4s28wDf2U1by7ZChv+G1Ew9jHnw4l gt+sBep0On8LEsRlN7mGfabH8HxxBuKeTDDWg0k8LVkW1QTjXm+PXObvaHXDEdtuDZ vY51ljatIVehvxj6KOUoFgsgJ/Uywyk/XasYYbn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan , Fabrice Gasnier , Felipe Balbi , Sasha Levin Subject: [PATCH 5.4 175/314] usb: dwc2: gadget: move gadget resume after the core is in L0 state Date: Tue, 23 Jun 2020 21:56:10 +0200 Message-Id: <20200623195347.229231631@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabrice Gasnier [ Upstream commit 8c935deacebb8fac8f41378701eb79d12f3c2e2d ] When the remote wakeup interrupt is triggered, lx_state is resumed from L2 to L0 state. But when the gadget resume is called, lx_state is still L2. This prevents the resume callback to queue any request. Any attempt to queue a request from resume callback will result in: - "submit request only in active state" debug message to be issued - dwc2_hsotg_ep_queue() returns -EAGAIN Call the gadget resume routine after the core is in L0 state. Fixes: f81f46e1f530 ("usb: dwc2: implement hibernation during bus suspend/resume") Acked-by: Minas Harutyunyan Signed-off-by: Fabrice Gasnier Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc2/core_intr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 6af6add3d4c0b..6272b4ae4740f 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -421,10 +421,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) if (ret && (ret != -ENOTSUPP)) dev_err(hsotg->dev, "exit power_down failed\n"); + /* Change to L0 state */ + hsotg->lx_state = DWC2_L0; call_gadget(hsotg, resume); + } else { + /* Change to L0 state */ + hsotg->lx_state = DWC2_L0; } - /* Change to L0 state */ - hsotg->lx_state = DWC2_L0; } else { if (hsotg->params.power_down) return; -- 2.25.1