From patchwork Wed Nov 20 13:31:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 3213001 Return-Path: X-Original-To: patchwork-linux-arm@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 3323C9F3DE for ; Wed, 20 Nov 2013 13:36:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0525F20258 for ; Wed, 20 Nov 2013 13:36:04 +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 7FFC920725 for ; Wed, 20 Nov 2013 13:36:02 +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 1Vj7wj-0003eb-Vb; Wed, 20 Nov 2013 13:35:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vj7wh-0007m5-Gd; Wed, 20 Nov 2013 13:35:55 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vj7we-0007l8-SS for linux-arm-kernel@lists.infradead.org; Wed, 20 Nov 2013 13:35:53 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id rAKDZCQx018673; Wed, 20 Nov 2013 07:35:12 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAKDZC4v029210; Wed, 20 Nov 2013 07:35:12 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Wed, 20 Nov 2013 07:35:11 -0600 Received: from localhost (uglx0174654.ucm2.emeaucm.ext.ti.com [10.167.145.75]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAKDZAIp029231; Wed, 20 Nov 2013 07:35:11 -0600 From: Grygorii Strashko To: Len Brown , Pavel Machek , "Rafael J. Wysocki" , Greg Kroah-Hartman Subject: [PATCH] PM / Clocks: fix pm_clk_resume/suspend if CONFIG_PM_RUNTIME is set Date: Wed, 20 Nov 2013 15:31:47 +0200 Message-ID: <1384954307-27094-1-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131120_083553_043379_8E287B5F X-CRM114-Status: GOOD ( 12.14 ) X-Spam-Score: -7.5 (-------) Cc: Grygorii Strashko , santosh.shilimkar@ti.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.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: , 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.7 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 The following warning is shown and clk_enable() failed on Keystone platform if CONFIG_PM_RUNTIME is set and Runtime PM is enabled for Davinci gpio driver: [ 0.564486] ------------[ cut here ]------------ [ 0.569221] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:883__clk_enable+0x8c/0x98() [ 0.577070] Modules linked in: [ 0.580231] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-10116-g11d59938-dirty #259 [ 0.588368] [] (unwind_backtrace+0x0/0xf8) from [] (show_stack+0x10/0x14) [ 0.597018] [] (show_stack+0x10/0x14) from [] (dump_stack+0x64/0xa4) [ 0.605235] [] (dump_stack+0x64/0xa4) from [] (warn_slowpath_common+0x68/0x88) [ 0.614315] [] (warn_slowpath_common+0x68/0x88) from [] (warn_slowpath_null+0x1c/0x24) [ 0.624092] [] (warn_slowpath_null+0x1c/0x24) from [] (__clk_enable+0x8c/0x98) [ 0.633173] [] (__clk_enable+0x8c/0x98) from [] (clk_enable+0x18/0x2c) [ 0.641556] [] (clk_enable+0x18/0x2c) from [] (pm_clk_resume+0x5c/0x80) [ 0.650025] [] (pm_clk_resume+0x5c/0x80) from [] (keystone_pm_runtime_resume+0xc/0x18) [ 0.659800] [] (keystone_pm_runtime_resume+0xc/0x18) from [] (__rpm_callback+0x34/0x70) [ 0.669662] [] (__rpm_callback+0x34/0x70) from [] (rpm_callback+0x28/0x88) [ 0.678390] [] (rpm_callback+0x28/0x88) from [] (rpm_resume+0x3c8/0x684) [ 0.686942] [] (rpm_resume+0x3c8/0x684) from [] (__pm_runtime_resume+0x4c/0x64) [ 0.696111] [] (__pm_runtime_resume+0x4c/0x64) from [] (davinci_gpio_probe+0x20c/0x5ac) [ 0.705983] [] (davinci_gpio_probe+0x20c/0x5ac) from [] (platform_drv_probe+0x18/0x48) [ 0.715758] [] (platform_drv_probe+0x18/0x48) from [] (driver_probe_device+0x80/0x21c) [ 0.725532] [] (driver_probe_device+0x80/0x21c) from [] (__driver_attach+0x8c/0x90) [ 0.735044] [] (__driver_attach+0x8c/0x90) from [] (bus_for_each_dev+0x60/0x94) [ 0.744207] [] (bus_for_each_dev+0x60/0x94) from [] (bus_add_driver+0xdc/0x1d0) [ 0.753371] [] (bus_add_driver+0xdc/0x1d0) from [] (driver_register+0x78/0xf4) [ 0.762449] [] (driver_register+0x78/0xf4) from [] (do_one_initcall+0xec/0x148) [ 0.771616] [] (do_one_initcall+0xec/0x148) from [] (kernel_init_freeable+0xfc/0x1c8) [ 0.781303] [] (kernel_init_freeable+0xfc/0x1c8) from [] (kernel_init+0x8/0x110) [ 0.790553] [] (kernel_init+0x8/0x110) from [] (ret_from_fork+0x14/0x3c) [ 0.799117] ---[ end trace 6588a0ec7fbc847a ]--- This happens because the clk_enable() is called without clk_prepare() from pm_clk_resume(). Hence, switch to use clk_prepare_enable()/clk_disable_unprepare() instead of clk_enable()/clk_disable() in case if CONFIG_PM_RUNTIME is set. Actually, This is remainder fix of the earlier commit c122f27e1c "base: power - use clk_prepare_enable and clk_prepare_disable". Signed-off-by: Grygorii Strashko --- drivers/base/power/clock_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 9d8fde7..60d389a 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -230,7 +230,7 @@ int pm_clk_suspend(struct device *dev) list_for_each_entry_reverse(ce, &psd->clock_list, node) { if (ce->status < PCE_STATUS_ERROR) { if (ce->status == PCE_STATUS_ENABLED) - clk_disable(ce->clk); + clk_disable_unprepare(ce->clk); ce->status = PCE_STATUS_ACQUIRED; } } @@ -259,7 +259,7 @@ int pm_clk_resume(struct device *dev) list_for_each_entry(ce, &psd->clock_list, node) { if (ce->status < PCE_STATUS_ERROR) { - clk_enable(ce->clk); + clk_prepare_enable(ce->clk); ce->status = PCE_STATUS_ENABLED; } }