From patchwork Mon Apr 1 13:54:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 2371011 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A64493FD40 for ; Mon, 1 Apr 2013 14:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758262Ab3DAN56 (ORCPT ); Mon, 1 Apr 2013 09:57:58 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:57878 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758529Ab3DAN5w (ORCPT ); Mon, 1 Apr 2013 09:57:52 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKK00LJAXGES7Z0@mailout1.samsung.com>; Mon, 01 Apr 2013 22:57:51 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 87.F8.07735.E5299515; Mon, 01 Apr 2013 22:57:50 +0900 (KST) X-AuditID: cbfee68e-b7f946d000001e37-10-5159925e0f6c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 93.C5.17838.E5299515; Mon, 01 Apr 2013 22:57:50 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKK00JXCXD41C70@mmp1.samsung.com>; Mon, 01 Apr 2013 22:57:50 +0900 (KST) From: Vivek Gautam To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-omap@vger.kernel.org Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com, stern@rowland.harvard.edu, sarah.a.sharp@linux.intel.com, rob.herring@calxeda.com, kgene.kim@samsung.com, kishon@ti.com, dianders@chromium.org, t.figa@samsung.com, p.paneri@samsung.com Subject: [PATCH v3 04/11] usb: dwc3: Add runtime power management callbacks Date: Mon, 01 Apr 2013 19:24:03 +0530 Message-id: <1364824448-14732-5-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1364824448-14732-1-git-send-email-gautam.vivek@samsung.com> References: <1364824448-14732-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRmVeSWpSXmKPExsWyRsSkTjduUmSgQeN+C4uD9+stzi47yGbR vHg9m0XvgqtsFhee9rBZXN41h81i9pJ+FosZ5/cxWSxa1spscX5LJ5PF4RUHmCyaT5xitpjw +wKbxfoZr1kc+DwWfL7C7jG74SKLx7yTgR77564B8u7+YPTo27KK0eP4je1MHp83yQVwRHHZ pKTmZJalFunbJXBlfHz+lrVgI1/Fpu1T2BsY33J3MXJySAiYSMz5cosZwhaTuHBvPVsXIxeH kMBSRomzrf+ZYIp+TD/ICGILCSxilLj7QwmiaAqTxPZDC9hBEmwCuhJNb3cBFXFwiAjESWye IAwSZhboYpJYelQcxBYW8JZYt/so2BwWAVWJ+VcvMIGU8wp4SNw7WASxSkHize1nYPdwCnhK fNi6mAlirYdE+9UTrCBrJQQesUts3XqcBWKOgMS3yYdYQOZICMhKbDoA9YukxMEVN1gmMAov YGRYxSiaWpBcUJyUXmSkV5yYW1yal66XnJ+7iREYQ6f/PevbwXjzgPUhxmSgcROZpUST84Ex mFcSb2hsZmRhamJqbGRuaUaasJI4r1qLdaCQQHpiSWp2ampBalF8UWlOavEhRiYOTqkGxpiW L7H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pUVTf8Q73Cn/WW9g5DY3ae5pwcJwkUl3l9ip1DwsVt2txFKckWioxVxUnAgAOIzHjRQDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Right now it doesn't handle full runtime suspend/resume functionality. However it allows to handle PHYs' sleep and wakeup across runtime suspend/resume. Signed-off-by: Vivek Gautam --- drivers/usb/dwc3/core.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e250828..65a3adf 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -745,11 +745,54 @@ static int dwc3_resume(struct device *dev) return 0; } +#ifdef CONFIG_PM_RUNTIME +static int dwc3_runtime_suspend(struct device *dev) +{ + struct dwc3 *dwc = dev_get_drvdata(dev); + int ret = 0; + + ret = usb_phy_autopm_put_sync(dwc->usb2_phy); + if (ret) + dev_warn(dev, "Can't autosuspend usb2-phy\n"); + + ret = usb_phy_autopm_put_sync(dwc->usb3_phy); + if (ret) + dev_warn(dev, "Can't autosuspend usb3-phy\n"); + + return ret; +} + +static int dwc3_runtime_resume(struct device *dev) +{ + struct dwc3 *dwc = dev_get_drvdata(dev); + int ret = 0; + + ret = usb_phy_autopm_get_sync(dwc->usb2_phy); + if (ret) { + dev_err(dev, "usb2-phy: get sync failed with err %d\n", ret); + return ret; + } + + ret = usb_phy_autopm_get_sync(dwc->usb3_phy); + if (ret) { + dev_err(dev, "usb3-phy: get sync failed with err %d\n", ret); + return ret; + } + + return ret; +} +#else +#define dwc3_runtime_suspend NULL +#define dwc3_runtime_resume NULL +#endif + static const struct dev_pm_ops dwc3_dev_pm_ops = { .prepare = dwc3_prepare, .complete = dwc3_complete, SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) + SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, + dwc3_runtime_resume, NULL) }; #define DWC3_PM_OPS &(dwc3_dev_pm_ops)