From 7c2bf062aec8b800400a50d71674c1667516fb19 Mon Sep 17 00:00:00 2001 From: Allan Clempe Date: Mon, 30 Nov 2026 14:41:56 +1000 Subject: [PATCH 1/2] drm/apple: skip DCP sleep callbacks while the T6041 host stop has them down On T6041 the display subsystem's suspend stops every DCP and lowers their power words (dcp_t6041_s2r_all()). Each DCP platform device suspends after it, and dcp_platform_suspend() then took its firmware sleep paths against a DCP that is already powered off. A read behind a powered-off block stalls the CPU on this fabric and the SoC resets: every deep sleep reset the J616c in the device suspend phase, with pm_test=devices too. ext_dead didn't cover it, since the stop sets it only for a DCP whose firmware ran. dcp_platform_resume() runs before the display subsystem's resume and would touch the same blocks. Both callbacks now return while dcp_t6041_down is set; the display subsystem's resume starts every DCP afterwards. Signed-off-by: Allan Clempe --- drivers/gpu/drm/apple/dcp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index e90ac4e251c8e..1116dc2168c31 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -11412,11 +11412,22 @@ bool dcp_sleep_keeps_firmware(struct device *dev) } EXPORT_SYMBOL_GPL(dcp_sleep_keeps_firmware); +/* Set by the host-driven T6041 stop once every DCP is down; see dcp_t6041_s2r_step(). */ +static bool dcp_t6041_down; + static int dcp_platform_suspend(struct device *dev) { struct apple_dcp *dcp = dev_get_drvdata(dev); dcp->sleep_fw_runs = false; + /* + * The display subsystem's suspend already stopped this DCP and lowered its power words: + * its registers sit behind a powered-off block, and a read there stalls the CPU. + */ + if (READ_ONCE(dcp_t6041_down)) { + dev_info(dev, "T6041 S2R: down by the host stop, own suspend skipped\n"); + return 0; + } /* Its power sequences may crash the DCP and blank the panel. */ if (dcp_takeover_was_aborted(dcp)) return -EBUSY; @@ -11646,6 +11657,11 @@ static int dcp_platform_resume(struct device *dev) struct apple_dcp *dcp = dev_get_drvdata(dev); dcp->sleep_fw_runs = false; + /* Still down: the display subsystem's resume, after this one, starts every DCP. */ + if (READ_ONCE(dcp_t6041_down)) { + dev_info(dev, "T6041 S2R: still down by the host stop, own resume skipped\n"); + return 0; + } if (dcp_takeover_was_aborted(dcp)) return 0; if (dcp_is_iboot(dcp)) @@ -12882,7 +12898,7 @@ static int dcp_t6041_start_one(struct device *dev, void *data) return ret ?: ps_ret; } -static bool dcp_t6041_down, dcp_t6041_words; +static bool dcp_t6041_words; /* @np's first DART, dark or lit if its driver is bound. */ static int dcp_t6041_dart_dark(struct device_node *np, bool dark) From 3294c96db3b9ea1cc16aaeedb0491e251717f783 Mon Sep 17 00:00:00 2001 From: Allan Clempe Date: Mon, 30 Nov 2026 14:42:00 +1000 Subject: [PATCH 2/2] drm/apple: use the firmware 27 calls in the T6041 host-driven sleep dcp_t6041_stop_one() and dcp_t6041_recommit() sent the 26.6 desktop calls whatever the firmware. On DCP firmware 27 the AP-link release has its own tag in the v27 method table, the 26.6 one names a different method there and crashes each DCP, and _dcp_poweroff() does nothing for an internal panel, so the stop then timed out waiting for the display to go off. With DCP_FIRMWARE_V_27_0 the stop now powers the internal panel off with iomfb_s2r_power_v27() and keeps waiting for the firmware's display-off answer before the DART streams go off, releases the AP link with iomfb_s2r_500_v27() (refusing if the table has no tag for it), and the recommit powers the panel back on the same way. The dispatch follows the driver's existing fw_compat checks; T6040's steps are unchanged. Signed-off-by: Allan Clempe --- drivers/gpu/drm/apple/dcp.c | 65 +++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 1116dc2168c31..47f227b730ecc 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -12236,7 +12236,16 @@ static int dcp_t6041_stop_one(struct device *dev, void *data) reinit_completion(&dcp->s2r_dart_done); WRITE_ONCE(dcp->s2r_active, true); } - _dcp_poweroff(dcp); + if (dcp->fw_compat == DCP_FIRMWARE_V_27_0) { + ret = iomfb_s2r_power_v27(dcp, false, true, false); + if (ret) { + dcp_s2r_dart_end(dcp); + dev_err(dev, "no reply to set_power_state(0): %d\n", ret); + goto err_unwind; + } + } else { + _dcp_poweroff(dcp); + } powered_off = true; if (t6040) { if (iomfb_wait_channels_idle(dcp, 200)) @@ -12292,7 +12301,16 @@ static int dcp_t6041_stop_one(struct device *dev, void *data) goto err_unwind; } } - ret = iomfb_s2r_500_v26_6_desktop(dcp); + if (dcp->fw_compat == DCP_FIRMWARE_V_27_0) { + if (!dcp->v27_methods || !dcp->v27_methods[dcpep_unnamed_500].tag[0]) { + dev_err(dev, "no AP-link release tag in firmware 27 method table\n"); + ret = -EOPNOTSUPP; + goto err_unwind; + } + ret = iomfb_s2r_500_v27(dcp); + } else { + ret = iomfb_s2r_500_v26_6_desktop(dcp); + } if (ret) { dev_err(dev, "no reply to A500: %d\n", ret); goto err_unwind; @@ -12623,20 +12641,39 @@ static int dcp_t6041_recommit(struct apple_dcp *dcp) bool modeset; int ret; - reinit_completion(&dcp->s2r_hpd_done); - iomfb_poweron_v26_6_desktop(dcp); - if (dcp->desktop && dcp->desktop->poweron_result) { - dev_err(dcp->dev, "display power-on after the sleep failed (%u)\n", - dcp->desktop->poweron_result); - return dcp->desktop->poweron_result == 1 ? -ETIMEDOUT : -EIO; - } - if (!wait_for_completion_timeout(&dcp->s2r_hpd_done, msecs_to_jiffies(1000))) { - dev_err(dcp->dev, "no D575 hotplug %lld ms after power-on\n", + if (dcp->fw_compat == DCP_FIRMWARE_V_27_0) { + WRITE_ONCE(dcp->pipe_off, false); + WRITE_ONCE(dcp->afk_power_gen, dcp->afk_power_gen + 1); + WRITE_ONCE(dcp->s2r_dart_err, 0); + reinit_completion(&dcp->s2r_dart_done); + WRITE_ONCE(dcp->s2r_active, true); + ret = iomfb_s2r_power_v27(dcp, true, true, true); + if (ret) { + dcp_s2r_dart_end(dcp); + dev_err(dcp->dev, "display power-on after the sleep failed (%d)\n", ret); + return ret; + } + if (!wait_for_completion_timeout(&dcp->s2r_dart_done, + msecs_to_jiffies(DCP_S2R_D572_TIMEOUT_MS))) + dev_warn(dcp->dev, "no D572 %lld ms after power-on\n", + ktime_ms_delta(ktime_get(), start)); + dcp_s2r_dart_end(dcp); + } else { + reinit_completion(&dcp->s2r_hpd_done); + iomfb_poweron_v26_6_desktop(dcp); + if (dcp->desktop && dcp->desktop->poweron_result) { + dev_err(dcp->dev, "display power-on after the sleep failed (%u)\n", + dcp->desktop->poweron_result); + return dcp->desktop->poweron_result == 1 ? -ETIMEDOUT : -EIO; + } + if (!wait_for_completion_timeout(&dcp->s2r_hpd_done, msecs_to_jiffies(1000))) { + dev_err(dcp->dev, "no D575 hotplug %lld ms after power-on\n", + ktime_ms_delta(ktime_get(), start)); + return -ETIMEDOUT; + } + dev_dbg(dcp->dev, "D575 hotplug ready %lld ms after power-on\n", ktime_ms_delta(ktime_get(), start)); - return -ETIMEDOUT; } - dev_dbg(dcp->dev, "D575 hotplug ready %lld ms after power-on\n", - ktime_ms_delta(ktime_get(), start)); if (iomfb_wait_channels_idle(dcp, 200)) { dev_err(dcp->dev, "display calls still in flight after D575\n"); return -ETIMEDOUT;