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: 3076631 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 81F859F2B8 for ; Mon, 21 Oct 2013 09:35:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AB28201F9 for ; Mon, 21 Oct 2013 09:35:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33F77200EA for ; Mon, 21 Oct 2013 09:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754279Ab3JUJf1 (ORCPT ); Mon, 21 Oct 2013 05:35:27 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55684 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076Ab3JUJfY (ORCPT ); Mon, 21 Oct 2013 05:35:24 -0400 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>; 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 Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Sylwester Nawrocki , Krzysztof Kozlowski , Kyungmin Park 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= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.3 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 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;