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=1796179382; b=sBxi5voe2P5x0Vrb/Mx5qNu/fx7Ev6lQeN48p5yMVfUwlwMy91M0YeNYoojKiOuQbDP4 r/zOqxjt3hFzuWbis0gpSvY/aRZ7OYU9xpju2EOWcfAYrWwPY/Kpwv0MptHYbre6qHtV9 9uwUk44Ym8Stc/UKj8X6y9DrKL72Bv3k5Zb3UN2M6vDoT8d/JNEHK3rKiOIJ2YkdBiHG/ nE2JcDDqh7ay+J9HIsBO9/+BYWA2+Th3O3/MRSTaiQdfBS4pe0RJFYm5V/0b6p7Lx6AlV COgtFzs4puyzzHk1N9fs4dEILZwVsLY1O2hNH3fXpgymt+FL0uJOwpK3v1lEjDwJnww== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796179382; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=FV+7g7YIZSkc0aBbnfAcak0jgz/Dw6aR3pSS9Do7P0g=; b=GB5WN+2tzq8hiJ9O+ifNCZdATKV1fpAdJmCmDsJZJzU2irSizX3fEy+iWZDCD0BXjs8/ 5HaR+C3ud0Pw7oZ502rxKL6ytGMtAl27Hx7tx2ND8bOOQA8JSL/CG1CecHnXEtzVMz3nL qU6KUGDwI7rL660Q8EzZg+3H836AoWtwUm9tX5SdIptQe7KW4GnKfz0A2wveEEDCKGC8V g2cGp+qDbg3ROhpYV8g7mcvS0KEK1zvYZAXetVBfPtm+T1NZzrPDdOjHipLEmxWx7Jy2k M+8j8BBFOQGzb9i1E0lZpu5mu2xqQy3wRWL0FOEGskbNVu36XGhNZbDaPoprZVVDLMg== 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=laR4RV+N; 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 B6562606A31A for ; Wed, 2 Dec 2026 02:43:02 +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=laR4RV+N Received: by smtp.kernel.org (Postfix) with ESMTPSA id 549A41F00893; Wed, 2 Dec 2026 02:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796179382; bh=FV+7g7YIZSkc0aBbnfAcak0jgz/Dw6aR3pSS9Do7P0g=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=laR4RV+NnEKuiDWnW4qQrVBEq78cUHDalNcG9s6ndjDQLLs6Kjc0ZlF34mfzZPtsw 0CMiBH+UiIl1Id8/btKmf+BKeBzjb19uxPzieZNRN2GaKUBDb9tPnalXSZM7ZDgpt5 CdkNEJdSAQ5khRA942isrdD9KNi7M9CLFLxRJrve9zdHyBVmw135RJYstKv0qVQDZi nJsmpHmxYZK/KIkN55ymGzgfS06emj+tPcuqYAKkUHpHkb098Q8IOn2GDumNSNPT3v G3V20iNljRAPlHk93TPtYknuCVCrxw/OVVwsH1v9X6NNiqS0WfIpkn0cNAJFVEZZrW JGe+LVX5EVvOA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 2/2] drm/bridge: Add ITE IT6162 MIPI DSI to HDMI bridge driver Reply-To: sashiko-reviews@lists.linux.dev To: "Hermes Wu" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261202-upstream-6162-v6-2-508a142766a2@ite.com.tw> References: <20261202-upstream-6162-v6-0-508a142766a2@ite.com.tw> <20261202-upstream-6162-v6-2-508a142766a2@ite.com.tw> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 02:43:01 +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: it6162: missing downstream bridge attach on DT port@3 - [High] drm/bridge: it6162: missing modeset on HDCP property changes in atomic_check() - [High] drm/bridge: it6162: incomplete mipi_cfg and disabled IRQ during attach - [Medium] drm/bridge: it6162: unpropagated HDCP topology errors in it6162_update_hdcp() - [Medium] drm/bridge: it6162: infinite HDCP 1.4 fallback loop in it6162_hdcp_handler() - [Medium] drm/bridge: it6162: race on hdcp_work queueing and unlocked HDCP state - [Low] drm/bridge: it6162: error codes overwritten with -ENODEV in probe path -- commit b7302ef734d960c18ef7e381678faab767cea1d0 Author: Hermes Wu drm/bridge: Add ITE IT6162 MIPI DSI to HDMI bridge driver This commit adds a DRM bridge driver for the ITE IT6162 MIPI DSI to HDMI 2.0 bridge chip, supporting single and dual MIPI DSI inputs, EDID retrieval, HPD, HDMI audio, and HDCP. > diff --git a/drivers/gpu/drm/bridge/ite-it6162.c b/drivers/gpu/drm/bridge= /ite-it6162.c > new file mode 100644 > index 0000000000000..05e8d0f34173c > --- /dev/null > +++ b/drivers/gpu/drm/bridge/ite-it6162.c > @@ -0,0 +1,1876 @@ [ ... ] > +static void it6162_update_hdcp14(struct it6162 *it6162) > +{ > + struct drm_device *drm =3D it6162->drm; > + int dev_count; > + u8 bksv[5]; > + u8 bstatus[2]; > + u8 ksvlist[5 * 30]; > + int ret; > + > + ret =3D it6162_hdcp_read_information(it6162, bstatus, bksv); > + if (ret < 0) { > + drm_err(drm, "fail to read Bstatus"); > + return; > + } > + > + dev_count =3D DRM_HDCP_NUM_DOWNSTREAM(bstatus[0]); > + if (dev_count =3D=3D 0) > + return; > + > + if (DRM_HDCP_MAX_DEVICE_EXCEEDED(bstatus[0]) || > + DRM_HDCP_MAX_CASCADE_EXCEEDED(bstatus[1])) { > + drm_err(drm, "HDCP1.4 Max Topology Limit Exceeded"); > + return; > + } > + > + dev_count =3D dev_count > 30 ? 30 : dev_count; > + ret =3D it6162_hdcp_read_list(it6162, ksvlist, dev_count); > + if (ret < 0) { > + drm_err(drm, "fail to read KSV list"); > + return; > + } > +} > + > +static void it6162_update_hdcp23(struct it6162 *it6162) > +{ > + struct drm_device *drm =3D it6162->drm; > + int dev_count; > + u8 rxid[5]; > + u8 rxinfo[2]; > + u8 rxid_list[5 * 30]; > + int ret; > + > + ret =3D it6162_hdcp_read_information(it6162, rxinfo, rxid); > + if (ret < 0) { > + drm_err(drm, "fail to read Rxinfo"); > + return; > + } > + > + dev_count =3D (HDCP_2_2_DEV_COUNT_HI(rxinfo[0]) << 4 | > + HDCP_2_2_DEV_COUNT_LO(rxinfo[1])); > + if (dev_count =3D=3D 0) > + return; > + > + if (HDCP_2_2_MAX_CASCADE_EXCEEDED(rxinfo[1]) || > + HDCP_2_2_MAX_DEVS_EXCEEDED(rxinfo[1])) { > + drm_err(drm, "HDCP2.3 Topology Max Size Exceeded"); > + return; > + } > + > + dev_count =3D dev_count > 30 ? 30 : dev_count; > + ret =3D it6162_hdcp_read_list(it6162, rxid_list, dev_count); > + if (ret < 0) { > + drm_err(drm, "fail to read RxID list"); > + return; > + } > +} > + > +static void it6162_update_hdcp(struct it6162 *it6162, u8 version) > +{ > + if (version =3D=3D HDCP_23) > + it6162_update_hdcp23(it6162); > + else > + it6162_update_hdcp14(it6162); > +} [ ... ] > +static void it6162_hdcp_handler(struct it6162 *it6162) > +{ > + struct regmap *regmap =3D it6162->regmap; > + unsigned int tx_status, sink_cap; > + enum hdcp_state hdcp_sts; > + struct it6162_hdcp_cfg *hdcp_cfg =3D &it6162->hdcp_cfg; > + u8 hdcp_ver; > + u64 cp_status =3D DRM_MODE_CONTENT_PROTECTION_DESIRED; > + > + if (hdcp_cfg->hdcp_version =3D=3D HDCP_DISABLE || !READ_ONCE(it6162->en= _hdcp)) > + return; > + > + if (it6162->hdcp_version !=3D HDCP_DISABLE) { > + if (regmap_read(regmap, OFFSET_TX_STATUS, &tx_status) < 0 || > + regmap_read(regmap, OFFSET_SINK_CAP, &sink_cap) < 0) > + return; > + > + if (!GET_TX_VIDEO_STATUS(tx_status)) { > + drm_dbg(it6162->drm, "video not stable, skip hdcp check"); > + return; > + } > + > + hdcp_sts =3D GET_TX_HDCP_STATUS(tx_status); > + hdcp_ver =3D GET_SINK_CAP_HDCP_VER(sink_cap); > + if (it6162->hdcp_sts !=3D hdcp_sts || > + it6162->hdcp_sts =3D=3D HDCP_STATE_IDLE) { > + it6162->hdcp_sts =3D hdcp_sts; > + switch (hdcp_sts) { > + case HDCP_STATE_AUTH_DONE: > + it6162_update_hdcp(it6162, hdcp_ver); > + cp_status =3D DRM_MODE_CONTENT_PROTECTION_ENABLED; > + break; [Severity: Medium] Should it6162_update_hdcp() return an error code so HDCP_STATE_AUTH_DONE does not report DRM_MODE_CONTENT_PROTECTION_ENABLED when Bstatus/RxInfo reads fail or topology limits are exceeded? In addition, it6162_update_hdcp14() and it6162_update_hdcp23() return early when dev_count =3D=3D 0 before checking the MAX_DEVICE_EXCEEDED and MAX_CASCADE_EXCEEDED overflow bits, and the bksv, ksvlist, rxid, and rxid_list buffers are read over I2C into stack arrays that are never checked or passed to drm_hdcp_check_ksvs_revoked(). > + case HDCP_STATE_AUTH_FAIL: > + /* Content Type 1 needs HDCP 2.3: no fallback */ > + if (hdcp_ver =3D=3D HDCP_23 && > + !READ_ONCE(it6162->hdcp_stream_type)) > + it6162_tx_hdcp_setup(it6162, HDCP_14, > + true); > + else > + it6162_tx_hdcp_disable(it6162); > + > + break; > + default: > + it6162_tx_hdcp_setup(it6162, > + it6162->hdcp_version, > + true); > + break; > + } > + it6162_hdcp_queue_prop_update(it6162, cp_status); > + } > + } > +} [Severity: Medium] If the HDCP 1.4 fallback also fails with HDCP_STATE_AUTH_FAIL, will this retry HDCP 1.4 forever instead of calling it6162_tx_hdcp_disable()? hdcp_ver is read from OFFSET_SINK_CAP (the sink's capability, which stays HDCP_23) and it6162_tx_hdcp_enable() resets it6162->hdcp_sts to HDCP_STATE_IDLE without recording that the driver has already fallen back to HDCP_14. On the next failure, hdcp_ver =3D=3D HDCP_23 is still true, so it6162_hdcp_handler() calls it6162_tx_hdcp_setup(it6162, HDCP_14, true) again and never reaches the else branch. > +static void it6162_interrupt_handler(struct it6162 *it6162) > +{ [ ... ] > + if (READ_ONCE(it6162->en_hdcp) && GET_TX_VIDEO_STATUS(tx_status) && > + connector_status =3D=3D connector_status_connected) > + queue_delayed_work(system_percpu_wq, &it6162->hdcp_work, > + msecs_to_jiffies(2000)); > +} [Severity: Medium] Can it6162_interrupt_handler() race with it6162_bridge_atomic_disable() to leave hdcp_work pending after the bridge is disabled? CPU0 (modeset) CPU1 (threaded IRQ) it6162_bridge_atomic_disable() it6162_interrupt_handler() if (READ_ONCE(it6162->en_hdcp) && ...) scoped_guard(mutex, &it6162->lock) WRITE_ONCE(it6162->en_hdcp, false) it6162_tx_disable() cancel_delayed_work_sync(&it6162->hdcp_work) queue_delayed_work(..., &it6162->hdcp= _work, ...) <-- hdcp_work queued after cancel Furthermore, in it6162_bridge_atomic_enable(), it6162->en_hdcp is set to true before it6162_tx_enable() sets it6162->hdcp_version and before it6162_mipi_enable() starts video, so a pending hdcp_work (or an interrupt arriving during enable) can run before hdcp_version is initialized or keep the 2000 ms stabilization timer from being reset when video becomes stable. it6162->hdcp_version and it6162->hdcp_sts are also read and modified without it6162->lock in it6162_tx_hdcp_disable(), it6162_tx_enable(), and it6162_hdcp_handler(). [ ... ] > +static int it6162_detect_devices(struct it6162 *it6162) > +{ > + struct device *dev =3D it6162->dev; > + const struct it6162_chip_info *chip_info; > + u32 chip_id, version; > + u8 buf[6]; > + int ret =3D -ENODEV; > + > + chip_info =3D i2c_get_match_data(it6162->it6162_i2c); > + if (!chip_info) > + return -ENODEV; > + > + if (it6162_platform_set_power(it6162) < 0) > + return -ENODEV; [Severity: Low] Should this propagate the error returned by it6162_platform_set_power() (and should it6162_probe() propagate the return value of it6162_detect_devices()) instead of overwriting it with -ENODEV? The driver core treats -ENODEV as an absent device and silently suppresses probe failure logging for regulator, I2C, or devres errors. [ ... ] > +static int it6162_attach_dsi(struct it6162 *it6162) > +{ > + struct device *dev =3D it6162->dev; > + const struct mipi_dsi_device_info info =3D { > + .type =3D "it6162-mipi", > + .channel =3D 0, > + .node =3D NULL, > + }; > + struct mipi_dsi_device *dsi; > + struct mipi_dsi_host *host; > + struct it6162_mipi_cfg *mipi_cfg =3D &it6162->mipi_cfg; > + int ret =3D 0; > + > + it6162->dsi =3D NULL; > + for (int port =3D 0; port < 2; port++) { > + host =3D it6162_of_get_dsi_host_by_port(it6162, port); > + if (IS_ERR(host)) > + continue; > + > + mipi_cfg->en_port[port] =3D true; > + > + dsi =3D devm_mipi_dsi_device_register_full(dev, host, &info); > + if (IS_ERR(dsi)) { > + dev_err(dev, "failed to create dsi device"); > + return PTR_ERR(dsi); > + } > + /* uses a single DSI configuration for both ports in dual-link mode */ > + if (!it6162->dsi) { > + ret =3D it6162_load_mipi_pars_from_port(it6162, port); > + if (ret <=3D 0) > + return ret; > + it6162->dsi =3D dsi; > + } > + > + dsi->lanes =3D mipi_cfg->lane_num; > + dsi->format =3D mipi_cfg->format; > + dsi->mode_flags =3D mipi_cfg->mode_flags; > + ret =3D devm_mipi_dsi_attach(dev, dsi); > + if (ret) { > + dev_err(dev, "failed to attach dsi device %d", port); > + return ret; > + } > + } > + > + return it6162_hw_start(it6162); > +} [Severity: High] Can the DRM pipeline bind and access the bridge during devm_mipi_dsi_attach() (or after devm_drm_bridge_add()) before mipi_cfg is populated for both ports and before it6162_hw_start() initializes the chip and enables the IRQ? Many DSI host drivers bind the DRM component master inside their mipi_dsi_host_ops.attach callback. When that happens during port 0's devm_mipi_dsi_attach() in dual-DSI mode, mipi_cfg->en_port[1] is still false, so it6162_bridge_mode_valid() computes ports =3D 1 and rejects dual- DSI 4K@60Hz modes with MODE_CLOCK_HIGH. In addition, because it6162_hw_start() has not run yet, an EDID read on a forced connector will time out waiting for an IRQ still disabled with IRQF_NO_AUTOEN, and when it6162_hw_start() -> it6162_reset_init() finally runs, it overwrites OFFSET_MIPI_CONFIG_L and OFFSET_TX_SETTING with 0, clobbering any initial modeset that already ran it6162_bridge_atomic_enable(). [ ... ] > +static int it6162_bridge_attach(struct drm_bridge *bridge, > + struct drm_encoder *encoder, > + enum drm_bridge_attach_flags flags) > +{ > + struct it6162 *it6162 =3D bridge_to_it6162(bridge); > + struct drm_device *drm =3D bridge->dev; > + > + it6162->drm =3D drm; > + if (!drm_core_check_feature(drm, DRIVER_ATOMIC)) { > + drm_dbg(drm, "it6162 driver only copes with atomic updates"); > + return -EOPNOTSUPP; > + } > + > + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { > + drm_err(drm, "DRM_BRIDGE_ATTACH_NO_CONNECTOR must be supplied"); > + return -EINVAL; > + } > + > + return 0; > +} [Severity: High] Does the driver need to look up and attach the downstream bridge on DT port@3? The ite,it6162.yaml binding defines port@3 as the HDMI output port connected to an hdmi-connector node, but it6162_probe() only checks ports 0..2 and it6162_bridge_attach() never calls drm_bridge_attach() on a next bridge, leaving any downstream display-connector or HDMI bridge unattached from the encoder bridge chain. [ ... ] > +static int it6162_bridge_atomic_check(struct drm_bridge *bridge, > + struct drm_bridge_state *bridge_state, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state) > +{ > + struct drm_display_mode *adj =3D &crtc_state->adjusted_mode; > + struct drm_display_mode *mode =3D &crtc_state->mode; > + struct it6162 *it6162 =3D bridge_to_it6162(bridge); > + struct drm_connector_state *old_conn_state; > + u32 hfp, hsw, hbp; > + u32 clock; > + u32 hfp_check; > + > + /* > + * A new HDCP content type needs a new authentication, which happens > + * at the next modeset; report DESIRED until then. > + */ > + old_conn_state =3D drm_atomic_get_old_connector_state(conn_state->state, > + conn_state->connector); > + if (old_conn_state && > + old_conn_state->hdcp_content_type !=3D conn_state->hdcp_content_typ= e && > + conn_state->content_protection !=3D > + DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { > + conn_state->content_protection =3D > + DRM_MODE_CONTENT_PROTECTION_DESIRED; > + } [Severity: High] How are changes to conn_state->content_protection or conn_state->hdcp_content_type applied when userspace updates those properties on an already active display without changing the mode? Because the driver only reads content_protection and hdcp_content_type in it6162_bridge_atomic_enable() and stops HDCP in it6162_bridge_atomic_disable(), and it6162_bridge_atomic_check() never sets crtc_state->mode_changed =3D true when those properties change, enabling or disabling HDCP without a modeset will never start or stop HDCP in hardware. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202-upstream-6= 162-v6-0-508a142766a2@ite.com.tw?part=3D2