Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1047128lqp; Fri, 22 Mar 2024 04:12:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjp4CU+MyNxpPN47/HNBlbJSnTZjopTINfeFtZKUfYRSct6BxaYv8gPi6jD2bV4wZbF+a47LLQkxyyKK7iT3II6cZ8J1UXaHzn8YcAbg== X-Google-Smtp-Source: AGHT+IHzyOMZvAxxhngQSSAohRR4zgN1tH2JNECskdzzuAn7/CoJbUnGsnt+0Lt8nf0yBXIAVZ8B X-Received: by 2002:a05:6830:1106:b0:6e5:a89:2ddd with SMTP id w6-20020a056830110600b006e50a892dddmr1701395otq.27.1711105931721; Fri, 22 Mar 2024 04:12:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711105931; cv=pass; d=google.com; s=arc-20160816; b=JoKzP/gFFJ4fpGZ1PcHfp84qPM7/Y1/nIA1iP+BvUx2O9+EG/GKgl3+4DVRRhddBUU Ke+cxuJ+xh5Uz7HjhlnnWsXTp14Rjpw/olrEgzdzPy5XG8J0b+2cAuF+73V1+7p7KcWJ fmNENXK3C03FnF6z4ajZXeu3Z000kFeYsZIxvrVVjG+a9KFrEL7tJkfV7lokSpK/yzA5 +AVxV+15vsfBiQHX850RmrcolYuEnC5kkNgVeGSa415f0jIQ6qvTx8lS/8YdhnNpFx3/ oc0hhPLSNkGq6aT1XFxNVtWxQSRsjTyYtO2hImejsLVfp5vSRx/gm87HOwPeKp5xrKWe 8BdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=J9CuZ33LUi+k6FzE7felhvKpLH81dmZUIoVLkX9iVZc=; fh=krA2Lry8V8WMJl3T5lU9uqFSUt3cIAmuxj8GiFxNX40=; b=Nmu/XUWkV7WA97upUflKCmypQBcRP1oHc5YgRQrarJtaowKSJr/ebN0awH7RA45lyH gYD70aM3Hskwe4OYrou3ftpqztwmCMBCnpG7OKyCW/vx41hn9HmI8G3CB5ouW00d/vt1 WW6TmMIYyxIjA//c/Pv8nZTBGg/Hs8FMNVBnSqOtZduz+6qQ0Kw82iUH8ZQgG22I14XV s0tAIO/C2nDm0dpB8sMFWU43SsFeiGXd1Zp5Yt0+WZh6AGffY+i3XfcGe4Q0Kk6At5/z kd+Dwn3T6Ru7qZpXjGy4Q18QBWmc9HByw5wEhkVEw0h66kclIbZd1EBAScFEzarpezfK Qp9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@geanix.com header.s=default2211 header.b=EGI2bvKt; arc=pass (i=1 spf=pass spfdomain=geanix.com dkim=pass dkdomain=geanix.com dmarc=pass fromdomain=geanix.com); spf=pass (google.com: domain of linux-kernel+bounces-111347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x35-20020a631723000000b005dc87994572si1704605pgl.346.2024.03.22.04.12.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 04:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=default2211 header.b=EGI2bvKt; arc=pass (i=1 spf=pass spfdomain=geanix.com dkim=pass dkdomain=geanix.com dmarc=pass fromdomain=geanix.com); spf=pass (google.com: domain of linux-kernel+bounces-111347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 15081B21596 for ; Fri, 22 Mar 2024 11:05:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23DA63E47A; Fri, 22 Mar 2024 11:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="EGI2bvKt" Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (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 DF5CF3D0D9 for ; Fri, 22 Mar 2024 11:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711105540; cv=none; b=WRQamMTg8zGBIOqp2V0eN5+La73lA6p2+CjSIoKbzqr+toH6a/DYvBefAskSYybGSk84IUkCQJDQFhFmM3IhXI85zbYDg8rqufS6TRw0oGsotXxK+bwOf6Hj6yl3Rwhkc0CVDz2pFiADuXWKh4FAnH2RIIbNEi5BONrvtq/hNpM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711105540; c=relaxed/simple; bh=Was4C+ESu5JAiwUHW6xmTjdvg1OJtFhRQJ3CzQTJRjI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Bn59egfQVFFkKH223NRNdbkQCQdjzyNmWsM86Mw9kaLBPfQjIacSrHyCuMU3vBozuOrYDIwngVZNjPK15MA3FxsjlbVFpIGjzOwNfV+gw/XH57O5UHI1OK6Tpyly0BqbwvmS6P3qbjlPkHQqSW7uerkkPwdv0cs5twnPrig/uQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=EGI2bvKt; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=J9CuZ33LUi+k6FzE7felhvKpLH81dmZUIoVLkX9iVZc=; b=EGI2bvKt0dsRuvymeSTE44Lu0C 0dY91Sy6D7CK+hkso1Zc+qs3iwd2r8eSK48LENFGHkTjwZdiDjZ7+yx1AoUVhC8q4hBiCAQkWYbJS wrH8OKsCg1NdlTi8egsT96mJyYWS0/3XkZPGHG4VbD7NBE6KryqudkAty571UJoz6tja6gOdhzyAD DTwM0GQRaQ5+SFWH9dHvORKJ+nk8wsCixkvZPLOlUSYF5gOLnXG0lTt+lktVXLkCRIdlPXLUbtfid fmUSGQg7AtwpXEUZbt4c+zts15I1jhjPAhRro7UEeVSvRQvnY87RDefXL6XnST34mgRnqWsG4aYcI DySFbOHw==; Received: from sslproxy02.your-server.de ([78.47.166.47]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rncRL-000B01-On; Fri, 22 Mar 2024 11:47:59 +0100 Received: from [185.17.218.86] (helo=zen..) by sslproxy02.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rncRK-00G8Yg-1h; Fri, 22 Mar 2024 11:47:58 +0100 From: Sean Nyekjaer To: Yannick Fertre , Raphael Gallais-Pou , Philippe Cornu , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , Robert Foss , Antonio Borneo Cc: Sean Nyekjaer , dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/stm: dsi: relax mode_valid clock tolerance Date: Fri, 22 Mar 2024 11:47:31 +0100 Message-ID: <20240322104732.2327060-1-sean@geanix.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27222/Fri Mar 22 09:30:59 2024) 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%. In case for HDMI .5% tolerance is required. Fixes: e01356d18273 ("drm/stm: dsi: provide the implementation of mode_valid()") Signed-off-by: Sean Nyekjaer --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; } -#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; /* sync packets are codes as DSI short packets (4 bytes) */ -- 2.44.0