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=1796372020; b=5XGYTKxVfxyA40UG1d9NuygryKrewHp/jQPGIjLUezcPOqDJZaGl37WvMslWRj8Caugw YztKgiq8D9vsBDqSEk5rKElaqVWVeV4/vrPmUQvgR16tDLUWzXSnlbbLof/D/Rg0pIBcB cVdE7U0/Jwmp5dQV+Xgnjw9ivx5p6xCZwbupjjTMZs3t5rKXMqcKTolXji+bcGiozcScA sgLOZbv69GpkcCUOowxm2TzahUZn7/yf2/1U/VaZNI/omPirs6LaOpSUqdeq5abz/m4Ot xybRFwxWUPUOjkahBlgmS6MyJZd9xmt07tE77PdPIK1aV1fMppgaJFP4X5VdwYXdbhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796372020; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=0+JP3Xcff27kgYyiI2ip+asS6OlWoPlMbmD9NYoTJvc=; b=IIjAKnfgX6b2DNfnQwTmaVflBctzsbh1nOJ/LbhvpNolrXIRpFjNMW8GNJSNlpS3zMF/ r8mJdvuqg0hVfg4q/LnE2lsZSjCs/bFak0qJYDGBpQu7rANzg75piCgMSbE5JXMuyytuD TdSGIqN3wVMnQ6qVAYWFM/jlkflNKa7UeNyZsuoIs2iciyd/YyThfi4q3TnGmQThKWOXU t3j6h6nOnc4qjTRRAoodV674BQmc711pSPJ6BLvJT70Xcz9xc+MVBLaN3AyrYGINZXWw0 39DjW981u8QwGeypZFOkFw4h8OZihJCUqzmSuYDVJh3svGIaUQDYut3Vp1BfOF4dgPA== 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=l8D9C6G6; 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 9405D606A322 for ; Fri, 4 Dec 2026 08:13:40 +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=l8D9C6G6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B3B31F000CE; Fri, 4 Dec 2026 08:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796372020; bh=0+JP3Xcff27kgYyiI2ip+asS6OlWoPlMbmD9NYoTJvc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=l8D9C6G6cha4zd7emTaf5vW9LNo9U+c+Efmj8QlVpIipKeF4gK4bh+Ax1qH44nZyT W5WVUb9K+5HcLBE0WIIAyud+xZN1oeiESv19MamivjYAjAnPPLTRnMZ4FizYZIsIEF NLrbtlygRcaj++qk/55xuNmj5jPIGO1+jlMSx1MEiW1LpVbpeuTCNTgKAXRWsbnol9 CqE2GhN6XNyLgVj/s0f29yMrbEBPLyR9s/gzZrICXzn6OsIehjbsfGLKP/Xoe7PPRU uMXgOKUuVVlLhXlCHFMufE6Rj0GgAFkI4Kf8lshM7Q7xhjJJsXwXbiBsIW3im5Z3lu LLs3qUsjogIHQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v9 2/5] drm/bridge: trilinear: add the DPTX hardware layer 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: <20261204074239.133559-3-Luo.Liu@cixtech.com> References: <20261204074239.133559-1-Luo.Liu@cixtech.com> <20261204074239.133559-3-Luo.Liu@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 08:13: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 11 potential issues to consider: - [Medium] drm/bridge: trilinear: leave opts.dp.lanes unset in dptx_hw_link_rate() - [Medium] drm/bridge: trilinear: missing pre-emphasis and swing sum clamping - [Medium] drm/bridge: trilinear: hardcode CTA limited range for RGB VSC SDP - [Medium] drm/bridge: trilinear: omit DCI-P3 and xvYCC/BT.709 in VSC SDP check - [Medium] drm/bridge: trilinear: leave unhandled interrupt bit 5 unmasked - [Medium] drm/bridge: trilinear: ignore DPCD write error in dptx_hw_link_train_end() - [Low] drm/bridge: trilinear: write DP_TRAINING_LANE0_SET before PHY update - [Low] drm/bridge: trilinear: commit message claims unimplemented downshifting - [Low] drm/bridge: trilinear: unnecessary single-implementation dptx_hw_ops vtable - [Low] drm/bridge: trilinear: dptx_hw_stream_format_set() lacks YUV420 VSC check - [Low] drm/bridge: trilinear: 32-bit overflow in dptx_hw_stream_timing_set() -- commit e7608fe3dedcf10692a9cd8f3d2a2dbebc772270 Author: Luo Liu drm/bridge: trilinear: add the DPTX hardware layer This commit adds the register and PHY programming layer for the Trilinear DisplayPort transmitter, including AUX transfers, DPCD capability parsing, link training, and per-stream timing and format setup. > Add the register and PHY programming for the Trilinear DisplayPort > transmitter: controller reset, host and core enable, AUX transfers > through the controller's AUX channel, sink capability parsing from the > DPCD, and link training with rate downshifting when the sink cannot > lock. [Severity: Low] Is the commit message accurate about rate downshifting? In this patch, dptx_hw_link_train() only runs a single link training attempt at the caller-supplied bw_code and lane_cnt and does not implement rate downshifting. > 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..8f5ff929aa07d > --- /dev/null > +++ b/drivers/gpu/drm/bridge/trilinear/dptx_hw.c [ ... ] > +#define DPTX_INTERRUPT_GP_TIMER_IRQ BIT(4) > +#define DPTX_INTERRUPT_REPLY_TIMEOUT BIT(3) > +#define DPTX_INTERRUPT_REPLY_RECEIVED BIT(2) > +#define DPTX_INTERRUPT_HPD_IRQ BIT(1) > +#define DPTX_INTERRUPT_HPD_EVENT BIT(0) > + > +#define DPTX_INTERRUPT_MASK_ALL 0x3f > +#define DPTX_INTERRUPT_CFG 0x1c [Severity: Medium] Does DPTX_INTERRUPT_CFG leave interrupt bit 5 unmasked? DPTX_INTERRUPT_MASK_ALL covers bits 0..5 (0x3f), where 1 masks an interrupt and 0 enables it. Writing DPTX_INTERRUPT_CFG (0x1c) to DPTX_INTERRUPT_MASK in dptx_hw_host_enable() unmasks bit 5 alongside HPD_EVENT and HPD_IRQ, even though dptx_hw_irq() only handles bits 0..4 and swallows any other unmasked cause bit as IRQ_HANDLED. Defining DPTX_INTERRUPT_CFG as DPTX_INTERRUPT_MASK_ALL & ~(DPTX_INTERRUPT_HPD_EVENT | DPTX_INTERRUPT_HPD_IRQ) (0x3c) keeps bit 5 masked. [ ... ] > +static int dptx_hw_link_rate(struct dp_hw *hw, struct phy *phy, > + u8 bw_code, u8 lanes, bool downspread) > +{ > + union phy_configure_opts opts =3D { 0 }; > + u32 ready =3D (1 << lanes) - 1; > + u32 value; > + int ret; > + > + dptx_hw_write(hw, DPTX_LINK_BW_SET, bw_code); > + > + opts.dp.link_rate =3D drm_dp_bw_code_to_link_rate(bw_code) / 100; > + opts.dp.ssc =3D downspread; > + opts.dp.set_rate =3D 1; > + ret =3D phy_configure(phy, &opts); [Severity: Medium] Should dptx_hw_link_rate() set opts.dp.lanes and opts.dp.set_lanes before calling phy_configure()? Because opts is zero-initialized, opts.dp.lanes is passed as 0 instead of 1, 2, or 4, which causes generic DP PHY drivers such as phy-cadence-torrent to reject phy_configure() with -EINVAL. In addition, opts.dp.set_lanes is never set anywhere in the driver and dptx_hw_link_configure() passes num_lanes rather than the active lane_cnt, so PHY drivers that implement set_lanes never reconfigure their active lanes. [ ... ] > +static int dptx_hw_link_vs_emph(struct dp_hw *hw, struct phy *phy, > + u8 lane_cnt) > +{ > + int ret; > + > + ret =3D drm_dp_dpcd_write(&hw->aux, DP_TRAINING_LANE0_SET, hw->train_se= tting, > + lane_cnt); > + if (ret < 0) > + return ret; > + > + return dptx_hw_phy_vs_emph_set(hw, phy, lane_cnt, hw->train_setting); > +} [Severity: Low] Should dptx_hw_phy_vs_emph_set() run before writing DP_TRAINING_LANE0_SET to the sink? Updating the sink DPCD first exposes it to stale drive levels if it starts evaluating immediately, and leaves the sink notified even if phy_configure() fails. > +static void dptx_hw_link_adjust_train(struct dp_hw *hw, u8 lane_cnt, > + const u8 *link_status) > +{ > + u8 voltage; > + u8 preemphasis; > + int i; > + > + for (i =3D 0; i < lane_cnt; i++) { > + voltage =3D drm_dp_get_adjust_request_voltage(link_status, i); > + preemphasis =3D > + drm_dp_get_adjust_request_pre_emphasis(link_status, i); > + > + if (voltage >=3D DP_TRAIN_VOLTAGE_SWING_LEVEL_3) > + voltage |=3D DP_TRAIN_MAX_SWING_REACHED; > + > + if (preemphasis >=3D DP_TRAIN_PRE_EMPH_LEVEL_2) > + preemphasis |=3D DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; > + > + hw->train_setting[i] =3D voltage | preemphasis; > + } > +} [Severity: Medium] Can dptx_hw_link_adjust_train() pass out-of-spec swing and pre-emphasis levels to phy_configure()? When a sink requests pre-emphasis level 3, this sets DP_TRAIN_MAX_PRE_EMPHASIS_REACHED at level 2 without clamping preemphasis to level 2, passing opts.dp.pre[i] =3D 3 in dptx_hw_phy_vs_emph_set(). It also does not enforce voltage + pre-emphasis <=3D 3, so combinations like swing level 2 with pre-emphasis level 2 are rejected with -EINVAL by generic DP PHY drivers such as phy-cadence-torrent and abort link training. [ ... ] > +static void dptx_hw_link_train_end(struct dp_hw *hw) > +{ > + drm_dp_dpcd_writeb(&hw->aux, DP_TRAINING_PATTERN_SET, 0); > + dptx_hw_write(hw, DPTX_TRAINING_PATTERN_SET, 0); > + dptx_hw_write(hw, DPTX_DISABLE_SCRAMBLING, 0); > +} > + > +static int dptx_hw_link_train(struct dp_hw *hw, struct phy *phy, u8 bw_c= ode, > + u8 lane_cnt, u8 num_lanes) > +{ [ ... ] > + dptx_hw_link_train_end(hw); > + > + return ret; > +} [Severity: Medium] Should dptx_hw_link_train_end() propagate a DPCD write error when link training otherwise succeeded? If clearing DP_TRAINING_PATTERN_SET on the sink fails after clock recovery and channel equalization pass, dptx_hw_link_train() still returns 0 while the sink remains in training pattern mode, preventing callers from retrying or downshifting. Propagating the error when ret =3D=3D 0 (while keeping any earlier training error) avoids reporting a false success. [ ... ] > + dptx_hw_write(hw, DPTX_SECONDARY_DATA_WINDOW(stream_id), > + (mode->htotal - mode->hdisplay) * (link_rate / 40) * > + 9 / mode->clock); [Severity: Low] Can this DPTX_SECONDARY_DATA_WINDOW calculation overflow 32-bit unsigned arithmetic? Because link_rate is u32, the numerator wraps when horizontal blanking is at least 35350 pixels at HBR2 or 23567 pixels at HBR3 for a custom userspace mode, writing a truncated value to the register. Using 64-bit arithmetic with div_u64() avoids the wrap. [ ... ] > +static bool dptx_hw_needs_vsc_sdp(enum dp_pixelformat format, > + u32 colorspace) > +{ > + if (format =3D=3D DP_PIXELFORMAT_YUV420) > + return true; > + > + switch (colorspace) { > + case DRM_MODE_COLORIMETRY_SYCC_601: > + case DRM_MODE_COLORIMETRY_OPYCC_601: > + case DRM_MODE_COLORIMETRY_BT2020_YCC: > + case DRM_MODE_COLORIMETRY_BT2020_RGB: > + case DRM_MODE_COLORIMETRY_BT2020_CYCC: > + return true; > + default: > + break; > + } > + > + return false; > +} [Severity: Medium] Should dptx_hw_needs_vsc_sdp() also return true for DCI-P3 RGB (D65 and Theater), xvYCC 601/709, and BT.709 YCbCr? dptx_hw_vsc_colorimetry() maps all five colorspaces, but when dptx_hw_needs_vsc_sdp() returns false, dptx_hw_stream_misc() ignores colorspace and programs MISC0 as sRGB or BT.601. This leaves the DCI-P3 RGB cases unreachable for RGB streams and silently drops these colorspaces unless paired with YUV420. [ ... ] > +static int dptx_hw_stream_format_set(struct dp_hw *hw, unsigned int stre= am_id, > + enum dp_pixelformat format, u32 colorspace, > + u8 bpc, u8 content_type) > +{ > + struct drm_dp_vsc_sdp vsc =3D {}; > + struct dp_sdp sdp; > + bool enable; > + ssize_t len; > + > + enable =3D hw->caps.vsc_supported && > + dptx_hw_needs_vsc_sdp(format, colorspace); [Severity: Low] Should dptx_hw_stream_format_set() return an error when format is DP_PIXELFORMAT_YUV420 and hw->caps.vsc_supported is false? If hw->caps.vsc_supported becomes false (for example, if a DPCD re-read hits an AUX error on DP_DPRX_FEATURE_ENUMERATION_LIST, which drm_dp_vsc_sdp_supported() converts to false), enable is false and dptx_hw_stream_misc() falls into its default case, programming RGB in MISC0 with DPTX_MAIN_STREAM_OVERRIDE left at 0 and returning 0 instead of failing cleanly. [ ... ] > + vsc.dynamic_range =3D DP_DYNAMIC_RANGE_CTA; > + vsc.content_type =3D content_type; [Severity: Medium] Should vsc.dynamic_range be DP_DYNAMIC_RANGE_VESA when format is DP_PIXELFORMAT_RGB? Hardcoding DP_DYNAMIC_RANGE_CTA signals limited dynamic range (16-235) for wide-gamut RGB modes such as BT.2020 RGB, mismatching the full-range RGB signaled in MISC0 when VSC SDP is disabled and crushing blacks and whites on the sink. > diff --git a/drivers/gpu/drm/bridge/trilinear/dptx_hw.h b/drivers/gpu/drm= /bridge/trilinear/dptx_hw.h > new file mode 100644 > index 0000000000000..b56ec3161f764 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/trilinear/dptx_hw.h [ ... ] > +struct dptx_hw_ops { > + bool (*hpd_state)(struct dp_hw *hw); > + bool (*sink_present)(struct dp_hw *hw); [Severity: Low] This isn't a bug, but is the 20-entry struct dptx_hw_ops vtable needed when dptx_hw_ops in dptx_hw.c is its only implementation? Declaring direct dptx_hw_*() functions in dptx_hw.h would avoid the indirect call boilerplate. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204074239.1335= 59-1-Luo.Liu@cixtech.com?part=3D2