From: Robert Foss <robert.foss@collabora.com>
To: Baolin Wang <baolin.wang@linaro.org>,
mathias.nyman@intel.com, balbi@kernel.org
Cc: gregkh@linuxfoundation.org, broonie@kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] usb: host: plat: Enable xhci plat runtime PM
Date: Wed, 25 Jan 2017 12:30:18 -0500 [thread overview]
Message-ID: <79fb9681-b52e-525c-c844-bee003ee7c9c@collabora.com> (raw)
In-Reply-To: <d7a3bb017581435bdb1e726c2b7260d85e1f5611.1481532028.git.baolin.wang@linaro.org>
Looks good to me.
Feel free to add my r-b.
On 2016-12-13 02:49 AM, Baolin Wang wrote:
> Enable the xhci plat runtime PM for parent device to suspend/resume xhci.
> Also call pm_runtime_get_noresume() in probe() function in case the parent
> device doesn't call suspend/resume callback by runtime PM now.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
> Changes since v4:
> - No updates.
>
> Changes since v3:
> - Fix kbuild error.
>
> Changes since v2:
> - Add pm_runtime_get_noresume() in probe() function.
> - Add pm_runtime_set_suspended()/pm_runtime_put_noidle() in remove() function.
>
> Changes since v1:
> - No updates.
> ---
> drivers/usb/host/xhci-plat.c | 41 ++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index ed56bf9..5805c6a 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -246,6 +246,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
> if (ret)
> goto dealloc_usb2_hcd;
>
> + pm_runtime_get_noresume(&pdev->dev);
> + pm_runtime_set_active(&pdev->dev);
> + pm_runtime_enable(&pdev->dev);
> +
> return 0;
>
>
> @@ -274,6 +278,10 @@ static int xhci_plat_remove(struct platform_device *dev)
> struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> struct clk *clk = xhci->clk;
>
> + pm_runtime_set_suspended(&dev->dev);
> + pm_runtime_put_noidle(&dev->dev);
> + pm_runtime_disable(&dev->dev);
> +
> usb_remove_hcd(xhci->shared_hcd);
> usb_phy_shutdown(hcd->usb_phy);
>
> @@ -311,14 +319,37 @@ static int xhci_plat_resume(struct device *dev)
>
> return xhci_resume(xhci, 0);
> }
> +#endif /* CONFIG_PM_SLEEP */
> +
> +#ifdef CONFIG_PM
> +static int xhci_plat_runtime_suspend(struct device *dev)
> +{
> + struct usb_hcd *hcd = dev_get_drvdata(dev);
> + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> +
> + return xhci_suspend(xhci, device_may_wakeup(dev));
> +}
> +
> +static int xhci_plat_runtime_resume(struct device *dev)
> +{
> + struct usb_hcd *hcd = dev_get_drvdata(dev);
> + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> +
> + return xhci_resume(xhci, 0);
> +}
> +
> +static int xhci_plat_runtime_idle(struct device *dev)
> +{
> + return 0;
> +}
> +#endif /* CONFIG_PM */
>
> static const struct dev_pm_ops xhci_plat_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
> +
> + SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume,
> + xhci_plat_runtime_idle)
> };
> -#define DEV_PM_OPS (&xhci_plat_pm_ops)
> -#else
> -#define DEV_PM_OPS NULL
> -#endif /* CONFIG_PM */
>
> static const struct acpi_device_id usb_xhci_acpi_match[] = {
> /* XHCI-compliant USB Controller */
> @@ -332,7 +363,7 @@ static int xhci_plat_resume(struct device *dev)
> .remove = xhci_plat_remove,
> .driver = {
> .name = "xhci-hcd",
> - .pm = DEV_PM_OPS,
> + .pm = &xhci_plat_pm_ops,
> .of_match_table = of_match_ptr(usb_xhci_of_match),
> .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
> },
>
next prev parent reply other threads:[~2017-01-25 17:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 7:49 [PATCH v5 1/2] usb: host: plat: Enable xhci plat runtime PM Baolin Wang
2016-12-13 7:49 ` [PATCH v5 2/2] usb: dwc3: core: Support the dwc3 host suspend/resume Baolin Wang
2017-01-16 10:28 ` Felipe Balbi
2017-01-16 10:53 ` Baolin Wang
2017-01-25 17:31 ` Robert Foss
2017-01-16 10:56 ` [PATCH v5 1/2] usb: host: plat: Enable xhci plat runtime PM Baolin Wang
2017-01-31 13:14 ` Mathias Nyman
2017-02-06 5:26 ` Baolin Wang
2017-02-20 2:47 ` Baolin Wang
2017-02-20 15:10 ` Mathias Nyman
2017-02-21 2:09 ` Baolin Wang
2017-03-21 7:55 ` Baolin Wang
2017-03-21 8:07 ` Felipe Balbi
2017-03-22 5:07 ` Baolin Wang
2017-03-22 9:00 ` Felipe Balbi
2017-03-22 10:40 ` Baolin Wang
2017-03-22 12:43 ` Mathias Nyman
2017-03-23 2:17 ` Baolin Wang
2017-01-25 17:30 ` Robert Foss [this message]
2017-02-06 5:27 ` Baolin Wang
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=79fb9681-b52e-525c-c844-bee003ee7c9c@collabora.com \
--to=robert.foss@collabora.com \
--cc=balbi@kernel.org \
--cc=baolin.wang@linaro.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.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;
as well as URLs for NNTP newsgroup(s).