devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: andersson@kernel.org, Thinh.Nguyen@synopsys.com,
	gregkh@linuxfoundation.org, mathias.nyman@intel.com,
	konrad.dybcio@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, linux-arm-msm@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 5/5] usb: dwc3: qcom: Allow runtime PM
Date: Tue, 28 Mar 2023 11:46:36 +0200	[thread overview]
Message-ID: <ZCK3fGkgowvAd6Dw@hovoldconsulting.com> (raw)
In-Reply-To: <20230325165217.31069-6-manivannan.sadhasivam@linaro.org>

On Sat, Mar 25, 2023 at 10:22:17PM +0530, Manivannan Sadhasivam wrote:
> dwc3-qcom driver is capable of doing runtime PM on its own, but currently
> it requires userspace intervention to enable it. But there is no harm in
> letting the driver to enable runtime PM on its own. So let's get rid of the
> "pm_runtime_forbid()" and make sure that the dependency is maintained with
> child devices using "pm_suspend_ignore_children(dev, false)".

Well, the potential harm is that these paths have hardly been tested so
enabling it by default is a risk (e.g. as you noticed when trying to
enable this by default). And especially if we don't address the layering
violations first.

> Also during remove(), the device needs to be waken up first if it was
> runtime suspended. Finally, pm_runtime_allow() can be removed.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index f1059dfcb0e8..5f26bb66274f 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -920,7 +920,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>  	qcom->is_suspended = false;
>  	pm_runtime_set_active(dev);
>  	pm_runtime_enable(dev);
> -	pm_runtime_forbid(dev);
> +	pm_suspend_ignore_children(dev, false);

There's no need to explicitly disable ignore-children as that is the
default.

>  	return 0;
>  
> @@ -948,6 +948,8 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	int i;
>  
> +	pm_runtime_get_sync(dev);

This call needs to be balanced. But this is a fix for a bug in the
current implementation that should go in a separate patch.

> +
>  	device_remove_software_node(&qcom->dwc3->dev);
>  	of_platform_depopulate(dev);
>  
> @@ -960,7 +962,6 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
>  	dwc3_qcom_interconnect_exit(qcom);
>  	reset_control_assert(qcom->resets);
>  
> -	pm_runtime_allow(dev);
>  	pm_runtime_disable(dev);
>  
>  	return 0;

Johan

  reply	other threads:[~2023-03-28  9:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 16:52 [PATCH 0/5] usb: dwc3: qcom: Allow runtime PM Manivannan Sadhasivam
2023-03-25 16:52 ` [PATCH 1/5] arm64: dts: qcom: sc8280xp: Add missing dwc3 quirks Manivannan Sadhasivam
2023-03-28  8:54   ` Johan Hovold
2023-03-28  9:38     ` Manivannan Sadhasivam
2023-03-29  5:26       ` Manivannan Sadhasivam
2023-03-29  8:34         ` Johan Hovold
2023-03-29 11:24           ` Konrad Dybcio
2023-03-29 12:15             ` Johan Hovold
2023-03-29 13:23           ` Manivannan Sadhasivam
2023-04-04 11:25             ` Johan Hovold
2023-03-25 16:52 ` [PATCH 2/5] xhci: host: Use 200ms autosuspend delay for runtime suspend Manivannan Sadhasivam
2023-03-25 16:52 ` [PATCH 3/5] usb: dwc3: qcom: Fix null ptr access during runtime_suspend() Manivannan Sadhasivam
2023-03-28  9:23   ` Johan Hovold
2023-03-28  9:47     ` Manivannan Sadhasivam
2023-03-28  9:51       ` Johan Hovold
2023-03-28 10:08         ` Manivannan Sadhasivam
2023-03-25 16:52 ` [PATCH 4/5] usb: dwc3: qcom: Clear pending interrupt before enabling wake interrupt Manivannan Sadhasivam
2023-03-28  9:28   ` Johan Hovold
2023-03-28  9:50     ` Manivannan Sadhasivam
2023-03-25 16:52 ` [PATCH 5/5] usb: dwc3: qcom: Allow runtime PM Manivannan Sadhasivam
2023-03-28  9:46   ` Johan Hovold [this message]
2023-03-28 10:05     ` Manivannan Sadhasivam
2023-03-28 12:18       ` Johan Hovold
2023-03-28 12:57         ` Manivannan Sadhasivam
2023-03-28 13:35           ` Johan Hovold
2023-03-27  9:01 ` [PATCH 0/5] " Konrad Dybcio
2023-03-27  9:17   ` Manivannan Sadhasivam
2023-03-27  9:24     ` Konrad Dybcio
2023-03-27 10:10       ` Manivannan Sadhasivam
2023-03-27 10:33         ` Konrad Dybcio

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=ZCK3fGkgowvAd6Dw@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mathias.nyman@intel.com \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).