[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f17da9c-0368-4a93-8b37-30d56841048d@ideasonboard.com>
Date: Wed, 26 Jun 2024 14:39:10 +0300
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Aradhya Bhatia <a-bhatia1@...com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>, Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>, Jernej Skrabec <jernej.skrabec@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Jyri Sarha <jyri.sarha@....fi>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: DRI Development List <dri-devel@...ts.freedesktop.org>,
Linux Kernel List <linux-kernel@...r.kernel.org>,
Dominik Haller <d.haller@...tec.de>, Sam Ravnborg <sam@...nborg.org>,
Thierry Reding <treding@...dia.com>,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Nishanth Menon <nm@...com>, Vignesh Raghavendra <vigneshr@...com>,
Praneeth Bajjuri <praneeth@...com>, Udit Kumar <u-kumar1@...com>,
Devarsh Thakkar <devarsht@...com>, Jayesh Choudhary <j-choudhary@...com>,
Jai Luthra <j-luthra@...com>
Subject: Re: [PATCH v4 11/11] drm/bridge: cdns-dsi: Use
pre_enable/post_disable to enable/disable
On 22/06/2024 14:09, Aradhya Bhatia wrote:
> The cdns-dsi controller requires that it be turned on completely before
> the input DPI's source has begun streaming[0]. Not having that, allows
> for a small window before cdns-dsi enable and after cdns-dsi disable
> where the previous entity (in this case tidss's videoport) to continue
> streaming DPI video signals. This small window where cdns-dsi is
> disabled but is still receiving signals causes the input FIFO of
> cdns-dsi to get corrupted. This causes the colors to shift on the output
> display. The colors can either shift by one color component (R->G, G->B,
> B->R), or by two color components (R->B, G->R, B->G).
>
> Since tidss's videoport starts streaming via crtc enable hooks, we need
> cdns-dsi to be up and running before that. Now that the bridges are
> pre_enabled before crtc is enabled, and post_disabled after crtc is
> disabled, use the pre_enable and post_disable hooks to get cdns-dsi
> ready and running before the tidss videoport to get pass the color shift
> issues.
>
> [0]: See section 12.6.5.7.3 "Start-up Procedure" in J721E SoC TRM
> TRM Link: http://www.ti.com/lit/pdf/spruil1
>
I think it makes sense to explain a bit about this in a comment in the
driver code. Otherwise doing all of this in pre_enable and post_disable
looks a bit odd.
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Tomi
> Signed-off-by: Aradhya Bhatia <a-bhatia1@...com>
> ---
> .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 32 +++----------------
> 1 file changed, 4 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index c9697818308e..c352ea7db4ed 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -655,8 +655,8 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge,
> return MODE_OK;
> }
>
> -static void cdns_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
> - struct drm_bridge_state *old_bridge_state)
> +static void cdns_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
> + struct drm_bridge_state *old_bridge_state)
> {
> struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> struct cdns_dsi *dsi = input_to_dsi(input);
> @@ -680,15 +680,6 @@ static void cdns_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
> pm_runtime_put(dsi->base.dev);
> }
>
> -static void cdns_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
> - struct drm_bridge_state *old_bridge_state)
> -{
> - struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> - struct cdns_dsi *dsi = input_to_dsi(input);
> -
> - pm_runtime_put(dsi->base.dev);
> -}
> -
> static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
> {
> struct cdns_dsi_output *output = &dsi->output;
> @@ -757,8 +748,8 @@ static void cdns_dsi_init_link(struct cdns_dsi *dsi)
> dsi->link_initialized = true;
> }
>
> -static void cdns_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> - struct drm_bridge_state *old_bridge_state)
> +static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> + struct drm_bridge_state *old_bridge_state)
> {
> struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> struct cdns_dsi *dsi = input_to_dsi(input);
> @@ -909,19 +900,6 @@ static void cdns_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> writel(tmp, dsi->regs + MCTL_MAIN_EN);
> }
>
> -static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> - struct drm_bridge_state *old_bridge_state)
> -{
> - struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
> - struct cdns_dsi *dsi = input_to_dsi(input);
> -
> - if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
> - return;
> -
> - cdns_dsi_init_link(dsi);
> - cdns_dsi_hs_init(dsi);
> -}
> -
> static u32 *cdns_dsi_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
> struct drm_bridge_state *bridge_state,
> struct drm_crtc_state *crtc_state,
> @@ -952,9 +930,7 @@ static u32 *cdns_dsi_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
> static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = {
> .attach = cdns_dsi_bridge_attach,
> .mode_valid = cdns_dsi_bridge_mode_valid,
> - .atomic_disable = cdns_dsi_bridge_atomic_disable,
> .atomic_pre_enable = cdns_dsi_bridge_atomic_pre_enable,
> - .atomic_enable = cdns_dsi_bridge_atomic_enable,
> .atomic_post_disable = cdns_dsi_bridge_atomic_post_disable,
> .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
Powered by blists - more mailing lists