From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796396020; b=B8YOKnw2iubtBu4a8RzBKFOwd9LfcX8Im9aPWvdvlcHGIBFnt6RXa2HyrgnP4DPwaOym 31ldB2lQkxB1983YizxCz376JGewnXiVRVlxFDEGzXJ9n3C1BlnlXwWk2dA9Xre2L60TZ zT0Txeu3YBrxUfIK5Fp5fMJON0b0CB33MNTG5i340PY4nNPDQOWkcGKz5p6USzpMjbDBi Kpp1pA0Pn6KrG0nN/ADSFjCO6AgwnpoSaxuJ3JvWA6I35YgASx79nEI3wdiOx4Iwtj2lC C/Jb+qamptNRLHmdHN5R6XeYszy0abMbjkPvNOTTEw+4WtJ2x6lxw6OGz70ZvpOFLoQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796396020; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=K4KVK39Xu0LcxgPq8yqOPGVM6IerWE2324Y6uWUCDEc=; b=tTVfLdDVFuPiubkRe88Xt2hQ5kSKRYvqzoOFIBBcc6Ccq7D+alz4Pbh9HRmT90HO5Qek bBcGC+oVLsghgF4/mFe0GdciIF5Q2rujW1dh9Hh8IkwL6m43XsvCLk+XAUV2qIXGjXHom U5tiWXyx0jG5S/kdhAVtbpQog2ANu5nZK4dLC+X071GlYKDoCX1hs2x5yL0QfrsGw5qCJ WKONt/kzqGollC49lY/3rGLf5gMo6+y1wuX0VAKhqhfawlxAL6mL2oErkCzuRfLTWAwDG 7hzv6O8on9OajlaafepRUdDBNfnowrBl2bHpO5jxN01k8y/11gBEh4ncAh3F7YimAqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FrRJzMDy; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 191B3606A322 for ; Fri, 4 Dec 2026 14:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FrRJzMDy Received: by smtp.kernel.org (Postfix) with ESMTPSA id 711831F000C2; Fri, 4 Dec 2026 14:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796396019; bh=K4KVK39Xu0LcxgPq8yqOPGVM6IerWE2324Y6uWUCDEc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FrRJzMDyjOLvtFv6wSkBppOyDDBOWkYgDkS/pkmNIYuZDTztwGLKxvYT2PPqogMyF C1hmStZ7h+swdUMxcGbQUFx0olKOsIL0J57ndlx5yySuMiw9S4OFU4iBtsqdrBgO5z QRv1o/9xFHbY+9lSX6dnAxyIYLiQbsmbY9SQLkeZeyTj3rRj5FZm/AIbyjiMyCllpb 9AtoWTFl29OiyeQDaZu96B57JOhigQGn05gjZZn7eNPp/eKaykX/+tA2gD7ebxr+/a SD0IHQH7KFPEx9NX/1v1WcFpN6nZhKoyjbXqYtFG77I4UmI34s7rgKjFgRhDsYQW27 u7sv9GZHE7RJg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 4/5] drm/bridge: trilinear: add the DPTX core and build glue Reply-To: sashiko-reviews@lists.linux.dev To: "Luo Liu" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261204131053.351956-5-Luo.Liu@cixtech.com> References: <20261204131053.351956-1-Luo.Liu@cixtech.com> <20261204131053.351956-5-Luo.Liu@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:53:39 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 7 potential issues to consider: - [High] drm/bridge: trilinear: dptx_hw_link_clock_recovery() skips max vswing - [Medium] drm/bridge: trilinear: stale phy_dp_tries counter across HPD wait abort - [Medium] drm/bridge: trilinear: force_hpd not rolled back when connect fails - [Medium] drm/bridge: trilinear: synchronous AUX stall and double HPD work on resume - [Medium] drm/bridge: trilinear: port@1 chaining breaks HPD notify and PHY aux-bridge - [Low] drm/bridge: trilinear: top-of-function __free() NULL init in probe - [Low] drm/bridge: trilinear: redundant dptx_read_sink_caps() calls on enable -- commit ebf11715f61cdf2f6b730942cc014262527875ef Author: Luo Liu drm/bridge: trilinear: add the DPTX core and build glue This commit adds the Trilinear DPTX core state machine, probe path, hotplug workers, and suspend/resume handling, and hooks the driver into the DRM bridge Kconfig and Makefile. > diff --git a/drivers/gpu/drm/bridge/trilinear/dptx_core.c b/drivers/gpu/d= rm/bridge/trilinear/dptx_core.c > new file mode 100644 > index 0000000000000..8f92b00142511 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/trilinear/dptx_core.c > @@ -0,0 +1,1076 @@ [ ... ] > +static int dptx_train_loop(struct dptx_dev *dp) > +{ [ ... ] > + ret =3D dp->hw->ops->link_train(dp->hw, dp->phy, > + mode->bw_code, > + mode->lane_cnt); [Severity: High] Does dptx_hw_link_clock_recovery() abort before ever transmitting maximum voltage swing? In drivers/gpu/drm/bridge/trilinear/dptx_hw.c:dptx_hw_link_clock_recovery()= { ... memcpy(prev, hw->train_setting, lane_cnt); dptx_hw_link_adjust_train(hw, lane_cnt, link_status); if (dptx_hw_link_max_vswing_reached(hw->train_setting, lane_cnt)) break; ... } dptx_hw_link_max_vswing_reached() is called on the newly adjusted hw->train_setting rather than prev. When all active lanes request level-3 voltage swing, the loop breaks out and returns -EIO before the next iteration can apply that level-3 setting to the PHY or write it to DPCD, causing premature link-rate downshifts or blank displays on sinks that need maximum swing. [ ... ] > +static bool dptx_check_oob_sink(struct dptx_dev *dp) > +{ > + if (!dp->oob_hpd || > + dp->force_hpd !=3D connector_status_unknown || > + phy_get_mode(dp->phy) !=3D PHY_MODE_DP || > + !dp->hw->ops->sink_present(dp->hw)) > + return false; > + > + dp->force_hpd =3D connector_status_connected; > + > + return true; > +} > + > +static int dptx_detect_locked(struct dptx_dev *dp) > +{ > + if (dp->released) > + return -ENODEV; > + > + if (dp->state & DPTX_STATE_SUSPENDED) > + return -EBUSY; > + > + if (!(dp->state & DPTX_STATE_INITIALIZED)) { > + dev_warn_once(dp->dev, "detect with uninitialized host\n"); > + return -ENODEV; > + } > + > + if (!dptx_get_hpd_state(dp)) { > + if (!dptx_check_oob_sink(dp)) { > + dptx_handle_disconnect(dp); > + return -ENODEV; > + } > + } > + > + return dptx_handle_connect(dp); > +} [Severity: Medium] Can dp->force_hpd remain stuck at connector_status_connected if dptx_handle_connect() fails right after dptx_check_oob_sink() succeeds? If the sink is unplugged mid-probe or full DPCD capability reads fail, neither dptx_detect_locked() nor dptx_prepare() rolls dp->force_hpd back to connector_status_unknown. Later dptx_detect_locked() calls then see dptx_get_hpd_state(dp) true and skip dptx_handle_disconnect(), keeping dp->force_hpd latched until an external disconnect or suspend. [ ... ] > +static bool dptx_phy_dp_mode_ready(struct dptx_dev *dp) > +{ > + if (phy_get_mode(dp->phy) =3D=3D PHY_MODE_DP) { > + dp->phy_dp_tries =3D 0; > + return true; > + } > + > + if (dptx_hpd_wait_aborted(dp) || > + ++dp->phy_dp_tries > DP_HPD_MAX_TRIES) { > + dp->phy_dp_tries =3D 0; > + dev_dbg(dp->dev, "PHY did not enter DP mode\n"); > + return false; > + } > + > + queue_delayed_work(system_freezable_wq, &dp->hpd_event_work, > + msecs_to_jiffies(100)); > + > + return false; > +} > + > +static void dptx_hpd_event_work_func(struct work_struct *work) > +{ > + struct dptx_dev *dp =3D container_of(work, struct dptx_dev, > + hpd_event_work.work); > + enum drm_connector_status status; > + bool hpd; > + > + scoped_guard(mutex, &dp->lock) { > + if (dptx_hpd_work_aborted(dp)) > + return; > + > + hpd =3D dptx_get_hpd_state(dp); > + } > + > + if (hpd && dp->oob_hpd && !dptx_phy_dp_mode_ready(dp)) > + return; [Severity: Medium] Can dp->phy_dp_tries carry a stale count into the next hotplug? dp->phy_dp_tries is only cleared inside dptx_phy_dp_mode_ready(). If HPD drops during a 100 ms retry window (so hpd is false here) or dptx_cancel_hpd_works() cancels the pending work on suspend or detach, dp->phy_dp_tries stays non-zero and later USB-C hotplugs can hit DP_HPD_MAX_TRIES early and abort detection before the PHY enters DP mode. [ ... ] > +static int dptx_pm_complete(struct dptx_dev *dp) > +{ > + bool replay =3D false; > + int ret; > + > + scoped_guard(mutex, &dp->lock) { > + ret =3D dptx_host_resume(dp); > + if (!ret) > + replay =3D !dp->hpd_stopped && dp->attached; > + } > + > + if (ret) > + return ret; > + > + if (replay) { > + dp->ops->replay_deferred_hotplug(dp); > + > + scoped_guard(mutex, &dp->lock) { > + if (!dptx_hpd_work_aborted(dp)) > + queue_delayed_work(system_freezable_wq, > + &dp->hpd_event_work, 0); > + } > + } > + > + return 0; > +} [Severity: Medium] Why call replay_deferred_hotplug() synchronously before unconditionally queuing hpd_event_work? On an OOB-HPD port in PHY_MODE_DP with no sink answering, dptx_replay_deferred_hotplug() -> dptx_check_oob_sink() runs a 32-retry DPCD read in drm_dp_dpcd_access(), stalling the PM resume thread for up to ~128 ms per port before hpd_event_work repeats the same probe asynchronously. When a sink is present, replay_deferred_hotplug() queues hpd_event_work and drops dp->lock, so if a worker starts it before the second queue_delayed_work(), dptx_hpd_event_work_func() runs twice. Queuing hpd_event_work once after dptx_host_resume() avoids both. [ ... ] > + if (!dptx_get_hpd_state(dp) && !dptx_check_oob_sink(dp)) > + return -ENODEV; > + > + return dptx_handle_connect(dp); > +} [Severity: Low] Does every display enable perform three back-to-back dptx_read_sink_caps() sequences? dptx_bridge_atomic_enable() calls dp->ops->prepare(dp), then immediately calls dptx_bridge_mode_set() which starts with dp->ops->detect(dp) with no intervening hardware change, and then calls dp->ops->encoder_enable() -> dptx_core_on() which calls dptx_read_sink_caps() a third time. Dropping the redundant detect call in dptx_bridge_mode_set() would avoid extra polled AUX transactions on every modeset and DPMS-on. [ ... ] > +struct dptx_dev *trilinear_dptx_probe(struct device *dev, > + const struct dptx_plat_data *soc_data, > + void *priv) > +{ > + struct dptx_dev *dp; > + struct dp_hw *hw; > + struct device_node *remote __free(device_node) =3D NULL; > + int ret; [Severity: Low] This isn't a bug, but remote is assigned unconditionally at top-level scope below, so it can be defined and initialized in one statement at the of_graph_get_remote_node() call to follow Cleanup API conventions. [ ... ] > + remote =3D of_graph_get_remote_node(dev->of_node, 1, 0); > + if (remote && remote !=3D dp->phy->dev.of_node) { > + dp->next_bridge =3D of_drm_find_and_get_bridge(remote); > + if (!dp->next_bridge) { > + dptx_deinit(dp); > + return ERR_PTR(-EPROBE_DEFER); > + } > + } > + > + if (!dp->next_bridge || > + !(dp->next_bridge->ops & DRM_BRIDGE_OP_DETECT)) > + dp->bridge.ops |=3D DRM_BRIDGE_OP_HPD; [Severity: Medium] Can chaining a downstream DRM_BRIDGE_OP_HPD bridge silently drop HPD notifications from dptx_hpd_event_work_func()? Bridges like display-connector (for DP with hpd-gpios) and drm_aux_hpd_bridge set DRM_BRIDGE_OP_HPD without DRM_BRIDGE_OP_DETECT. drm_bridge_connector_init() picks the last bridge with DRM_BRIDGE_OP_HPD as bridge_connector->bridge_hpd and only calls drm_bridge_hpd_enable() on it, leaving dp->bridge.hpd_cb NULL so dptx_notify_hpd() becomes a no-op after delayed PHY DP-mode polling or system resume. In addition, skipping of_drm_find_and_get_bridge(remote) whenever remote =3D=3D dp->phy->dev.of_node prevents attaching a PHY-hosted drm_aux_bridge on combo PHYs. That leaves &dp->bridge as the last bridge, so connector->fwnode points to the DPTX node instead of usb-c-connector, causing drm_connector_oob_hotplug_event() from Type-C DP altmode to miss the connector. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204131053.3519= 56-1-Luo.Liu@cixtech.com?part=3D4