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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 2DFB1D41D44 for ; Tue, 12 Nov 2024 02:07:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7703810E207; Tue, 12 Nov 2024 02:07:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.b="uvDouWKH"; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D93C10E207 for ; Tue, 12 Nov 2024 02:07:54 +0000 (UTC) Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9142A893A6; Tue, 12 Nov 2024 03:07:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1731377273; bh=A9Zh7fGm4aPbFAZBONhgPyhvESfO5Dj0x7OGmUZvBjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uvDouWKHlWrAHK1h9e6KE3dx1mIAIgRjeLMuVADJAfXv8syNCcKu+znTF8vuQkivj wQDZU/u3GHINeghKFeXxFrdffrkwSea2Vnvb0e2u+Q7A/IpDVr5rgYdO17tkFJkMYi B2WRkqLv2MSCqgJT1N4HCwz26orkvq5V2H8Rx002UHc5YFigB+tMigd9uPjNq9dbbO gcaM6wLcM7JF+OwhCGv4n/uvnSA73cvHwfj7ea0vrov6P97eR/Ko5OodnmNJMWw7Qm DaPOJ0/zdxliKVAXYr5n0tDpId1Pg3QL3BIYpXbpfKEGyvh/5uszbNG/+5SdcqI9Iy hFQjWz9bFfVbw== From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Andrzej Hajda , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Robert Foss , Simona Vetter , Thomas Zimmermann Subject: [PATCH v2 2/2] drm/bridge: tc358767: Improve DPI output pixel clock accuracy Date: Tue, 12 Nov 2024 03:05:37 +0100 Message-ID: <20241112020737.335297-2-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112020737.335297-1-marex@denx.de> References: <20241112020737.335297-1-marex@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The Pixel PLL is not very capable and may come up with wildly inaccurate clock. Since DPI panels are often tolerant to slightly higher pixel clock without being operated outside of specification, calculate two Pixel PLL from either mode clock or display_timing .pixelclock.max , whichever is higher. Since the Pixel PLL output clock frequency calculation always returns lower frequency than the requested clock frequency, passing in the higher clock frequency should result in output clock frequency which is closer to the expected pixel clock. For the Chefree CH101 panel with 13 MHz Xtal input clock, the frequency without this patch is 65 MHz which is out of the panel specification of 68.9..73.4 MHz, while with this patch it is 71.5 MHz which is well within the specification and far more accurate. Keep the change isolated to DPI output. Signed-off-by: Marek Vasut --- Cc: Andrzej Hajda Cc: David Airlie Cc: Jernej Skrabec Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Neil Armstrong Cc: Robert Foss Cc: Simona Vetter Cc: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org --- V2: - Isolate the change to DPI only, split tc_bridge_mode_set() - Look up display_timings and use .pixelclock.max as input into the PLL calculation if available. That should yield more accurate results for DPI panels. --- drivers/gpu/drm/bridge/tc358767.c | 47 +++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 0d523322fdd8e..fe9ab06d82d91 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -39,6 +39,8 @@ #include #include +#include