Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp741497imm; Thu, 13 Sep 2018 07:06:22 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda6KnuQfH1sTHPOHfoyMWzX5hynR6nfkppXNThJy5Dl/kG1c9UjqDwk5c8WeE8sQXXPjOvA X-Received: by 2002:a17:902:6b83:: with SMTP id p3-v6mr7531239plk.133.1536847582453; Thu, 13 Sep 2018 07:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847582; cv=none; d=google.com; s=arc-20160816; b=e/zSb54Ps7eXHIkxlsdxDyzldrtQGXpMQCkhiOqz0bIMUQ+PN3MwTJVyx1F2yGJq9x 4ly7hL7UUJgFxsDCEL1/llNbO8CPzKYqnDRnxaRzzXCcf3q9iskagORKUgnYnRSisHCH anZ2MPSapIG1fu3omv2/o4RgneM5oziy6cgCOQO4EMqx5FmRt6Frg/u9lVy2z5d6e4jo 3EkVyTWVGuOUVyWU70++IdzVFAIY+O5cfyVI9djIM2Qh7nrF96uwl7W9owAHqtoRu9IU qFIQsuA7qiWfr7KbLk2/OimsQ3cgSOucTa1eK6AVH3mmOx7ylEzSAfe7xNT6InvUQv4Q gxdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=ZvY+BlcU0OkF/4YbpDrJGhblbe3TrZo7gRMSc6BMjuo=; b=zymkLCw1ICE4szL5GNme1rcT148mQGX2NCxGxmjasrlj3putJJX98j8zU9z+H3Z9/S OC7DnjxnwBNMFCyYb27aZjQhAhX3wf8l03DQREDH5u9s47+aMSY95bO5sWT3IJHNBLLw FI+sHWv2eB7cCF8u5IY7hqpgFMEbRusB2L5V4R2w3VRqy/LRwCnzYuoA1DSOhlT3GUYY 8Itdsa/MT/zhUiW9StTcjqJzIFOYUuGvIWmd4DMO4uPMDoZfNf1ldN6LN2tsELZ9SXTA uKEGCFuOYvKqaEO6h8fgr5YTg0ZNCvSDaQcR9rlPzcocQ/DZQdgB8NijKDUB5eISiL3Y yhKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t190-v6si4258982pfb.344.2018.09.13.07.06.01; Thu, 13 Sep 2018 07:06:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731790AbeIMTNt (ORCPT + 99 others); Thu, 13 Sep 2018 15:13:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35372 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727566AbeIMTNs (ORCPT ); Thu, 13 Sep 2018 15:13:48 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1733BD35; Thu, 13 Sep 2018 14:04:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Ezequiel Garcia , Tomasz Figa Subject: [PATCH 4.18 170/197] drm/rockchip: vop: split out core clock enablement into separate functions Date: Thu, 13 Sep 2018 15:31:59 +0200 Message-Id: <20180913131848.361976379@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heiko Stuebner commit e2810a7167df14c762e085fae5aade38425b71bf upstream. Judging from the iommu code, both the hclk and aclk are necessary for register access. Split them off into separate functions from the regular vop enablement, so that we can use them elsewhere as well. Fixes: d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()") [prerequisite change for the actual fix] Cc: stable@vger.kernel.org Signed-off-by: Heiko Stuebner Tested-by: Ezequiel Garcia Reviewed-by: Tomasz Figa Link: https://patchwork.freedesktop.org/patch/msgid/20180612132028.27490-2-heiko@sntech.de Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 44 +++++++++++++++++++--------- 1 file changed, 31 insertions(+), 13 deletions(-) --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -486,6 +486,31 @@ static void vop_line_flag_irq_disable(st spin_unlock_irqrestore(&vop->irq_lock, flags); } +static int vop_core_clks_enable(struct vop *vop) +{ + int ret; + + ret = clk_enable(vop->hclk); + if (ret < 0) + return ret; + + ret = clk_enable(vop->aclk); + if (ret < 0) + goto err_disable_hclk; + + return 0; + +err_disable_hclk: + clk_disable(vop->hclk); + return ret; +} + +static void vop_core_clks_disable(struct vop *vop) +{ + clk_disable(vop->aclk); + clk_disable(vop->hclk); +} + static int vop_enable(struct drm_crtc *crtc) { struct vop *vop = to_vop(crtc); @@ -497,17 +522,13 @@ static int vop_enable(struct drm_crtc *c return ret; } - ret = clk_enable(vop->hclk); + ret = vop_core_clks_enable(vop); if (WARN_ON(ret < 0)) goto err_put_pm_runtime; ret = clk_enable(vop->dclk); if (WARN_ON(ret < 0)) - goto err_disable_hclk; - - ret = clk_enable(vop->aclk); - if (WARN_ON(ret < 0)) - goto err_disable_dclk; + goto err_disable_core; /* * Slave iommu shares power, irq and clock with vop. It was associated @@ -519,7 +540,7 @@ static int vop_enable(struct drm_crtc *c if (ret) { DRM_DEV_ERROR(vop->dev, "failed to attach dma mapping, %d\n", ret); - goto err_disable_aclk; + goto err_disable_dclk; } spin_lock(&vop->reg_lock); @@ -558,12 +579,10 @@ static int vop_enable(struct drm_crtc *c return 0; -err_disable_aclk: - clk_disable(vop->aclk); err_disable_dclk: clk_disable(vop->dclk); -err_disable_hclk: - clk_disable(vop->hclk); +err_disable_core: + vop_core_clks_disable(vop); err_put_pm_runtime: pm_runtime_put_sync(vop->dev); return ret; @@ -609,8 +628,7 @@ static void vop_crtc_atomic_disable(stru rockchip_drm_dma_detach_device(vop->drm_dev, vop->dev); clk_disable(vop->dclk); - clk_disable(vop->aclk); - clk_disable(vop->hclk); + vop_core_clks_disable(vop); pm_runtime_put(vop->dev); mutex_unlock(&vop->vop_lock);