From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (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 4542C48CC0; Wed, 20 Dec 2023 19:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="xbQQdgnG" Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4SwP3b1fmjz9ssS; Wed, 20 Dec 2023 20:37:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1703101067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jgxSUwGOi+ie/puV3wymSBpsL2XirYOnPiXm8jpB72I=; b=xbQQdgnGakr8QIqbYrhLaYBAmMjZeHqK+kgRtWIfiTEw6bI2ZeRalOrkweo9b7MqptX65d vIB4sGVAAw79caC0Tus+QNhPiHsM/RKd12D7HtqTwbkNUq+osNaBuIkZWFRmQnuk62b6Hv 8wuPpg/a75LWGtHsnabNtGjgFzqnWBahaUS1qTs2kAmneFYcC7YNJblIpi0/Ek+BOHHse6 bb7ZnfOx4X1ew9HJUvbUxRqsXSp29Z3dXNuxKhEFJ9YtSUN3NgLTdsXB8mfWfLHb3nUVFT ud9eAuOyF4gFtqV41ulbeS2P0PoRaVtJ0pfcw/A0HFfcQX4PiUHNK7yp0fz1IQ== References: <20231218-pinephone-pll-fixes-v1-0-e238b6ed6dc1@oltmanns.dev> <10386431.nUPlyArG6x@jernej-laptop> <87edfh9ud8.fsf@oltmanns.dev> <1845418.atdPhlSkOF@jernej-laptop> From: Frank Oltmanns To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Samuel Holland , Guido =?utf-8?Q?G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 5/5] drm/panel: st7703: Drive XBD599 panel at higher clock rate Date: Wed, 20 Dec 2023 19:57:06 +0100 In-reply-to: <1845418.atdPhlSkOF@jernej-laptop> Message-ID: <875y0sacmz.fsf@oltmanns.dev> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ok, I've done more detailed testing, and it seems this patch results in lots of dropped frames. I'm sorry for not being more thorough earlier. I'll do some more testing without this patch and might have to either remove it from V2 of this series. I need to see if the same stability can be achieved when running PLL-MIPI outside its specied range. Best regards, Frank On 2023-12-20 at 16:18:49 +0100, Jernej =C5=A0krabec wrote: > Dne sreda, 20. december 2023 ob 08:14:27 CET je Frank Oltmanns napisal(a): >> >> On 2023-12-19 at 18:04:29 +0100, Jernej =C5=A0krabec wrote: >> > Dne ponedeljek, 18. december 2023 ob 14:35:23 CET je Frank Oltmanns na= pisal(a): >> >> This panel is used in the pinephone that runs on a Allwinner A64 SOC. >> >> Acoording to it's datasheet, the SOC requires PLL-MIPI to run at more >> >> than 500 MHz. >> >> >> >> Therefore, change [hv]sync_(start|end) so that we reach a clock rate >> >> that is high enough to drive PLL-MIPI within its limits. >> >> >> >> Signed-off-by: Frank Oltmanns >> > >> > I'm not too sure about this patch. I see that PLL_MIPI doesn't have set >> > minimum frequency limit in clock driver. If you add it, clock framework >> > should find rate that is high enough and divisible with target rate. >> >> This one is really a tough nut. Unfortunately, the PLL_MIPI clock for >> this panel has to run exactly at 6 * panel clock. Let me start by >> showing the relevant part of the clock tree (this is on the pinephone >> after applying the patches): >> pll-video0 393600000 >> pll-mipi 500945454 >> tcon0 500945454 >> tcon-data-clock 125236363 >> >> To elaborate, tcon-data-clock has to run at 1/4 the DSI per-lane bit >> rate [1]. It's a fixed divisor >> >> The panel I'm proposing to change is defined as this: >> >> static const struct st7703_panel_desc xbd599_desc =3D { >> .mode =3D &xbd599_mode, >> .lanes =3D 4, >> .mode_flags =3D MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULS= E, >> .format =3D MIPI_DSI_FMT_RGB888, >> .init_sequence =3D xbd599_init_sequence, >> }; >> >> So, we have 24 bpp and 4 lanes. Therefore, the resulting requested >> tcon-data-clock rate is >> crtc_clock * 1000 * (24 / 4) / 4 >> >> tcon-data-clock therefore requests a parent rate of >> 4 * (crtc_clock * 1000 * (24 / 4) / 4) >> >> The initial 4 is the fixed divisor between tcon0 and tcon-data-clock. >> Since tcon0 is a ccu_mux, the rate of tcon0 equals the rate of pll-mipi. >> >> Since PLL-MIPI has to run at at least at 500MHz this forces us to have a >> crtc_clock >=3D 83.333 MHz. The mode I'm prorposing results in a rate of >> 83.502 MHz. > > This is much better explanation why this change is needed. Still, I think > adding min and max rate to PLL_MIPI would make sense, so proper rates > are guaranteed. > > Anyway, do you know where are all those old values come from? And how did > you come up with new ones? I guess you can't just simply change timings, > there are probably some HW limitations? Do you know if BSP kernel support > this panel and how this situation is solved there? > >> >> If we only changed the constraints on the PLL_MIPI without changing the >> panel mode, we end up with a mismatch. This, in turn, would result in >> dropped frames, right? > > From what I read, I think frame rate would be higher than 60 fps. What > exactly would happen depends on the panel. > > Best regards, > Jernej > >> >> Best regards, >> Frank >> >> [1] Source: >> https://elixir.bootlin.com/linux/v6.6.7/source/drivers/gpu/drm/sun4i/sun= 4i_tcon.c#L346 >> >> > >> > Best regards, >> > Jernej >> > >> >> --- >> >> drivers/gpu/drm/panel/panel-sitronix-st7703.c | 14 +++++++------- >> >> 1 file changed, 7 insertions(+), 7 deletions(-) >> >> >> >> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/= gpu/drm/panel/panel-sitronix-st7703.c >> >> index b55bafd1a8be..6886fd7f765e 100644 >> >> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c >> >> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c >> >> @@ -320,14 +320,14 @@ static int xbd599_init_sequence(struct st7703 *= ctx) >> >> >> >> static const struct drm_display_mode xbd599_mode =3D { >> >> .hdisplay =3D 720, >> >> - .hsync_start =3D 720 + 40, >> >> - .hsync_end =3D 720 + 40 + 40, >> >> - .htotal =3D 720 + 40 + 40 + 40, >> >> + .hsync_start =3D 720 + 65, >> >> + .hsync_end =3D 720 + 65 + 65, >> >> + .htotal =3D 720 + 65 + 65 + 65, >> >> .vdisplay =3D 1440, >> >> - .vsync_start =3D 1440 + 18, >> >> - .vsync_end =3D 1440 + 18 + 10, >> >> - .vtotal =3D 1440 + 18 + 10 + 17, >> >> - .clock =3D 69000, >> >> + .vsync_start =3D 1440 + 30, >> >> + .vsync_end =3D 1440 + 30 + 22, >> >> + .vtotal =3D 1440 + 30 + 22 + 29, >> >> + .clock =3D (720 + 65 + 65 + 65) * (1440 + 30 + 22 + 29) * 60 /= 1000, >> >> .flags =3D DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, >> >> .width_mm =3D 68, >> >> .height_mm =3D 136, >> >> >> >> >> 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 07E03C46CCD for ; Wed, 20 Dec 2023 19:38:21 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-reply-to: Date:Subject:Cc:To:From:References:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vdpb5li5C7cd4gnzyVuFiBVc6UYYmFzpCmdzT1QO1As=; b=1uD5fJbL5bFMgl O0RwTvxO4aMfTQOT9mjO++SPOAlEP0EzDJQ8x+xCkLhuXMUp9yTULBElpRuvfCXp9d5pZZZ0p38LJ jRrKLqiP6Wytrc1pwqnr5zFqgMwcULtYuElPMNHM87/taGFNcOiH/71jq2Btmv1c5RM8qRsCVD3AQ xXjeTPNkrYOMicaYCmPoKV5GNyi9tvVoSv2NCq/spf6h7qs4BcAUtYTvor8yc/JmeWGBK9aOTHUkS 6KODOlVHhi/DhkDm3sHA08haWUwFHrcFYRIGEnraeMw1ca+0E8NKeE5+m1tVyq+mnYpUoL/leRG3H Y3KRkSn0P4SIpX2TD88g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rG2OF-000mFj-28; Wed, 20 Dec 2023 19:37:59 +0000 Received: from mout-p-101.mailbox.org ([80.241.56.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rG2OB-000mEp-21 for linux-arm-kernel@lists.infradead.org; Wed, 20 Dec 2023 19:37:57 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4SwP3b1fmjz9ssS; Wed, 20 Dec 2023 20:37:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1703101067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jgxSUwGOi+ie/puV3wymSBpsL2XirYOnPiXm8jpB72I=; b=xbQQdgnGakr8QIqbYrhLaYBAmMjZeHqK+kgRtWIfiTEw6bI2ZeRalOrkweo9b7MqptX65d vIB4sGVAAw79caC0Tus+QNhPiHsM/RKd12D7HtqTwbkNUq+osNaBuIkZWFRmQnuk62b6Hv 8wuPpg/a75LWGtHsnabNtGjgFzqnWBahaUS1qTs2kAmneFYcC7YNJblIpi0/Ek+BOHHse6 bb7ZnfOx4X1ew9HJUvbUxRqsXSp29Z3dXNuxKhEFJ9YtSUN3NgLTdsXB8mfWfLHb3nUVFT ud9eAuOyF4gFtqV41ulbeS2P0PoRaVtJ0pfcw/A0HFfcQX4PiUHNK7yp0fz1IQ== References: <20231218-pinephone-pll-fixes-v1-0-e238b6ed6dc1@oltmanns.dev> <10386431.nUPlyArG6x@jernej-laptop> <87edfh9ud8.fsf@oltmanns.dev> <1845418.atdPhlSkOF@jernej-laptop> From: Frank Oltmanns To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Samuel Holland , Guido =?utf-8?Q?G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 5/5] drm/panel: st7703: Drive XBD599 panel at higher clock rate Date: Wed, 20 Dec 2023 19:57:06 +0100 In-reply-to: <1845418.atdPhlSkOF@jernej-laptop> Message-ID: <875y0sacmz.fsf@oltmanns.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231220_113755_963164_99F2133A X-CRM114-Status: GOOD ( 29.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ck9rLCBJJ3ZlIGRvbmUgbW9yZSBkZXRhaWxlZCB0ZXN0aW5nLCBhbmQgaXQgc2VlbXMgdGhpcyBw YXRjaCByZXN1bHRzIGluCmxvdHMgb2YgZHJvcHBlZCBmcmFtZXMuIEknbSBzb3JyeSBmb3Igbm90 IGJlaW5nIG1vcmUgdGhvcm91Z2ggZWFybGllci4KSSdsbCBkbyBzb21lIG1vcmUgdGVzdGluZyB3 aXRob3V0IHRoaXMgcGF0Y2ggYW5kIG1pZ2h0IGhhdmUgdG8gZWl0aGVyCnJlbW92ZSBpdCBmcm9t IFYyIG9mIHRoaXMgc2VyaWVzLgoKSSBuZWVkIHRvIHNlZSBpZiB0aGUgc2FtZSBzdGFiaWxpdHkg Y2FuIGJlIGFjaGlldmVkIHdoZW4gcnVubmluZwpQTEwtTU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CgpfX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpsaW51eC1hcm0ta2VybmVsIG1haWxpbmcg bGlzdApsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmlu ZnJhZGVhZC5vcmcvbWFpbG1hbi9saXN0aW5mby9saW51eC1hcm0ta2VybmVsCg== 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 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 F1870C3DA6E for ; Wed, 20 Dec 2023 19:37:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4437710E5E6; Wed, 20 Dec 2023 19:37:51 +0000 (UTC) Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050:0:465::101]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9F9310E5E6 for ; Wed, 20 Dec 2023 19:37:50 +0000 (UTC) Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4SwP3b1fmjz9ssS; Wed, 20 Dec 2023 20:37:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1703101067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jgxSUwGOi+ie/puV3wymSBpsL2XirYOnPiXm8jpB72I=; b=xbQQdgnGakr8QIqbYrhLaYBAmMjZeHqK+kgRtWIfiTEw6bI2ZeRalOrkweo9b7MqptX65d vIB4sGVAAw79caC0Tus+QNhPiHsM/RKd12D7HtqTwbkNUq+osNaBuIkZWFRmQnuk62b6Hv 8wuPpg/a75LWGtHsnabNtGjgFzqnWBahaUS1qTs2kAmneFYcC7YNJblIpi0/Ek+BOHHse6 bb7ZnfOx4X1ew9HJUvbUxRqsXSp29Z3dXNuxKhEFJ9YtSUN3NgLTdsXB8mfWfLHb3nUVFT ud9eAuOyF4gFtqV41ulbeS2P0PoRaVtJ0pfcw/A0HFfcQX4PiUHNK7yp0fz1IQ== References: <20231218-pinephone-pll-fixes-v1-0-e238b6ed6dc1@oltmanns.dev> <10386431.nUPlyArG6x@jernej-laptop> <87edfh9ud8.fsf@oltmanns.dev> <1845418.atdPhlSkOF@jernej-laptop> From: Frank Oltmanns To: Jernej =?utf-8?Q?=C5=A0krabec?= Subject: Re: [PATCH 5/5] drm/panel: st7703: Drive XBD599 panel at higher clock rate Date: Wed, 20 Dec 2023 19:57:06 +0100 In-reply-to: <1845418.atdPhlSkOF@jernej-laptop> Message-ID: <875y0sacmz.fsf@oltmanns.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: , Cc: Neil Armstrong , Purism Kernel Team , Samuel Holland , Stephen Boyd , David Airlie , Michael Turquette , linux-kernel@vger.kernel.org, Maxime Ripard , linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Ondrej Jirman , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Jessica Zhang , Sam Ravnborg , Guido =?utf-8?Q?G=C3=BCnther?= , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Ok, I've done more detailed testing, and it seems this patch results in lots of dropped frames. I'm sorry for not being more thorough earlier. I'll do some more testing without this patch and might have to either remove it from V2 of this series. I need to see if the same stability can be achieved when running PLL-MIPI outside its specied range. Best regards, Frank On 2023-12-20 at 16:18:49 +0100, Jernej =C5=A0krabec wrote: > Dne sreda, 20. december 2023 ob 08:14:27 CET je Frank Oltmanns napisal(a): >> >> On 2023-12-19 at 18:04:29 +0100, Jernej =C5=A0krabec wrote: >> > Dne ponedeljek, 18. december 2023 ob 14:35:23 CET je Frank Oltmanns na= pisal(a): >> >> This panel is used in the pinephone that runs on a Allwinner A64 SOC. >> >> Acoording to it's datasheet, the SOC requires PLL-MIPI to run at more >> >> than 500 MHz. >> >> >> >> Therefore, change [hv]sync_(start|end) so that we reach a clock rate >> >> that is high enough to drive PLL-MIPI within its limits. >> >> >> >> Signed-off-by: Frank Oltmanns >> > >> > I'm not too sure about this patch. I see that PLL_MIPI doesn't have set >> > minimum frequency limit in clock driver. If you add it, clock framework >> > should find rate that is high enough and divisible with target rate. >> >> This one is really a tough nut. Unfortunately, the PLL_MIPI clock for >> this panel has to run exactly at 6 * panel clock. Let me start by >> showing the relevant part of the clock tree (this is on the pinephone >> after applying the patches): >> pll-video0 393600000 >> pll-mipi 500945454 >> tcon0 500945454 >> tcon-data-clock 125236363 >> >> To elaborate, tcon-data-clock has to run at 1/4 the DSI per-lane bit >> rate [1]. It's a fixed divisor >> >> The panel I'm proposing to change is defined as this: >> >> static const struct st7703_panel_desc xbd599_desc =3D { >> .mode =3D &xbd599_mode, >> .lanes =3D 4, >> .mode_flags =3D MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULS= E, >> .format =3D MIPI_DSI_FMT_RGB888, >> .init_sequence =3D xbd599_init_sequence, >> }; >> >> So, we have 24 bpp and 4 lanes. Therefore, the resulting requested >> tcon-data-clock rate is >> crtc_clock * 1000 * (24 / 4) / 4 >> >> tcon-data-clock therefore requests a parent rate of >> 4 * (crtc_clock * 1000 * (24 / 4) / 4) >> >> The initial 4 is the fixed divisor between tcon0 and tcon-data-clock. >> Since tcon0 is a ccu_mux, the rate of tcon0 equals the rate of pll-mipi. >> >> Since PLL-MIPI has to run at at least at 500MHz this forces us to have a >> crtc_clock >=3D 83.333 MHz. The mode I'm prorposing results in a rate of >> 83.502 MHz. > > This is much better explanation why this change is needed. Still, I think > adding min and max rate to PLL_MIPI would make sense, so proper rates > are guaranteed. > > Anyway, do you know where are all those old values come from? And how did > you come up with new ones? I guess you can't just simply change timings, > there are probably some HW limitations? Do you know if BSP kernel support > this panel and how this situation is solved there? > >> >> If we only changed the constraints on the PLL_MIPI without changing the >> panel mode, we end up with a mismatch. This, in turn, would result in >> dropped frames, right? > > From what I read, I think frame rate would be higher than 60 fps. What > exactly would happen depends on the panel. > > Best regards, > Jernej > >> >> Best regards, >> Frank >> >> [1] Source: >> https://elixir.bootlin.com/linux/v6.6.7/source/drivers/gpu/drm/sun4i/sun= 4i_tcon.c#L346 >> >> > >> > Best regards, >> > Jernej >> > >> >> --- >> >> drivers/gpu/drm/panel/panel-sitronix-st7703.c | 14 +++++++------- >> >> 1 file changed, 7 insertions(+), 7 deletions(-) >> >> >> >> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/= gpu/drm/panel/panel-sitronix-st7703.c >> >> index b55bafd1a8be..6886fd7f765e 100644 >> >> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c >> >> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c >> >> @@ -320,14 +320,14 @@ static int xbd599_init_sequence(struct st7703 *= ctx) >> >> >> >> static const struct drm_display_mode xbd599_mode =3D { >> >> .hdisplay =3D 720, >> >> - .hsync_start =3D 720 + 40, >> >> - .hsync_end =3D 720 + 40 + 40, >> >> - .htotal =3D 720 + 40 + 40 + 40, >> >> + .hsync_start =3D 720 + 65, >> >> + .hsync_end =3D 720 + 65 + 65, >> >> + .htotal =3D 720 + 65 + 65 + 65, >> >> .vdisplay =3D 1440, >> >> - .vsync_start =3D 1440 + 18, >> >> - .vsync_end =3D 1440 + 18 + 10, >> >> - .vtotal =3D 1440 + 18 + 10 + 17, >> >> - .clock =3D 69000, >> >> + .vsync_start =3D 1440 + 30, >> >> + .vsync_end =3D 1440 + 30 + 22, >> >> + .vtotal =3D 1440 + 30 + 22 + 29, >> >> + .clock =3D (720 + 65 + 65 + 65) * (1440 + 30 + 22 + 29) * 60 /= 1000, >> >> .flags =3D DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, >> >> .width_mm =3D 68, >> >> .height_mm =3D 136, >> >> >> >> >>