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 B8A3EC36000 for ; Fri, 21 Mar 2025 14:26:24 +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=fI7kpBlYakjtVbWpsDDNOq3MbmuVbxFMLPQQBZ0IFAE=; b=m/VqbOL0rbHXKV6qth0lnzbZjU WJQUktSlTIfHez0qCy2Ov+0SzozNScjHAp4MSuFQoBBu2HgaBMvB9uziYAHDQeAI+cY8TnWfVquLV X4uLM52kUbjjsa/z2VKgXaTghXuiFeTaGd9OrQVCZPCV0Q64w44R9OwUEc3FwySFXcwp27UG9QXCI p1lpchvssg0xEeug0czNWxl3DxZubA6sy49zPwMgBzfcCiKlvi2DAT5CVam31luG3KUGtlK6N788O wxP6SX0qcj726hbJjzEwwCzlOu08oiH9YbHhAWkbD2/7rBBKG6DiRp/Z91yZ4gnNBsyDdGzoFvuzU cPeCJf5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tvdKK-0000000F6R2-28Yl; Fri, 21 Mar 2025 14:26:24 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tvdCD-0000000F4cA-0XCM for linux-phy@lists.infradead.org; Fri, 21 Mar 2025 14:18:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id F28D4A468B3; Fri, 21 Mar 2025 14:12:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77ACFC4CEEC; Fri, 21 Mar 2025 14:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742566680; bh=0amfkrO3B1zq5t8fnOfrUB4M+QOIpfFLARmwtZZfJw4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h28JaQj+Cuj1LkqH51sg7oXGnIp4dVVxPZLz+0RAoJ/cvMEaPF8oIsuaNLxg6oydV r1yJNsBhghnpG5hehz+YWKOib6wlXmRNYJP7ecTb3km28qnRD6pBOoGxDewxc4Udqp M3VCQqx7xzCwXw05YFYf0I++tTrBW3LCeKuiIctyDlwgH9flhmRhKbywagZErNUwkl z+mg2s7FssEr24uOfvVkTLbAuEnEKhf3y/Qzh1gNfpYQYjqJpFejFsahS/CASq8/IB ZlJyi2L7eqISoLmTCRdL3u9zf1QNz6RraU3518vXPG/QTtwiQLFWd2PA6UUZZMcqLT qZ8Zkfy0Bycew== Date: Fri, 21 Mar 2025 15:17:57 +0100 From: Maxime Ripard To: Tomi Valkeinen Cc: Jyri Sarha , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Vinod Koul , Kishon Vijay Abraham I , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Francesco Dolcini , Aradhya Bhatia , Devarsh Thakkar Subject: Re: [PATCH 03/18] drm/tidss: Add mode_fixup to adjust the clock based on HW Message-ID: <20250321-adaptable-astonishing-adder-ceeb6f@houat> References: <20250320-cdns-dsi-impro-v1-0-725277c5f43b@ideasonboard.com> <20250320-cdns-dsi-impro-v1-3-725277c5f43b@ideasonboard.com> MIME-Version: 1.0 In-Reply-To: <20250320-cdns-dsi-impro-v1-3-725277c5f43b@ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250321_071801_293036_4E9CA1B4 X-CRM114-Status: GOOD ( 22.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: , Content-Type: multipart/mixed; boundary="===============3789142753375998592==" Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org --===============3789142753375998592== Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="bchtvmz6w2bii2si" Content-Disposition: inline --bchtvmz6w2bii2si Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 03/18] drm/tidss: Add mode_fixup to adjust the clock based on HW MIME-Version: 1.0 On Thu, Mar 20, 2025 at 05:59:58PM +0200, Tomi Valkeinen wrote: > 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. >=20 > Add mode_fixup(), in which the clk_round_rate() is used to get the > "rounded" rate, and set that to the adjusted_mode. >=20 > 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. >=20 > Signed-off-by: Tomi Valkeinen > --- > drivers/gpu/drm/tidss/tidss_crtc.c | 22 ++++++++++++++++++++++ > drivers/gpu/drm/tidss/tidss_dispc.c | 6 ++++++ > drivers/gpu/drm/tidss/tidss_dispc.h | 2 ++ > 3 files changed, 30 insertions(+) >=20 > diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/t= idss_crtc.c > index 1604eca265ef..b3338dac25bc 100644 > --- a/drivers/gpu/drm/tidss/tidss_crtc.c > +++ b/drivers/gpu/drm/tidss/tidss_crtc.c > @@ -309,7 +309,29 @@ enum drm_mode_status tidss_crtc_mode_valid(struct dr= m_crtc *crtc, > return dispc_vp_mode_valid(tidss->dispc, tcrtc->hw_videoport, mode); > } > =20 > +static bool tidss_crtc_mode_fixup(struct drm_crtc *crtc, > + const struct drm_display_mode *mode, > + struct drm_display_mode *adjusted_mode) > +{ > + struct tidss_crtc *tcrtc =3D to_tidss_crtc(crtc); > + struct drm_device *ddev =3D crtc->dev; > + struct tidss_device *tidss =3D to_tidss(ddev); > + long rate; > + > + rate =3D dispc_vp_round_clk_rate(tidss->dispc, tcrtc->hw_videoport, > + adjusted_mode->clock * 1000); > + if (rate < 0) > + return false; > + > + adjusted_mode->clock =3D rate / 1000; > + > + drm_mode_set_crtcinfo(adjusted_mode, 0); > + > + return true; > +} mode_fixup is deprecated in favor of atomic_check. If you can't use it for some reason, it should be documented one way or another. Maxime --bchtvmz6w2bii2si Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZ911EQAKCRAnX84Zoj2+ dgndAYCh/YgKmD2eT0IGBSW4oFScUbO0JiE0c6rJgT/fOlLd8ZyEQUmNR3/ihtKv L3mLPUwBgN2SlLXG4F2ri8LKeYXjbpOagi9fMufwxwGrEzWDluOQ6RSb6Ak7/Y/H uemPVUoFyg== =QyZO -----END PGP SIGNATURE----- --bchtvmz6w2bii2si-- --===============3789142753375998592== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy --===============3789142753375998592==--