From patchwork Mon Oct 21 09:35:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 3076641 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 1B3D1BF924 for ; Mon, 21 Oct 2013 09:36:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2D432014A for ; Mon, 21 Oct 2013 09:36:26 +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 9CD0520149 for ; Mon, 21 Oct 2013 09:36:25 +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 1VYBu8-0000AG-K7; Mon, 21 Oct 2013 09:36:04 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYBty-0006d9-T1; Mon, 21 Oct 2013 09:35:54 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYBtv-0006bR-Oo for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2013 09:35:53 +0000 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 <0MV000HGJILHC9A0@mailout1.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2013 10:35:22 +0100 (BST) X-AuditID: cbfec7f5-b7ef66d00000795a-a8-5264f55a817e Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 13.5D.31066.A55F4625; Mon, 21 Oct 2013 10:35:22 +0100 (BST) 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 <0MV000FUYIMVCB10@eusync1.samsung.com>; Mon, 21 Oct 2013 10:35:22 +0100 (BST) From: Krzysztof Kozlowski To: Ben Dooks , Kukjin Kim , Mark Brown Subject: [PATCH] spi/s3c64xx: Fix doubled clock disable on suspend Date: Mon, 21 Oct 2013 11:35:17 +0200 Message-id: <1382348117-6666-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFJMWRmVeSWpSXmKPExsVy+t/xy7pRX1OCDB7vk7KYtO4Ak8XUh0/Y LF6/MLToXXCVzeJs0xt2i02Pr7FaXN41h81ixvl9TBaNH2+yWxx+087qwOXxd9ULZo9NqzrZ PDYvqffo27KK0ePzJrkA1igum5TUnMyy1CJ9uwSujDOT37AUnJGsWL7hOGMD4w6xLkZODgkB E4ml/46zQNhiEhfurWfrYuTiEBJYyihx5+JPZginj0ni4a8dYFVsAsYSm5cvYQOxRQSyJG7/ 2wJWxCwwmUni9MudjCAJYQEniSmztrF3MXJwsAioSvw6D7aNV8BN4uKsuUwgYQkBBYk5k2wm MHIvYGRYxSiaWppcUJyUnmukV5yYW1yal66XnJ+7iRESPl93MC49ZnWIUYCDUYmHN8AlJUiI NbGsuDL3EKMEB7OSCO/nj0Ah3pTEyqrUovz4otKc1OJDjEwcnFINjMuWHQg3aZdvvBlmyqy8 7stlf+uGNmeGZx1cWZtOfd4kWfZYT2xnc9XV7a6GRzt8V0Wd/+mu/2JODc+cOun7bfevLb1U MFU9MvJfT/gFXtlZgscsInTKD9XsW5vep/xv1pU3YgzPQjhsT1cGKl1vEXSat8s4QlUsSTnz 4x7+TMUCheXJsi+tlFiKMxINtZiLihMBu8Qh9/0BAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131021_053551_889016_B5EACC0C X-CRM114-Status: GOOD ( 11.58 ) 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 are already disabled before suspending. Additionally add PM runtime get() and put() during resume so device won't sleep for the time of s3c64xx_spi_hwinit(). Signed-off-by: Krzysztof Kozlowski Signed-off-by: Kyungmin Park --- drivers/spi/spi-s3c64xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index a80376d..374be7d 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1482,10 +1482,6 @@ static int s3c64xx_spi_suspend(struct device *dev) spi_master_suspend(master); - /* Disable the clock */ - clk_disable_unprepare(sdd->src_clk); - clk_disable_unprepare(sdd->clk); - sdd->cur_speed = 0; /* Output Clock is stopped */ return 0; @@ -1496,16 +1492,19 @@ static int s3c64xx_spi_resume(struct device *dev) struct spi_master *master = dev_get_drvdata(dev); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_info *sci = sdd->cntrlr_info; + int ret; + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + dev_err(dev, "pm runtime failed, e = %d\n", ret); + return ret; + } if (sci->cfg_gpio) sci->cfg_gpio(); - /* Enable the clock */ - clk_prepare_enable(sdd->src_clk); - clk_prepare_enable(sdd->clk); - s3c64xx_spi_hwinit(sdd, sdd->port_id); + pm_runtime_put(dev); spi_master_resume(master); return 0;