From: sashiko-bot@kernel.org
To: "Luo Liu" <Luo.Liu@cixtech.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v11 4/5] drm/bridge: trilinear: add the DPTX core and build glue
Date: Fri, 04 Dec 2026 14:53:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-250027@kernel.org> (raw)
In-Reply-To: <20261204131053.351956-5-Luo.Liu@cixtech.com>
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 <Luo.Liu@cixtech.com>
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/drm/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 = 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 != connector_status_unknown ||
> + phy_get_mode(dp->phy) != PHY_MODE_DP ||
> + !dp->hw->ops->sink_present(dp->hw))
> + return false;
> +
> + dp->force_hpd = 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) == PHY_MODE_DP) {
> + dp->phy_dp_tries = 0;
> + return true;
> + }
> +
> + if (dptx_hpd_wait_aborted(dp) ||
> + ++dp->phy_dp_tries > DP_HPD_MAX_TRIES) {
> + dp->phy_dp_tries = 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 = 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 = 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 = false;
> + int ret;
> +
> + scoped_guard(mutex, &dp->lock) {
> + ret = dptx_host_resume(dp);
> + if (!ret)
> + replay = !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) = 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 = of_graph_get_remote_node(dev->of_node, 1, 0);
> + if (remote && remote != dp->phy->dev.of_node) {
> + dp->next_bridge = 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 |= 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 == 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.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204131053.351956-1-Luo.Liu@cixtech.com?part=4
next prev parent reply other threads:[~2026-12-04 14:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 13:10 [PATCH v11 0/5] drm/bridge: trilinear: add the Sky1 DisplayPort transmitter Luo Liu
2026-12-04 13:10 ` [PATCH v11 1/5] dt-bindings: display: add CIX " Luo Liu
2026-12-04 13:10 ` [PATCH v11 2/5] drm/bridge: trilinear: add the DPTX hardware layer Luo Liu
2026-12-04 13:48 ` sashiko-bot
2026-12-04 13:10 ` [PATCH v11 3/5] drm/bridge: trilinear: add the DPTX DRM bridge Luo Liu
2026-12-04 14:19 ` sashiko-bot
2026-12-04 13:10 ` [PATCH v11 4/5] drm/bridge: trilinear: add the DPTX core and build glue Luo Liu
2026-12-04 14:53 ` sashiko-bot [this message]
2026-12-04 13:10 ` [PATCH v11 5/5] drm/cix: add the Sky1 DisplayPort platform glue Luo Liu
2026-12-04 15:06 ` sashiko-bot
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-250027@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Luo.Liu@cixtech.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox