[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220806143529.GF14384@thinkpad>
Date: Sat, 6 Aug 2022 20:05:29 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: Johan Hovold <johan+linaro@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Konrad Dybcio <konrad.dybcio@...ainline.org>,
Krishna Kurapati <quic_kriskura@...cinc.com>,
Stephen Boyd <swboyd@...omium.org>,
Doug Anderson <dianders@...omium.org>,
Matthias Kaehlcke <mka@...omium.org>,
Pavankumar Kondeti <quic_pkondeti@...cinc.com>,
quic_ppratap@...cinc.com, quic_vpulyala@...cinc.com,
linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/9] usb: dwc3: qcom: fix runtime PM wakeup
On Thu, Aug 04, 2022 at 05:09:57PM +0200, Johan Hovold wrote:
> A device must enable wakeups during runtime suspend regardless of
> whether it is capable and allowed to wake the system up from system
> suspend.
>
> Fixes: 2664deb09306 ("usb: dwc3: qcom: Honor wakeup enabled/disabled state")
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Thanks,
Mani
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 6884026b9fad..05b4666fde14 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -397,7 +397,7 @@ static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
> dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0);
> }
>
> -static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
> +static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
> {
> u32 val;
> int i, ret;
> @@ -416,7 +416,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
> if (ret)
> dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret);
>
> - if (device_may_wakeup(qcom->dev)) {
> + if (wakeup) {
> qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom);
> dwc3_qcom_enable_interrupts(qcom);
> }
> @@ -426,7 +426,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
> return 0;
> }
>
> -static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
> +static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
> {
> int ret;
> int i;
> @@ -434,7 +434,7 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
> if (!qcom->is_suspended)
> return 0;
>
> - if (device_may_wakeup(qcom->dev))
> + if (wakeup)
> dwc3_qcom_disable_interrupts(qcom);
>
> for (i = 0; i < qcom->num_clocks; i++) {
> @@ -945,9 +945,11 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
> static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
> {
> struct dwc3_qcom *qcom = dev_get_drvdata(dev);
> + bool wakeup = device_may_wakeup(dev);
> int ret = 0;
>
> - ret = dwc3_qcom_suspend(qcom);
> +
> + ret = dwc3_qcom_suspend(qcom, wakeup);
> if (!ret)
> qcom->pm_suspended = true;
>
> @@ -957,9 +959,10 @@ static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
> static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
> {
> struct dwc3_qcom *qcom = dev_get_drvdata(dev);
> + bool wakeup = device_may_wakeup(dev);
> int ret;
>
> - ret = dwc3_qcom_resume(qcom);
> + ret = dwc3_qcom_resume(qcom, wakeup);
> if (!ret)
> qcom->pm_suspended = false;
>
> @@ -970,14 +973,14 @@ static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev)
> {
> struct dwc3_qcom *qcom = dev_get_drvdata(dev);
>
> - return dwc3_qcom_suspend(qcom);
> + return dwc3_qcom_suspend(qcom, true);
> }
>
> static int __maybe_unused dwc3_qcom_runtime_resume(struct device *dev)
> {
> struct dwc3_qcom *qcom = dev_get_drvdata(dev);
>
> - return dwc3_qcom_resume(qcom);
> + return dwc3_qcom_resume(qcom, true);
> }
>
> static const struct dev_pm_ops dwc3_qcom_dev_pm_ops = {
> --
> 2.35.1
>
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists