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 v8 2/5] drm/bridge: trilinear: add the DPTX hardware layer
Date: Mon, 30 Nov 2026 02:42:51 +0000 [thread overview]
Message-ID: <sashiko-outbox-240256@kernel.org> (raw)
In-Reply-To: <20261130022510.762141-3-Luo.Liu@cixtech.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/bridge: trilinear: off-by-one retry check in
dptx_hw_link_clock_recovery()
--
commit 79d7005f35e737f691dac4559a73f058da476746
Author: Luo Liu <Luo.Liu@cixtech.com>
drm/bridge: trilinear: add the DPTX hardware layer
This commit adds the register, AUX, DPCD, link training, and stream setup
hardware layer for the Trilinear DisplayPort transmitter.
> diff --git a/drivers/gpu/drm/bridge/trilinear/dptx_hw.c b/drivers/gpu/drm/bridge/trilinear/dptx_hw.c
> new file mode 100644
> index 0000000000000..df4ba883edbaa
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/trilinear/dptx_hw.c
[ ... ]
> +static int dptx_hw_link_clock_recovery(struct dp_hw *hw, struct phy *phy,
> + u8 lane_cnt)
> +{
> + u8 link_status[DP_LINK_STATUS_SIZE];
> + u8 prev[DPTX_MAX_LANES];
> + bool train_done = false;
> + int tries = 0;
> + int i;
> + int ret;
> +
> + ret = dptx_hw_link_set_pattern(hw, DP_TRAINING_PATTERN_1);
> + if (ret < 0)
> + return ret;
> +
> + memset(prev, 0xff, lane_cnt);
> +
> + for (i = 0; i < 512; i++) {
> + ret = dptx_hw_link_vs_emph(hw, phy, lane_cnt);
> + if (ret)
> + return ret;
> +
> + drm_dp_link_train_clock_recovery_delay(&hw->aux, hw->dpcd);
> + ret = drm_dp_dpcd_read_link_status(&hw->aux, link_status);
> + if (ret < 0)
> + return ret;
> +
> + train_done = drm_dp_clock_recovery_ok(link_status, lane_cnt);
> + if (train_done)
> + break;
> +
> + if (!memcmp(hw->train_setting, prev, lane_cnt))
> + tries++;
> + else
> + tries = 0;
> +
> + if (tries == DP_MAX_TRAINING_TRIES)
> + break;
> +
> + memcpy(prev, hw->train_setting, lane_cnt);
> + dptx_hw_link_adjust_train(hw, lane_cnt, link_status);
> + }
[Severity: Medium]
Should prev be saved and dptx_hw_link_adjust_train() be called before
comparing hw->train_setting against prev?
Because memcmp() and the tries check run before dptx_hw_link_adjust_train()
updates hw->train_setting from link_status, each iteration compares the
setting just transmitted against the previous iteration's setting (starting
with 0x00 vs 0xff on the first pass). As a result, the same drive setting
is transmitted 6 times instead of DP_MAX_TRAINING_TRIES (5), and when tries
reaches DP_MAX_TRAINING_TRIES the loop breaks before parsing the newly read
link_status, discarding any new voltage swing or pre-emphasis adjustment the
sink requested on that pass and failing clock recovery with -EIO.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130022510.762141-1-Luo.Liu@cixtech.com?part=2
next prev parent reply other threads:[~2026-11-30 2:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 2:25 [PATCH v8 0/5] drm/bridge: trilinear: add the Sky1 DisplayPort transmitter Luo Liu
2026-11-30 2:25 ` [PATCH v8 1/5] dt-bindings: display: add CIX " Luo Liu
2026-11-30 2:25 ` [PATCH v8 2/5] drm/bridge: trilinear: add the DPTX hardware layer Luo Liu
2026-11-30 2:42 ` sashiko-bot [this message]
2026-11-30 2:25 ` [PATCH v8 3/5] drm/bridge: trilinear: add the DPTX DRM bridge Luo Liu
2026-11-30 2:25 ` [PATCH v8 4/5] drm/bridge: trilinear: add the DPTX core and build glue Luo Liu
2026-11-30 2:36 ` sashiko-bot
2026-11-30 2:25 ` [PATCH v8 5/5] drm/cix: add the Sky1 DisplayPort platform glue Luo Liu
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-240256@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 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.