From patchwork Tue Jan 3 15:15:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 89674 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8051263qgi; Tue, 3 Jan 2017 07:18:50 -0800 (PST) X-Received: by 10.99.171.10 with SMTP id p10mr116136879pgf.36.1483456730268; Tue, 03 Jan 2017 07:18:50 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q89si38121665pfj.115.2017.01.03.07.18.50; Tue, 03 Jan 2017 07:18:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758347AbdACPP5 (ORCPT + 4 others); Tue, 3 Jan 2017 10:15:57 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:42005 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757317AbdACPPm (ORCPT ); Tue, 3 Jan 2017 10:15:42 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v03FFfwn014182; Tue, 3 Jan 2017 09:15:41 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v03FFfk9005546; Tue, 3 Jan 2017 09:15:41 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Tue, 3 Jan 2017 09:15:41 -0600 Received: from dbdmail01.india.ti.com (dbdmail01.india.ti.com [172.24.162.206]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v03FFe6U019365; Tue, 3 Jan 2017 09:15:41 -0600 Received: from uda0271908.am.dhcp.ti.com (uda0271908.am.dhcp.ti.com [128.247.83.228]) by dbdmail01.india.ti.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id v03FFLYM027043; Tue, 3 Jan 2017 20:45:39 +0530 From: Bin Liu To: Greg KH CC: Subject: [PATCH 11/16] usb: musb: da8xx: Add support of suspend / resume Date: Tue, 3 Jan 2017 09:15:16 -0600 Message-ID: <1483456521-24416-12-git-send-email-b-liu@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483456521-24416-1-git-send-email-b-liu@ti.com> References: <1483456521-24416-1-git-send-email-b-liu@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Alexandre Bailon Implement PM methods specifics for da8xx glue. The only thing to do is to power off the phy. As the registers are in retention during suspend, there is no need to save them. Signed-off-by: Alexandre Bailon Signed-off-by: Bin Liu --- drivers/usb/musb/da8xx.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 26766a523352..738417986398 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -577,6 +577,34 @@ static int da8xx_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int da8xx_suspend(struct device *dev) +{ + int ret; + struct da8xx_glue *glue = dev_get_drvdata(dev); + + ret = phy_power_off(glue->phy); + if (ret) + return ret; + clk_disable_unprepare(glue->clk); + + return 0; +} + +static int da8xx_resume(struct device *dev) +{ + int ret; + struct da8xx_glue *glue = dev_get_drvdata(dev); + + ret = clk_prepare_enable(glue->clk); + if (ret) + return ret; + return phy_power_on(glue->phy); +} +#endif + +static SIMPLE_DEV_PM_OPS(da8xx_pm_ops, da8xx_suspend, da8xx_resume); + #ifdef CONFIG_OF static const struct of_device_id da8xx_id_table[] = { { @@ -592,6 +620,7 @@ static int da8xx_remove(struct platform_device *pdev) .remove = da8xx_remove, .driver = { .name = "musb-da8xx", + .pm = &da8xx_pm_ops, .of_match_table = of_match_ptr(da8xx_id_table), }, };