lkml.org 
[lkml]   [2018]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2 2/3] usb: xhci: tegra: Add runtime PM support
On Thu, Apr 26, 2018 at 03:59:09PM +0100, Jon Hunter wrote:
> Add runtime PM support to the Tegra XHCI driver and move the function
> calls to enable/disable the clocks, regulators and PHY into the runtime
> PM callbacks.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>
> Changes since V1:
> - Re-worked change to handle case where runtime PM is disabled.
>
> drivers/usb/host/xhci-tegra.c | 89 ++++++++++++++++++++++++++++++-------------
> 1 file changed, 63 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
> index 02b0b24faa58..85f2381883ad 100644
> --- a/drivers/usb/host/xhci-tegra.c
> +++ b/drivers/usb/host/xhci-tegra.c
> @@ -18,6 +18,7 @@
> #include <linux/phy/tegra/xusb.h>
> #include <linux/platform_device.h>
> #include <linux/pm.h>
> +#include <linux/pm_runtime.h>
> #include <linux/regulator/consumer.h>
> #include <linux/reset.h>
> #include <linux/slab.h>
> @@ -761,6 +762,50 @@ static void tegra_xusb_phy_disable(struct tegra_xusb *tegra)
> }
> }
>
> +static int tegra_xusb_runtime_suspend(struct device *dev)
> +{
> + struct tegra_xusb *tegra = dev_get_drvdata(dev);
> +
> + tegra_xusb_phy_disable(tegra);
> + regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
> + tegra_xusb_clk_disable(tegra);
> +
> + return 0;
> +}
> +
> +static int tegra_xusb_runtime_resume(struct device *dev)
> +{
> + struct tegra_xusb *tegra = dev_get_drvdata(dev);
> + int err;
> +
> + err = tegra_xusb_clk_enable(tegra);
> + if (err) {
> + dev_err(dev, "failed to enable clocks: %d\n", err);
> + return err;
> + }
> +
> + err = regulator_bulk_enable(tegra->soc->num_supplies, tegra->supplies);
> + if (err) {
> + dev_err(dev, "failed to enable regulators: %d\n", err);
> + goto disable_clk;
> + }
> +
> + err = tegra_xusb_phy_enable(tegra);
> + if (err < 0) {
> + dev_err(dev, "failed to enable PHYs: %d\n", err);
> + goto disable_regulator;
> + }
> +
> + return 0;
> +
> +disable_regulator:
> + regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
> +disable_clk:
> + tegra_xusb_clk_disable(tegra);
> + return err;
> +}
> +
> +

There's an extra blank line here. Other than that, this looks very nice.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-04-27 12:10    [W:0.051 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site