mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Martin Kepplinger <martin.kepplinger@puri.sm>, <balbi@kernel.org>
Cc: <gregkh@linuxfoundation.org>,
	<sergei.shtylyov@cogentembedded.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] usb: dwc3: support continuous runtime PM with dual role
Date: Fri, 24 Apr 2020 10:48:11 +0300	[thread overview]
Message-ID: <cb2db077-0f37-2221-84f6-a7adfd6ed1f1@ti.com> (raw)
In-Reply-To: <20200319100207.19957-1-martin.kepplinger@puri.sm>



On 19/03/2020 12:02, Martin Kepplinger wrote:
> The DRD module calls dwc3_set_mode() on role switches, i.e. when a device is
> being plugged in. In order to support continuous runtime power management when
> plugging in / unplugging a cable, we need to call pm_runtime_get_sync() in
> this path.
> 
> Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>

Reviewed-by: Roger Quadros <rogerq@ti.com>


cheers,
-roger

> ---
> 
> 
> revision history
> ----------------
> v3: call pm_runtime_get_sync() and fix commit message typo (thanks Sergei)
> v2: move pm_rumtime calls into workqueue (thanks Roger)
>      remove unrelated documentation patch
>      https://lore.kernel.org/linux-usb/7a085229-68a7-d700-1781-14225863a228@cogentembedded.com/T/
> v1: https://lore.kernel.org/linux-usb/ef22f8de-9bfd-c1d5-111c-696f1336dbda@puri.sm/T/
> 
> 
>   drivers/usb/dwc3/core.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 1d85c42b9c67..da93faef74a6 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -121,17 +121,19 @@ static void __dwc3_set_mode(struct work_struct *work)
>   	if (dwc->dr_mode != USB_DR_MODE_OTG)
>   		return;
>   
> +	pm_runtime_get_sync(dwc->dev);
> +
>   	if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_OTG)
>   		dwc3_otg_update(dwc, 0);
>   
>   	if (!dwc->desired_dr_role)
> -		return;
> +		goto out;
>   
>   	if (dwc->desired_dr_role == dwc->current_dr_role)
> -		return;
> +		goto out;
>   
>   	if (dwc->desired_dr_role == DWC3_GCTL_PRTCAP_OTG && dwc->edev)
> -		return;
> +		goto out;
>   
>   	switch (dwc->current_dr_role) {
>   	case DWC3_GCTL_PRTCAP_HOST:
> @@ -190,6 +192,9 @@ static void __dwc3_set_mode(struct work_struct *work)
>   		break;
>   	}
>   
> +out:
> +	pm_runtime_mark_last_busy(dwc->dev);
> +	pm_runtime_put_autosuspend(dwc->dev);
>   }
>   
>   void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  parent reply	other threads:[~2020-04-24  7:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 10:02 Martin Kepplinger
2020-04-05 11:43 ` Martin Kepplinger
2020-04-24  7:42   ` Martin Kepplinger
2020-04-24  7:48 ` Roger Quadros [this message]
2020-05-05  9:44   ` Martin Kepplinger
2020-05-14 10:40     ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb2db077-0f37-2221-84f6-a7adfd6ed1f1@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=martin.kepplinger@puri.sm \
    --cc=sergei.shtylyov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®