From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: dri-devel@lists.freedesktop.org, Marek Vasut <marex@denx.de>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Jonas Karlman <jonas@kwiboo.se>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Lucas Stach <l.stach@pengutronix.de>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
kernel@dh-electronics.com
Subject: Re: [PATCH 2/6] drm/bridge: tc358767: Use tc_pxl_pll_calc() to correct adjusted_mode clock
Date: Tue, 04 Jun 2024 13:35:38 +0200 [thread overview]
Message-ID: <3228734.5fSG56mABF@steina-w> (raw)
In-Reply-To: <7989cb19-7735-4e38-8187-68a31fff7a5b@denx.de>
Hi Marek,
Am Montag, 3. Juni 2024, 23:27:34 CEST schrieb Marek Vasut:
> On 6/3/24 2:45 PM, Alexander Stein wrote:
>
> Hi,
>
> >> @@ -1631,6 +1643,18 @@ static int tc_edp_atomic_check(struct drm_bridge *bridge,
> >> struct drm_crtc_state *crtc_state,
> >> struct drm_connector_state *conn_state)
> >> {
> >> + struct tc_data *tc = bridge_to_tc(bridge);
> >> + int adjusted_clock = 0;
> >> + int ret;
> >> +
> >> + ret = tc_pxl_pll_calc(tc, clk_get_rate(tc->refclk),
> >> + crtc_state->adjusted_mode.clock * 1000,
> >> + &adjusted_clock, NULL);
> >> + if (ret)
> >> + return ret;
> >> +
> >> + crtc_state->adjusted_mode.clock = adjusted_clock / 1000;
> >
> > This is prone to rounding errors. Debug output in my case:
> >> [ 16.007127] tc358767 1-000f: enable video stream
> >> [ 16.007148] tc358767 1-000f: PLL: requested 148500000 pixelclock, ref 26000000
> >> [ 16.007163] tc358767 1-000f: PLL: got 147333333, delta -1166667
> >> [ 16.007169] tc358767 1-000f: PLL: 26000000 / 1 / 1 * 17 / 3
> >> [ 16.027112] tc358767 1-000f: set mode 1920x1080
> >> [ 16.027138] tc358767 1-000f: H margin 148,88 sync 44
> >> [ 16.027144] tc358767 1-000f: V margin 36,4 sync 5
> >> [ 16.027150] tc358767 1-000f: total: 2200x1125
> >> [ 16.059426] tc358767 1-000f: PLL: requested 147333000 pixelclock, ref 26000000
> >> [ 16.059455] tc358767 1-000f: PLL: got 146250000, delta -1083000
> >> [ 16.059461] tc358767 1-000f: PLL: 26000000 / 1 / 4 * 45 / 2
> >> [ 16.095724] tc358767 1-000f: PLL: requested 146250000 pixelclock, ref 26000000
> >> [ 16.095739] tc358767 1-000f: PLL: got 146250000, delta 0
> >> [ 16.095745] tc358767 1-000f: PLL: 26000000 / 1 / 4 * 45 / 2
> >
> > The accuracy degrades with each call, until a full kHz frequency is reached,
> > because drm_display_mode.clock only accounts for kHz, but the PLL
> > calculation takes Hz into account.
>
> Hmmmmm, I need to take a closer look at this one.
>
> Do you have any quick hints ?
No, sorry. I'm not sure about those VFIFO overruns/underruns you mentioned
in the commit message. Does this maybe only apply to DPI input?
At least for 148.5MHz (1080p) apparently it is not possible to that
exact clock anyway.
> > BTW: Which platform are you testing on?
>
> MX8MP with LCDIFv3 -> DSIM -> TC9595 -> DP output.
>
> The TC9595 is 2nd generation (automotive?) replacement for TC358767 (1st
> generation replacement is TC358867) .
Same here. But fail to get output on a DP monitor if I'm running from
external refclk. Using DSICLK/4 seems necessary for some reason, but it
is very unreliable to get a proper image.
Which display are you using? Do you mind sharing your DT?
Best regards,
Alexander
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
next prev parent reply other threads:[~2024-06-04 11:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 20:39 [PATCH 1/6] drm/bridge: tc358767: Split tc_pxl_pll_en() into parameter calculation and enablement Marek Vasut
2024-05-31 20:39 ` [PATCH 2/6] drm/bridge: tc358767: Use tc_pxl_pll_calc() to correct adjusted_mode clock Marek Vasut
2024-06-03 12:45 ` Alexander Stein
2024-06-03 21:27 ` Marek Vasut
2024-06-04 11:35 ` Alexander Stein [this message]
2024-06-04 16:17 ` Marek Vasut
2024-06-05 10:52 ` Alexander Stein
2024-06-05 16:25 ` Marek Vasut
2024-06-06 10:10 ` Alexander Stein
2024-06-11 16:45 ` Marek Vasut
2024-06-21 3:30 ` Marek Vasut
2024-06-21 10:32 ` Alexander Stein
2024-06-21 14:54 ` Marek Vasut
2024-06-24 9:26 ` Alexander Stein
2024-06-25 0:33 ` Marek Vasut
2024-06-25 6:11 ` Alexander Stein
2024-06-25 12:16 ` Marek Vasut
2024-05-31 20:39 ` [PATCH 3/6] drm/bridge: tc358767: Drop line_pixel_subtract Marek Vasut
2024-06-03 12:18 ` Alexander Stein
2024-06-03 21:25 ` Marek Vasut
2024-06-04 11:12 ` Alexander Stein
2024-06-04 16:19 ` Marek Vasut
2024-05-31 20:39 ` [PATCH 4/6] drm/bridge: tc358767: Disable MIPI_DSI_CLOCK_NON_CONTINUOUS Marek Vasut
2024-05-31 20:39 ` [PATCH 5/6] drm/bridge: tc358767: Set LSCLK divider for SYSCLK to 1 Marek Vasut
2024-05-31 20:39 ` [PATCH 6/6] Revert "drm/bridge: tc358767: Set default CLRSIPO count" Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3228734.5fSG56mABF@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@dh-electronics.com \
--cc=l.stach@pengutronix.de \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marex@denx.de \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.