All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v9 13/13] drm/tegra: Add support for 8-bit CPU interface
Date: Mon, 30 Nov 2026 12:11:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-241032@kernel.org> (raw)
In-Reply-To: <20261130114155.72920-14-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/tegra: duplicate and out-of-order next_bridge
  enable/disable calls
- [Medium] drm/tegra: unconditional PIN_LDC muxing in
  tegra_dbi_atomic_enable()
--

commit 38f73e44f1c5bf7df4c07a00d683e9382cb4da10
Author: Svyatoslav Ryhel <clamor95@gmail.com>

drm/tegra: Add support for 8-bit CPU interface

This commit adds a DRM bridge and MIPI DBI host driver for the Tegra20/30
display controller's 8-bit CPU interface to transfer MIPI DCS commands
before switching the pins to RGB scanout.

> diff --git a/drivers/gpu/drm/tegra/dbi.c b/drivers/gpu/drm/tegra/dbi.c
> new file mode 100644
> index 0000000000000..a33e2c1147122
> --- /dev/null
> +++ b/drivers/gpu/drm/tegra/dbi.c

[ ... ]

> +static void tegra_dbi_atomic_enable(struct drm_bridge *bridge,
> +				    struct drm_atomic_commit *state)
> +{
> +	struct tegra_dbi_priv *priv = bridge_to_tegra_dbi(bridge);
> +	struct drm_bridge *next_bridge = priv->next_bridge;
> +	struct tegra_dc *dc = priv->dc;
> +	u32 value, reg_idx;
> +	int ret;

[ ... ]

> +	/*
> +	 * Set the LDC pin to V Pulse 1. The secondary interface may require
> +	 * LVP0 to be set to function 6 (V Pulse 1), but this is not confirmed.
> +	 * TODO: parameterize this if needed.
> +	 */
> +	reg_idx = PIN_SELECT_REGISTER_INDEX(PIN_LDC);
> +	value = tegra_dc_readl(dc, DC_COM_PIN_OUTPUT_SELECT(reg_idx));
> +	value &= ~PIN_OUTPUT_SELECT_MASK(PIN_SELECT_SHIFT(PIN_LDC));
> +	value |= PIN_OUTPUT_SELECT_F4(PIN_SELECT_SHIFT(PIN_LDC));
> +	tegra_dc_writel(dc, value, DC_COM_PIN_OUTPUT_SELECT(reg_idx));

[Severity: Medium]
Does this break per-frame D/C signaling when the secondary interface
(nvidia,interface = <1>) is selected?

tegra_dc_dbi_probe() accepts both interface 0 (where dc_pin is PIN_LDC)
and interface 1 (where dc_pin is PIN_LVP0), but tegra_dbi_atomic_enable()
unconditionally muxes V_PULSE1 onto PIN_LDC before saving
tegra_dbi_pin_regs[] into com_pin_backup.  When interface 1 is used,
PIN_LDC is clobbered while PIN_LVP0 in DC_COM_PIN_OUTPUT_SELECT(4) keeps
the PIN_OUTPUT_SELECT_OUT setting programmed by tegra_rgb_encoder_enable(),
leaving PIN_LVP0 in static GPIO output mode once com_pin_backup is
restored for active scanout.

[ ... ]

> +	/* Unshadow to set up command and data pins */
> +	tegra_dc_writel(dc, WRITE_MUX | READ_MUX, DC_CMD_STATE_ACCESS);
> +
> +	tegra_dbi_init_interface(priv);
> +	priv->active = true;
> +
> +	/*
> +	 * DBI requires that the next bridge be enabled here in order to
> +	 * send DCS commands, since the interface pins will subsequently be
> +	 * reconfigured for video data.
> +	 *
> +	 * Using the prepare_prev_first flag in the panel will not work,
> +	 * because the DBI bridge requires the panel to be enabled beforehand
> +	 * for proper configuration.
> +	 */
> +	if (next_bridge && next_bridge->funcs && next_bridge->funcs->atomic_enable)
> +		next_bridge->funcs->atomic_enable(next_bridge, state);
> +
> +	tegra_dbi_pin_set(dc, priv->interface->cs_pin, 0);
> +
> +	priv->active = false;
> +
> +	tegra_dc_writel(dc, 0, DC_CMD_STATE_ACCESS);
> +
> +	for (int i = 0; i <  ARRAY_SIZE(tegra_dbi_pin_regs); i++)
> +		tegra_dc_writel(dc, priv->com_pin_backup[i],
> +				tegra_dbi_pin_regs[i]);
> +
> +	tegra_dc_commit(dc);
> +
> +	value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
> +	value &= ~DISP_CTRL_MODE_MASK;
> +	value |= DISP_CTRL_MODE_C_DISPLAY;
> +	tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
> +}
> +
> +static void tegra_dbi_atomic_disable(struct drm_bridge *bridge,
> +				     struct drm_atomic_commit *state)
> +{
> +	struct tegra_dbi_priv *priv = bridge_to_tegra_dbi(bridge);
> +	struct drm_bridge *next_bridge = priv->next_bridge;
> +	struct tegra_dc *dc = priv->dc;
> +	int ret;
> +
> +	for (int i = 0; i < ARRAY_SIZE(tegra_dbi_pin_regs); i++)
> +		priv->com_pin_backup[i] = tegra_dc_readl(dc, tegra_dbi_pin_regs[i]);
> +
> +	ret = tegra_dbi_stop_dc(priv);
> +	if (ret)
> +		return;
> +
> +	tegra_dc_writel(dc, WRITE_MUX | READ_MUX, DC_CMD_STATE_ACCESS);
> +
> +	tegra_dbi_init_interface(priv);
> +	priv->active = true;
> +
> +	/*
> +	 * DBI requires that the next bridge be disabled here in order to
> +	 * send DCS commands, since the interface pins will subsequently be
> +	 * reconfigured for video data and tegra_rgb_encoder_disable() will
> +	 * be called before drm_panel_unprepare() runs in post_disable.
> +	 */
> +	if (next_bridge && next_bridge->funcs && next_bridge->funcs->atomic_disable)
> +		next_bridge->funcs->atomic_disable(next_bridge, state);

[Severity: High]
As reported by Mikko Perttunen on v5 [1], does manually calling
next_bridge->funcs->atomic_enable() and atomic_disable() cause duplicate
and out-of-order execution with drm_atomic_bridge_chain_enable() and
drm_atomic_bridge_chain_disable()?

Because tegra_dbi_attach() attaches priv->next_bridge to
encoder->bridge_chain, the DRM bridge helpers already walk both bridges:

1. On enable, drm_atomic_bridge_chain_enable() calls
   tegra_dbi_atomic_enable() (which manually runs
   next_bridge->funcs->atomic_enable() while priv->active is true) and
   then advances to next_bridge and calls its atomic_enable() a second
   time while priv->active is false, triggering the "Skipping enable of
   already enabled panel" warning in drm_panel_enable().

2. On disable, drm_atomic_bridge_chain_disable() walks
   encoder->bridge_chain in reverse order and calls
   next_bridge->funcs->atomic_disable() before tegra_dbi_atomic_disable()
   has stopped the DC, configured the pins for DBI output, or set
   priv->active = true.  During that first call, tegra_dbi_dbi_command()
   rejects every DCS shutdown command with -ENODEV while the panel driver
   still runs its msleep() delays; tegra_dbi_atomic_disable() then runs
   next_bridge->funcs->atomic_disable() a second time.

[1] https://lore.kernel.org/r/weWUeY3nRGCfNVcl2RuY5g@nvidia.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130114155.72920-1-clamor95@gmail.com?part=13

      reply	other threads:[~2026-11-30 12:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 11:41 [PATCH v9 00/13] drm/tegra: Add support for Tegra20/Tegra30 8-bit CPU interface Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 01/13] drm: Add MIPI DBI bus support for MIPI DBI Type A and B Svyatoslav Ryhel
2026-11-30 11:55   ` sashiko-bot
2026-11-30 11:41 ` [PATCH v9 02/13] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 03/13] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 04/13] drm/panel: panel-lg-lh400wv3: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 05/13] drm/panel: panel-lg-lh400wv3: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 06/13] drm/tegra: dc: Add elements required by Tegra MIPI DBI Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 07/13] dt-bindings: display: tegra: Document Tegra20 DSI port Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 08/13] drm/tegra: output: Make panel parsing configurable Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 09/13] drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs Svyatoslav Ryhel
2026-11-30 11:53   ` sashiko-bot
2026-11-30 11:41 ` [PATCH v9 10/13] dt-bindings: display: tegra: Document nvidia,contiguous-rgb-pins property Svyatoslav Ryhel
2026-11-30 11:41   ` [PATCH v9 10/13] dt-bindings: display: tegra: Document nvidia, contiguous-rgb-pins property Svyatoslav Ryhel
2026-11-30 11:41 ` [PATCH v9 11/13] drm/tegra: rgb: Parameterize configuration based on bus flags and DT property Svyatoslav Ryhel
2026-11-30 11:59   ` sashiko-bot
2026-11-30 11:41 ` [PATCH v9 12/13] dt-bindings: display: tegra: Document 8-bit CPU parallel interface Svyatoslav Ryhel
2026-11-30 13:59   ` Rob Herring (Arm)
2026-11-30 11:41 ` [PATCH v9 13/13] drm/tegra: Add support for 8-bit CPU interface Svyatoslav Ryhel
2026-11-30 12:11   ` sashiko-bot [this message]

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=sashiko-outbox-241032@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.