Skip to content

Commit

Permalink
usb: dwc3: xilinx: add power management ops support
Browse files Browse the repository at this point in the history
Added system sleep and run-time power management ops support for
dwc3-xilinx glue layer and update function name.

Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
Link: https://lore.kernel.org/r/20220912111017.901321-2-piyush.mehta@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Piyush Mehta authored and Greg Kroah-Hartman committed Sep 22, 2022
1 parent e219a71 commit ec50e11
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions drivers/usb/dwc3/dwc3-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static int dwc3_xlnx_remove(struct platform_device *pdev)
return 0;
}

static int __maybe_unused dwc3_xlnx_suspend_common(struct device *dev)
static int __maybe_unused dwc3_xlnx_runtime_suspend(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);

Expand All @@ -331,7 +331,7 @@ static int __maybe_unused dwc3_xlnx_suspend_common(struct device *dev)
return 0;
}

static int __maybe_unused dwc3_xlnx_resume_common(struct device *dev)
static int __maybe_unused dwc3_xlnx_runtime_resume(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);

Expand All @@ -346,8 +346,33 @@ static int __maybe_unused dwc3_xlnx_runtime_idle(struct device *dev)
return 0;
}

static UNIVERSAL_DEV_PM_OPS(dwc3_xlnx_dev_pm_ops, dwc3_xlnx_suspend_common,
dwc3_xlnx_resume_common, dwc3_xlnx_runtime_idle);
static int __maybe_unused dwc3_xlnx_suspend(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);

/* Disable the clocks */
clk_bulk_disable(priv_data->num_clocks, priv_data->clks);

return 0;
}

static int __maybe_unused dwc3_xlnx_resume(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
int ret;

ret = clk_bulk_enable(priv_data->num_clocks, priv_data->clks);
if (ret)
return ret;

return 0;
}

static const struct dev_pm_ops dwc3_xlnx_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(dwc3_xlnx_suspend, dwc3_xlnx_resume)
SET_RUNTIME_PM_OPS(dwc3_xlnx_runtime_suspend,
dwc3_xlnx_runtime_resume, dwc3_xlnx_runtime_idle)
};

static struct platform_driver dwc3_xlnx_driver = {
.probe = dwc3_xlnx_probe,
Expand Down

0 comments on commit ec50e11

Please sign in to comment.