From patchwork Tue Jun 7 21:15:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 12872416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27630C433EF for ; Tue, 7 Jun 2022 21:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ZlOlDwv/R2eaXRbLwWirjctxkhAgJkXyw2D/fQZHRFc=; b=P5cFfBvLqg77s+ TkVCRL/IYkhGNBr6fxaLVcUI/30T6wB7/HAwdu63nY8pm58akiSrLb24bLSN/4gQlDGkUq6QHON9K /D97uIwbLwPN1J4Iudri90gPY+91NRGoNN8SJ+KvkPbkeqSEnKjhxtWGLgRzAD+u8kkgoPlEe2ghm ZBz+bk+45q9u1CKeRiD+zsakGh01QPqoCnM1WI3rTULwghnxTKk7IIPkrAHg89Eis7OExDQnXUqEz KECQY43tQjN43PiZ3C5DoScvFif1uFwvBcmulQ7abRlesulP/Sn9YkdlpiD4mUWq9WnrgZTZttb7i yePloC8pXb8SuNO3uV8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nygYM-009j03-Mj; Tue, 07 Jun 2022 21:15:54 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nygYJ-009izR-As for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2022 21:15:52 +0000 Received: by mail-pj1-x1031.google.com with SMTP id gd1so16760869pjb.2 for ; Tue, 07 Jun 2022 14:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jT8DLfbyhUAC8YupnNkx7/WPeiPnBTRo6q4n9p3S9IY=; b=VlUgXcU9owX1EBIje6hBA2fwQ9kjFpI9bPxIwfz3BBF+P0QwC14EOuzXoFF8wDys4m LvFexAAmIgm9t44ySB3iZn4tl5NRcrd+xFuGu0qVyxf3w/br+VLAlQmjgGoWKBREO2gT mBi4xnNl9LeVoaIH1Mm5CLnk7Jt6LFoQ9GNFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jT8DLfbyhUAC8YupnNkx7/WPeiPnBTRo6q4n9p3S9IY=; b=eHqnrIBUNN3RbFEy+EvECUXD/+6toXhzbx/7GTzth9uxNwB+YtIW5+pngKxw/NasOY XvjYZ9nPAdobvtrep/7Y6bwGEU/V80Nq90uIfBz+Jk4ySCZ78Z4d0LYc2DH68oUJZyiz IyO6OFTDSKtuvI/C+PfjGzZ9zI5WFRZebKW9EneN4KtSVw2BeImgET6ZVHw8oLBJ3R1X doRf7NWSxRu/FmAY+z6d2Tr5nlN2RwKWD0dzpmmI49xm77COJ6aS3ZZSqy96O6lhrkOi BNJ4HnNwScN96Ql8sRdVlR9j8Bzaf7QXAwjSv0bTawvwHP6tirwo1Gk6kn82MkluSKIi 2Fww== X-Gm-Message-State: AOAM533Vyqk/h74R9VHgfmg9r1DsPS03oAMvNeLB0h2smQLHcxhqHgv+ rw05Zs0ugS8dy3RgPTlDFI47aQ== X-Google-Smtp-Source: ABdhPJxhFzWqzH75FBiSKGcGqopAKv26dB/QVu2+AEpLNrGFVc0gxO7a4bpodDrd1FVbJmDNPWR2Tg== X-Received: by 2002:a17:903:110e:b0:167:8847:5d9d with SMTP id n14-20020a170903110e00b0016788475d9dmr8945619plh.3.1654636548284; Tue, 07 Jun 2022 14:15:48 -0700 (PDT) Received: from localhost ([2620:15c:202:201:b689:cc5b:e6ad:930e]) by smtp.gmail.com with UTF8SMTPSA id g7-20020a636b07000000b003fd3a3db089sm8589907pgc.11.2022.06.07.14.15.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 14:15:47 -0700 (PDT) From: Brian Norris To: Heiko Stuebner Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Hans Verkuil , Nicolas Dufresne , Sebastian Fricke , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ezequiel Garcia , Brian Norris , stable@vger.kernel.org Subject: [PATCH] arm64: dts: rockchip: Assign RK3399 VDU clock rate Date: Tue, 7 Jun 2022 14:15:36 -0700 Message-Id: <20220607141535.1.Idafe043ffc94756a69426ec68872db0645c5d6e2@changeid> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_141551_418745_724BFB55 X-CRM114-Status: GOOD ( 15.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Before commit 9998943f6dfc ("media: rkvdec: Stop overclocking the decoder"), the rkvdec driver was forcing the VDU clock rate. After that commit, we rely on the default clock rate. That rate works OK on many boards, with the default PLL settings (CPLL is 800MHz, VDU dividers leave it at 400MHz); but some boards change PLL settings. Assign the expected default clock rate explicitly, so that the rate is consistent, regardless of PLL configuration. This was particularly broken on RK3399 Gru Scarlet systems, where the rk3399-gru-scarlet.dtsi assigns PLL_CPLL to 1.6 GHz, and so the VDU clock ends up at 800 MHz (twice the expected rate), and causes video artifacts and other issues. Note: I assign the clock rate in the clock controller instead of the vdec node, because there are multiple nodes that use this clock, and per the clock.yaml specification: Configuring a clock's parent and rate through the device node that consumes the clock can be done only for clocks that have a single user. Specifying conflicting parent or rate configuration in multiple consumer nodes for a shared clock is forbidden. Configuration of common clocks, which affect multiple consumer devices can be similarly specified in the clock provider node. Fixes: 9998943f6dfc ("media: rkvdec: Stop overclocking the decoder") Cc: Signed-off-by: Brian Norris Reviewed-by: Nicolas Dufresne --- This is a candidate for 5.19 IMO, since commit 9998943f6dfc landed in 5.19-rc1 and is being queued up for -stable as we speak. arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi | 4 +++- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi index 913d845eb51a..1977103a5ef4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi @@ -376,7 +376,8 @@ &cru { <&cru ACLK_VIO>, <&cru ACLK_GIC_PRE>, <&cru PCLK_DDR>, - <&cru ACLK_HDCP>; + <&cru ACLK_HDCP>, + <&cru ACLK_VDU>; assigned-clock-rates = <600000000>, <1600000000>, <1000000000>, @@ -388,6 +389,7 @@ &cru { <400000000>, <200000000>, <200000000>, + <400000000>, <400000000>; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index fbd0346624e6..9d5b0e8c9cca 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi @@ -1462,7 +1462,8 @@ cru: clock-controller@ff760000 { <&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>, <&cru ACLK_VIO>, <&cru ACLK_HDCP>, <&cru ACLK_GIC_PRE>, - <&cru PCLK_DDR>; + <&cru PCLK_DDR>, + <&cru ACLK_VDU>; assigned-clock-rates = <594000000>, <800000000>, <1000000000>, @@ -1473,7 +1474,8 @@ cru: clock-controller@ff760000 { <100000000>, <50000000>, <400000000>, <400000000>, <200000000>, - <200000000>; + <200000000>, + <400000000>; }; grf: syscon@ff770000 {