From patchwork Fri Sep 25 11:57:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 7263631 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C35279F380 for ; Fri, 25 Sep 2015 11:58:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9E7920B18 for ; Fri, 25 Sep 2015 11:58:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D60E120AEC for ; Fri, 25 Sep 2015 11:58:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE2DBA553; Fri, 25 Sep 2015 04:58:10 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metis.ext.pengutronix.de (metis.ext.4.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF0596F0A3 for ; Fri, 25 Sep 2015 04:58:04 -0700 (PDT) Received: from weser.hi.4.pengutronix.de ([10.1.0.109] helo=weser.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1ZfRda-0004Em-PW; Fri, 25 Sep 2015 13:58:02 +0200 From: Lucas Stach To: Russell King , Christian Gmeiner Subject: [PATCH 28/48] staging: etnaviv: rename GPU clock functions Date: Fri, 25 Sep 2015 13:57:40 +0200 Message-Id: <1443182280-15868-29-git-send-email-l.stach@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443182280-15868-1-git-send-email-l.stach@pengutronix.de> References: <20150916080435.GA21084@n2100.arm.linux.org.uk> <1443182280-15868-1-git-send-email-l.stach@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.109 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 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 From: Russell King Rename the GPU clock functions for what they actually are, splitting the clock disable out from etnaviv_gpu_suspend(). This allows us to fix etnaviv_gpu_rpm_resume(), which needed only to disable the clocks on failure, rather than trying to stop an uninitialised GPU. Signed-off-by: Russell King --- drivers/staging/etnaviv/etnaviv_gpu.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c index d274fcf9f5b1..2a6560be4c51 100644 --- a/drivers/staging/etnaviv/etnaviv_gpu.c +++ b/drivers/staging/etnaviv/etnaviv_gpu.c @@ -1046,7 +1046,7 @@ static irqreturn_t irq_handler(int irq, void *data) return ret; } -static int etnaviv_gpu_resume(struct etnaviv_gpu *gpu) +static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu) { int ret; @@ -1063,10 +1063,23 @@ static int etnaviv_gpu_resume(struct etnaviv_gpu *gpu) return 0; } -static int etnaviv_gpu_suspend(struct etnaviv_gpu *gpu) +static int etnaviv_gpu_clk_disable(struct etnaviv_gpu *gpu) { int ret; + ret = disable_axi(gpu); + if (ret) + return ret; + + ret = disable_clk(gpu); + if (ret) + return ret; + + return 0; +} + +static int etnaviv_gpu_suspend(struct etnaviv_gpu *gpu) +{ if (gpu->buffer) { unsigned long timeout; @@ -1096,15 +1109,7 @@ static int etnaviv_gpu_suspend(struct etnaviv_gpu *gpu) } while (1); } - ret = disable_axi(gpu); - if (ret) - return ret; - - ret = disable_clk(gpu); - if (ret) - return ret; - - return 0; + return etnaviv_gpu_clk_disable(gpu); } static int etnaviv_gpu_bind(struct device *dev, struct device *master, @@ -1118,7 +1123,7 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master, #ifdef CONFIG_PM ret = pm_runtime_get_sync(gpu->dev); #else - ret = etnaviv_gpu_resume(gpu); + ret = etnaviv_gpu_clk_enable(gpu); #endif if (ret < 0) return ret; @@ -1300,7 +1305,7 @@ static int etnaviv_gpu_rpm_resume(struct device *dev) if (drm && WARN_ON_ONCE(mutex_is_locked(&drm->struct_mutex))) return -EDEADLK; - ret = etnaviv_gpu_resume(gpu); + ret = etnaviv_gpu_clk_enable(gpu); if (ret) return ret; @@ -1308,7 +1313,7 @@ static int etnaviv_gpu_rpm_resume(struct device *dev) if (drm && gpu->buffer) { ret = mutex_lock_killable(&drm->struct_mutex); if (ret) { - etnaviv_gpu_suspend(gpu); + etnaviv_gpu_clk_disable(gpu); return ret; } etnaviv_gpu_hw_init(gpu);