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=1795957306; b=5o3w+yF/S6jCPO9A2xNPzluYbSwdvgGSWhAEyGv3UH0V2bDyWTF2zkD3btGoNBHM7CK3 nbP03cbKseYfJvADlwAoOgeiWuW42VtXvIKn7yGn0+kzwWj7oSUrQgR71Pw2Af1b6fqNW 80Q6rG6s+ADFVMvB6slptcgQA7gsTgq1+HRQzqeTWDDCZLpMYFUgHG33kbaKumxiAu3i9 cxpnnHrE+xCjwQPg0UGlR9uJWcacs9nqsGiO3nT44NhXbuo+YlLLW1gyPiayBc2qP5L9M BlDIgkAR2w0YKsrhWkOndSGTc926jAu5Zthgfox8l6+SJelPtOubpsKMX3kX83I3GLA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795957306; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=mhAs9CPj0afdd0/y4a+uGl+kV/FAGnA3Js0FO/2XHrM=; b=fy6FRBlfMX0BEQbzJrde9HjJFD67R4O99rsAhru8uYZg8zTNphhDpyRiey5SXzT3CFTF kEPE3XE46ne+vvyNUDIiUvhrgu/3FIDbpuAwH40OtbDzAo2GKZewAOYWEV9six6CcsDRw kGvqpGTgPL/n8E4KEyxjPEfCS7IonxOnGMN4x/wGS+1M5EcV4iqKTkDz2FeVQwzKCsKNa Bj2R3BpwgC94jQ0dcXTC03GqI7SqQnw0Nbd2EW4y+o5xYknqacVaS6lK2WvuWT+uulITK 3IMsBe7eeguiFWP0kB9I4pgZ7QJpuM+DKkyhItb+AjpaeYYfWWxvizFYAGFQcHhpEQg== 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=Fs5j52XL; 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) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DA4C606A31C; Sun, 29 Nov 2026 13:01:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Fs5j52XL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45AA21F000C1; Sun, 29 Nov 2026 13:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795957305; bh=mhAs9CPj0afdd0/y4a+uGl+kV/FAGnA3Js0FO/2XHrM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Fs5j52XL+YK1CiBLG+02ySpTJ8/qn3DR3WfvM186knVku/5/gCiXIpsEO5fjjX3Mw 9V98S85qKWi9lFUeBcbLHO9xy7eW7iukUWjick38XGs/IsiGYgKx2GLdGl0ZaKpia5 vV4t/LQBZirFigruKihzmVVdj26seZXS6zbylIEIQ3ofe+QdZH2t17hIgVWmH4oHoZ BXrlTlVk4jIUKpxXOcd/EMODE3xxPWd0r1Uab3UDF97dysS2Xw2ppqEhYVfGuf2TZP 56duiHnmK2zeJdAOMbQGpO4+rx6oNh34JlCqQeJfK836R/kotaNeBf+ki9zH6BNVyZ trOLoDn72JCbg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 11/16] drm/spacemit: add Innosilicon DP/eDP controller bridge driver Reply-To: sashiko-reviews@lists.linux.dev To: "Cody Kang" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-phy@lists.infradead.org, linux-clk@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com In-Reply-To: <20261129-k3-display-v4-11-ce6cf7988202@gmail.com> References: <20261129-k3-display-v4-0-ce6cf7988202@gmail.com> <20261129-k3-display-v4-11-ce6cf7988202@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 13:01:44 +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: - [High] drm/spacemit: clk_set_parent() fails in spacemit_dp_probe() due to ccu-k3 mux - [High] drm/spacemit: DP_PHY_RESET in spacemit_dp_dev_init() desyncs PREPLL clk rate - [Medium] drm/spacemit: sink count and cap retry bugs in spacemit_dp_bridge_detect() - [Medium] drm/spacemit: missing 1-lane HBR2 config and eDP sink_rates filter - [Medium] drm/spacemit: skipped PLL check and stale DPCD in mode_valid() - [Medium] drm/spacemit: phy_exit() in spacemit_dp_shutdown() while DRM device is active - [Medium] drm/spacemit: spacemit_dp_remove() runs before devm DP AUX bus depopulation - [Medium] drm/spacemit: AUX registered before init and MPLL reset without hw_mutex - [Medium] drm/spacemit: unlocked dp->link and dp->dpcd reads in mode_valid() and check - [Medium] drm/spacemit: multi-second AUX timeout stalls and ignored D0 timeout - [Medium] drm/spacemit: redundant init and unguarded eDP HPD check in spacemit_dp_bind() -- commit 35a58c12d01e7fe94c01dcd449a9206872d617e4 Author: Cody Kang drm/spacemit: add Innosilicon DP/eDP controller bridge driver This commit adds the DRM bridge driver for the Innosilicon DisplayPort and embedded DisplayPort controller downstream of the Saturn DPU on SpacemiT SoCs. > diff --git a/drivers/gpu/drm/spacemit/spacemit_inno_dp.c b/drivers/gpu/dr= m/spacemit/spacemit_inno_dp.c > new file mode 100644 > index 0000000000000..c4d4e2aec5fdd > --- /dev/null > +++ b/drivers/gpu/drm/spacemit/spacemit_inno_dp.c [ ... ] > +static const struct spacemit_dp_link_config { > + enum spacemit_dp_link_rate rate; > + enum spacemit_dp_lane_count lanes; > +} spacemit_dp_link_priority_table[] =3D { > + {SPACEMIT_DP_LINK_RATE_1_62, SPACEMIT_DP_LANE_1}, /* 1.62 Gbps */ > + {SPACEMIT_DP_LINK_RATE_2_70, SPACEMIT_DP_LANE_1}, /* 2.70 Gbps */ > + {SPACEMIT_DP_LINK_RATE_1_62, SPACEMIT_DP_LANE_2}, /* 3.24 Gbps */ > + > + {SPACEMIT_DP_LINK_RATE_2_70, SPACEMIT_DP_LANE_2}, /* 5.40 Gbps */ > + {SPACEMIT_DP_LINK_RATE_1_62, SPACEMIT_DP_LANE_4}, /* 6.48 Gbps */ > + > + {SPACEMIT_DP_LINK_RATE_2_70, SPACEMIT_DP_LANE_4}, /* 10.8 Gbps */ > + {SPACEMIT_DP_LINK_RATE_5_40, SPACEMIT_DP_LANE_2}, /* 10.8 Gbps */ > + > + {SPACEMIT_DP_LINK_RATE_5_40, SPACEMIT_DP_LANE_4}, /* 21.6 Gbps */ > +}; [Severity: Medium] Should spacemit_dp_link_priority_table[] also include {SPACEMIT_DP_LINK_RATE_5_40, SPACEMIT_DP_LANE_1}? Both the DisplayPort specification and phy-k3-inno-dp support 1-lane HBR2 (4.32 Gbps usable capacity), and spacemit_dp_bridge_mode_valid() accepts 1-lane HBR2 modes up to 4.32 Gbps, but spacemit_dp_bridge_atomic_check() and spacemit_dp_bridge_atomic_enable() reject any 1-lane mode above 2.16 Gbps because that entry is missing from the table. In addition, when dp->link.use_rate_select is true on eDP 1.4, neither spacemit_dp_bridge_atomic_check() nor the loop filter in spacemit_dp_bridge_atomic_enable() verifies that cfg->rate is listed in dp->link.sink_rates[]. If a panel lists 2.70 Gbps in DP_SUPPORTED_LINK_RATES without 1.62 Gbps, atomic_check() picks 1.62 Gbps and atomic_enable() power-cycles the link, programs the PLLs, powers on the PHY, and writes DP_EDP_CONFIGURATION_SET before spacemit_dp_link_train() rejects the rate with -EINVAL. [ ... ] > + ret =3D regmap_read_poll_timeout(dp->regs, DP_GENERAL_INTERRUPT, val, > + val & DP_AUX_REPLY_EVENT_INT_STA, > + SPACEMIT_DP_AUX_POLL_US, > + SPACEMIT_DP_AUX_TIMEOUT_US); > + if (ret) { > + spacemit_dp_aux_hw_reset(dp); > + dev_dbg_ratelimited(dp->dev, > + "AUX transfer timeout, req: 0x%x, cmd: 0x%x, addr: 0x%x, size %z= u\n", > + msg->request, cmd, msg->address, msg->size); > + return ret; > + } [ ... ] > + /* A sink left in D3 need not answer the training writes. */ > + if (drm_dp_link_power_up(&dp->aux, dp->link.revision) < 0) > + drm_dbg(dp->drm, "failed to set the sink to D0\n"); > + > + /* > + * A sink may act on the DP_LINK_BW_SET write, so set the lane count > + * first. > + */ > + link_config[0] =3D lanes; > + if (dp->link.enhanced_framing) > + link_config[0] |=3D DP_LANE_COUNT_ENHANCED_FRAME_EN; > + regmap_write_bits(dp->regs, DP_CORE_CONTROL, DP_ENHANCE_FRAMING_EN, > + FIELD_PREP(DP_ENHANCE_FRAMING_EN, > + dp->link.enhanced_framing)); > + > + ret =3D drm_dp_dpcd_write_byte(&dp->aux, DP_LANE_COUNT_SET, > + link_config[0]); [Severity: Medium] Does a single timed-out DPCD access stall for 6.5 seconds, and does spacemit_dp_link_train() double that stall by ignoring -ETIMEDOUT from drm_dp_link_power_up()? SPACEMIT_DP_AUX_TIMEOUT_US is 200 ms plus 4-5 ms in spacemit_dp_aux_hw_reset(), and drm_dp_dpcd_access() retries all 32 times even on -ETIMEDOUT, so each unresponsive DPCD access blocks for 6.54 seconds while holding aux.hw_mutex and dp->mode_lock. Because spacemit_dp_link_train() only logs a failure from drm_dp_link_power_up() and proceeds to drm_dp_dpcd_write_byte(DP_LANE_COUNT_SET), an unresponsive sink stalls for 13.1 seconds before returning -ETIMEDOUT to spacemit_dp_bridge_atomic_enable(). [ ... ] > +static enum drm_connector_status > +spacemit_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connecto= r *connector) > +{ > + struct spacemit_dp_dev *dp =3D container_of_const(bridge, > + struct spacemit_dp_dev, > + bridge); > + enum drm_connector_status status; > + > + guard(mutex)(&dp->mode_lock); > + status =3D spacemit_dp_hw_detect_hpd(dp); > + > + /* > + * The bind-time cap read only covers a sink that was already there. > + * Without a re-read here, link.max_rate stays 0 and every link config > + * is filtered out. > + */ > + if (status =3D=3D connector_status_connected && > + dp->connector_status !=3D connector_status_connected) > + spacemit_dp_hw_read_sink_caps(dp); > + > + /* A branch device holds HPD up with no sink behind it. */ > + if (status =3D=3D connector_status_connected && > + drm_dp_is_branch(dp->dpcd) && !drm_dp_read_sink_count(&dp->aux)) > + status =3D connector_status_disconnected; > + > + dp->connector_status =3D status; > + > + return status; > +} [Severity: Medium] Does !drm_dp_read_sink_count(&dp->aux) treat negative error returns as a connected sink? drm_dp_read_sink_count() returns a negative errno when reading DP_SINK_COUNT fails, so !drm_dp_read_sink_count(&dp->aux) evaluates to false on error and reports the branch device as connected; checking drm_dp_read_sink_count(&dp->aux) <=3D 0 would avoid that. Also, if spacemit_dp_hw_read_sink_caps() fails (or if spacemit_dp_bridge_atomic_enable() clears dp->link.max_rate and dp->link.max_num_lanes after sink_lost), dp->dpcd is zeroed while dp->connector_status is still latched to connector_status_connected. Later detect polls while HPD stays high see dp->connector_status =3D=3D connector_status_connected and never retry spacemit_dp_hw_read_sink_caps() even though dp->link.max_rate is 0. [ ... ] > +static enum drm_mode_status > +spacemit_dp_bridge_mode_valid(struct drm_bridge *bridge, > + const struct drm_display_info *info, > + const struct drm_display_mode *mode) > +{ > + struct spacemit_dp_dev *dp =3D container_of_const(bridge, > + struct spacemit_dp_dev, > + bridge); > + unsigned int max_link_rate, max_lanes; > + u64 max_bw, req_bw; > + > + /* > + * Prefer the link limits the driver maintains: they start as the > + * sink's capabilities clamped to the PHY and are narrowed after a > + * failed training. drm_dp_max_link_rate() is in 10 kbit/s. > + */ > + if (dp->link.max_rate && dp->link.max_num_lanes) { > + max_link_rate =3D dp->link.max_rate / 10; > + max_lanes =3D dp->link.max_num_lanes; > + } else { > + max_link_rate =3D min_t(unsigned int, > + drm_dp_max_link_rate(dp->dpcd), > + SPACEMIT_DP_SOURCE_MAX_RATE / 10); > + max_lanes =3D drm_dp_max_lane_count(dp->dpcd); > + } > + if (!max_link_rate || !max_lanes) { > + /* Sink not enumerated yet: accept and re-check at modeset. */ > + return MODE_OK; > + } > + > + /* > + * max_link_rate is per lane in 10 kbit/s. The x10 to reach kbit/s and > + * the 8b/10b coding overhead cancel down to a plain "* 8". > + */ > + max_bw =3D (u64)max_link_rate * max_lanes * 8; > + > + /* Required bandwidth: pixel clock (kHz) * bits per pixel. */ > + req_bw =3D (u64)mode->clock * SPACEMIT_DP_BPP; > + > + if (req_bw > max_bw) { > + drm_dbg(bridge->dev, > + "rejecting %dx%d@%d: %llu > %llu kbit/s (%u kbit/s x%u lanes)\n", > + mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), > + req_bw, max_bw, max_link_rate * 10, max_lanes); > + return MODE_CLOCK_HIGH; > + } > + > + /* The pixel clock is made by the PHY PLL, which cannot hit every rate.= */ > + if (clk_round_rate(dp->pll_clk, mode->clock * 1000UL) <=3D 0) > + return MODE_NOCLOCK; > + > + return MODE_OK; > +} [Severity: Medium] Does returning MODE_OK when !max_link_rate || !max_lanes bypass the clk_round_rate(dp->pll_clk, ...) check, and does the else branch fall back to un-narrowed dp->dpcd values? Before an eDP panel is enabled for the first time, its DPCD limits are 0, so spacemit_dp_bridge_mode_valid() returns early before checking whether dp->pll_clk can synthesize mode->clock. If the PHY PLL rejects the rate, spacemit_dp_set_plls() later fails in spacemit_dp_bridge_atomic_enable() (including in the !dp->phy_powered fallback), leaving the pixel clock off and wedging the CRTC commit. Also, when spacemit_dp_bridge_atomic_enable() zeroes dp->link.max_rate and dp->link.max_num_lanes after link narrowing is exhausted or the sink is lost, dp->dpcd is not cleared, so the else branch here reverts to the full un-narrowed capabilities from dp->dpcd. [ ... ] > +static int spacemit_dp_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 spacemit_dp_dev *dp =3D container_of_const(bridge, > + struct spacemit_dp_dev, > + bridge); > + struct spacemit_dp_bridge_state *st =3D > + to_spacemit_dp_bridge_state(bridge_state); > + const struct drm_display_mode *mode =3D &crtc_state->adjusted_mode; > + u32 req_bw; > + int i; > + > + req_bw =3D spacemit_dp_calc_required_bw(mode, SPACEMIT_DP_BPP); > + > + /* No caps yet: leave idx unset and let ->atomic_enable() retry. */ > + if (!dp->link.max_rate || !dp->link.max_num_lanes) { > + st->link_cfg_idx =3D -1; > + return 0; > + } > + > + for (i =3D 0; i < ARRAY_SIZE(spacemit_dp_link_priority_table); i++) { > + const struct spacemit_dp_link_config *cfg =3D > + &spacemit_dp_link_priority_table[i]; > + > + if (cfg->rate > dp->link.max_rate || > + cfg->lanes > dp->link.max_num_lanes) > + continue; > + if (spacemit_dp_calc_link_capacity(cfg->rate, cfg->lanes) < req_bw) > + continue; > + > + st->link_cfg_idx =3D i; > + return 0; > + } > + > + drm_dbg(bridge->dev, > + "no DP link cfg fits %dx%d@%d (need %u kbit/s; sink %u kbit/s x %u lan= es)\n", > + mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), > + req_bw, dp->link.max_rate, dp->link.max_num_lanes); > + return -EINVAL; > +} [Severity: Medium] Can spacemit_dp_bridge_atomic_check() and spacemit_dp_bridge_mode_valid() race with concurrent updates to dp->link and dp->dpcd because neither acquires dp->mode_lock? output_poll_execute() runs spacemit_dp_bridge_detect() under mode_config.mutex (without connection_mutex), and non-blocking commits run spacemit_dp_bridge_atomic_enable() on a workqueue without modeset locks: CPU0 CPU1 (kworker) spacemit_dp_bridge_atomic_check() spacemit_dp_bridge_atomic_enable() if (!dp->link.max_rate || ...) guard(mutex)(&dp->mode_lock); dp->link.max_rate =3D 0; dp->link.max_num_lanes =3D 0; for (i =3D 0; ...; i++) if (cfg->rate > dp->link.max_rate) continue; return -EINVAL; <-- commit fails instead of returning 0 with idx =3D -1 If dp->link.max_rate or dp->link.max_num_lanes is cleared after the initial check in spacemit_dp_bridge_atomic_check(), the loop filters out every table entry and fails the atomic check with -EINVAL. [ ... ] > +static int spacemit_dp_dev_init(struct spacemit_dp_dev *dp) > +{ > + int ret; > + > + /* The PHY parks its lanes and PLLs for the reset below. */ > + ret =3D phy_reset(dp->phy); > + if (ret) > + return ret; > + > + /* Reset Controller and PHY */ > + regmap_write_bits(dp->regs, DP_SOFT_RESET, DP_CONTROLLER_RESET, > + FIELD_PREP(DP_CONTROLLER_RESET, 0x1)); > + regmap_write_bits(dp->regs, DP_SOFT_RESET, DP_PHY_RESET, > + FIELD_PREP(DP_PHY_RESET, 0x1)); [ ... ] > + ret =3D spacemit_dp_set_plls(dp, SPACEMIT_DP_LINK_RATE_2_70, 148500); > + if (ret) > + return ret; > + > + ret =3D spacemit_dp_phy_set_lanes(dp, SPACEMIT_DP_LANE_2); > + if (ret) > + return ret; > + > + ret =3D spacemit_dp_phy_on(dp); > + if (ret) > + return ret; > + > + return phy_calibrate(dp->phy); > +} [Severity: High] Does pulsing DP_PHY_RESET in spacemit_dp_dev_init() wipe the PHY PREPLL registers while the clock framework still caches 148500000 Hz? On eDP, spacemit_dp_probe() calls spacemit_dp_dev_init(), which calls clk_set_rate(dp->pll_clk, 148500000) to program the PREPLL registers and cache p->pxclk_rate =3D 148500000 in phy-k3-inno-dp. When spacemit_dp_bind() calls spacemit_dp_dev_init() a second time (or on a component rebind), DP_PHY_RESET resets the PREPLL registers to their hardware defaults, but clk_set_rate(dp->pll_clk, 148500000) sees the rate unchanged and returns 0 without calling k3_inno_dp_pxclk_set_rate(). spacemit_dp_phy_on() and any subsequent 148.5 MHz modeset then power on PREPLL with its post-reset register defaults. > +static int spacemit_dp_bind(struct device *dev, struct device *master, > + void *data) > +{ > + struct spacemit_dp_dev *dp =3D dev_get_drvdata(dev); > + struct drm_device *drm =3D data; > + struct device_node *ep; > + int ret; > + > + dp->drm =3D drm; > + dp->aux.drm_dev =3D drm; > + ret =3D drm_dp_aux_register(&dp->aux); > + if (ret) { > + dev_err_probe(dev, ret, "failed to register DP AUX\n"); > + goto err_drm; > + } [Severity: Medium] Does registering dp->aux before spacemit_dp_dev_init() expose the AUX device and I2C adapter while the controller and MPLL are uninitialized or being reset without dp->aux.hw_mutex? drm_dp_aux_register() publishes /dev/drm_dp_aux* and the I2C-over-AUX adapter before spacemit_dp_dev_init() runs below. Neither spacemit_dp_dev_init() (which powers down MPLL via phy_reset() and asserts DP_CONTROLLER_RESET and DP_AUX_RESET) nor spacemit_dp_set_plls() in spacemit_dp_bridge_atomic_enable() (which power-cycles the MPLL supplying the 16 MHz AUX clock after spacemit_dp_link_disable() releases dp->aux.hw_mutex) holds dp->aux.hw_mutex, racing with concurrent userspace AUX or DDC transfers. [ ... ] > + ret =3D spacemit_dp_dev_init(dp); > + > + /* > + * Also after a failed bring-up, which may have left the PHY on. Not > + * spacemit_dp_hw_disable(): see spacemit_dp_unbind(). > + */ > + spacemit_dp_link_disable(dp); > + if (ret) > + goto err_encoder; > + > + dp->connector_status =3D spacemit_dp_hw_detect_hpd(dp); > + > + if (dp->connector_status =3D=3D connector_status_connected) > + spacemit_dp_hw_read_sink_caps(dp); [Severity: Medium] Should spacemit_dp_bind() skip spacemit_dp_hw_detect_hpd() and the second spacemit_dp_dev_init() on eDP? On eDP, spacemit_dp_probe() has just run spacemit_dp_dev_init() and spacemit_dp_link_disable() before populating the AUX bus, so repeating them in spacemit_dp_bind() adds another ~150 ms of synchronous reset and PHY calibration delay. spacemit_dp_bind() then checks spacemit_dp_hw_detect_hpd() and calls spacemit_dp_hw_read_sink_caps() without checking !dp->edp_mode, even though DP_HPD_IN_STATUS is noisy on eDP and an unpowered panel with a non-AUX backlight can time out on those DPCD reads. [ ... ] > +/* Leave the DRM device, or power down a controller that never joined on= e. */ > +static void spacemit_dp_unregister(struct spacemit_dp_dev *dp) > +{ > + if (dp->component_added) > + component_del(dp->dev, &spacemit_dp_ops); > + > + /* The device is going away; its next probe resets the block. */ > + spacemit_dp_hw_disable(dp); > +} [Severity: Medium] During driver unbind on eDP, does spacemit_dp_remove() -> spacemit_dp_unregister() tear down the component and PHY before devres depopulates the DP AUX bus? spacemit_dp_probe() registers AUX bus depopulation via devm_of_dp_aux_populate_bus(), which runs during devres_release_all() after spacemit_dp_remove() returns: CPU0 CPU1 (deferred probe work) spacemit_dp_remove() spacemit_dp_unregister() if (dp->component_added) spacemit_dp_hw_disable() phy_exit(dp->phy) dp_aux_ep_probe() spacemit_dp_edp_link_panel() component_add(dp->dev, ...) dp->component_added =3D true; devres_release_all() of_dp_aux_depopulate_bus_void() /* dp is freed with component still on component_list */ Even without a racing deferred panel probe, spacemit_dp_hw_disable() exits the PHY and stops the MPLL AUX clock while the AUX child panel device is still bound. [ ... ] > + /* > + * The PHY exposes its PLL as the APMU pixel-clock mux's external > + * parent. > + */ > + dp->pll_clk =3D devm_clk_get(dev, "pll"); > + if (IS_ERR(dp->pll_clk)) > + return dev_err_probe(dev, PTR_ERR(dp->pll_clk), > + "failed to get PHY pixel clock\n"); > + > + ret =3D clk_set_parent(dp->pxclk, dp->pll_clk); > + if (ret) > + return dev_err_probe(dev, ret, > + "failed to route the pixel mux to the PHY PLL\n"); [Severity: High] Does clk_set_parent(dp->pxclk, dp->pll_clk) always fail with -EINVAL on K3? In drivers/clk/spacemit/ccu-k3.c, both edp0_pclk_parents[] and edp1_pclk_parents[] declare their second parent with CCU_PARENT_NAME(external_clk) (.fw_name =3D "external_clk"), whereas the spacemit,k3-syscon-apmu binding and DT node name those clock inputs "edp0_pll_pxclk" and "edp1_pll_pxclk": drivers/clk/spacemit/ccu-k3.c: static const struct clk_parent_data edp0_pclk_parents[] =3D { CCU_PARENT_HW(lcd_pxclk), CCU_PARENT_NAME(external_clk), }; When clk_set_parent() resolves edp0_pxclk or edp1_pxclk's external parent via clk_core_get(), of_parse_clkspec() looks up "external_clk" in the APMU node's clock-names, fails to match dp->pll_clk, and aborts spacemit_dp_probe() with -EINVAL. [ ... ] > +static void spacemit_dp_shutdown(struct platform_device *pdev) > +{ > + struct spacemit_dp_dev *dp =3D platform_get_drvdata(pdev); > + > + /* Not under mode_lock: the modeset that the work starts takes it. */ > + disable_work_sync(&dp->modeset_retry_work); > + > + /* The DRM device may still be there and enabling the output. */ > + guard(mutex)(&dp->mode_lock); > + spacemit_dp_hw_disable(dp); > +} [Severity: Medium] Can calling spacemit_dp_hw_disable() in spacemit_dp_shutdown() run phy_exit() before the DPU master device shuts down its KMS pipeline? Because the DP/eDP platform devices are registered after the DPU devices, device_shutdown() runs spacemit_dp_shutdown() before spacemit_dpu_shutdown() runs drm_atomic_helper_shutdown(). spacemit_dp_hw_disable() calls phy_exit(dp->phy), which powers down the PHY bandgap, LDOs, and MPLL (stopping the 16 MHz AUX clock) and drops phy->init_count to 0. Any subsequent AUX transfer during panel disable in drm_atomic_helper_shutdown() will time out, and any in-flight spacemit_dp_bridge_atomic_enable() that acquires dp->mode_lock after spacemit_dp_shutdown() will call phy_power_on() with phy->init_count =3D=3D= 0. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129-k3-display= -v4-0-ce6cf7988202@gmail.com?part=3D11