All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonardo Costa <leoreis.costa@gmail.com>
To: andrzej.hajda@intel.com, neil.armstrong@linaro.org,
	rfoss@kernel.org, Laurent.pinchart@ideasonboard.com,
	jonas@kwiboo.se, jernej.skrabec@gmail.com,
	luca.ceresoli@bootlin.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
	simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	tomi.valkeinen@ideasonboard.com, francesco@dolcini.it,
	leonardo.costa@toradex.com, stable@vger.kernel.org
Subject: [PATCH] drm/bridge: tc358768: Enforce input bus flags via atomic_check
Date: Mon,  6 Jul 2026 07:57:45 -0300	[thread overview]
Message-ID: <20260706105840.1582166-1-leoreis.costa@gmail.com> (raw)
In-Reply-To: <20251106141227.899054-6-s-jain1@ti.com>

From: Leonardo Costa <leonardo.costa@toradex.com>

The tc358768 declares static bridge timings requiring pixel data to be
sampled on the positive clock edge.

However, the DRM core default propagation simply copies the output-side
bus flags, coming from the next bridge, connector or panel, to the
input side. If the propagated flags are incompatible with the bridge
ones, the data is wrongly sampled, typically resulting in visual
artifacts on the panel.

Implement the atomic_check hook, replacing the mutually exclusive
mode_fixup, and set the bridge state input bus flags to the ones
required by the tc358768. The sync polarity defaulting previously done
in mode_fixup is carried over into atomic_check unchanged.

Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Leonardo Costa <leonardo.costa@toradex.com>
---
 drivers/gpu/drm/bridge/tc358768.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c
index 0d85120fcc7a3..0516a331e71ba 100644
--- a/drivers/gpu/drm/bridge/tc358768.c
+++ b/drivers/gpu/drm/bridge/tc358768.c
@@ -1262,10 +1262,13 @@ tc358768_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 	return input_fmts;
 }
 
-static bool tc358768_mode_fixup(struct drm_bridge *bridge,
-				const struct drm_display_mode *mode,
-				struct drm_display_mode *adjusted_mode)
+static int tc358768_bridge_atomic_check(struct drm_bridge *bridge,
+					struct drm_bridge_state *bridge_state,
+					struct drm_crtc_state *crtc_state,
+					struct drm_connector_state *conn_state)
 {
+	struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
+
 	/* Default to positive sync */
 
 	if (!(adjusted_mode->flags &
@@ -1276,13 +1279,15 @@ static bool tc358768_mode_fixup(struct drm_bridge *bridge,
 	      (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)))
 		adjusted_mode->flags |= DRM_MODE_FLAG_PVSYNC;
 
-	return true;
+	bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags;
+
+	return 0;
 }
 
 static const struct drm_bridge_funcs tc358768_bridge_funcs = {
 	.attach = tc358768_bridge_attach,
 	.mode_valid = tc358768_bridge_mode_valid,
-	.mode_fixup = tc358768_mode_fixup,
+	.atomic_check = tc358768_bridge_atomic_check,
 	.atomic_pre_enable = tc358768_bridge_atomic_pre_enable,
 	.atomic_enable = tc358768_bridge_atomic_enable,
 	.atomic_disable = tc358768_bridge_atomic_disable,

  parent reply	other threads:[~2026-07-06 11:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 14:12 [RESEND PATCH v2 0/5] drm/tidss: Fixes data edge sampling on AM62X and AM62A Swamil Jain
2025-11-06 14:12 ` [RESEND PATCH v2 1/5] dt-bindings: display: ti,am65x-dss: Add clk property for data edge synchronization Swamil Jain
2025-11-06 14:12   ` [RESEND PATCH v2 1/5] dt-bindings: display: ti, am65x-dss: " Swamil Jain
2025-11-07  7:54   ` [RESEND PATCH v2 1/5] dt-bindings: display: ti,am65x-dss: " Krzysztof Kozlowski
2025-11-07  7:56     ` Krzysztof Kozlowski
2025-11-07  7:56       ` [RESEND PATCH v2 1/5] dt-bindings: display: ti, am65x-dss: " Krzysztof Kozlowski
2025-11-06 14:12 ` [RESEND PATCH v2 2/5] dt-bindings: mfd: syscon: Add ti,am625-dss-clk-ctrl Swamil Jain
2025-11-06 14:12   ` [RESEND PATCH v2 2/5] dt-bindings: mfd: syscon: Add ti, am625-dss-clk-ctrl Swamil Jain
2025-11-07  7:50   ` [RESEND PATCH v2 2/5] dt-bindings: mfd: syscon: Add ti,am625-dss-clk-ctrl Krzysztof Kozlowski
2025-11-07  7:56     ` Krzysztof Kozlowski
2025-11-06 14:12 ` [RESEND PATCH v2 3/5] arm64: dts: ti: k3-am62-main: Add tidss clk-ctrl property Swamil Jain
2025-11-07  7:57   ` Krzysztof Kozlowski
2025-11-06 14:12 ` [RESEND PATCH v2 4/5] arm64: dts: ti: k3-am62a-main: " Swamil Jain
2025-11-07  7:58   ` Krzysztof Kozlowski
2025-11-06 14:12 ` [RESEND PATCH v2 5/5] drm/tidss: Fix sampling edge configuration Swamil Jain
2025-11-07  7:59   ` Krzysztof Kozlowski
2026-07-02 12:59   ` Leonardo Costa
2026-07-06 10:57   ` Leonardo Costa [this message]
2026-07-06 11:38     ` [PATCH] drm/bridge: tc358768: Enforce input bus flags via atomic_check Leonardo Costa

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=20260706105840.1582166-1-leoreis.costa@gmail.com \
    --to=leoreis.costa@gmail.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francesco@dolcini.it \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=leonardo.costa@toradex.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    --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.