From patchwork Wed Nov 12 14:32:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5289671 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3651B9F440 for ; Wed, 12 Nov 2014 14:35:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E942201B4 for ; Wed, 12 Nov 2014 14:35:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 861482015D for ; Wed, 12 Nov 2014 14:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753000AbaKLOee (ORCPT ); Wed, 12 Nov 2014 09:34:34 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63658 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbaKLOci (ORCPT ); Wed, 12 Nov 2014 09:32:38 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NEX00DQ9KJ5A480@mailout1.w1.samsung.com>; Wed, 12 Nov 2014 14:35:29 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-27-54636f8395ca Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 8D.82.24279.38F63645; Wed, 12 Nov 2014 14:32:35 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NEX00K83KE6S170@eusync3.samsung.com>; Wed, 12 Nov 2014 14:32:35 +0000 (GMT) From: Krzysztof Kozlowski To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Russell King , Dan Williams , Vinod Koul , Ulf Hansson , Alan Stern , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org Cc: Kevin Hilman , Laurent Pinchart , Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski Subject: [PATCH v11 3/6] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM Date: Wed, 12 Nov 2014 15:32:25 +0100 Message-id: <1415802748-30530-4-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1415802748-30530-1-git-send-email-k.kozlowski@samsung.com> References: <1415802748-30530-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHLMWRmVeSWpSXmKPExsVy+t/xq7rN+ckhBreXqVpsnLGe1WL61AuM Fqun/mW1eP3C0OLp5sdMFmeb3rBbdE5cwm4xa8peJovLu+awWXzuPcJocfsyr8XaI3fZLe6e Ospmceb0JVaLCb8vsFkcXxtu8bJvP4uDoEdLcw+bx+yOmawei/e8ZPLYtKqTzePOtT1sHluu trN4zL77g9Gjb8sqRo8Vq7+ze3zeJBfAFcVlk5Kak1mWWqRvl8CVsaS1uGACX8Wzs4vZGhiP cHcxcnJICJhINO7dygZhi0lcuLceyObiEBJYyigxs/ssO4TTxySxf2YHK0gVm4CxxOblS8Cq RATamSX61k0Fa2cWWMQk0TRVEcQWFkiTmDlpOiOIzSKgKvG+fzcTiM0r4C5x98U/Voh1chIn j00GszkFPCS+bPsLNkcIqObM5YMsExh5FzAyrGIUTS1NLihOSs810itOzC0uzUvXS87P3cQI CfOvOxiXHrM6xCjAwajEw/tBKzlEiDWxrLgy9xCjBAezkgjvrhygEG9KYmVValF+fFFpTmrx IUYmDk6pBkaTw+eDZwfFfXLyqNjxKEjYrkf9Zvf21prPmVJ2qoKNk+UcO+ZxvNm8/nuqvYGu yI0PhttjOc5On3eANS+Sb8WWE2zXp06fes71UqiizNS2oNqCW6uP3k1cu+NUUcjX0mM9pwMu uagU3jr3PM77V+hrKwmjRudn5tGLmC9Mf2G+7J5ZWWa3ymolluKMREMt5qLiRAADusSuUQIA AA== Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The AMBA bus driver defines runtime Power Management functions which disable and unprepare AMBA bus clock. This is problematic for runtime PM because unpreparing a clock might sleep so it is not interrupt safe. However some drivers may want to implement runtime PM functions in interrupt-safe way (see pm_runtime_irq_safe()). In such case the AMBA bus driver should only disable/enable the clock in runtime suspend and resume callbacks. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Ulf Hansson --- drivers/amba/bus.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index a4ac490dd784..c2153a1d1981 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -95,8 +95,12 @@ static int amba_pm_runtime_suspend(struct device *dev) struct amba_device *pcdev = to_amba_device(dev); int ret = pm_generic_runtime_suspend(dev); - if (ret == 0 && dev->driver) - clk_disable_unprepare(pcdev->pclk); + if (ret == 0 && dev->driver) { + if (pm_runtime_is_irq_safe(dev)) + clk_disable(pcdev->pclk); + else + clk_disable_unprepare(pcdev->pclk); + } return ret; } @@ -107,7 +111,10 @@ static int amba_pm_runtime_resume(struct device *dev) int ret; if (dev->driver) { - ret = clk_prepare_enable(pcdev->pclk); + if (pm_runtime_is_irq_safe(dev)) + ret = clk_enable(pcdev->pclk); + else + ret = clk_prepare_enable(pcdev->pclk); /* Failure is probably fatal to the system, but... */ if (ret) return ret; @@ -115,7 +122,7 @@ static int amba_pm_runtime_resume(struct device *dev) return pm_generic_runtime_resume(dev); } -#endif +#endif /* CONFIG_PM */ static const struct dev_pm_ops amba_pm = { .suspend = pm_generic_suspend,