From patchwork Fri Nov 14 08:50:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5304201 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 BA5C49FD5A for ; Fri, 14 Nov 2014 08:53:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC1D720149 for ; Fri, 14 Nov 2014 08:53:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A04C02017D for ; Fri, 14 Nov 2014 08:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754868AbaKNIwW (ORCPT ); Fri, 14 Nov 2014 03:52:22 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:36630 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754661AbaKNIun (ORCPT ); Fri, 14 Nov 2014 03:50:43 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF000L58U14OX60@mailout2.w1.samsung.com>; Fri, 14 Nov 2014 08:53:28 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-f9-5465c260c3ef Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 10.0C.04619.062C5645; Fri, 14 Nov 2014 08:50:40 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NF00074XTWBTB70@eusync1.samsung.com>; Fri, 14 Nov 2014 08:50:40 +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 v12 3/6] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM Date: Fri, 14 Nov 2014 09:50:30 +0100 Message-id: <1415955033-29093-4-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1415955033-29093-1-git-send-email-k.kozlowski@samsung.com> References: <1415955033-29093-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPLMWRmVeSWpSXmKPExsVy+t/xy7oJh1JDDPY90LPYOGM9q8X0qRcY LVZP/ctq8fqFocXTzY+ZLM42vWG36Jy4hN1i1pS9TBaXd81hs/jce4TR4vZlXou1R+6yW9w9 dZTN4szpS6wWE35fYLM4vjbc4mXffhYHQY+W5h42j9kdM1k9Fu95yeSxaVUnm8eda3vYPLZc bWfxmH33B6NH35ZVjB4rVn9n9/i8SS6AK4rLJiU1J7MstUjfLoErY+OTCewFh/kqjhzZy9jA +Im7i5GTQ0LARGLfxcXsELaYxIV769m6GLk4hASWMko0nJ7BDOH0MUls/biPEaSKTcBYYvPy JWBVIgLtzBJ966aygSSYBRYxSTRNVQSxhQXSJE6tWMkEYrMIqEpcm34ZrJlXwF3i8aKTrBDr 5CROHpsMZnMKeEhM3riKBcQWAqr5fPkP8wRG3gWMDKsYRVNLkwuKk9JzDfWKE3OLS/PS9ZLz czcxQgL9yw7GxcesDjEKcDAq8fAaFKSGCLEmlhVX5h5ilOBgVhLhVdoNFOJNSaysSi3Kjy8q zUktPsTIxMEp1cBYnxNdN6dEc7Wyl2V00J31wfeF/6TaMZbPE5KbHyFsbXDt+4LPV1UuF9w6 9fWQ85RZPPoZvd+Zv2mu1V+hwvoxWetpl37WqYv/nnm+mz/j0TGX1lyfcpsq/S+uPjxFMtnJ 7/xfCR9sW/vLJb1NqmSXwevTHju6mj2WZHD9rQkwu6Yhwn6sylKJpTgj0VCLuag4EQA1jbkm UgIAAA== Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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,