From mboxrd@z Thu Jan 1 00:00:00 1970 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 4A303C4345F for ; Tue, 30 Apr 2024 07:48:31 +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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EEicpHJfu8TrPFkqrmUTwCXpTRlHK7G9n8grK8IQkJI=; b=CpL+eEVxu6XHyANGG0cMnH9niZ B0aeDE2BTuQEl3iqYqR2oMGXRHxpwwzFbTMK92KrxUUCfjFsPCFcj9AsUcR2StWIksmALeaaPb2IJ o0pfwxewh6jL2EiFspNaHC1dXkMcNVbDtthg+IS4B7s11i/4hKThntRyJanh81Fkjwg0zuE5Bh817 jNgRhfr/6ZygQKvgWwvUq/sLpXs2JnuiVktkhqe4mvg/6cTggilTIamzRIgSdOXe0EaTKF9Ey3M6d 41RZipn++KV/w54zqfFutAlGsBiWAnzDpAoDm3EVttC2teurzfWqsButeT+D7f9ofkaLNEe3Y22YJ 8mHQM09A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1iDt-00000005Ubb-1f45; Tue, 30 Apr 2024 07:48:21 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1iDo-00000005UY5-44GW for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2024 07:48:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E3669CE0D6B; Tue, 30 Apr 2024 07:48:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B01D8C2BBFC; Tue, 30 Apr 2024 07:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714463288; bh=9IhoDrLW5nla3PkdfiFXqy+CBqAGV0puxz21Q1cMMhc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X3j4NGN90P1GmyQQZcPK/CCn5HXBpRxqpfpBMjPyL6V+WuLs+vRwa9bhCkFvf2Ypk CzCK8BwSeEyDG9CfSTutylcTBbnnjDCw7jayRL3BEadM690pBlnxcWNQhadXREO1aE zZpOSJPJXmSPNPYodAUpTnSOSlha4iWzZ0v95ipKKTh6HmWO6jfvRVo/AteUos0gyM pmTPyaOSoJIlZX7sGBY8NkLvjZ4tsnbk9zPVvNzoah5m0mZl66RKHgPosxZw7oYPNJ ODdcC8hGQWGlb/xKfwCZCaFGey6QzbRahjO0nE2fP6aahKt3yMu1HSE3M4TXw0NWkQ boFt3JByVTJBw== Date: Tue, 30 Apr 2024 09:48:05 +0200 From: Maxime Ripard To: Sean Nyekjaer Cc: Yannick Fertre , Raphael Gallais-Pou , Philippe Cornu , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , Robert Foss , Antonio Borneo , dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/stm: dsi: relax mode_valid clock tolerance Message-ID: <20240430-exuberant-ludicrous-caiman-bc7dac@houat> References: <20240322104732.2327060-1-sean@geanix.com> <20240424-famous-fascinating-hyena-8fb3a7@houat> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240430_004817_373251_62176F27 X-CRM114-Status: GOOD ( 30.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6477949260624473033==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6477949260624473033== Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="3ku2wna3thhbsakw" Content-Disposition: inline --3ku2wna3thhbsakw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Mon, Apr 29, 2024 at 10:17:45AM +0200, Sean Nyekjaer wrote: > On Wed, Apr 24, 2024 at 09:21:17AM UTC, Maxime Ripard wrote: > > Hi, > >=20 > > Sorry, my previous review didn't go through. > >=20 > > On Fri, Mar 22, 2024 at 11:47:31AM +0100, Sean Nyekjaer wrote: > > > When using the DSI interface via DSI2LVDS bridge, it seems a bit harsh > > > to reguire the requested and the actual px clock to be within > > > 50Hz. A typical LVDS display requires the px clock to be within +-10%. > > >=20 > > > In case for HDMI .5% tolerance is required. > > >=20 > > > Fixes: e01356d18273 ("drm/stm: dsi: provide the implementation of mod= e_valid()") > > > Signed-off-by: Sean Nyekjaer > > > --- > > > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 7 +++---- > > > 1 file changed, 3 insertions(+), 4 deletions(-) > > >=20 > > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/= stm/dw_mipi_dsi-stm.c > > > index d5f8c923d7bc..97936b0ef702 100644 > > > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > > > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > > > @@ -322,8 +322,6 @@ dw_mipi_dsi_phy_get_timing(void *priv_data, unsig= ned int lane_mbps, > > > return 0; > > > } > > > =20 > > > -#define CLK_TOLERANCE_HZ 50 > > > - > > > static enum drm_mode_status > > > dw_mipi_dsi_stm_mode_valid(void *priv_data, > > > const struct drm_display_mode *mode, > > > @@ -375,9 +373,10 @@ dw_mipi_dsi_stm_mode_valid(void *priv_data, > > > /* > > > * Filter modes according to the clock value, particularly useful = for > > > * hdmi modes that require precise pixel clocks. > > > + * Check that px_clock is within .5% tolerance. > > > */ > > > - if (px_clock_hz < target_px_clock_hz - CLK_TOLERANCE_HZ || > > > - px_clock_hz > target_px_clock_hz + CLK_TOLERANCE_HZ) > > > + if (px_clock_hz < mult_frac(target_px_clock_hz, 995, 1000) || > > > + px_clock_hz > mult_frac(target_px_clock_hz, 1005, 1000)) > > > return MODE_CLOCK_RANGE; > >=20 > > I wonder if it's not something that should be made into a helper. We > > have a couple of drivers doing it already, so it might be worth creating > > a function that checks for a given struct clk pointer and pixel clock if > > it's within parameters. > >=20 > > Maxime >=20 > Yes agree, if the same calculation is happening other places. > I can't identify where it happens though. sun4i has one: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_= rgb.c#L123 > Would that helper function exist in drivers/gpu/drm/drm_hdmi_helper.c ? There's nothing related to HDMI per se, so in drm_modes is probably better. Maxime --3ku2wna3thhbsakw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZjCiLQAKCRAnX84Zoj2+ ds5wAYDHGuIdIPY8LGE5jCxGK/zlexyRCxqHgMO/chCJQKe8587hAVvgA6kCEjOG 8wElsZsBgOUQR5Rq+np631HT2l10Ql64rLGh4vOK+pluY8lwaT5XM5UI5MXsn+dH OEGAeKFVbw== =xyGn -----END PGP SIGNATURE----- --3ku2wna3thhbsakw-- --===============6477949260624473033== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6477949260624473033==--