From patchwork Tue May 14 15:19:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Detlev Casanova X-Patchwork-Id: 13664239 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 6AF99C04FFE for ; Tue, 14 May 2024 15:24:39 +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:References:In-Reply-To: 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: List-Owner; bh=cCO4HQEwCajJ/sclpYyEzYXZBcWJ5J1WGHWOpYWeO3s=; b=V2NZGrhmSxWh2e keKLuKeXTZoCN0y3V6WhDLQDJjFRoHBHHrqochZKDe6bfkJvlIarsOoqcSzVKS8ZRsGBwtM1bIzaE zTIvWKw4zs7EHJ9QWFa3CE3W4WtOA7ILyO36MHctj6Tj5kLCkGOOJ5YVfSmUw6DMOrZ5J43wLGT2w FlsH+hiZjmDIop62FkmxAZO6GzLJlCKgzjJlfpOyDyPexlCXjGtORvrAAtuuyj3+DN8nXJ04GzMn8 pQBH6ysAPu0T1cSUdJfH1tmWGt1fFOFVt7Ni/xmWe7OdbN7J8sajqGOSjyCdDksvds8w8eNH5YwTW T02bO5Vp9yHQOdf8n9pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6u0u-0000000GJas-13vf; Tue, 14 May 2024 15:24:24 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6u0n-0000000GJVd-1BnL; Tue, 14 May 2024 15:24:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715700254; bh=PA/IrvxvIM1ep8+7B89JcUeTkpU1YjsSPqMoeUWmhXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTBoB/7uotXXUuwJ8K2YfoYtA/rDvdjmDaQQEPVWDdXWA202pbtg8J7SPXQoW3ufN UaQMlPxpioSSIfoX90k0nPA377XM0GYLVHL/atltBTMSY33pYN64CCHQQW2my9agS7 k/on0z/UGaaQs0akuOubpl1+KtZ0ciLAtOcDl+vC+Hyi4BtJpRN89jDlNUrO7rnnWK cv7xupPLy+51AxvvlgSE/2fR+O/+lO4g/0ed1R8e9SxfRo6db8xh+lYlmgiZ1dkIEb DhQ9mtc51bNAsvyVAR5SrC1jJpcitZuhfkPgAdQdHPBPYBZlL4v17cAt9ZzhixLReG S7lwSTHqRC0EA== Received: from arisu.hitronhub.home (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: detlev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id ED28B3782191; Tue, 14 May 2024 15:24:10 +0000 (UTC) From: Detlev Casanova To: linux-kernel@vger.kernel.org Cc: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sebastian Reichel , Dragan Simic , Chris Morgan , Diederik de Haas , Boris Brezillon , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Detlev Casanova Subject: [PATCH 1/3] drm/rockchip: vop2: Add clock resets support Date: Tue, 14 May 2024 11:19:45 -0400 Message-ID: <20240514152328.21415-2-detlev.casanova@collabora.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514152328.21415-1-detlev.casanova@collabora.com> References: <20240514152328.21415-1-detlev.casanova@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240514_082417_496081_188F5A50 X-CRM114-Status: GOOD ( 15.85 ) 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 At the end of initialization, each VP clock needs to be reset before they can be used. Failing to do so can put the VOP in an undefined state where the generated HDMI signal is either lost or not matching the selected mode. Signed-off-by: Detlev Casanova --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index fdd768bbd487c..e81a67161d29a 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -157,6 +158,7 @@ struct vop2_win { struct vop2_video_port { struct drm_crtc crtc; struct vop2 *vop2; + struct reset_control *dclk_rst; struct clk *dclk; unsigned int id; const struct vop2_video_port_data *data; @@ -1915,6 +1917,26 @@ static int us_to_vertical_line(struct drm_display_mode *mode, int us) return us * mode->clock / mode->htotal / 1000; } +static int vop2_clk_reset(struct vop2_video_port *vp) +{ + struct reset_control *rstc = vp->dclk_rst; + struct vop2 *vop2 = vp->vop2; + int ret; + + if (!rstc) + return 0; + + ret = reset_control_assert(rstc); + if (ret < 0) + drm_warn(vop2->drm, "failed to assert reset\n"); + udelay(10); + ret = reset_control_deassert(rstc); + if (ret < 0) + drm_warn(vop2->drm, "failed to deassert reset\n"); + + return ret; +} + static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state) { @@ -2055,6 +2077,8 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, vop2_vp_write(vp, RK3568_VP_DSP_CTRL, dsp_ctrl); + vop2_clk_reset(vp); + drm_crtc_vblank_on(crtc); vop2_unlock(vop2); @@ -2706,6 +2730,12 @@ static int vop2_create_crtcs(struct vop2 *vop2) vp->data = vp_data; snprintf(dclk_name, sizeof(dclk_name), "dclk_vp%d", vp->id); + vp->dclk_rst = devm_reset_control_get_optional(vop2->dev, dclk_name); + if (IS_ERR(vp->dclk_rst)) { + drm_err(vop2->drm, "failed to get %s reset\n", dclk_name); + return PTR_ERR(vp->dclk_rst); + } + vp->dclk = devm_clk_get(vop2->dev, dclk_name); if (IS_ERR(vp->dclk)) { drm_err(vop2->drm, "failed to get %s\n", dclk_name); From patchwork Tue May 14 15:19:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Detlev Casanova X-Patchwork-Id: 13664238 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 B45D3C25B75 for ; Tue, 14 May 2024 15:24:36 +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:References:In-Reply-To: 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: List-Owner; bh=EJTWypCiHoOayJc0FXT6m7RvMwqCr6AMTfK2tU5k+zI=; b=vTSdigtQ9iBN7e DinnK4HAlWPKVxW4+LcBkAaTYufJCvQBn8wHkWSBryMTaB1zcwrUhPnujq0FAyL9lR+cSx0h6iUEA Gv4JGTMvgw+qFoB+gkSAqzmI3XUplHvmbQ2V5vKjwUhg9TSezel+AR3hixHaBcjx4KTH52JAfRZbZ gWXzh9BzpdewEtGCFygCihnw5AMMJBj/a19J9KFfVmhPHsC+uD+21rly6wqQwVM4J9gmo6kSBGiE1 HfkuClSVMIjYiwM+ITQKsfmxJGzwZbl4JKcXvtoMdLEnqQBZWCAag4bnPfZ+La5Aq67+Lh18Xldrs brU+UhzacfmCL/w1lIgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6u0w-0000000GJd8-1VD7; Tue, 14 May 2024 15:24:26 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6u0p-0000000GJXB-1ux7; Tue, 14 May 2024 15:24:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715700258; bh=r3Fx1MKTIpt0X27ue0Y4XgM4MOWhxwM0vB8PYtwySfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXK1+Wklm7FOLRZkfhUFoZSpyv6Dym+xBQ18JYUutLSyxwrBvBzgFT5cweUI3jcvj K1JiI654qKuV0zDABaBUJ/jgC0gqyXX12BCLd4JPtnqi6bFcCKDZOMA44KLA4O+6xN +czk+HRC89F2Fufc58nRVkWyx4xWX5L7el+lOfvSB1VdkFjcxMQroIPg2tyiHXhQax lkp6TOo4jjdjMZImi814JUwawbanqzYR5JmzXhAurJvCIYtnWLdumVvefw6PgwGWdg 2syvr382zNcyr1xQsu/OPwQoPbXOaCb1gOFrzfQwZGXCZg2RQ77uH2V6z7mDEIj7Yq 8i3I7rTp12WeA== Received: from arisu.hitronhub.home (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: detlev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id C30FE3782197; Tue, 14 May 2024 15:24:14 +0000 (UTC) From: Detlev Casanova To: linux-kernel@vger.kernel.org Cc: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sebastian Reichel , Dragan Simic , Chris Morgan , Diederik de Haas , Boris Brezillon , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Detlev Casanova Subject: [PATCH 2/3] arm64: dts: rockchip: Add VOP clock resets for rk3588s Date: Tue, 14 May 2024 11:19:46 -0400 Message-ID: <20240514152328.21415-3-detlev.casanova@collabora.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514152328.21415-1-detlev.casanova@collabora.com> References: <20240514152328.21415-1-detlev.casanova@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240514_082419_716284_30A5ABFC X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. 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 This adds the needed clock resets for all rk3588(s) based SOCs. Signed-off-by: Detlev Casanova --- arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi index 6ac5ac8b48abb..8560c92cd406c 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi @@ -1193,6 +1193,14 @@ vop: vop@fdd90000 { "pclk_vop"; iommus = <&vop_mmu>; power-domains = <&power RK3588_PD_VOP>; + resets = <&cru SRST_D_VOP0>, + <&cru SRST_D_VOP1>, + <&cru SRST_D_VOP2>, + <&cru SRST_D_VOP3>; + reset-names = "dclk_vp0", + "dclk_vp1", + "dclk_vp2", + "dclk_vp3"; rockchip,grf = <&sys_grf>; rockchip,vop-grf = <&vop_grf>; rockchip,vo1-grf = <&vo1_grf>; From patchwork Tue May 14 15:19:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Detlev Casanova X-Patchwork-Id: 13664240 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 96E6DC25B78 for ; Tue, 14 May 2024 15:24:41 +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:References:In-Reply-To: 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: List-Owner; bh=pXa8ZjrpfDhCFL7Vm7/T62SqdhT2kqiugQtuxorJG3s=; b=vuY//uoSiNsDWI J4FJ6vGXzquPiir5KgL58ruDLjjbUhRf60bJmNeiwr4pdlwDlcskF2oRfXLk0DkvjSKH+n53PnjpF 6+nWNzIsk6LBfc6YbKNOaZLLwt51nkPa4gYASwX5/bXw5S29svxKXicTbBMB1RQ/ZoMw6wZcpK5ky xiFkzGj23CgVpMe3Cr0QFppszWE3cfPBY2m/203GIzZxz/derFDjRVUO3kN5VHXM2YN4+tl278kAM c4tWE4JfivGZPUVS7047+01c76fRt3QP1Ismtgr4ARoBDJQ0qKsX0T7VA+8i3iTsysdPW8rE0U5z0 Cut8lExBb/a+AeclRWUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6u11-0000000GJh0-1Zgu; Tue, 14 May 2024 15:24:31 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6u0t-0000000GJZA-1INT; Tue, 14 May 2024 15:24:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1715700262; bh=p7nTz/Irz77RiCSjoigxmGbDz02q1CnibFJajp5cPw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tV5Hda4AXXSV+gBLPGXMrdFGL33+gcnuSGI60CBLFQtOcWSaYTb6XDVRRmGy4DC0E 08XVWtEfv8Unohji+Dqq4bAHaP2tmtAJMuAnPGHSFOHpmbjAA8rsGbveIBC14tUv9y 7uFM+yfjX/p8jWMKLEi/e9CXy3IBXc/IKg0WqXq3EowUuanIJZkCyjWfd8yr39kIG7 XT2tsD6I6RZ6bCCa3bc9g6V6lMmvQLE03pNbrU/XP9C9iat4iqBmSc4uYU8irRpcfn zFZcoZwSWXhU7f098rg64RxI0HHBz+kyPTx1e62LNMDWfyH6PUOZ6vpopQCMLIQm2b 1HmBeCp4zPvJQ== Received: from arisu.hitronhub.home (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: detlev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 98D883782198; Tue, 14 May 2024 15:24:18 +0000 (UTC) From: Detlev Casanova To: linux-kernel@vger.kernel.org Cc: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sebastian Reichel , Dragan Simic , Chris Morgan , Diederik de Haas , Boris Brezillon , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Detlev Casanova Subject: [PATCH 3/3] dt-bindings: display: vop2: Add VP clock resets Date: Tue, 14 May 2024 11:19:47 -0400 Message-ID: <20240514152328.21415-4-detlev.casanova@collabora.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240514152328.21415-1-detlev.casanova@collabora.com> References: <20240514152328.21415-1-detlev.casanova@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240514_082423_500773_6E9D89DB X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. 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 Add the documentation for VOP2 video ports reset clocks. One reset can be set per video port. Signed-off-by: Detlev Casanova --- .../display/rockchip/rockchip-vop2.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml index 2531726af306b..941fd059498d4 100644 --- a/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml @@ -65,6 +65,22 @@ properties: - const: dclk_vp3 - const: pclk_vop + resets: + minItems: 3 + items: + - description: Pixel clock reset for video port 0. + - description: Pixel clock reset for video port 1. + - description: Pixel clock reset for video port 2. + - description: Pixel clock reset for video port 3. + + reset-names: + minItems: 3 + items: + - const: dclk_vp0 + - const: dclk_vp1 + - const: dclk_vp2 + - const: dclk_vp3 + rockchip,grf: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -128,6 +144,11 @@ allOf: clock-names: minItems: 7 + resets: + minItems: 4 + reset-names: + minItems: 4 + ports: required: - port@0 @@ -183,6 +204,12 @@ examples: "dclk_vp0", "dclk_vp1", "dclk_vp2"; + resets = <&cru SRST_VOP0>, + <&cru SRST_VOP1>, + <&cru SRST_VOP2>; + reset-names = "dclk_vp0", + "dclk_vp1", + "dclk_vp2"; power-domains = <&power RK3568_PD_VO>; iommus = <&vop_mmu>; vop_out: ports {