From patchwork Mon Nov 28 16:26:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 84422 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1210627qgi; Mon, 28 Nov 2016 08:26:29 -0800 (PST) X-Received: by 10.84.135.34 with SMTP id 31mr50781430pli.50.1480350389325; Mon, 28 Nov 2016 08:26:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si55876310pfg.259.2016.11.28.08.26.29; Mon, 28 Nov 2016 08:26:29 -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 S932965AbcK1Q01 (ORCPT + 4 others); Mon, 28 Nov 2016 11:26:27 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:35644 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932787AbcK1Q00 (ORCPT ); Mon, 28 Nov 2016 11:26:26 -0500 Received: by mail-wm0-f45.google.com with SMTP id a197so210656543wmd.0 for ; Mon, 28 Nov 2016 08:26:25 -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=QIjjVi/WKuZUtcvJxBPXqM1vZ/jyNt2fzhtBNPwbr5Y=; b=LoLuA4vdUn4f6hMyJvZPCRttvNRPa8Sr2GgCqZujuw3q6eU3qHldJAR10XuxooiKJo 1Vgd71Q2mhe4thgSbFO33GfLrhyyOvBYBts/WS+jDdRO5w0qXWRBLuq9ai97/M9+kQys MFSGUDQ8Xnop39C4KhgWRXWYwHcSM7EHMBy6CAUp++0vnZjlwRtTy5N5oUbys3kDTxZF 5F033URLbaHdtbNFUDvucsSPKI/u/jD5sgyDCHKRqP7tc7sext0MtOTr7mlfH6H4Feh2 UrqE9Q4g38nJWGy6xP24pahTxTBzSyd7MY/iEuX5EnZAQXK5xii0V/EzbKnaHtieU1qH myxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QIjjVi/WKuZUtcvJxBPXqM1vZ/jyNt2fzhtBNPwbr5Y=; b=J2pEme+ONfdul90eNC9xNO5SjxnPcftPCGaFY7f911DQ8Hu1Kwl1kYUatkqu2MtQmH x9CAG7aQx05p7nqQvLI2uSK+RSep7Kk40kh9BldX0YijXcfTQh+VdjZZwi9Sa8eAPvbR NTIhlIHRQBsw7w4eF3RNhJBaLCYJ3N6GjwabDUGTVeZuGIyWYlmB//JtJb2mH+WvZtmO ToUlOtqynEcwDWbHc33OXj9lWwguFQQdEQA5WIsD4QO2x3ASsLxDryMdGEbQlY2zAFMP XmhBjozeKznEvo41yh7kqC4bHlvrLGxXNk5wESSglV1K+z9k/XP0hmwKjMC2JbX8Dl/j QDRw== X-Gm-Message-State: AKaTC03kXPwVD373D4fVDyddLCfI1Z19AqZJgZIS/5jv+VEBXCzsqSJLbikGlwwVNMwYYlRn X-Received: by 10.28.57.193 with SMTP id g184mr19188996wma.122.1480350384762; Mon, 28 Nov 2016 08:26:24 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id t82sm29710641wmd.17.2016.11.28.08.26.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 08:26:24 -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 1/3] usb: musb: da8xx: Add support of suspend / resume Date: Mon, 28 Nov 2016 17:26:19 +0100 Message-Id: <1480350381-26151-2-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1480350381-26151-1-git-send-email-abailon@baylibre.com> References: <1480350381-26151-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 e89708d..905f0d9 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -578,6 +578,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[] = { { @@ -593,6 +621,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), }, };