From patchwork Mon Oct 21 13:42:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 3077401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D059BF924 for ; Mon, 21 Oct 2013 13:44:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D06C202C7 for ; Mon, 21 Oct 2013 13:44:06 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC456202C1 for ; Mon, 21 Oct 2013 13:44:04 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYFlm-0006sb-8v; Mon, 21 Oct 2013 13:43:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYFlg-0003Fl-27; Mon, 21 Oct 2013 13:43:36 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYFlW-0003E5-9q for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2013 13:43:26 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MV000H1MU2EWH00@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2013 14:43:00 +0100 (BST) X-AuditID: cbfec7f4-b7f0a6d000007b1b-d9-52652f64a219 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 22.FC.31515.46F25625; Mon, 21 Oct 2013 14:43:00 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MV000AMCU3K8C20@eusync4.samsung.com>; Mon, 21 Oct 2013 14:43:00 +0100 (BST) From: Krzysztof Kozlowski To: Ben Dooks , Kukjin Kim , Mark Brown Subject: [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend Date: Mon, 21 Oct 2013 15:42:50 +0200 Message-id: <1382362971-16763-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1382362971-16763-1-git-send-email-k.kozlowski@samsung.com> References: <1382362971-16763-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e/4Nd0U/dQgg40ThCwmrTvAZDH14RM2 i9cvDC16F1xlszjb9IbdYtPja6wWl3fNYbOYcX4fk0Xjx5vsFofftLM6cHn8XfWC2WPTqk42 j81L6j36tqxi9Pi8SS6ANYrLJiU1J7MstUjfLoEro3vrRNaCAxIVjV+3MTYwXhTtYuTkkBAw kfj6fh8LhC0mceHeerYuRi4OIYGljBJnLr9ihnD6mCTe/D/BBlLFJmAssXn5EjBbRCBL4va/ LWBFzAKTmSROv9zJCJIQFnCT+P2gDcxmEVCVOD55GlgDr4C7xJE3+9i7GDmA1ilIzJlkAxLm FPCQOPniOBOILQRUMundDOYJjLwLGBlWMYqmliYXFCel5xrqFSfmFpfmpesl5+duYoQE3Jcd jIuPWR1iFOBgVOLhDXBJCRJiTSwrrsw9xCjBwawkwvv5I1CINyWxsiq1KD++qDQntfgQIxMH p1QD44Ks/6/Mpvy5p81oOW3D5+a2xL0nvV4yJvm+Mg9cwHPbfJXYNN+X3BcPbS9j+RDgZLg+ pjW2y1cqYJ+ZiR9Tf9LUR9qi6yf3/zJL3vf5aqEx+4WdkhPN05d0ngrlW+xWr/z3xpyG1ZdN K1Ok7Dz2mf3y+hI2ReD6mVcTNp5Q2Cw/m9XK40zTMyWW4oxEQy3mouJEAMjN+bcWAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131021_094326_419617_543E9342 X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -7.3 (-------) Cc: Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Kyungmin Park , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Fix doubled clock disable and unprepare during PM suspend which triggered the warnings: WARNING: at drivers/clk/clk.c:800 clk_disable+0x18/0x24() Modules linked in: CPU: 0 PID: 1745 Comm: sh Not tainted 3.10.14-01211-ge2549bb-dirty #62 [] (unwind_backtrace+0x0/0x138) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (warn_slowpath_common+0x4c/0x68) [] (warn_slowpath_common+0x4c/0x68) from [] (warn_slowpath_null+0x1c/0x24) [] (warn_slowpath_null+0x1c/0x24) from [] (clk_disable+0x18/0x24) [] (clk_disable+0x18/0x24) from [] (s3c64xx_spi_suspend+0x28/0x54) [] (s3c64xx_spi_suspend+0x28/0x54) from [] (platform_pm_suspend+0x2c/0x5c) [] (platform_pm_suspend+0x2c/0x5c) from [] (dpm_run_callback+0x44/0x7c) [] (dpm_run_callback+0x44/0x7c) from [] (__device_suspend+0x108/0x300) [] (__device_suspend+0x108/0x300) from [] (dpm_suspend+0x54/0x208) [] (dpm_suspend+0x54/0x208) from [] (suspend_devices_and_enter+0x98/0x458) [] (suspend_devices_and_enter+0x98/0x458) from [] (pm_suspend+0x1c4/0x25c) [] (pm_suspend+0x1c4/0x25c) from [] (state_store+0x6c/0xbc) [] (state_store+0x6c/0xbc) from [] (kobj_attr_store+0x14/0x20) [] (kobj_attr_store+0x14/0x20) from [] (sysfs_write_file+0xfc/0x164) [] (sysfs_write_file+0xfc/0x164) from [] (vfs_write+0xbc/0x1bc) [] (vfs_write+0xbc/0x1bc) from [] (SyS_write+0x40/0x68) [] (SyS_write+0x40/0x68) from [] (ret_fast_syscall+0x0/0x3c) The clocks may be already disabled before suspending. Check PM runtime suspend status and disable clocks only if device is not suspended. During resume do not enable the clocks if device is runtime suspended. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Kyungmin Park Reviewed-by: Sylwester Nawrocki --- drivers/spi/spi-s3c64xx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 59f4fd9..8953178 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1484,9 +1484,10 @@ static int s3c64xx_spi_suspend(struct device *dev) if (ret) return ret; - /* Disable the clock */ - clk_disable_unprepare(sdd->src_clk); - clk_disable_unprepare(sdd->clk); + if (!pm_runtime_suspended(dev)) { + clk_disable_unprepare(sdd->clk); + clk_disable_unprepare(sdd->src_clk); + } sdd->cur_speed = 0; /* Output Clock is stopped */ @@ -1502,9 +1503,10 @@ static int s3c64xx_spi_resume(struct device *dev) if (sci->cfg_gpio) sci->cfg_gpio(); - /* Enable the clock */ - clk_prepare_enable(sdd->src_clk); - clk_prepare_enable(sdd->clk); + if (!pm_runtime_suspended(dev)) { + clk_prepare_enable(sdd->src_clk); + clk_prepare_enable(sdd->clk); + } s3c64xx_spi_hwinit(sdd, sdd->port_id);