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 9ECE7D41D53 for ; Tue, 12 Nov 2024 05:29:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 177EE10E572; Tue, 12 Nov 2024 05:29:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="wUbmB4U0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C29F10E570 for ; Tue, 12 Nov 2024 05:29:21 +0000 (UTC) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 227E6512; Tue, 12 Nov 2024 06:29:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1731389348; bh=EN3H5ctw+W8jPZHaMp+X3x7khh5ZqkE8eDyq5RTuNf0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wUbmB4U0Uqsf6+fkgTaEWOLslDNYHUovU3MEg0jvpj2gHjv94xi5aRF2Hy1qlyu3g thu3RMxghSu5iNnbbLtjx1E2f+cK6jDhEHrL1x8mrIBaeOcr7kcOGewzKi/v4PmuG9 LNSV0Y2fxoQd1OoMhUafd0IcJ8zLeL2hi0tdnH9w= Date: Tue, 12 Nov 2024 07:29:11 +0200 From: Laurent Pinchart To: Marek Vasut Cc: dri-devel@lists.freedesktop.org, Andrzej Hajda , David Airlie , Jernej Skrabec , Jonas Karlman , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Robert Foss , Simona Vetter , Thomas Zimmermann Subject: Re: [PATCH v2 2/2] drm/bridge: tc358767: Improve DPI output pixel clock accuracy Message-ID: <20241112052911.GA5877@pendragon.ideasonboard.com> References: <20241112020737.335297-1-marex@denx.de> <20241112020737.335297-2-marex@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20241112020737.335297-2-marex@denx.de> 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" Hi Marek, Thank you for the patch. On Tue, Nov 12, 2024 at 03:05:37AM +0100, Marek Vasut wrote: > 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. Maybe this is a leftover from v1 in the commit message, but I don't think the code computes two pixel PLL. > 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. Is that guaranteed ? > 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. I'm a bit concerned that this patch is quite a bit of a hack, but fixing the problem correctly would be too much yak shaving :-S > > 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