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=1796386011; b=DxJ3I3G0m4YdnxH8KMJ/TnZiaaVgKgW7aGbD4GNjseDr71DUULweEcQema06KIQXd1tw RJQQ70O2qMCUZ+uQhdPExqJv7fEY3V0UA9OE/fsSkRXDwqm7zFKzxLdLBLra98DZSLWxA mDFcMOZvoSIPkVVpl05jCobUJ7H4IAOYEAkbQa0wxNFF7C2bR2JE1fP03D4GaY0SZzS+t xlbLB+lCIfLFHvrHNqTG9dhslBud1h/tX2kmqbYvvZUqKPS/Sx53mmlmYnfPFateAeYrl 5p8Sz9DnEyJcWZKGX2N1xTyU7FxIVmY5KehZmjoVTHfEjQxenm/+m6W6GDzZ0xQe9Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386011; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=HAI4MbylKCbLU1f2Ad8MCjD1MZzMAGjyjdD/+WgeYtM=; b=dOaYKEHAxaCKOvEkY9O3ZxvoVSyQbQ30q6SLRki8+VIbbrwwaLmJiXrSPorPrMmTr+8V 0DxRiNjDebtUOU3T2/zEIFmK+MZKW9e8QtfwhSDw8iZ1+UoNmWZuZMr6sheg7NKfB3e0n jaeCdrEQgS9j5X/LSIrLyZsYy6U7k+kbRUFjP7d/Ietmr4jNrw1Bt5Ub34jE5lnNYl/ZG 5C2GGCiAbgjLzRrWbRTlsctmeEDPzDIGEqsy6P5CM2ZqDWKTlFN/DPR37ESwetVrFr91X GI7+UY0iHr1qMnA6RvlDLJlgTkJzA4RxGtxP+R/WrACodys4gcxe6+jjFOUccvgZnFQ== 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=XyJdtJ3q; 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 21C0B606A322 for ; Fri, 4 Dec 2026 12:06:51 +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=XyJdtJ3q Received: by smtp.kernel.org (Postfix) with ESMTPSA id A49881F000CE; Fri, 4 Dec 2026 12:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796386010; bh=HAI4MbylKCbLU1f2Ad8MCjD1MZzMAGjyjdD/+WgeYtM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=XyJdtJ3qQou7vMgUwKcOGpXE3Hmr9r9+KC8VEiTxWPAeoibUh3sI3PTlC9vYJ2JMu JhoNkLfDv8v3LyPcjEdBDCzKqrdywUeA7O8N0VhZLPWkwl1PgKD1j1O0IAgPFEcswm Rh3b/xJyiYT8eLyYA5yJAIv8V3kfffiHNHenA5Oi+xmdyTsIM6plA4iGhCvB1JWgRD ol3SP98pnbPBA4SrwZA5i7SIqVkrqGrN+VYsivdhaGY6/u4Cl2LNwbgb2SDzpQJRUh HaQftvTmULQ1gJjNBTqzqGPsmUhcOBA0X2ubn5qvxnd50A1kColjvtghrc4eXC6VaZ UQsZfQx858vbg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v10 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: <20261204114332.280808-3-Luo.Liu@cixtech.com> References: <20261204114332.280808-1-Luo.Liu@cixtech.com> <20261204114332.280808-3-Luo.Liu@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 12:06:50 +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 5 potential issues to consider: - [High] drm/bridge: trilinear: dptx_hw_link_vs_emph() returns positive byte count - [Medium] drm/bridge: dptx_hw_link_adjust_train() clamps pre-emphasis instead of swing - [Medium] drm/bridge: trilinear: missing CR limits in dptx_hw_link_clock_recovery() - [Low] drm/bridge: trilinear: duplicate DPCD power helpers in dptx_hw.c - [Low] drm/bridge: trilinear: unnecessary single-implementation dptx_hw_ops vtable -- commit f4828b3f444687387aa09825f7746b0c5c9153bf Author: Luo Liu drm/bridge: trilinear: add the DPTX hardware layer This commit adds the register, AUX channel, DPCD capability, link training, and main stream programming 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..bdf24e464b942 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/trilinear/dptx_hw.c [ ... ] > +static int dptx_hw_link_vs_emph(struct dp_hw *hw, struct phy *phy, > + u8 lane_cnt) > +{ > + int ret; > + > + ret =3D dptx_hw_phy_vs_emph_set(hw, phy, lane_cnt, hw->train_setting); > + if (ret) > + return ret; > + > + return drm_dp_dpcd_write(&hw->aux, DP_TRAINING_LANE0_SET, > + hw->train_setting, lane_cnt); > +} [Severity: High] Does dptx_hw_link_vs_emph() return a positive byte count on success? drm_dp_dpcd_write() returns the number of bytes written (lane_cnt) rather than 0. Both dptx_hw_link_clock_recovery() and dptx_hw_link_channel_equalization() treat any non-zero return as an error, so link training aborts on the first clock-recovery iteration, skips channel equalization, and fails modeset enable. Using drm_dp_dpcd_write_data() here returns 0 on a full write and a negative error code on failure or a short write. > + > +static void dptx_hw_link_adjust_train(struct dp_hw *hw, u8 lane_cnt, > + const u8 *link_status) > +{ > + u8 voltage; > + u8 preemphasis; > + u8 pre_level; > + 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); > + pre_level =3D preemphasis >> DP_TRAIN_PRE_EMPHASIS_SHIFT; > + > + if (voltage + pre_level > 3) { > + pre_level =3D 3 - voltage; > + preemphasis =3D pre_level << DP_TRAIN_PRE_EMPHASIS_SHIFT; > + } [Severity: Medium] Should this clamp voltage swing instead of pre-emphasis when voltage + pre_level > 3? Per the DisplayPort specification, when a requested combination exceeds 3, the transmitter keeps the requested pre-emphasis and clamps voltage to 3 - pre_level. Clamping pre-emphasis instead drops requested pre-emphasis during link training and fails DisplayPort compliance tests. [ ... ] > +static int dptx_hw_link_clock_recovery(struct dp_hw *hw, struct phy *phy, > + u8 lane_cnt) > +{ [ ... ] > + for (i =3D 0; i < 512; i++) { > + ret =3D 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 =3D drm_dp_dpcd_read_link_status(&hw->aux, link_status); > + if (ret < 0) > + return ret; > + > + train_done =3D drm_dp_clock_recovery_ok(link_status, lane_cnt); > + if (train_done) > + break; > + > + memcpy(prev, hw->train_setting, lane_cnt); > + dptx_hw_link_adjust_train(hw, lane_cnt, link_status); > + > + if (!memcmp(hw->train_setting, prev, lane_cnt)) > + tries++; > + else > + tries =3D 0; > + > + if (tries =3D=3D DP_MAX_TRAINING_TRIES) > + break; > + } [Severity: Medium] Can this 512-iteration clock-recovery loop stall link training for seconds on a marginal or oscillating sink? The loop never stops when DP_TRAIN_MAX_SWING_REACHED is set and does not enforce the DP 1.4 10-iteration limit (or a bounded cap such as 80 iterations for pre-DP 1.4 sinks). On an oscillating pre-DP 1.4 sink with DP_TRAINING_AUX_RD_INTERVAL =3D=3D 4, drm_dp_link_train_clock_recovery_delay() sleeps 16 to 32 ms per iteration, turning 512 iterations into an 8 to 16 second stall per training attempt. [ ... ] > +static int dptx_hw_dpcd_power_up(struct dp_hw *hw, > + unsigned int delay_ms) > +{ > + u8 value; > + int ret; > + > + if (hw->dpcd[DP_DPCD_REV] < DP_DPCD_REV_11) > + return 0; > + > + ret =3D drm_dp_dpcd_readb(&hw->aux, DP_SET_POWER, &value); > + if (ret < 0) > + return ret; > + > + value =3D (value & ~DP_SET_POWER_MASK) | DP_SET_POWER_D0; > + > + ret =3D drm_dp_dpcd_writeb(&hw->aux, DP_SET_POWER, value); > + if (ret < 0) > + return ret; > + > + msleep(delay_ms); > + > + return 0; > +} > + > +static int dptx_hw_dpcd_power_down(struct dp_hw *hw, bool hpd) > +{ > + u8 value; > + int ret; > + > + if (!hpd) > + return 0; > + > + if (hw->dpcd[DP_DPCD_REV] < DP_DPCD_REV_11) > + return 0; > + > + ret =3D drm_dp_dpcd_readb(&hw->aux, DP_SET_POWER, &value); > + if (ret < 0) > + return ret; > + > + value =3D (value & ~DP_SET_POWER_MASK) | DP_SET_POWER_D3; > + > + ret =3D drm_dp_dpcd_writeb(&hw->aux, DP_SET_POWER, value); > + if (ret < 0) > + return ret; > + > + usleep_range(200, 205); > + > + return 0; > +} [Severity: Low] Can dptx_hw_dpcd_power_up() and dptx_hw_dpcd_power_down() reuse drm_dp_link_power_up() and drm_dp_link_power_down()? Those core helpers already check DP_DPCD_REV_11 and perform the DP_SET_POWER read-modify-write, avoiding duplicate DPCD power-state code. [ ... ] > 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..420ef242a4f61 > --- /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); > + > + void (*host_enable)(struct dp_hw *hw, bool enable); > + void (*reset)(struct dp_hw *hw, bool assert); > + void (*core_enable)(struct dp_hw *hw, int source_id, bool enable); [Severity: Low] Is the 20-method struct dptx_hw_ops vtable needed? There is only one implementation (dptx_hw_ops in dptx_hw.c), assigned unconditionally in dptx_hw_init(). Declaring direct dptx_hw_*() functions in dptx_hw.h would avoid the boilerplate and indirect calls. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204114332.2808= 08-1-Luo.Liu@cixtech.com?part=3D2