From patchwork Fri Dec 16 10:46:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 88280 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1329419qgi; Fri, 16 Dec 2016 02:46:59 -0800 (PST) X-Received: by 10.98.217.153 with SMTP id b25mr2403803pfl.77.1481885219903; Fri, 16 Dec 2016 02:46:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si7200046pli.232.2016.12.16.02.46.59; Fri, 16 Dec 2016 02:46:59 -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; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760474AbcLPKq4 (ORCPT + 4 others); Fri, 16 Dec 2016 05:46:56 -0500 Received: from mail-wj0-f169.google.com ([209.85.210.169]:33858 "EHLO mail-wj0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760347AbcLPKqz (ORCPT ); Fri, 16 Dec 2016 05:46:55 -0500 Received: by mail-wj0-f169.google.com with SMTP id tg4so90615353wjb.1 for ; Fri, 16 Dec 2016 02:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i8G2BtJuHhikkZWzgdV366KiQlW3U86uMl0dw195jJ0=; b=q1cWiptIjaAr8cj1wI1Nnaha9Wbb4nggsJBoppcC85cFoga63af/No3/kMpquo3iz5 xSezPKLjG1nkGOCDzqCoZBUHzoNNeXXNLIGgt2sTm9fj5mhwkeM2wTaBNcW0W9CvXPGN SUc6tiEZHJ5NO+aVkl/Y6Q+l08Nn1OwMkhQaSuQ74ymjsdDb3P+rCLRQKJyxNLiGEiI1 hhGgHOWNzwLXJmQwRPuqCLmdcxwTvVGZa2UD66fN2o3x/5iLHGEdxB0qtmEtx43UwaXR ldm20MvTJBcsiltCiPlcbGkc+5wZbNcdfWDkiYZa+to5PFHi8jc53ieyO65ivgEL7z/z C7/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i8G2BtJuHhikkZWzgdV366KiQlW3U86uMl0dw195jJ0=; b=JTiKtxwATya09QAhyAv3vtJphwn7L0jTe7rVEy+otHeeWX/Jz7Evke6D8p8NKQAlNr eG/mtBjUi+s572zi/l8fRImU3HkCqG1zSyKcm7BHphKXP0ovNi+5Fjfk47ceuQ/WO5g5 NDo0b1hBdINytMH9FrMWXmhpN68M9Kvcc9YKVdgRKfQDjpPTQnt65laqX+szHIAV6/IO urqzxy2Raoguu0At9pI7R9SRVOjcywZ7sEpdfHQeXpulCvsr3NuPmyZpglj4ZDbL/YPA PyIVekeK58LK0EvMaXM4hk8pC+gknyfJcopNCjcY1eEJPfT3ihJqBBAvsSDQF6sNaPvA uWnQ== X-Gm-Message-State: AKaTC01cDWoOWIecRUJnczRS1v81uSlkGQ8mTSZyVxoZq3OEaCh2b/L4Tix1iFoWrVUAHxkT X-Received: by 10.194.162.8 with SMTP id xw8mr2015563wjb.125.1481885196215; Fri, 16 Dec 2016 02:46:36 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z6sm6215001wjt.24.2016.12.16.02.46.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Dec 2016 02:46:35 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: linux-usb@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, Alexandre Bailon Subject: [PATCH v2 1/3] usb: musb: da8xx: Add support of suspend / resume Date: Fri, 16 Dec 2016 11:46:14 +0100 Message-Id: <1481885176-16984-2-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1481885176-16984-1-git-send-email-abailon@baylibre.com> References: <1481885176-16984-1-git-send-email-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- drivers/usb/musb/da8xx.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -- 2.7.3 -- 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 26766a5..7384179 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 struct platform_driver da8xx_driver = { .remove = da8xx_remove, .driver = { .name = "musb-da8xx", + .pm = &da8xx_pm_ops, .of_match_table = of_match_ptr(da8xx_id_table), }, };