From patchwork Wed Apr 2 13:30:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036038 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 C4D49C3601A for ; Wed, 2 Apr 2025 13:37:51 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ht+JtOGp/3yIWp3whle9yDOfxL+xslExGOOaIuqehT0=; b=mY3lCYbFZtjg55 BM90QTr6XfEmdUjb+BbwhyyCbjyxFwmae7JP+GMT0HIT7zMRYUg46gmtJJxZHBn5kKTin5p+EBx5S 0Nc+uBn/RmBSk3AuFpWG3MFnDsk9v31yEq7NMBtOFX9en85ub+Wh7fDhmGQryETi9R28YRHVNxOBI fWjxRolDSTx1BAjtt7HD8veuuXv2Vpn04gC8+B0jx5LQx6owJQBEvxAbp2M/3dL6t9RYBjtazNYLJ mX4GKcy0w8PLZJajTOP/S+CE/WoO6jkRgd0xFqsc64G1bAWM9ErUym1ej105l/vwq6fLcgQSkEI4Y /7xcAkAxq3bW3K9CViKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHv-00000006GjX-2Hzh; Wed, 02 Apr 2025 13:37:51 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBa-00000006F72-0lBb for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:19 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E74956A2; Wed, 2 Apr 2025 15:29:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600563; bh=tWpzu7ba133Zdaj4dIf8mfTY5P/FzEw3AwQGlLkB6nY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XiTaeGGQDZcc5mC4YZUP28aG6WrYTqwJQctuaS29IqWasCY46ayi9aMnTvOV2+0Dp 7fgHvJty0omJ9Bh/B/U+pTGpHyUu2ldvTRDegglbK6fsqJU1lBXWLEu53CmakAo8Ez F+BKSFgd1LhMBrUybOl3GlRzHbnQveR5lUTMs9zE= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:43 +0300 Subject: [PATCH v2 01/18] drm/tidss: Fix missing includes and struct decls MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-1-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2118; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=tWpzu7ba133Zdaj4dIf8mfTY5P/FzEw3AwQGlLkB6nY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twb1rv8WsaK7ZyMNRHo2SCza155wW0BQGFDR NuG01wNSSSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08GwAKCRD6PaqMvJYe 9ZZSD/49WAxaJgfcNgLcwg7nvNWgDMBwl6GFx8D71IkdeY1FtzSCQzO0LoB9ZeM9+Y+aPy9f9T9 DqhcnPQ7o/u4tq67PcIq4OIVOklnk5O0Z2SDVMNryax3kQboN4gvnlUFAaMPSHSFzE3vY9pw2m3 bwVFI+eLtAntLqXcsXBm1uFy5LlptAFXbaknwYA6Uvkw6/GBkOgJF4E9WqIMPvtXmOJDse1lYgh oIOBPDA1ZyVbQ+i3mSH3PDAi9PXz/Emza4558knGsHsMizm4dfqD/oTuWIqDAikqEdyQ2ZQYEdk IjDah/sv1spVbVDqJiLbcgE+0SMW263mwf4AFwyLvmRkLP6AhpUcgs9WUA2iZxpBxTbbHKB1VIR l0O9mMR1nSWTo9yMRjp7HkgyrINyVN/FYbnCUBwMRKmR9O18a63yjhaMyG9StPtVPRrtouYxf7A F0dd/L06h6dfIrsecf9CV2zgezxbcmGXWjFDUOpANUM+Rmsffmr/JmKCw9oVjdtpuLWEsdZuIoi IGYR5UCtUABr//fBgpalui7Bg9vmxND+t6TgKl5e/vis7yEOk3X4LPpTiVt8BCvzS3zUWPN5GgM 8UsMXNWazahMmRyhzBBBtMut6+QhJqZchWn+kGEVwfExjBemikxlF7Re4nAiJqW9kKrELflJVi7 H70T3CRi185GwZw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063118_361626_D6BDCEA7 X-CRM114-Status: UNSURE ( 7.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Fix missing includes and struct declarations. Even if these don't cause any compile issues at the moment, it's good to have them correct. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_dispc.h | 3 +++ drivers/gpu/drm/tidss/tidss_drv.h | 2 ++ drivers/gpu/drm/tidss/tidss_plane.h | 2 ++ drivers/gpu/drm/tidss/tidss_scale_coefs.h | 2 ++ 4 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.h b/drivers/gpu/drm/tidss/tidss_dispc.h index 086327d51a90..c31b477a18b0 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.h +++ b/drivers/gpu/drm/tidss/tidss_dispc.h @@ -7,11 +7,14 @@ #ifndef __TIDSS_DISPC_H__ #define __TIDSS_DISPC_H__ +#include + #include "tidss_drv.h" struct dispc_device; struct drm_crtc_state; +struct drm_plane_state; enum tidss_gamma_type { TIDSS_GAMMA_8BIT, TIDSS_GAMMA_10BIT }; diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h index 7f4f4282bc04..56a2020e20d0 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.h +++ b/drivers/gpu/drm/tidss/tidss_drv.h @@ -9,6 +9,8 @@ #include +#include + #define TIDSS_MAX_PORTS 4 #define TIDSS_MAX_PLANES 4 diff --git a/drivers/gpu/drm/tidss/tidss_plane.h b/drivers/gpu/drm/tidss/tidss_plane.h index aecaf2728406..92c560c3a621 100644 --- a/drivers/gpu/drm/tidss/tidss_plane.h +++ b/drivers/gpu/drm/tidss/tidss_plane.h @@ -7,6 +7,8 @@ #ifndef __TIDSS_PLANE_H__ #define __TIDSS_PLANE_H__ +#include + #define to_tidss_plane(p) container_of((p), struct tidss_plane, plane) struct tidss_device; diff --git a/drivers/gpu/drm/tidss/tidss_scale_coefs.h b/drivers/gpu/drm/tidss/tidss_scale_coefs.h index 9c560d0fdac0..9824d02d9d1f 100644 --- a/drivers/gpu/drm/tidss/tidss_scale_coefs.h +++ b/drivers/gpu/drm/tidss/tidss_scale_coefs.h @@ -9,6 +9,8 @@ #include +struct device; + struct tidss_scale_coefs { s16 c2[16]; s16 c1[16]; From patchwork Wed Apr 2 13:30:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036037 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 1D68EC3601B for ; Wed, 2 Apr 2025 13:37:52 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sJvI34xiFjRXVlrRx0CfhPncbxfVw9QzOIS8v8AAplw=; b=MUurD7vmPgUPN1 hlAsVrg7EtDg8EP88ea4FpR80kln7XpMEFrEZ2LOy8gjdXBij9+76IxCW8NdpcV+OL8OId4kP+in4 uBfxfNyyztL0V+B3CxWcUNhFPsu6InDBs/ihWSWAroEcySkrVrElmHDWFFdXgUfl4vdJjdSvpQtJD umNFtrMizxlJOkT+1bBxH0J/I2zY2ESr6/XojoCjJSfuYl08252lHd15HD00fLttbZs5lsEqTME/M Y61PYUOcoTh+jemwru5bcXK9tETKQTmlgd9kOthCzwGJlvW8Dq9kax5/W5xgwQak97tkoay+Ff3Zx QLlDHWRfoPMgJkCcp3Ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHv-00000006Gjp-3UxT; Wed, 02 Apr 2025 13:37:51 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBb-00000006F7O-0MQA for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:20 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 18666109A; Wed, 2 Apr 2025 15:29:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600565; bh=lEa3BxN/6LhqthWXir58vTyZRT4d8BUmsi3iv05b4SI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Hy0ZYv7+3NqqgAW6ebTLNj5eH6r2ENeyc/blyhhqBpSlqnBwwUqwXlwD49+yrFSLs IMPf0B6XfIpmyQpLcXQ/vhpXR9lqE4Ww/Q1ShnLm0L1sO7kt9RqcZqZJC+Cgv1sPGV fi2pmDfwqoHy9ZO6DIjEz1eB3HGiy/Rqpeq60okE= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:44 +0300 Subject: [PATCH v2 02/18] drm/tidss: Use the crtc_* timings when programming the HW MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-2-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2447; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=lEa3BxN/6LhqthWXir58vTyZRT4d8BUmsi3iv05b4SI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7TwbvLVB3NSmEEZTKu2mPkd4cA53AxHiHX+cu 5bfLMU8TS6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08GwAKCRD6PaqMvJYe 9YhAEACdn7Oov1vXfnvsqQzBPL5vwo3aQ+a4r7+ThgX72vDWUZGEOsnceOUSZQ/kOBrq/jD+6E6 YMTaSawx/zRswAAP7WZE1bFd+6z1cXCmNPG2n32uuK5ZCmqObJsOeFBjwfjFvaj/MF+EsGpUyUq e7LY81lqAZ3D1GDP6xBRytSabDoObPpXq/flP7O5Fp21I414UcJ0KOHpY5W6l5T5nEgmbDuw8+O oobEl38xV/8siHif2loJz2WG9Lcjt3uwtd6GpX1HlWOJ4sM8xeWcQWQcuDA82qt+iyM9SrXUT8/ bOBc15mxhN8Xccl4UwTQ2bArkFjt4pr5+efjgUK3Pf9lpEuJufM8msXpAtfIAhTHRrKX1Z9VsxA rOLBWEAMtg5Df5q+4/T6x9pJI6z4luCbY490q3vDxJEfARQNso96i0EgwDylPGnJ26FyAfuML0O 822FOJzLMxiEhd1In7hO3gDL/U5OuEixME7uxHVP5piFfNNM1jBLULEU4dBSbDPOXmIg1cC+x/T AztfKErMNF60ODMLK12eSIKYKZJkFeFHX+Zy/visWKf1kA6rqhnsbqf8itA/ZDPv6kuvG/23B4M NU6JU8R90kccucxKjhv8ERWCeIPRWEDVKUPpjHR+H6P+sZHoX+ftCTkpIQGau+0WrCqLkIH/sCw Xvv81vKlzLHxMdA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063119_282254_B22CA7B0 X-CRM114-Status: UNSURE ( 9.29 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Use the crtc_* fields from drm_display_mode, instead of the "logical" fields. This shouldn't change anything in practice, but afaiu the crtc_* fields are the correct ones to use here. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_crtc.c | 2 +- drivers/gpu/drm/tidss/tidss_dispc.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c index 94f8e3178df5..1604eca265ef 100644 --- a/drivers/gpu/drm/tidss/tidss_crtc.c +++ b/drivers/gpu/drm/tidss/tidss_crtc.c @@ -225,7 +225,7 @@ static void tidss_crtc_atomic_enable(struct drm_crtc *crtc, tidss_runtime_get(tidss); r = dispc_vp_set_clk_rate(tidss->dispc, tcrtc->hw_videoport, - mode->clock * 1000); + mode->crtc_clock * 1000); if (r != 0) return; diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index cacb5f3d8085..a5107f2732b1 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -1084,13 +1084,13 @@ void dispc_vp_enable(struct dispc_device *dispc, u32 hw_videoport, dispc_set_num_datalines(dispc, hw_videoport, fmt->data_width); - hfp = mode->hsync_start - mode->hdisplay; - hsw = mode->hsync_end - mode->hsync_start; - hbp = mode->htotal - mode->hsync_end; + hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; + hsw = mode->crtc_hsync_end - mode->crtc_hsync_start; + hbp = mode->crtc_htotal - mode->crtc_hsync_end; - vfp = mode->vsync_start - mode->vdisplay; - vsw = mode->vsync_end - mode->vsync_start; - vbp = mode->vtotal - mode->vsync_end; + vfp = mode->crtc_vsync_start - mode->crtc_vdisplay; + vsw = mode->crtc_vsync_end - mode->crtc_vsync_start; + vbp = mode->crtc_vtotal - mode->crtc_vsync_end; dispc_vp_write(dispc, hw_videoport, DISPC_VP_TIMING_H, FLD_VAL(hsw - 1, 7, 0) | @@ -1132,8 +1132,8 @@ void dispc_vp_enable(struct dispc_device *dispc, u32 hw_videoport, FLD_VAL(ivs, 12, 12)); dispc_vp_write(dispc, hw_videoport, DISPC_VP_SIZE_SCREEN, - FLD_VAL(mode->hdisplay - 1, 11, 0) | - FLD_VAL(mode->vdisplay - 1, 27, 16)); + FLD_VAL(mode->crtc_hdisplay - 1, 11, 0) | + FLD_VAL(mode->crtc_vdisplay - 1, 27, 16)); VP_REG_FLD_MOD(dispc, hw_videoport, DISPC_VP_CONTROL, 1, 0, 0); } From patchwork Wed Apr 2 13:30:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036040 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 C8971C3601E for ; Wed, 2 Apr 2025 13:37:52 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mvc1wbz6ZD33tB1Fvhv0bYStUP/jftbYcDxRKNozxE4=; b=RXbGcTCZWle+s8 s/hAN6AARbTIf0o6nuUNRrq2I0VSoVYfTZO1rynsSfrQ7tVan0HSlO7duR56vEs0XUFA1tOq2WrLQ +zKsuZrzUfq+Fjg10RqddlZZqLAprgXPCHT6whLnSUkprTvWcXcYaoSHvpOmdrIowXR/HdIaAFVWk 3TXpEPiFIXzRiiGMpgHO4vW1XZzx10pNoACwtOXVHP+dX+SzGG30shpqOwWuFgOjQ4SEcJZ5pSsnl Cs8Inx1OeR4BUlqkvEnrFsKlr5BkueJpHG+2vIP76HZUcDw7V5SKQ24h+X9QL2+zE6t8/u/fTj7vT LUTMFkTRFAZuAkdsII5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHw-00000006Gkt-26FJ; Wed, 02 Apr 2025 13:37:52 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBd-00000006F8I-3E4T for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:23 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3BD7618D7; Wed, 2 Apr 2025 15:29:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600566; bh=ye/JSU6RkHhBBCfydm73XwRK9B4EaT5qH6JR7AJ+l70=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ernYpvSOioCibN7IuvbvF7/jfNl3aNOXg1fJd16OOoWZ9TOvQGQJdTg1zlBcLPxTG mFFzFf3Rgi+24oi/gaw9jZkDM7xjZGJnU+ifDS6/ORhD35v1qFmTi95ZfVsKAxHk5v O4gr0ByK+z6yre1/ulHGxtFK+mIwQHVBtKU1tExo= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:45 +0300 Subject: [PATCH v2 03/18] drm/tidss: Adjust the pclk based on the HW capabilities MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-3-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3735; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=ye/JSU6RkHhBBCfydm73XwRK9B4EaT5qH6JR7AJ+l70=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twc2escEfItlPXesG8FIeup/1y8543dNTdaB i4LBDgP+8eJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HAAKCRD6PaqMvJYe 9dSQD/9pkps9DnK+/7diEOjwiA0BDCFcQ1JC+JDSASXO8elUhhgqL0ULOQJp4YE2OTt9HTu+tMN QQNa/DZiRsrZeStCyq/gR/2ulYvPYseaGQVPQZ5AS9uwiJWVe0FCqu/+Ht9eG6enBon/+2E6O8j La315wTP6NOqY+dNj6V6VQrN38Q+eCLKQ0g7yXVQj724m+mWBmqT+zGC47xK80AIhsPpg32QaTS On+g4uJaI4Z+vUqoTGU/01k53r3rzAKrexnPdvl8m5YfLzdeF6TcZe7gRtauo6heYvLhUfLf5nU ytU8TeHyTymbKJapftCnLhyAlE26DXdSgz7ddN2jeGzZXcSNZe2uiUgvhce2rARtyCQBY9Zmkmd URIWI5LKtYpA1G3AMYYVNaLq5Ld0OKj7fmetN3b7fO37hRNSwOALNvUse3gy3sJI24yVGsbf6Bd ABqwOsP7tf+lUqOzTLpqeCN8IaFoxYp52XH+tRuTT1bdQjarDwAg8VkT1+m8Zb597wlZOhEDw++ Tv2sVhO639/y9Mbxm8jnFlES9jeMMvXHH/1pQR2sjbPktWTRRjZ/vhPFWnbH8wGFovXy+wDMfRa Lq9q5Dlu0O1EytKTDHzbmpqLGhgoKj2KZ3+cBZcYsvZ9ad32oo3Gfw/80t6dV1ULhIRKlOL3oZd JxmcmBJhYsMQyWg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063121_951272_B5A287FA X-CRM114-Status: GOOD ( 15.39 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org At the moment the driver just sets the clock rate with clk_set_rate(), and if the resulting rate is not the same as requested, prints a debug print, but nothing else. Add functionality to atomic_check(), in which the clk_round_rate() is used to get the "rounded" rate, and set that to the adjusted_mode. In practice, with the current K3 SoCs, the display PLL is capable of producing very exact clocks, so most likely the rounded rate is the same as the original one. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_crtc.c | 23 +++++++++++++++++++---- drivers/gpu/drm/tidss/tidss_dispc.c | 6 ++++++ drivers/gpu/drm/tidss/tidss_dispc.h | 2 ++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c index 1604eca265ef..6c3967f70510 100644 --- a/drivers/gpu/drm/tidss/tidss_crtc.c +++ b/drivers/gpu/drm/tidss/tidss_crtc.c @@ -91,7 +91,7 @@ static int tidss_crtc_atomic_check(struct drm_crtc *crtc, struct dispc_device *dispc = tidss->dispc; struct tidss_crtc *tcrtc = to_tidss_crtc(crtc); u32 hw_videoport = tcrtc->hw_videoport; - const struct drm_display_mode *mode; + struct drm_display_mode *adjusted_mode; enum drm_mode_status ok; dev_dbg(ddev->dev, "%s\n", __func__); @@ -99,12 +99,27 @@ static int tidss_crtc_atomic_check(struct drm_crtc *crtc, if (!crtc_state->enable) return 0; - mode = &crtc_state->adjusted_mode; + adjusted_mode = &crtc_state->adjusted_mode; - ok = dispc_vp_mode_valid(dispc, hw_videoport, mode); + if (drm_atomic_crtc_needs_modeset(crtc_state)) { + long rate; + + rate = dispc_vp_round_clk_rate(tidss->dispc, + tcrtc->hw_videoport, + adjusted_mode->clock * 1000); + if (rate < 0) + return -EINVAL; + + adjusted_mode->clock = rate / 1000; + + drm_mode_set_crtcinfo(adjusted_mode, 0); + } + + ok = dispc_vp_mode_valid(dispc, hw_videoport, adjusted_mode); if (ok != MODE_OK) { dev_dbg(ddev->dev, "%s: bad mode: %ux%u pclk %u kHz\n", - __func__, mode->hdisplay, mode->vdisplay, mode->clock); + __func__, adjusted_mode->hdisplay, + adjusted_mode->vdisplay, adjusted_mode->clock); return -EINVAL; } diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index a5107f2732b1..3930fb7f03c2 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -1318,6 +1318,12 @@ unsigned int dispc_pclk_diff(unsigned long rate, unsigned long real_rate) return (unsigned int)(abs(((rr - r) * 100) / r)); } +long dispc_vp_round_clk_rate(struct dispc_device *dispc, u32 hw_videoport, + unsigned long rate) +{ + return clk_round_rate(dispc->vp_clk[hw_videoport], rate); +} + int dispc_vp_set_clk_rate(struct dispc_device *dispc, u32 hw_videoport, unsigned long rate) { diff --git a/drivers/gpu/drm/tidss/tidss_dispc.h b/drivers/gpu/drm/tidss/tidss_dispc.h index c31b477a18b0..d4c335e918fb 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.h +++ b/drivers/gpu/drm/tidss/tidss_dispc.h @@ -120,6 +120,8 @@ enum drm_mode_status dispc_vp_mode_valid(struct dispc_device *dispc, const struct drm_display_mode *mode); int dispc_vp_enable_clk(struct dispc_device *dispc, u32 hw_videoport); void dispc_vp_disable_clk(struct dispc_device *dispc, u32 hw_videoport); +long dispc_vp_round_clk_rate(struct dispc_device *dispc, u32 hw_videoport, + unsigned long rate); int dispc_vp_set_clk_rate(struct dispc_device *dispc, u32 hw_videoport, unsigned long rate); void dispc_vp_setup(struct dispc_device *dispc, u32 hw_videoport, From patchwork Wed Apr 2 13:30:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036036 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 6F9A6C3601C for ; Wed, 2 Apr 2025 13:37:52 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sMT0Oxm58ee/kvrYwSxVBLsfj7DPooOgf+YP6+tbTA4=; b=YDdubbq5jF1LEr liA2DkSel7HEYk5GdVEA72lN2qZdlHfoiJwCLdBTdg8hhAFnvbeXk3mCkZr/T0W2KhUIy4+0LlmOJ MFBuvpp5f5Ms4F0PtiudmtL9yPNl+RnNzwnaJegSZ5+UFG7dpf1FGQ/HFjbATj1Y/ZCHtWNYbtemm UvYDOKieV0qiGMHx721e0zvmdxsS2liEiH5q87zi6dtrnnjpuE9r5Yd+itXayak1cq1kZdpEwAItw 7iatKtWhB8vZvOUEl+pL8O30MnmdQjcSCn2r1AEF4/EftfCaTflzLFr62Kry2MZ4iUPgUnJRohmvX r7ALgGOEioohuhSJcSyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHw-00000006GkJ-0h3W; Wed, 02 Apr 2025 13:37:52 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBd-00000006F8B-1Pjm for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:22 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 62FF71986; Wed, 2 Apr 2025 15:29:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600567; bh=0rz+qtGwR8012ibx7Ol/9THyUm6cLrG8rh2vtI7MsMc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iHMAvUFZ0oSZaOR2bJctKAa9uKxqxZ1uwIFG+fgt5ReEow5ommMK0fE7hXUtlMVHP LYg4CJOs+qmplVfNkcrrvIm5kSC4X9Ctgy/7LmY7shiVHpIRsYSRzKm1vHRg2p7+WX 1Hf+o9yBxVAqV7dcQwiZpakjC1ZGJsqvH4fXSda0= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:46 +0300 Subject: [PATCH v2 04/18] phy: cdns-dphy: Store hs_clk_rate and return it MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-4-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1212; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=0rz+qtGwR8012ibx7Ol/9THyUm6cLrG8rh2vtI7MsMc=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7TwcaZeTlUBNgRJH+o0UqxKZ47XGEk5nI4+fx rlZ/xHDxHSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HAAKCRD6PaqMvJYe 9fwTD/4xUL4hkpewbyumBl2OhN2ZsCukOxQqMp6sDpBhQla+6MmBo5TwSfiDKA5PxrVTVCoRRHl Tz13fTTolMEQB8iy4zjXiMJ7YoVFe0yzM73tnnh4Ay5RfGd4JvM96cx8prHIdyRuzQG/ANWjaS7 XVq12EuPuOpuzzWHdwSh10BVmxzShAOJINdAHPCvl0e7OXkUE9tesiZEmqgIfQwWqGdV7ZiGtHx 8goeYf3sVYdKDcEQSfAZZDXXmRjEFFHZ6mlbjxoUpR/HoKEumNUAIYU/mL1nqmWOFOrC89g3/eG hJq8F2FIdZQEaWxRYqO5KlzYXLq1qPWiKfK0stc7BYHPl83I9oqk8uzWaVqYiZmNidVr21Q/wXz ec3sOipiMf5xS4j16tOu47LJ6W1WupZ9FGqd/C6ocDn9KE00TdJOWesU326VPcUn7lRAsv+yDGY WSxKkXX3n2FKpiQB70ejX1wcD3/OqmVeJOK9J7wSdPNZPXX7dGyyiM6GcsfYkCd4J35IPa83G3z +whWZc3fkm6jHWRYIMvW4FSRXRHpdRdFXoiKqk1UAKdCqdRvfpZJWkruEqfjTqjMknMErxQ8rfC PCANjw3lqM0A5neDAwc0TdSUqxnGRQXn7tfmKPVNcOFjDjekJfeSMhRTsMk/h2yUUoPpArXnMBJ 0LZmxjAyRkrlGKg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063121_590670_7342D025 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The DPHY driver does not return the actual hs_clk_rate, so the DSI driver has no idea what clock was actually achieved. Set the realized hs_clk_rate to the opts struct, so that the DSI driver gets it back. Signed-off-by: Tomi Valkeinen --- drivers/phy/cadence/cdns-dphy.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/phy/cadence/cdns-dphy.c b/drivers/phy/cadence/cdns-dphy.c index ed87a3970f83..f79ec4fab409 100644 --- a/drivers/phy/cadence/cdns-dphy.c +++ b/drivers/phy/cadence/cdns-dphy.c @@ -79,6 +79,7 @@ struct cdns_dphy_cfg { u8 pll_ipdiv; u8 pll_opdiv; u16 pll_fbdiv; + u32 hs_clk_rate; unsigned int nlanes; }; @@ -154,6 +155,9 @@ static int cdns_dsi_get_dphy_pll_cfg(struct cdns_dphy *dphy, cfg->pll_ipdiv, pll_ref_hz); + cfg->hs_clk_rate = div_u64((u64)pll_ref_hz * cfg->pll_fbdiv, + 2 * cfg->pll_opdiv * cfg->pll_ipdiv); + return 0; } @@ -297,6 +301,7 @@ static int cdns_dphy_config_from_opts(struct phy *phy, if (ret) return ret; + opts->hs_clk_rate = cfg->hs_clk_rate; opts->wakeup = cdns_dphy_get_wakeup_time_ns(dphy) / 1000; return 0; From patchwork Wed Apr 2 13:30:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036039 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 26583C3601F for ; Wed, 2 Apr 2025 13:37:53 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IR2X/81c+obyg3GFd4T/Nlclm2SW9hbrvlzlqtKUEUA=; b=UB4kycMW6TOnwV MDKZtQ/buK/5AbmJF5/7hHYbPIQvAracj4lKditqohpNk0yZChhZ/fXgmPZpbeoEynw624NVqNtTG JJ7+VmH6V+jrmPJmXHkEyUit0X3GpM1wvOhhymw+1g7Z+iODY4NGhtf48TcH13lUavptH+weGGN3i 8rDv8ZvWR4Ys/d+0L2QPR9hK93oLwDFsKv2OgPtwdwIkqtWvg2mOBsGjIx4abD5lK6TDgJWCp/rcF OVBoCPso4pzGIZbOzGIt45MVbXZ0Qx4LSEYAqr0kEoSNgg95Jll0dJpMaK04pV4xVeXzVfyYZJ/25 0MBqSh8JxKbk8E0gRP0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHw-00000006GlK-3QwD; Wed, 02 Apr 2025 13:37:52 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBe-00000006F8O-1840 for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:23 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 861F81990; Wed, 2 Apr 2025 15:29:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600568; bh=c1oUALt2KZgajaeiEy/9OAK/9/j14NZ5nS73HsxdZOA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=wXmGBINmOlLXn1vTyhMmFZrXUAfsfyZtR9pUGb0w99+dJ58rFxlqXdfSyz+58BF3h H018uSJwxkNFLeBm2pZkm3R6mcjrWaoUaU+gxWkMwgcGgHDF0+/8aGiR8ub/CKFaGB S2D0dDF0K5AGe7ojFYzsR+sf3HN2mVWuDAl4Z++4= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:47 +0300 Subject: [PATCH v2 05/18] phy: cdns-dphy: Remove leftover code MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-5-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2173; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=c1oUALt2KZgajaeiEy/9OAK/9/j14NZ5nS73HsxdZOA=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twc8yDvZ1RQJmWUsNT9bt28ZCh+IWNxKTyfr JxisTgoyRGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HAAKCRD6PaqMvJYe 9cqHD/9RumZ2gSAlo7blCD7hh6ZrKtGOq284AvCCYaDZvrs4Mzx2hggPApHUDHtXlpnebCAF48s JDRfz/OAfVIR184WRUzqOPBH1VxP22ztZsJLwqGVDvA/o/IMTQfNzmIeFHArLZ5JLOH+t7o27Pt BlgXlBUJn6BIVrW1X9mDuYfrpLRObGkDbNo3iyQkykFD314zD91/O4YJ8Ik8RuqZeeV0bceFKr8 k2zpHNKg4dYmODOlGEFBdCxjRxcDAIwJkyUtPvcFkgjo8J1i3pkExPTTDkqrJOIqR/qVDZGBUrQ WgVHoDXspczgFPTAF4uBACOXICC04RifuCSxHGZ3ET2Pszvg8Ju2KHcraEUxDIOb8HB9YZQNseq EUbfzuFLhe4Maj624ts32U3VifQtHflpK5VYr61NOoR2Z+Flrn4p6oM0CWIImb5gbraKDnaFbIz BuN8Cyw16yQ1Oa5oP3DJeRbZhGbJuYP5XjGQ4gh15Me+Ao0JrZawQ41eVaV6041pJzCCT+8oYsY BnzAwg/FgZ6/YdP8X1hMyqgArhoSfrNo4hKvHD4WsvagnI1ObkJYZWoDM6v8sM5ge9T2RQHPdr3 zpItaUkyesVtWXZ3MJZRYryv8gMAMJmskOeHcEPKxOIEJ5Fncw0tFtIBwxRYfDzSlKnqPGaf9L1 7/75V09J/IMEAUw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063122_449330_A04E463B X-CRM114-Status: GOOD ( 10.43 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The code in cdns-dphy has probably been part of a DSI driver in the past. Remove DSI defines and variables which are not used or do not actually do anything. Also rename cdns_dsi_get_dphy_pll_cfg() to cdns_get_dphy_pll_cfg(), i.e. drop the "dsi", as it's not relevant here. Signed-off-by: Tomi Valkeinen --- drivers/phy/cadence/cdns-dphy.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/phy/cadence/cdns-dphy.c b/drivers/phy/cadence/cdns-dphy.c index f79ec4fab409..7f8b70ec10c5 100644 --- a/drivers/phy/cadence/cdns-dphy.c +++ b/drivers/phy/cadence/cdns-dphy.c @@ -55,14 +55,6 @@ #define DPHY_PSM_CFG_FROM_REG BIT(0) #define DPHY_PSM_CLK_DIV(x) ((x) << 1) -#define DSI_HBP_FRAME_OVERHEAD 12 -#define DSI_HSA_FRAME_OVERHEAD 14 -#define DSI_HFP_FRAME_OVERHEAD 6 -#define DSI_HSS_VSS_VSE_FRAME_OVERHEAD 4 -#define DSI_BLANKING_FRAME_OVERHEAD 6 -#define DSI_NULL_FRAME_OVERHEAD 6 -#define DSI_EOT_PKT_SIZE 4 - #define DPHY_TX_J721E_WIZ_PLL_CTRL 0xF04 #define DPHY_TX_J721E_WIZ_STATUS 0xF08 #define DPHY_TX_J721E_WIZ_RST_CTRL 0xF0C @@ -117,10 +109,9 @@ static const unsigned int tx_bands[] = { 870, 950, 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2500 }; -static int cdns_dsi_get_dphy_pll_cfg(struct cdns_dphy *dphy, - struct cdns_dphy_cfg *cfg, - struct phy_configure_opts_mipi_dphy *opts, - unsigned int *dsi_hfp_ext) +static int cdns_get_dphy_pll_cfg(struct cdns_dphy *dphy, + struct cdns_dphy_cfg *cfg, + struct phy_configure_opts_mipi_dphy *opts) { unsigned long pll_ref_hz = clk_get_rate(dphy->pll_ref_clk); u64 dlane_bps; @@ -289,15 +280,13 @@ static int cdns_dphy_config_from_opts(struct phy *phy, struct cdns_dphy_cfg *cfg) { struct cdns_dphy *dphy = phy_get_drvdata(phy); - unsigned int dsi_hfp_ext = 0; int ret; ret = phy_mipi_dphy_config_validate(opts); if (ret) return ret; - ret = cdns_dsi_get_dphy_pll_cfg(dphy, cfg, - opts, &dsi_hfp_ext); + ret = cdns_get_dphy_pll_cfg(dphy, cfg, opts); if (ret) return ret; From patchwork Wed Apr 2 13:30:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036042 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 7981BC369A1 for ; Wed, 2 Apr 2025 13:37:53 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WZ+/BNvwH91A8zSDp6ifjLUwkED2oL9naptAsGQlFo4=; b=J8wb+v4R8eGoeq yJdwOhmsZefV+IWErA4O7MO0mqoy7oW6Mr2E/D5jt4+O08yMP4Atl1UorW+URYveC/4po9ZYiZxLi Rnm/dUGbQEOObYJYhUa+57Xlj7I3Di7OnKuvoTK4AlYBtOj62HDuG9Wuvm0btUm9FPwUH8UiDnpHc jWP/UwykFCWLK1E1B0UhICfK4LfNPILmvC/cvGtw0VcxKzkVEYvx0tF7EAOByTTP8QXutfuofzC4Q n2FzZB09jnZp99QPC65E1RMEn+6w4dPtHQ8rS3KCNR5tSlVFAdQyqbYh/SSGKQX5ksyiKTcS9rV/f 3VYYJKE8RiY2Okz+U8bQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHx-00000006Gln-0gDX; Wed, 02 Apr 2025 13:37:53 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBf-00000006F94-1v9o for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:24 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A7C9119C9; Wed, 2 Apr 2025 15:29:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600569; bh=3CN4uj1iCwxXdJquhx40R2NHzb/pS+FOmacXJwz76L8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NQHUAfPcH1rwhxyByEIFVaRgsdUCfq2XYKbi/yXKQkeOS0Pi1n1l7ioh7sUYpGwPK SswKu8gTOL3mgBzpherhLplNBdr5rAzyX1mPg/NXxrOlkOZien3VL/HPfVbop9jAUv imPdp1wS9kvmpXgSEJjj7ZsckJp9ahlz2heCcQ7E= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:48 +0300 Subject: [PATCH v2 06/18] drm/bridge: cdns-dsi: Adjust mode to negative syncs MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-6-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1357; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=3CN4uj1iCwxXdJquhx40R2NHzb/pS+FOmacXJwz76L8=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twdw/WedZDgLhiIic9z7RcO+p8ir4C1KqJPF U0d60QXZ7yJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HQAKCRD6PaqMvJYe 9aaoEACIPT3NJO+z+ih6nFSRkIVA5j6s8OwEPZYFfv3GG651PEeRrOCmHTCuXOwCMc8ZuZFVRzH 9j1KMTGQ9ZkccMBOo33ZjUz0TWeT18peERi4/4/O1kTJZPLtYRTZ7FUionkIgNCqrCbRqJCMABn UH4BDCRaVEg1FdHDVnDfaQmY/ORhppJE5ICsTni6q4FEc9ZCDMRuzM+NWJkW846ptRw1FTOjtne 09NjoKB3JrllIxRhdlLzrdft/Fh8HN1wZNm5Mehs01dk0Z9aKtFfBNS0sMM9IMvv9H+5GKc2+YU 6KvkIMFa8njKqmqHzssSsArx5qPTn/AENQjJ3mIAbStlSIicaWlo6AQy44YP0dbQWkHHfRdXS+G Cg41EhJVTLpq6d+vFfaUnpY0JuYETBVwfBIZwC+8Po6ceD05ww7LVvquJ3cWP0kP8GVnmRoCPVN MZNkeU0n83KTC4t1ksALYouwmfMGIr4GxUvVLvr5M8kGIvDeJSzceXrpfJIPED2+wZARPjbsDJB BiEuDgxa1CO2fpS60IDu5q5tA2MOyBvxs9F46Mz+df2EnRUZDaxmZd4eydcMiEUzbkNBEiL8U3N tHDYnKvb4zhmi02j024+tj5DW+KVEwtV0pzmbCuEMKR/cLwgYoJQvIRiOXhc7IajPjgsFoNMPeT 3CFUlpTJi/8jUAA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063123_640101_E8ECCAA9 X-CRM114-Status: UNSURE ( 8.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Cadence DSI requires negative syncs from the incoming video signal, but at the moment that requirement is not expressed in any way. If the crtc decides to use positive syncs, things break down. Use the adjusted_mode in atomic_check to set the sync flags to negative ones. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 8a320bd4d34d..53322407c1b0 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -992,6 +992,11 @@ static int cdns_dsi_bridge_atomic_check(struct drm_bridge *bridge, struct cdns_dsi_bridge_state *dsi_state = to_cdns_dsi_bridge_state(bridge_state); const struct drm_display_mode *mode = &crtc_state->mode; struct cdns_dsi_cfg *dsi_cfg = &dsi_state->dsi_cfg; + struct drm_display_mode *adjusted_crtc_mode = &crtc_state->adjusted_mode; + + /* cdns-dsi requires negative syncs */ + adjusted_crtc_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); + adjusted_crtc_mode->flags |= DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC; return cdns_dsi_check_conf(dsi, mode, dsi_cfg, false); } From patchwork Wed Apr 2 13:30:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036041 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 B2BC5C369A0 for ; Wed, 2 Apr 2025 13:37:53 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z5/0MrEh7r3CSRDW35pNFgJ7lQ9a72uerB8boV73sCE=; b=U1M2NPf608FxHI J6PY3xUicSdxANtd+qGRO881zQnAOWvPCdC2ibBkhDrSlrq7UpePB+WZFrYaEeHIGOtteRJf1rIb7 KBMNythXqLi/lT5osigBAZGVRJbDLY1FInAG5LZyra+tQqSoy6k+scsXwSCxtwA24DFV9VOFOz3Jr M6gVrgWeWBTJl+gRp21itennfAYRLPDa9ypmevn3X2izSft8Uq/cHIHOwsIlmH9AYbESdGvwTbBur 2zYiTq4yrcmyyz+cTwA77QBIPS8A0yTZ7+8JSOybiQCGNBKFdhUUmDAOACIiig8X/AloKZ1JqbprG ZnUU8taF3TwX4SOfzF9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHx-00000006GmQ-1tz2; Wed, 02 Apr 2025 13:37:53 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBg-00000006F9o-2YE6 for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:25 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D0A2E19E1; Wed, 2 Apr 2025 15:29:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600570; bh=S8uUUDEaNeicbiSY8YvRq9DMlAGVbKYKCtdKJ0sZaN8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TbQrJStTAPF/eX2uVj21oQLUiAQSdSbuRTR8bEbdfA1mEtwLCjQNHwn9xj/cNFzqg bRrN/9IxkjOov7R65sbDIpt1ExDvfOSYFub3T8h0VHPPjShL+SrFUAoyv5IyYTUT1f qB/8V5uw8CvyXOxrbIzWhj0QWZPElZn9/571LhF8= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:49 +0300 Subject: [PATCH v2 07/18] drm/bridge: cdns-dsi: Fail if HS rate changed when validating PHY config MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-7-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2073; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=S8uUUDEaNeicbiSY8YvRq9DMlAGVbKYKCtdKJ0sZaN8=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twd0AEPulojI4YQTGxGlw6WhL0s6oojtNNCo xGjiLne1PSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HQAKCRD6PaqMvJYe 9YEcD/0bgooVvLCuu3FLtqeH3YC4ZA8SY/8y8p73Uq7oomgpTBroT3IKCHwFz5CGjRwFwKyvKWU 49YHzXWtvHKvaG5zkLT4/DBlXEshXP6ss5n2mSE6cUres/zdcuLKUw34XI23inbILk5hQ9STkFA ydYNpT/3gwzcfi8YEL99Z1YnkcBNDNTbEhugwFiZin620DQyVS75prnbIpKtoV8w5ZWP0Qil7WC IEfpDvajZ9YgClKsudDokHQQbYdfYKPE32S/O1uESrHiC0hukSDENMiCovaMsUfgZVEV35Qlkdk g36FPQQuQTBb57Q6rENl62mfPACfkA470gD5eMCLWE/KfwDk/ztpblrh8/VbII1VRZH029ybkOf cbe+JBhQO03GlaI3XY7h+xGu2uEEhm3yVr4JrQCQueKk1dDMF9GVMqNKR2vFUqIj/RfAHc4FeLh fFttc4ylimhxsqb14tzONvAZViku9y05/6Z/2947F3shnrzBz2dFk611s5ClKK4aTujvexVjz3d ltQIzcJzOSYQp8tkfb/iOe9kh78TVN0H9gZer9Sw5VWfZ3Dt4SVfjhMhkQS3aLFHFtAdNx5c6Yo RywJDjX0/pfoIinfbZeLodLfe6cVHrqDdvbZjJaowgpPnuxG5E+T8IedpBrRBjis/o4LdsVOA4K oGfwJfwi+7y+85w== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063124_804918_8B96CA1C X-CRM114-Status: GOOD ( 10.74 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The phy_validate() can change the HS clock rate we passed to it in the PHY config, depending on what the HW can actually do. The driver just ignores this at the moment, but if the actual HS clock rate is different than the requested one, the pipeline will fail as all the DSI timing calculations will be incorrect. There are ways to improve DSI operation for various clock rates, but for now, just add a check to see if the rate changed, and return an error if that happens. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 53322407c1b0..9238acf69823 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -580,6 +580,7 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi, unsigned long dsi_hss_hsa_hse_hbp; unsigned int nlanes = output->dev->lanes; int mode_clock = (mode_valid_check ? mode->clock : mode->crtc_clock); + unsigned long req_hs_clk_rate; int ret; ret = cdns_dsi_mode2cfg(dsi, mode, dsi_cfg, mode_valid_check); @@ -596,10 +597,20 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi, if (ret) return ret; + req_hs_clk_rate = output->phy_opts.mipi_dphy.hs_clk_rate; ret = phy_validate(dsi->dphy, PHY_MODE_MIPI_DPHY, 0, &output->phy_opts); if (ret) return ret; + if (req_hs_clk_rate != output->phy_opts.mipi_dphy.hs_clk_rate) { + dev_err(&dsi->dphy->dev, + "validation changed hs_clk_rate from %lu to %lu, diff %lu\n", + req_hs_clk_rate, output->phy_opts.mipi_dphy.hs_clk_rate, + output->phy_opts.mipi_dphy.hs_clk_rate - + req_hs_clk_rate); + return -EINVAL; + } + dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD; if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) dsi_hss_hsa_hse_hbp += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD; From patchwork Wed Apr 2 13:30:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036045 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 15F89C369A2 for ; Wed, 2 Apr 2025 13:37:54 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gdPb/R2h2DUYpD1TKPfe9K2J2BA+uWjEChfeOF2UPNc=; b=Yk2bGCv1vekj3B vvVkqH125korXlwX3qSrkTz7+GNcYVW6rBtv9Ts+n4XhuLOL3j4ClxHS1ahhp8ESn9bDHPMt11Id2 TWzkRm//43dHYYtgnCkyeyi0L3QbwahF2FeoihhywkQPs0nj3QZUE0wEWOQqqGxwIB8A9mcp1EggH sBRj8892aawLLRe8qcccqMhm3UPEGgpdopPXf/4yQr6Q8Fi6sJ2TwG9CPJykGSKRwJ7WYR3vZ7qRO XFhfOfqNTE8SF6g/ohyz16ubqvZhV6fSWh902HVPHt9wzaUBAST7fplA0O8cU8v5LfsvWd47qkWK6 RtgQl5+e2C8jOWZWcy+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHx-00000006Gml-33ok; Wed, 02 Apr 2025 13:37:53 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBh-00000006FAK-3JXM for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:27 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 04FC21FD6; Wed, 2 Apr 2025 15:29:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600572; bh=vjRuuRXkQ3UFqYx/0yC4s/4b1wMI2nCnKESmkXL4LGc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bePSgVek6aFL2lIogvgla6Mc4vD1ekSrYF6lPAnZu3rboQXtuLIpHx4aj5I61/Sqg +6jWuKieT/305mi9XK6UAJIfMg/Knu3foDyCfyldVvJWiXTXnsG72ibaUjisn+bwJh nnG5NeAQacxM3Ha6vaZATZSaWcQaGBfp0TrmZk/I= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:50 +0300 Subject: [PATCH v2 08/18] drm/bridge: cdns-dsi: Clean up cdns_dsi_mode2cfg() MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-8-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2823; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=vjRuuRXkQ3UFqYx/0yC4s/4b1wMI2nCnKESmkXL4LGc=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twe4ruVwjDyoZFcIcdKbfQD5zYgBMS52y27F sAMybOt7t+JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HgAKCRD6PaqMvJYe 9feeEACuB7Lm9N6fMlgyo92alSQDJNrXcax5yxnsjAfUFi/MHJqlyXp5se2qMeu6PfMicvbDpKU hUvOc7vYBwAyq7Xte8qBrDKm3chOM8zxZ2862G8k13xTMI2Fm/OBIUtJhQpdm6WaRs1KuzLwZwh 7WPyCe3BIeaLgtJ4tKWeTW7x7rOqpBbBHG9hB41tUibQFdYlIg6lKeGOgzcGU4uHVtbY0gwjg/r BRHwCtI5xEQSv01UgIQ7Api4Nb+js+jJuBAjzjJkaBP3VUkVp/RSBRMpBgYGnZVVJSXCB4juIDP oKwnDAIpb3M7Tb3XCe6eebc20WgqlwwA4SZToB08xsNYJmjVcHZkpcYLYlSdLK+XPa+quTFWDeX E7V2hSkJU/gnMXCW6/+ZmFFToCT/qyYJl7Oe15A4FuJV1wNxMrTYVAwBIp96R/gmX3sqUPOoVf1 AYLBB1xsqllBmLioXpuFPip7Pbk1XGWEfK/GEah14PIt696Y3OMGBAbpr7QvGWZa7UdcN2Cnril +cxqBHxXmVqx1l9FAOpzWe9h29h1SvJk4hsXSJaFRiz1er3Xb7556cYqcwFShAmF0/K6+ywCwvo qbGm0bIttUKVGz+Oxx/rWWUWxdxTLV5EXa3NQULWvfF84+CM4VCDGpqN0CdgHGNSqZT5zRKix88 5BRpV64LLORGLrw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063125_977123_96139471 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Clean up the function a bit, mainly by doing the mode_valid_check dance once in the beginning of the function, and grouping the calculations wrt. sync/event mode a bit better. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 48 ++++++++++++-------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 9238acf69823..0aaa1d06b21c 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -481,42 +481,38 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, bool mode_valid_check) { struct cdns_dsi_output *output = &dsi->output; - unsigned int tmp; - bool sync_pulse = false; + u32 dpi_hsa, dpi_hbp, dpi_hfp, dpi_hact; + bool sync_pulse; int bpp; + if (mode_valid_check) { + dpi_hsa = mode->hsync_end - mode->hsync_start; + dpi_hbp = mode->htotal - mode->hsync_end; + dpi_hfp = mode->hsync_start - mode->hdisplay; + dpi_hact = mode->hdisplay; + } else { + dpi_hsa = mode->crtc_hsync_end - mode->crtc_hsync_start; + dpi_hbp = mode->crtc_htotal - mode->crtc_hsync_end; + dpi_hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; + dpi_hact = mode->crtc_hdisplay; + } + memset(dsi_cfg, 0, sizeof(*dsi_cfg)); - if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) - sync_pulse = true; + sync_pulse = output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE; bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format); - if (mode_valid_check) - tmp = mode->htotal - - (sync_pulse ? mode->hsync_end : mode->hsync_start); - else - tmp = mode->crtc_htotal - - (sync_pulse ? - mode->crtc_hsync_end : mode->crtc_hsync_start); - - dsi_cfg->hbp = dpi_to_dsi_timing(tmp, bpp, DSI_HBP_FRAME_OVERHEAD); + dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp + (sync_pulse ? 0 : dpi_hsa), + bpp, DSI_HBP_FRAME_OVERHEAD); - if (sync_pulse) { - if (mode_valid_check) - tmp = mode->hsync_end - mode->hsync_start; - else - tmp = mode->crtc_hsync_end - mode->crtc_hsync_start; + if (sync_pulse) + dsi_cfg->hsa = + dpi_to_dsi_timing(dpi_hsa, bpp, DSI_HSA_FRAME_OVERHEAD); - dsi_cfg->hsa = dpi_to_dsi_timing(tmp, bpp, - DSI_HSA_FRAME_OVERHEAD); - } + dsi_cfg->hact = dpi_to_dsi_timing(dpi_hact, bpp, 0); - dsi_cfg->hact = dpi_to_dsi_timing(mode_valid_check ? - mode->hdisplay : mode->crtc_hdisplay, - bpp, 0); - dsi_cfg->hfp = dpi_to_dsi_timing(mode_to_dpi_hfp(mode, mode_valid_check), - bpp, DSI_HFP_FRAME_OVERHEAD); + dsi_cfg->hfp = dpi_to_dsi_timing(dpi_hfp, bpp, DSI_HFP_FRAME_OVERHEAD); return 0; } From patchwork Wed Apr 2 13:30:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036043 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 95F98C36017 for ; Wed, 2 Apr 2025 13:37:54 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=77EVB8dNqc5cppwMV5LG/Nvdp0UPZaCmLVR4TWL0iqc=; b=rIv/2d1uwd73CA T8czX54TzRIt4gHQLI6R6CvHzN+ntvDl6BH0J00Kd1hfEOwkv6b0Og5bjfWUAMo3YsJG5aVdMqHsE wlXJjfB6sA0BEPDdDe2ZKqoIArkBacVXHKXkd2QhsDajRh+bm1zkeQ4Y2cXJXW9i27pqX40kOP+Z3 8Hg/SES+y929BFnit1cGHg+eFJghLr2AJ5M9DIBXExUCsmE2hLA+0s1aqLwxuzJA5mvtuUqM7tK/L N1pHRM7gtUCAHkFFBBKiTmDNLJ4C9oVc1B5zjX9xAX5QsUKG3Po6ZUCiT0qrwimLbQ3rJaz37iONe ZAOlswVklJtSnRsSLqQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHy-00000006GnL-1GHY; Wed, 02 Apr 2025 13:37:54 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBi-00000006FB8-3uSk for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:28 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 292E36A2; Wed, 2 Apr 2025 15:29:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600573; bh=PM3qn/s33KHnLl3YvY8GLYvLdFsywv9G587wE6W8Bwk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cS+v1bTaOhJ5Kp2CgKyh5zPS5svmlJ/aP6I9Cvu6DKZ1ZNWZphx9epAGK3SbZ2gn0 uxmTWepbQDW/2gJm7GnutZJzLGLNKbVp56ClQMR0iTxf/dsVRrYOL9VinZOIXY5vV+ GFx+jReLqTq7SXVoeIXk0+cLdaq8uWYIaGQ09NQA= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:51 +0300 Subject: [PATCH v2 09/18] drm/bridge: cdns-dsi: Fix REG_WAKEUP_TIME value MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-9-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1914; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=PM3qn/s33KHnLl3YvY8GLYvLdFsywv9G587wE6W8Bwk=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7TweyQPovNekJjG70A8r4TqzcJ/RzGV+MzpSO QLm9FkmlieJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HgAKCRD6PaqMvJYe 9fM1D/4rcbNWQXxfqSvs7aVKIohHjvYtU5pKE0RDzydbYhHTW4n9F8Se/x3T++shXnKUfTrT7V/ OaKm9e7AeocvNtPdkY0/lfRAtvEpuMH3J7U0CTl9/CsGjq253/4lKVW+j+gEhDeCb+Ip8ipjX8j H3YbzlQZtlZF93gVx4d/jS1pBje+g7T26nYv1402EBbsAJSUlCdUwDgxbEr1PCSERZylv2BzBlP NSl4HzotvY/0zrcATP1p8ENDex8BltYmFdVAtIuHqz8mg6PhiIxDkj0PgNWdVxmkCN272jspYvU MTxHVPTYitYsmjtq1CLuCt2vvxbzZRKXUWB8lwx4IKYBpxOGrqz+Y2f2p27Bv7qWfCj78pY5f68 Iaczz8yQpXJDkn8X8CjZRk3ZJ5UMXDdzm7sSoNMnzhtLIvwtTEjRdJ5LyUdGWl2tm9e6sdfaVZb jxRWeD+MWpg5D40omp2fx2FNZS3ebsQ4G8yxSuD+eaUgLnpZlUgJZdqN7DdzT7gBpqKVa9wW+cT 2Hi8D9/WhbWBpuCqgSvwvInujJ/aizA8ExOnB7eP/NuYtBsm6Ov/Lb+Xm+RsmHTPXCXOjROmJgg GUapoY8ePDu6Kg6dUv24ULQOiBpHuDNuOjGujm7Lg1SYNjPiG6BCe2JPUsi5PSvXYu0Cgd2W2mK Avghy47TW0sOWNg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063127_117531_8DF96D76 X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The driver tries to calculate the value for REG_WAKEUP_TIME. However, the calculation itself is not correct, and to add on it, the resulting value is almost always larger than the field's size, so the actual result is more or less random. According to the docs, figuring out the value for REG_WAKEUP_TIME requires HW characterization and there's no way to have a generic algorithm to come up with the value. That doesn't help at all... However, we know that the value must be smaller than the line time, and, at least in my understanding, the proper value for it is quite small. Testing shows that setting it to 1/10 of the line time seems to work well. All video modes from my HDMI monitor work with this algorithm. Hopefully we'll get more information on how to calculate the value, and we can then update this. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 0aaa1d06b21c..62811631341b 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -882,7 +882,13 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, tx_byte_period = DIV_ROUND_DOWN_ULL((u64)NSEC_PER_SEC * 8, phy_cfg->hs_clk_rate); - reg_wakeup = (phy_cfg->hs_prepare + phy_cfg->hs_zero) / tx_byte_period; + + /* + * Estimated time [in clock cycles] to perform LP->HS on D-PHY. + * It is not clear how to calculate this, so for now, + * set it to 1/10 of the total number of clocks in a line. + */ + reg_wakeup = dsi_cfg.htotal / nlanes / 10; writel(REG_WAKEUP_TIME(reg_wakeup) | REG_LINE_DURATION(tmp), dsi->regs + VID_DPHY_TIME); From patchwork Wed Apr 2 13:30:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036044 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 02668C369A3 for ; Wed, 2 Apr 2025 13:37:54 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h89WJQZcVWa3pHogTdIjFi/p+QiEIWsTeJvpFp2+Iyo=; b=2Gk25oc9BzwgXH 6+mxn8atD1N0RtL1ytYn7NseeIYqGDTCDfvHKSYYFfLxj5rwSFN7GnuKwib2QEOvssqbKEtxyPuS6 9YZ4NPXklujfBVvsRyatwfTs/iWwZVzWSwX5at51K9cbW3rTwG1JjINyRhUMJWFjvEN75vooaZ6KE gZtb7F+rvOiGwMprlpyLQNAFl7uyA5K8O4HNYLle8m8ijvy+tyopb8yikC6Bc7qO+vRhlAuV7yFaV etoa5yzmbdKSwCN3QAho/1lhLyfizzSc/52VA990KHE3iRGw8FDxa6wXM04pK4/mYA52/6sZjmfCe h7IcxOwCswpdie44A2IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHy-00000006Gns-2sc9; Wed, 02 Apr 2025 13:37:54 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBk-00000006FBk-0TkS for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:29 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4FDB82434; Wed, 2 Apr 2025 15:29:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600574; bh=terDw8VLDSycV/I6fcyF4BbvPpfjEASKJADXJuIxv/I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ho2aCxgA2Wca4y/Fx9LV5m1CBUTqC0FR0oSA/lDRGCmWLPztwKzsQPOJj22M3kFil IYprW4tjzvrcF2DR+kVKOevgomS3+CFYqqw0qkPfA/143TfoLsxKl8863mmnzEvJ9n OcaX1ac63U/AVoDZaATIUXUV5fw2xY6xoLJ+RJes= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:52 +0300 Subject: [PATCH v2 10/18] drm/bridge: cdns-dsi: Fix event mode MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-10-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2987; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=terDw8VLDSycV/I6fcyF4BbvPpfjEASKJADXJuIxv/I=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twe/tVteqeFa2Ic65dsnEnKHbgdu1Loaivie SSxoDo3+RmJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HgAKCRD6PaqMvJYe 9ci7D/9OtgQL1krF/aw7wnzN0htt0P7N47K84a6EPWb7y4IMK5MQZdsqKuijjPHF6z/ClvNgiho /Uh3mJCxDtp18WXVfLy0TAJUKJi+4tatoj2RES+oBDmP/auadigIcKTSDlvNlUI6S5GOj64hBj/ d04YpnuXZeHpteVxUqAm4s8Dj+g33JB7Ap2Ly2yEfa9rAJb4PNIKnaa9qxe6E7Iu8ZuspmNVh/Y UvgJhurgvGHO3BSZmce9Oh47/cSrMRLP4W14nbEioXRe9YebaqD8f5WC5xaIiFaM7272U5WFbt8 15fZpF4ZkzmURY1FFy8Hq68NDl/WDQ7Ic0v2tTokcLCbp+pq7fDQSrlRoYiK+ZT/xRYdi/0AZIj V1+fwOK+OHvcDlfFzi/1AaixDq1jwghtIIIwVuCqunKxiuBWzOJgknZchoodaFTHC8B3k5GPy3L 1XC2GIHNbRbShvhwwUFPNJiEiPLLZuE3lFL8XZAAn8Y66SMZdoYfaNc5GZKEc0gNAP5NiqqOwhZ +VZul9N6SNqO4BbaYctQboVh37y8drjWLuH0DtGp/8lbU3dgTD3AOd6iv5q4k+RWEHQVax+IH1W 9SMnLFY2gscCgs8XoE4PfVB6ZJbS5AvkzRqtPvXhKU2G27ZyiAFO9Dlj6ke6vQx64dSnFTZrgqs V/6UA0/8jBLtslg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063128_296175_6A315C05 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The timings calculation gets it wrong for DSI event mode, resulting in too large hbp value. Fix the issue by taking into account the pulse/event mode difference. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 33 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 62811631341b..9797e6faa29d 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -417,7 +417,8 @@ #define DSI_OUTPUT_PORT 0 #define DSI_INPUT_PORT(inputid) (1 + (inputid)) -#define DSI_HBP_FRAME_OVERHEAD 12 +#define DSI_HBP_FRAME_PULSE_OVERHEAD 12 +#define DSI_HBP_FRAME_EVENT_OVERHEAD 16 #define DSI_HSA_FRAME_OVERHEAD 14 #define DSI_HFP_FRAME_OVERHEAD 6 #define DSI_HSS_VSS_VSE_FRAME_OVERHEAD 4 @@ -503,12 +504,18 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format); - dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp + (sync_pulse ? 0 : dpi_hsa), - bpp, DSI_HBP_FRAME_OVERHEAD); + if (sync_pulse) { + dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp, bpp, + DSI_HBP_FRAME_PULSE_OVERHEAD); - if (sync_pulse) - dsi_cfg->hsa = - dpi_to_dsi_timing(dpi_hsa, bpp, DSI_HSA_FRAME_OVERHEAD); + dsi_cfg->hsa = dpi_to_dsi_timing(dpi_hsa, bpp, + DSI_HSA_FRAME_OVERHEAD); + } else { + dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp + dpi_hsa, bpp, + DSI_HBP_FRAME_EVENT_OVERHEAD); + + dsi_cfg->hsa = 0; + } dsi_cfg->hact = dpi_to_dsi_timing(dpi_hact, bpp, 0); @@ -532,9 +539,12 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi, unsigned int dsi_hfp_ext; unsigned int lanes = output->dev->lanes; - dsi_htotal = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD; - if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) { + dsi_htotal = dsi_cfg->hbp + DSI_HBP_FRAME_PULSE_OVERHEAD; dsi_htotal += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD; + } else { + dsi_htotal = dsi_cfg->hbp + DSI_HBP_FRAME_EVENT_OVERHEAD; + } dsi_htotal += dsi_cfg->hact; dsi_htotal += dsi_cfg->hfp + DSI_HFP_FRAME_OVERHEAD; @@ -607,9 +617,12 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi, return -EINVAL; } - dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD; - if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) { + dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_PULSE_OVERHEAD; dsi_hss_hsa_hse_hbp += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD; + } else { + dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_EVENT_OVERHEAD; + } /* * Make sure DPI(HFP) > DSI(HSS+HSA+HSE+HBP) to guarantee that the FIFO From patchwork Wed Apr 2 13:30:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036047 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 51808C369A4 for ; Wed, 2 Apr 2025 13:37:55 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mv35+eMi01I12UdkG1Nvx8xObd44Pu9Ut19A72FjCCs=; b=JPAftRyqT6/PqU Je7dcatA+lWtfDUjr0sOmZa3GdkwcGqgSUfwsBcvlPHmXyE4CTvc/wzjIRSkERHx+2d3Zg3WDm71Z F5WMRQZ9v7JiizGZZhaJppch979iadDBlevVXT4C1QVYqbrjt21aLHmVGTzwAxRSZE+rMjSzcabST OkgoAW2MOQF5+ZV27guoSdTidU/CFn7oEjt3dGZ+aUCHN9Jr8a9nrKujzfDmnYm8j9lFuod0V7iPX B3yBufAfe08EYIGGk7n4qH3+rdQc0x12kaoOZ0vqHyRogb7j0JRd8HXMM2yWflxc3z4C3IOkIi6GY NzreTjxlJitV7v+U1HMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHz-00000006GoF-0CW4; Wed, 02 Apr 2025 13:37:55 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBl-00000006FCU-1AU1 for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:30 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A82A245E; Wed, 2 Apr 2025 15:29:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600575; bh=2qJfC7oDxsjuiQHnkQy9vy3BrMM57VcAHQdpuKoTbDE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MBGQt6G1K+JaPOeF4nizPZ8kWrecJo1iwuq/b5SUlW+V6bxcccpy7J0NJz2kXqAgx fbdvvtMyzn85QXtwtFLbFBpszDjFVYE4zTg5FgcktugZitCiElEFoKHiqcPX0pYT/8 KKHj3vDTBEtAtHMuGwzVywRSbk20VBxF/Hz9Va0Q= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:53 +0300 Subject: [PATCH v2 11/18] drm/bridge: cdns-dsi: Remove broken fifo emptying check MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-11-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2637; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=2qJfC7oDxsjuiQHnkQy9vy3BrMM57VcAHQdpuKoTbDE=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7TwfNSdCSAxRQ7FWWHrv+ucmbrxQItEOhvwxd 8wtdX1XYAaJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HwAKCRD6PaqMvJYe 9c39D/wPtEvIKBRT0+zWyqwf1N+KagKV5o3nGkcvDwRIswnJJEK4SSUUGwmtshFXIttWQ3gFjFj kYsY0xqd1Kis9EhELKPE4/v4foX/AiP4os8/cci6iekicrTq9+51XGozSx8dHGS5xDcjVmuH/xt WXqO6A6ofc+63+BOx5u56ocun59IJyxLu2aU1LfOX0b6vtbdgnfnH7ah9x1/PWTqA+ZEFsoimb0 i1IGBJOpdItLZ8aGqz/PaMQoHMK8YW+80oSIqp7U3JlLpsrQ5902mgebD0lcb3k8xNIrJtQJEnw mY8vrT/ypwkxxZtmQVZwcAOum9gB0i8eQ46SSxJYKtr68Pra+d/iBXnuPhz+5YkNmbODhnOAa40 ettMRlNFDNh0uGG8XrW3LOkoRsRjls+R5UgbKXs3pOOa14gTc/SilBSHYdBfc0jIP8fd4Ge61PI tyS4+MgoHlC6AQi4RJ4VbheqyCLHrFO/G9cIlDLTAs1DwmFgFiMYKohRZRb0S6uIo5CT4y8spRt 39d0T2mcveoGUAL3tJAS0nXYNbb0clid/9gJWZVSz4+Jdv8UcRWJRhuyYE1+r2w/c8l9dei0gzy WE8yHsTrstJ2oehxi0DZTX31fk5Q9YfHEeD7MvLjJtHgixKEhQ6RgIcfKLq8BEVej/DHKVocni/ CQAGqQXza3Rnzdw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063129_482205_EE6E2E5D X-CRM114-Status: GOOD ( 14.18 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The driver check if "DPI(HFP) > DSI(HSS+HSA+HSE+HBP)", and rejects the mode if not. However, testing shows that this doesn't hold at all. I can set the hfp to very small values, with no errors. The feedback from the HW team also was that the check is not right, although it's not clear if there's a way to validate the FIFO emptying. The check rejects quite a lot of modes, apparently for no good reason, so drop the check. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 28 -------------------------- 1 file changed, 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 9797e6faa29d..e85c8652c96e 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -453,15 +453,6 @@ bridge_to_cdns_dsi_input(struct drm_bridge *bridge) return container_of(bridge, struct cdns_dsi_input, bridge); } -static unsigned int mode_to_dpi_hfp(const struct drm_display_mode *mode, - bool mode_valid_check) -{ - if (mode_valid_check) - return mode->hsync_start - mode->hdisplay; - - return mode->crtc_hsync_start - mode->crtc_hdisplay; -} - static unsigned int dpi_to_dsi_timing(unsigned int dpi_timing, unsigned int dpi_bpp, unsigned int dsi_pkt_overhead) @@ -583,7 +574,6 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi, { struct cdns_dsi_output *output = &dsi->output; struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy; - unsigned long dsi_hss_hsa_hse_hbp; unsigned int nlanes = output->dev->lanes; int mode_clock = (mode_valid_check ? mode->clock : mode->crtc_clock); unsigned long req_hs_clk_rate; @@ -617,24 +607,6 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi, return -EINVAL; } - if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) { - dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_PULSE_OVERHEAD; - dsi_hss_hsa_hse_hbp += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD; - } else { - dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_EVENT_OVERHEAD; - } - - /* - * Make sure DPI(HFP) > DSI(HSS+HSA+HSE+HBP) to guarantee that the FIFO - * is empty before we start a receiving a new line on the DPI - * interface. - */ - if ((u64)phy_cfg->hs_clk_rate * - mode_to_dpi_hfp(mode, mode_valid_check) * nlanes < - (u64)dsi_hss_hsa_hse_hbp * - (mode_valid_check ? mode->clock : mode->crtc_clock) * 1000) - return -EINVAL; - return 0; } From patchwork Wed Apr 2 13:30:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036049 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 9F335C28B20 for ; Wed, 2 Apr 2025 13:37:55 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IOb4SOXq1pi9QE7s8wPa2FIpUXbbcH76NxQmqVLVXjg=; b=I7Op+PFbOfHfDv Y8fqOzZz+YZCcgfaMUyqQD2bBKdkXYZ806e1BAdowFePie40dFwiju0oCw1DAw6gpueBtooAsjLzP rFiZefUFgo21WTuUDgzK+GQTkcB2ZFtleR5/v6rJtyW7Trkq8MX6gZZyF6F6jTblZxfzEc+ash8kM Sq6Fq9YbT6YWRLZZ4ICkf5OtRWDXAE6Uj/A53rLI03AE1SuPneqpXFZmg3Wln25XYGvTJgDjPVCNm OSYEMyg+lkyVcBtp1i80Jz15f3JaoEZq8o75n5wNF9dOPzAS8h0JRrQJKIVoV4YIXGABA35Lma5ZS QhZOKfxvHK8THvzW1fVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHz-00000006Gom-1TVt; Wed, 02 Apr 2025 13:37:55 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBm-00000006FDP-1pF3 for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:31 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A4D5F1FD3; Wed, 2 Apr 2025 15:29:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600576; bh=yg2ZEQSdiQylg810dHQuElWWoHgC3iltx0QPHEXmIO4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ohQf+fPS5mpyI2EheGw+m2jJiIltnZK1MpKQZWlCy0xFMk1MukwmJOYA7AAPSp33u hGPmGgsKDsG8p9fNyALv8uMnZbiEypEHXy9GBBVxeNcd52OXDc4IoEkdx8YBp/2IJN agEFqfbuEZwbbf8u2TWywW2SKmWTVDa7wUbSklJQ= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:54 +0300 Subject: [PATCH v2 12/18] drm/bridge: cdns-dsi: Drop checks that shouldn't be in .mode_valid() MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-12-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5390; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=yg2ZEQSdiQylg810dHQuElWWoHgC3iltx0QPHEXmIO4=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7Twf10ut22iEk3Q+EDdXda2S5QpSgD3saziGo vfHAAnAiCGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08HwAKCRD6PaqMvJYe 9SQdD/4xFxcBWH9hIqosPQ4f9ilyKef6n4RzucI4w0aaasSQaapdUWX6mVEiLZr7EC5LvRNli4U d5JvgqpYDtsSwbu0ymmVbBMPxWnPN/n/2p5ebTnjFr4oG4fcDFUTYDtybd3KmvPsvlFX7CBEB86 RVVFcpMwt0yUqxECLySurCXu9gpG21sCVUuh8tLX23H1UpbNkdiCiU+YE1ijrF9ClPOdCs88rJv HusugEcbVSoXACsMQRvlfi5kzBX7Pb5f7wzKGDd+c6ZLFx/gqLqsoTr44h2VfxZqkzVZ2qpJiDy YHRaJTI3OsjFggvPdqakxPkqFLOeXeUqgwJprASvt1i+OzrJRPxlWxUMBuRIxiQvbMRT+ZJLpJ2 TZwKJpqsksXZPf+F95clJY/tttnJ+NKbeYaNv/+rbucGHX0xbwcgHJc5upcd3qYMuHG8d/hoJUa 50cl4H+3q2epTtnM/AgQznD+ZYtKV3R/wGFoQSE40rJ8Ivx1p3xsSUwKP3vP7BjktbamRiNRv9D HWLwEIJt/6NGtHUG1Rd4zB2nAwlzblWjonVhwsS58oErIZT33MxBUa7DXvDH9Vds6gZ3hCphzVe 1mJjUqP1EfJYcI5AfWtIV8oZ2tXhdB2w66mhlxZ8miIx4iI5ab6M3jhw1SbyKTKDdBTMw/s6L7D BAc+GsztPb6DSPQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063130_639624_3A7FA4FB X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The docs say about mode_valid(): "it is not allowed to look at anything else but the passed-in mode, and validate it against configuration-invariant hardware constraints" We're doing a lot more than just looking at the mode. The main issue here is that we're doing checks based on the pixel clock, before we know what the pixel clock from the crtc actually is. So, drop the checks from .mode_valid(). This also allows us to remove the 'mode_valid_check' parameter from internal functions, and the related code. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 44 ++++++++------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index e85c8652c96e..cf783680b1b4 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -469,25 +469,17 @@ static unsigned int dpi_to_dsi_timing(unsigned int dpi_timing, static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, const struct drm_display_mode *mode, - struct cdns_dsi_cfg *dsi_cfg, - bool mode_valid_check) + struct cdns_dsi_cfg *dsi_cfg) { struct cdns_dsi_output *output = &dsi->output; u32 dpi_hsa, dpi_hbp, dpi_hfp, dpi_hact; bool sync_pulse; int bpp; - if (mode_valid_check) { - dpi_hsa = mode->hsync_end - mode->hsync_start; - dpi_hbp = mode->htotal - mode->hsync_end; - dpi_hfp = mode->hsync_start - mode->hdisplay; - dpi_hact = mode->hdisplay; - } else { - dpi_hsa = mode->crtc_hsync_end - mode->crtc_hsync_start; - dpi_hbp = mode->crtc_htotal - mode->crtc_hsync_end; - dpi_hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; - dpi_hact = mode->crtc_hdisplay; - } + dpi_hsa = mode->crtc_hsync_end - mode->crtc_hsync_start; + dpi_hbp = mode->crtc_htotal - mode->crtc_hsync_end; + dpi_hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; + dpi_hact = mode->crtc_hdisplay; memset(dsi_cfg, 0, sizeof(*dsi_cfg)); @@ -518,8 +510,7 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi, struct cdns_dsi_cfg *dsi_cfg, struct phy_configure_opts_mipi_dphy *phy_cfg, - const struct drm_display_mode *mode, - bool mode_valid_check) + const struct drm_display_mode *mode) { struct cdns_dsi_output *output = &dsi->output; unsigned long long dlane_bps; @@ -549,11 +540,11 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi, if (dsi_htotal % lanes) adj_dsi_htotal += lanes - (dsi_htotal % lanes); - dpi_hz = (mode_valid_check ? mode->clock : mode->crtc_clock) * 1000; + dpi_hz = mode->crtc_clock * 1000; dlane_bps = (unsigned long long)dpi_hz * adj_dsi_htotal; /* data rate in bytes/sec is not an integer, refuse the mode. */ - dpi_htotal = mode_valid_check ? mode->htotal : mode->crtc_htotal; + dpi_htotal = mode->crtc_htotal; if (do_div(dlane_bps, lanes * dpi_htotal)) return -EINVAL; @@ -569,27 +560,25 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi, static int cdns_dsi_check_conf(struct cdns_dsi *dsi, const struct drm_display_mode *mode, - struct cdns_dsi_cfg *dsi_cfg, - bool mode_valid_check) + struct cdns_dsi_cfg *dsi_cfg) { struct cdns_dsi_output *output = &dsi->output; struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy; unsigned int nlanes = output->dev->lanes; - int mode_clock = (mode_valid_check ? mode->clock : mode->crtc_clock); unsigned long req_hs_clk_rate; int ret; - ret = cdns_dsi_mode2cfg(dsi, mode, dsi_cfg, mode_valid_check); + ret = cdns_dsi_mode2cfg(dsi, mode, dsi_cfg); if (ret) return ret; - ret = phy_mipi_dphy_get_default_config(mode_clock * 1000, + ret = phy_mipi_dphy_get_default_config(mode->crtc_clock * 1000, mipi_dsi_pixel_format_to_bpp(output->dev->format), nlanes, phy_cfg); if (ret) return ret; - ret = cdns_dsi_adjust_phy_config(dsi, dsi_cfg, phy_cfg, mode, mode_valid_check); + ret = cdns_dsi_adjust_phy_config(dsi, dsi_cfg, phy_cfg, mode); if (ret) return ret; @@ -635,8 +624,7 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); struct cdns_dsi_output *output = &dsi->output; - struct cdns_dsi_cfg dsi_cfg; - int bpp, ret; + int bpp; /* * VFP_DSI should be less than VFP_DPI and VFP_DSI should be at @@ -654,10 +642,6 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, if ((mode->hdisplay * bpp) % 32) return MODE_H_ILLEGAL; - ret = cdns_dsi_check_conf(dsi, mode, &dsi_cfg, true); - if (ret) - return MODE_BAD; - return MODE_OK; } @@ -996,7 +980,7 @@ static int cdns_dsi_bridge_atomic_check(struct drm_bridge *bridge, adjusted_crtc_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); adjusted_crtc_mode->flags |= DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC; - return cdns_dsi_check_conf(dsi, mode, dsi_cfg, false); + return cdns_dsi_check_conf(dsi, mode, dsi_cfg); } static struct drm_bridge_state * From patchwork Wed Apr 2 13:30:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036052 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 E5079C369A5 for ; Wed, 2 Apr 2025 13:37:55 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o70PmHLfHb3nw8mR3Lw4+7HbhjnXxdSKQOJM9Qm/WEs=; b=h7j2E60mI1pgVf iZTISvXE8UfC/BOdoXyEsVo2kgEmmoUezivKjnoXGYKDOgHaq8CaY8Tb5YtpWadsz6vo2kbQ+jFio A508w1EwIeVIn5mZUvgtIYsuGT8C4P1GMnrR3ZThbZJkX/FRP3LVY1cA4D3QK/VdA2fuO45B5qw5p PX7hItfQ5gh7DOmmudytwdY1MNCYQfEkoILG0XzPPON7fZBuOGoGfhowOJvwAGyWGD+i7S8Oba3pG Ge8Gz8Ix6XRb2T5H1Sj4kZaCvcbRZjoHXuAKHlVNlrkJqrLL9S9fgVkn+mOzQa9E1eXwuIj/IT4u5 Q9zAqp8IHrE3t6IQqVFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHz-00000006Gp3-2lRy; Wed, 02 Apr 2025 13:37:55 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBn-00000006FEA-2h6v for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:33 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CC2ED2462; Wed, 2 Apr 2025 15:29:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600577; bh=NRiwCTHabbz+p81RY4GkrUeFRgzVyalNNk+RjRNcX5o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=R1/1KBExfXLQe7uYnRhUvVpwZ+6WqqfR911hFWDEsBUCpjWJThhB4tgINO8soYh+a PWOlEM5yeGFgsWDWQcxsM9xOejA4m7yTQ2JeohXkRxCOpbWaBimDai6YdRza/S/q15 u79JPCyG7NtIXZxUQ0jhQRoLq1tv23Mzqp6FIyKM= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:55 +0300 Subject: [PATCH v2 13/18] drm/bridge: cdns-dsi: Do not use crtc_* values MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-13-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3185; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=NRiwCTHabbz+p81RY4GkrUeFRgzVyalNNk+RjRNcX5o=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7TwgEslEJvR9Rc4ug3uU1XdfqYhOfdiaYk1nK v92vYpcJQGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08IAAKCRD6PaqMvJYe 9dWUD/9ATKuRhrpAf5dk5R+z7ZUL3tLNU0Wz7KDGDLopcmgFyARqJwBE8pSz7MkS61+QZHM1rzK NL6V46R64DfI+o4NrGiCkFbc895Y4E8c4ycvQCYoDSsfW0qtzP7eNdnPys7NKy2KNgtG35daKSt MRIz+ZRzGe7nkfTFXa9ansPgtUQzEbXeokS33MrjKQDfkxwixFGqsLwOUBYUqTZQY9n66oXimIJ mFtusdSOJjrBb/jjmsS92crz2AzxUlFNwPqTmsuJv6ShWK8SWjdl0cxQGO+Aki7gNfh5JiC3E17 A/uSf1J/ODbH56U3CZ/9T0gElZh04t36our6aAS1EKZj/LxmU1k0y/sC/ZdE7h0NGKU+J99GzPT LFjx1PoAfj0hQbmT5uu/rh/yATkZHif9Ix5slv69LPEnfVOvx3Enne2sJX9b6ZAedgYb0PyZ+/Y sMef89w3/Ax6m1eCNvNQ9Ieu7SWv999/Uku99PINMBHouCnQsn0+hu5DzNG7qClAbmXFEXDivRj tEN5+dSjXc10GQPu2BURm64p1pzxcRUkI2hT3porcs9WJatofIcOExJMxTpp3ty8zx1uB4V9fXS C/fM/giH9iGBa4d3nYUXeKqKT1/94sZb0lOyRokUOjML1KNpshtJkVjsSMJOq/Ehud7ir/74B6i 3p4sfe9y0bgLSAw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063131_837478_F5B34A7E X-CRM114-Status: GOOD ( 13.28 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The driver uses crtc_* fields from the mode. While I think in the enable-path this would be correct, I do not think it's correct in the check phase, as the crtc hasn't had a chance to update the crtc_* fields yet. Overall, my understanding is that the crtc_* fields are relevant only in cases where we have things like interlace or double pixel mode, where we have a logical and real timings. We never use those with DSI, so the crtc_* fields should just always match the normal values. So, drop the use of crtc_* values. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index cf783680b1b4..220213f5cb09 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -476,10 +476,10 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, bool sync_pulse; int bpp; - dpi_hsa = mode->crtc_hsync_end - mode->crtc_hsync_start; - dpi_hbp = mode->crtc_htotal - mode->crtc_hsync_end; - dpi_hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; - dpi_hact = mode->crtc_hdisplay; + dpi_hsa = mode->hsync_end - mode->hsync_start; + dpi_hbp = mode->htotal - mode->hsync_end; + dpi_hfp = mode->hsync_start - mode->hdisplay; + dpi_hact = mode->hdisplay; memset(dsi_cfg, 0, sizeof(*dsi_cfg)); @@ -540,11 +540,11 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi, if (dsi_htotal % lanes) adj_dsi_htotal += lanes - (dsi_htotal % lanes); - dpi_hz = mode->crtc_clock * 1000; + dpi_hz = mode->clock * 1000; dlane_bps = (unsigned long long)dpi_hz * adj_dsi_htotal; /* data rate in bytes/sec is not an integer, refuse the mode. */ - dpi_htotal = mode->crtc_htotal; + dpi_htotal = mode->htotal; if (do_div(dlane_bps, lanes * dpi_htotal)) return -EINVAL; @@ -572,7 +572,7 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi, if (ret) return ret; - ret = phy_mipi_dphy_get_default_config(mode->crtc_clock * 1000, + ret = phy_mipi_dphy_get_default_config(mode->clock * 1000, mipi_dsi_pixel_format_to_bpp(output->dev->format), nlanes, phy_cfg); if (ret) @@ -822,11 +822,11 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, writel(HFP_LEN(dsi_cfg.hfp) | HACT_LEN(dsi_cfg.hact), dsi->regs + VID_HSIZE2); - writel(VBP_LEN(mode->crtc_vtotal - mode->crtc_vsync_end - 1) | - VFP_LEN(mode->crtc_vsync_start - mode->crtc_vdisplay) | - VSA_LEN(mode->crtc_vsync_end - mode->crtc_vsync_start + 1), + writel(VBP_LEN(mode->vtotal - mode->vsync_end - 1) | + VFP_LEN(mode->vsync_start - mode->vdisplay) | + VSA_LEN(mode->vsync_end - mode->vsync_start + 1), dsi->regs + VID_VSIZE1); - writel(mode->crtc_vdisplay, dsi->regs + VID_VSIZE2); + writel(mode->vdisplay, dsi->regs + VID_VSIZE2); tmp = dsi_cfg.htotal - (dsi_cfg.hsa + DSI_BLANKING_FRAME_OVERHEAD + From patchwork Wed Apr 2 13:30:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 14036048 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 36E85C369A6 for ; Wed, 2 Apr 2025 13:37:56 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p6wtw8Q0jF7qvle4bWEZgGO+Q63Aig728jE8v+uIBIQ=; b=HbJJW0Y2P3btt1 ZiPeOjb2zBPN6Wcp06b5pNDYJRxZQ1z63UG49xxn2hONsjO21NTr6AHQ+AJxdkrHXytsLr0/mGLiw dRfXo5PlYDC3E6vPCM6HnRxC3HXYuu9tTllJyOoWsu4oQcOzIkQjA21yFMGDLEYZG5kp4kwv27dQ6 JZH29nV6IKTNhuLG2iYu+srF2hREN7zfsELHlRS8D9AfLA/fKb2q987UpvvPQex+J1gFAMFqofrNj SQBuoZPNRabTeTrb+n5xXsfOMwjrfFsVdgOY9ZDKcXoeB1lKtPP8sWceSMkLszicROA8o0rvS7RTh 9f8N2xmJENZ3CdjjM5Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyHz-00000006GpL-40df; Wed, 02 Apr 2025 13:37:55 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzyBo-00000006FFY-3Tf3 for linux-phy@lists.infradead.org; Wed, 02 Apr 2025 13:31:34 +0000 Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0252D25EC; Wed, 2 Apr 2025 15:29:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743600579; bh=IIDKgphBR8Z+MRb90fam19Jh4edh+nhVkDzVKuQW/rY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ewM5tG4L4CyDBKjLkSnh7Rr31MZz7fmacUoHMQMziVAXkIX7yD4ZQ3F3N6n2wdbv/ HzBWmdmMDQX4K8btkW357qlv0EAC8avTWIiuEe+GPkZzs6wkWK/efBrhmIbzC16QJd yumSuguNH+GOaHJSTfiUiF4x9yycs/yfPj50xyts= From: Tomi Valkeinen Date: Wed, 02 Apr 2025 16:30:56 +0300 Subject: [PATCH v2 14/18] drm/bridge: cdns-dsi: Use videomode internally MIME-Version: 1.0 Message-Id: <20250402-cdns-dsi-impro-v2-14-4a093eaa5e27@ideasonboard.com> References: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> In-Reply-To: <20250402-cdns-dsi-impro-v2-0-4a093eaa5e27@ideasonboard.com> To: Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar , Tomi Valkeinen X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4546; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=IIDKgphBR8Z+MRb90fam19Jh4edh+nhVkDzVKuQW/rY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBn7TwgE/Bvc7519Sav63c0+qQ9diO63TzZq0FQt bfZL9SrcD2JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ+08IAAKCRD6PaqMvJYe 9VncD/9A2IAiZBtLzbDk1nuBNFg+G5KREDNLS8B4zuMU3PYMZaXqSsVkC7XtLfeNq7K7sqyUFWJ TOAu0B5cX6KqWqSMjJMk2O40xrNBfoC8X9LSwk0dWekEvYkgk0MEhk4bx0aPrV90XQh5hWSc7ou nn17eQTJm+++ctGVPCQ2CEyoRnA5yxyuXUDKWV+wM+lE7kEL6sQXrfN66aUHV0HEwKgbVM9kQIk YK1KXS/Ing/hhEn5jwAeq1AzInP6wNvu6UOMjz1qYKoRWobkYw4ccAPK6+X47PTq1L6mVw1oBgs 9CRLlRS/jhzzURio7IedIGL9oW8U9EihYeYo3ao8IKygZDQH288xX3qLDLVWLypVcktZvmIiMDA zX273jVH+BrLsooaYPk5fGLMVOCNEWjtlvPpcQSL7IBjZKgKM0Gv7fa6Q5cCSx47tTcrY3TOoYQ v5atM+ropp+FV9Q4MV8Onvw3hur+38pdZB+ZNzb471C8dWlsGmnS/tKbBkIH8CfkuH02nVNXAnw F4P882pDYymsmLJlp7C8ND3GaRFXNmSJZ34rlpoxjfP7zwXDGP9O7F3b8xTmIELWjalqC4Pi99p KJZs7q9fY092WkvCOtBMdb2vqDeDzPYhSjj/siufqhqs1ZAVbphJU7BHmUA6j+Q8khTD/IExsPH XBrm62/72WB7nMg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250402_063133_181861_B9F43444 X-CRM114-Status: GOOD ( 12.71 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The drm_display_mode is a bit difficult one to use (we need hfp, hbp, ... instead of hsync_start, hsync_end, ...) and understand (when to use crtc_* fields). To simplify the code, use struct videomode internally which cleans up the code. If in the future we want to use crtc_* fields in some code patchs, that can be easily achieved by creating a videomode from the crtc_* fields, and no change to the functions that do the work is needed. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 31 +++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 220213f5cb09..1a30e2f7d402 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -9,6 +9,7 @@ #include #include #include