Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp382718ybh; Wed, 18 Mar 2020 01:35:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv6HZkzfEIkga4AjGq/OgvHYZ0Nlrh/911KVJYfkW+4MYEdGD12MHxUJ7AZZlX+Fvz4gsvR X-Received: by 2002:a54:410c:: with SMTP id l12mr2294300oic.13.1584520552184; Wed, 18 Mar 2020 01:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584520552; cv=none; d=google.com; s=arc-20160816; b=xNBR03zyz9EPmxC7TDErubshaJWlBwNA7HH0O6OXtJuSOKyg1xrjz2l+H+rAOCOSlQ 59+/Z9VtkgPZrD0lybwnCZmx+m5ZsCxH8bGwzIQVq0FZrVCgf/Sw3paGaUK4PELlhdr2 EfPXIlIUTP0DDMVWOKvDlBXwFe4BdNhmkhVB1bDZch5cUtbcgDyH2VDdJ7PHmeRILWGt IGIbh8kxm/Qap0eIW/+j1jmQ8FLJyoemgGIFiAWAUdcJ0xbeYzSnuaPrSUXq7RX7tvcb zCRs85fACNUfvXUBFQ8W6DFKgozuQPLrtZ6VFhaMFIHDyADbrpmiWoGZdGXUF/sGhJvx bCEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id:date :subject:cc:to:from; bh=yI8vE14HETdgrPGvdno34yNg0Pd4dPhv489L8nDEsug=; b=eF7kpJ46twqdHJ37IDl52CD7rvC5JX1eGeU24N91N+htQxZP+1ziOaIFYc3JlanTVw LwdJgwuPBE/o+OevLiM1jYb/EF7m2iF4rhCpYgv/BUqMe9aCz82ae5DMydYNRFNpbZMA F2ds6QpNxg/QBxdm4g9xxCRaOvp6i3UMD7ksyvaaFIJuG49q/1h0MTgylyLzgvqfG059 iOsx+QcR0wViRBk3EjjiUrvTp8RPHTxk95BfOLGGJ2ntbzGJhk18VQxVwJ1oof3m1nj3 /ZrZBmQJ1uCk/UjgAk87bsCyrsGa7Ib/ztGZnPdzmZr6wwtGeZes1QvE1APFTsgeLkQX v4+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7si2821299otq.323.2020.03.18.01.35.40; Wed, 18 Mar 2020 01:35:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbgCRIfX (ORCPT + 99 others); Wed, 18 Mar 2020 04:35:23 -0400 Received: from comms.puri.sm ([159.203.221.185]:55288 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbgCRIfW (ORCPT ); Wed, 18 Mar 2020 04:35:22 -0400 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 33C99DFBC8; Wed, 18 Mar 2020 01:35:22 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nDDoW9hT1CA6; Wed, 18 Mar 2020 01:35:21 -0700 (PDT) From: Martin Kepplinger To: balbi@kernel.org, robh@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH 1/2] usb: dwc3: support continuous runtime PM with dual role Date: Wed, 18 Mar 2020 09:35:07 +0100 Message-Id: <20200318083508.20781-1-martin.kepplinger@puri.sm> Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DRD module calls dwc3_set_mode() on role switches, i.e. when a device is being pugged in. In order to support continuous runtime power management when plugging in / unplugging a cable, we need to call pm_runtime_get() in this path. Signed-off-by: Martin Kepplinger --- drivers/usb/dwc3/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index edc17155cb2b..7743c4de82e9 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -196,11 +196,16 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode) { unsigned long flags; + pm_runtime_get(dwc->dev); + spin_lock_irqsave(&dwc->lock, flags); dwc->desired_dr_role = mode; spin_unlock_irqrestore(&dwc->lock, flags); queue_work(system_freezable_wq, &dwc->drd_work); + + pm_runtime_mark_last_busy(dwc->dev); + pm_runtime_put_autosuspend(dwc->dev); } u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type) -- 2.20.1