Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp245728lqd; Wed, 24 Apr 2024 00:23:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6csoOTlA3yuW7fnRBZs7NN86TozSJkrGahEWead4e6yc1MJjY9QSHzmIvfvC55ykQXI3t2CwpofofkBq10evKU4PR64sIg1QfQtY4Xg== X-Google-Smtp-Source: AGHT+IF++YyXy/JDKwWiulrf14qCAR6y/ggFJN6QSB5NywkWldIf5l6r2wLnPbLyoGiLgb3pz4+u X-Received: by 2002:ad4:5485:0:b0:69b:e64a:c11d with SMTP id pv5-20020ad45485000000b0069be64ac11dmr1516144qvb.18.1713943425932; Wed, 24 Apr 2024 00:23:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713943425; cv=pass; d=google.com; s=arc-20160816; b=xoqlv68guGvBDIYEhBDJGZBKWkCL6Uw0ooYnWdZsUPgq1YcXvO+HY/JIV/HU5VXFpN OnHeClrMMfn3DaK7comwtMTEFjASY5/trUyUA1XvPUyQWanotS0YvcWUF8pQZOlxdD1X K0KXa6kt50JX+mWm7RFemNtE1pEghC6qfU9Hb0Q2TNLrygsbsbxk9knvWPxM79vamcmu BH6PsICvbOsA+gBphYlyl7tpcKC8y0whC7hqINgt8z1Q3T/OfaAgENSJI5pOsyq+pQOM afAR+shSbhT5k1QBOQPcFoZbYqn6DQnEO2qRHONd5mA6Nh4RK93nPLfWbunza/Ra6wWG o1Ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=awV1h4Eyy8ZFt6VigZyp4TrpkShfn0LZ0qqG+WyOA0Q=; fh=4V4T3Qv93YtHzQoiRMvRXOEX8phL5a7QJKACvReLClE=; b=f9dJmwnftk1Uk5Ch3OlyNE1bmv82eAuMjM0+43NbYmbbcQXpnkEffQleqEy8/IOrej 6v0tmfHTMK9ULAAw56nzxiNbOGEgKkO8u1sMsLKRE5B2wnMcbuEjSYOZFZ3dnipII9YQ 7KGgMutjfKPncV/s66vt/w+cuRNVF8oDy2oUllVye7suahVhQkmM4UvFktZtM//kvT5O bwg/8JsDOxku7SxTzLD0VtXd+WkCHSx4gm9TcrwFxh104nVpBrBGZxheEZpXKGsuNrXz hRS32cYRDkO5SahHs3+3H6D0L15tdir7g4b6Tc0VlJ/cbeSJHIBKMy6ot7++meSMLF0L QxVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gKTHYL64; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gf10-20020a056214250a00b0069b8256d994si14112998qvb.67.2024.04.24.00.23.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 00:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gKTHYL64; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A59811C2410D for ; Wed, 24 Apr 2024 07:23:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93C1E158A3C; Wed, 24 Apr 2024 07:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gKTHYL64" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C06361581EC for ; Wed, 24 Apr 2024 07:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713943280; cv=none; b=S8lzxGCRHQ/jfQxZbxHunXuhqFUv5znFgW7S3Jj99K+anxzj5NbFVi1Z+gDqo67mXN8dALJoXDni1UiRJk3uWH7pNUy6Zes6vyrb18ElWrxLdlFc80kqsrF6VnubA5Lax7a6iBhqzDSpRyGtnLQPjdkejoCLjHVnvOcvvGsFBdc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713943280; c=relaxed/simple; bh=gejzVuWBbs/WERJ9LaTFGpunGqbTm4721u2pjEmC5BU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ua6W2FpJ7g/I4+SN4RSCMXEtJjv9c96PHImTiNDzMjGn1xWhg2tXqP1Qsd0miMv3okScwk4BBvNrRYekp7OTueIUw4pIA+5UUhd5B2LlBENUqX8ineN0udF6xlYTeI2Ehwpf4Mjv/KO5cQbY9X7KNRvB2wnQ55PL4Tz1bdyuZIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gKTHYL64; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B32EC113CE; Wed, 24 Apr 2024 07:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713943280; bh=gejzVuWBbs/WERJ9LaTFGpunGqbTm4721u2pjEmC5BU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gKTHYL64JeM+ohgmxJAKPd2RuwHo3HmQplRv1+DpcgSWHMoiUiOsftam/VHAIIIkJ G38mdmJFVDjIIdXL3mtsrFLetGYqsFcbCWSTJS3mEI20HJRlGkDIc9WKcTk2gmcOyW zks617G6u9CE/v6dwUq6DSTMfkb782ZgDhcVZPgR00b5yOMCs4Dbry0C5zLwjGVl+A odlPGnfynIi93X34NgtJNYd8OYF1FGQ13zG/o8LuFVSh3mDdVHmRh8nPqYMrOSdaXK n/cpKRz9K+39tqwO1nq8t+3QYMxNlA2jcy32rRfjllGuWp7J8n6LLrsckq7y/iQxmG f38oAyu+xW1qg== Date: Wed, 24 Apr 2024 09:21:17 +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: <20240424-famous-fascinating-hyena-8fb3a7@houat> References: <20240322104732.2327060-1-sean@geanix.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="v3qz7kftr5irttdu" Content-Disposition: inline In-Reply-To: <20240322104732.2327060-1-sean@geanix.com> --v3qz7kftr5irttdu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, Sorry, my previous review didn't go through. 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 mode_va= lid()") > 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, unsigned = 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; 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. Maxime --v3qz7kftr5irttdu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZiiy6AAKCRAnX84Zoj2+ dhSPAX4unsLgg7n5/O2rJ1Xlrd/571ia5c4LJJUra+mfWA8IhYeQMu4sWwT4uRjd Dgb0KZUBgLBnBIhAxuWQ3eNhMQrD/r7T0Mjb7b77bERge1rc14SEDTgD9BpPn8mG jmgHEANigw== =h0FU -----END PGP SIGNATURE----- --v3qz7kftr5irttdu--