Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
7e8f0dc
drm/apple: audio: keep the DP audio domain while its DCP firmware runs
RyanTheTide Nov 23, 2026
1693055
tools/asahi: test the DP audio domain hold for a sleep
RyanTheTide Nov 23, 2026
d64d981
drm/apple: audio: hold the DP audio domain only while the DCP firmwar…
RyanTheTide Nov 23, 2026
19f90d0
tools/asahi: model the DCP's firmware-runs flag in the retained-sleep…
RyanTheTide Nov 23, 2026
002e507
drm/apple: dcp: say dcp_sleep_keeps_firmware() is for late suspend only
RyanTheTide Nov 23, 2026
3437a5a
drm/apple: dcp: keep the DP PHY of a DCP whose firmware runs through …
RyanTheTide Nov 24, 2026
c672252
tools/asahi: test the DCP sleep PHY hold
RyanTheTide Nov 24, 2026
2267280
drm/apple: dcp: keep a still-attached HDMI link through a sleep
RyanTheTide Nov 24, 2026
245f899
tools/asahi: stub the DP PHY hold in the dcpext26 suspend route test
RyanTheTide Nov 24, 2026
702e0c3
drm/apple: read the sleep PHYs under the fabric lock
RyanTheTide Nov 24, 2026
1274718
arm64: dts: apple: t8112: allow the display PHY domains to wake
RyanTheTide Nov 24, 2026
31ba92a
drm/apple: dcp: release an HDMI display unplugged during a sleep
RyanTheTide Nov 24, 2026
ca69a30
arm64: dts: apple: revert T8112 display PHY wakeup flags
RyanTheTide Nov 24, 2026
8781980
Merge integration/aurora into m2mini/dpaudio-sleep-hold
RyanTheTide Nov 24, 2026
be35165
drm/apple: serialize HDMI resume unplug with route assignment
RyanTheTide Nov 24, 2026
d2e7b95
Merge remote-tracking branch 'aurora/integration/aurora' into HEAD
RyanTheTide Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion drivers/gpu/drm/apple/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,39 @@ static __maybe_unused int dcpaud_system_suspend(struct device *dev)
return 0;
}

/*
* The DCP's firmware drives this block. A DCP that keeps its coprocessor
* running through a sleep keeps its own power domains for it, and this
* block's domain must stay with them: cutting it at noirq under running DCP
* firmware resets the machine. A DCP that stops its firmware for the sleep
* needs nothing held here, so the domain goes down as before. A DCP device
* without a driver may still run firmware that a boot stage or an earlier
* bind left running, so its block is kept too. Every device's .suspend has
* run before this late phase, so the DCP's choice is known
* (dcp_sleep_keeps_firmware()).
*/
static __maybe_unused int dcpaud_suspend_late(struct device *dev)
{
struct device_node *endpoint, *dcp_node = NULL;
struct platform_device *dcp_pdev = NULL;

endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
if (endpoint) {
dcp_node = of_graph_get_remote_port_parent(endpoint);
of_node_put(endpoint);
}
if (dcp_node && of_device_is_available(dcp_node))
dcp_pdev = of_find_device_by_node(dcp_node);
of_node_put(dcp_node);
if (dcp_pdev) {
if (dcp_sleep_keeps_firmware(&dcp_pdev->dev))
device_set_wakeup_path(dev);
put_device(&dcp_pdev->dev);
}

return pm_runtime_force_suspend(dev);
}

/*
* Runtime PM stops in the late phase and comes back in the early one, so it
* works through every device's .suspend and .resume. The display resumes
Expand All @@ -2083,7 +2116,7 @@ static __maybe_unused int dcpaud_system_suspend(struct device *dev)
static const struct dev_pm_ops dcpaud_pm_ops = {
.prepare = pm_sleep_ptr(dcpaud_pm_prepare),
SYSTEM_SLEEP_PM_OPS(dcpaud_system_suspend, NULL)
LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
LATE_SYSTEM_SLEEP_PM_OPS(dcpaud_suspend_late, pm_runtime_force_resume)
RUNTIME_PM_OPS(dcpaud_suspend, dcpaud_resume, NULL)
};

Expand Down
52 changes: 50 additions & 2 deletions drivers/gpu/drm/apple/dcp-fabric.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,12 +1213,12 @@ static void dcp_hdmi_capacity_available(void *ctx)
* never tracked: when the hold expires, the desktop has let the HDMI CRTC go
* and the hybrid is free for a Type-C display again.
*/
void dcp_fabric_hdmi_unplugged(struct apple_dcp *dcp)
static void dcp_fabric_hdmi_unplugged_locked(struct apple_dcp *dcp)
{
unsigned long flags;
u64 generation;

guard(mutex)(&dcp_typec_fabric_lock);
lockdep_assert_held(&dcp_typec_fabric_lock);
generation = dcp_hdmi_edge(dcp);
if (!generation)
return;
Expand All @@ -1230,6 +1230,31 @@ void dcp_fabric_hdmi_unplugged(struct apple_dcp *dcp)
dcp_fabric_hybrid_kick(dcp, 0);
}

void dcp_fabric_hdmi_unplugged(struct apple_dcp *dcp)
{
guard(mutex)(&dcp_typec_fabric_lock);
dcp_fabric_hdmi_unplugged_locked(dcp);
}

/*
* Release a fixed HDMI link unplugged while its HPD IRQ was masked. Hold
* the fabric lock from the ownership check through the presence update so
* a Type-C route cannot take the same DPTX port during the release.
*/
void dcp_hdmi_unplugged_in_sleep(struct apple_dcp *dcp)
{
guard(mutex)(&dcp_typec_fabric_lock);

if (dcp->active_typec_route || !dcp->connector ||
!READ_ONCE(dcp->connector->connected) ||
gpiod_get_value_cansleep(dcp->hdmi_hpd) != 0)
return;

dev_info(dcp->dev, "HDMI display unplugged during sleep\n");
dcp_hdmi_disconnect(dcp);
dcp_fabric_hdmi_unplugged_locked(dcp);
}

static void dcp_hdmi_settle_work(struct work_struct *work)
{
struct apple_dcp *dcp = container_of(to_delayed_work(work),
Expand Down Expand Up @@ -4995,6 +5020,29 @@ int dcp_register_typec_routes(struct apple_dcp *dcp)
return dcp_fabric_run_probe(!!routes, dcp_register_typec_routes_present, &ctx);
}

/*
* A DCP whose firmware runs through a sleep keeps driving the DP PHY of its
* output, so the PHY's power domain has to stay up with the DCP's own: cut at
* noirq under the running firmware, it resets the SoC (J473, firmware 27.2).
* Put the PHY devices in use on the wakeup path, as the DCP itself is.
*/
static void dcp_phy_set_wakeup_path(struct phy *phy)
{
if (!IS_ERR_OR_NULL(phy) && phy->dev.parent)
device_set_wakeup_path(phy->dev.parent);
}

void dcp_sleep_hold_phys(struct apple_dcp *dcp)
{
struct apple_dcp_typec_route *route;

guard(mutex)(&dcp_typec_fabric_lock);
route = dcp->active_typec_route;
dcp_phy_set_wakeup_path(dcp->phy);
if (route)
dcp_phy_set_wakeup_path(route->phy);
}

/*
* A sleep that reaches its commit powers the crossbar off. Take the output of a direct
* route down while it still has power, as a released display's is, and select it again
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/apple/dcp-fabric.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ bool dcp_is_t8132_ext(const struct apple_dcp *dcp);

/* DCP probe, resume and endpoint teardown hooks. */
int dcp_register_typec_routes(struct apple_dcp *dcp);
void dcp_sleep_hold_phys(struct apple_dcp *dcp);
void dcp_typec_route_park(struct apple_dcp *dcp);
void dcp_typec_route_unpark(struct apple_dcp *dcp);
int dcp_fabric_sleep_release(struct apple_dcp *dcp, s64 ms[2]);
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/apple/dcp-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,12 @@ struct apple_dcp {
struct delayed_work secure_poll_wq;
/* Stopped and not restarted, which outlives a suspend that gets refused. */
bool s2r_fw_down;
/*
* Its last system suspend left the firmware running and its domains on
* (wakeup path), see dcp_sleep_keeps_firmware(). Cleared by the next
* suspend and resume.
*/
bool sleep_fw_runs;
/* DCPEXT kept down through a dark wake, see dcp_s2r_dark_finish(). */
bool s2r_dark_held;
struct notifier_block s2r_pm_nb;
Expand Down
60 changes: 59 additions & 1 deletion drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10053,10 +10053,37 @@ static void dcp_t8132_sleep_stopped(struct apple_dcp *dcp)
WRITE_ONCE(dcp->t8132_release_late, false);
}

/**
* dcp_sleep_keeps_firmware - whether a DCP's firmware runs through this sleep
* @dev: the DCP device
*
* For blocks the DCP's firmware drives (DP audio), from their late suspend,
* after every device's .suspend. It takes the DCP's device lock, which can
* sleep, so it is not for the noirq phase. True when the DCP's suspend left
* its coprocessor running with its domains on, or when no driver is bound
* (a boot stage or an earlier bind may have left the firmware running).
* False when the suspend stopped the firmware (S2R, the 27.x sleep, an M4
* stop or power gate) or never ran it.
*/
bool dcp_sleep_keeps_firmware(struct device *dev)
{
struct apple_dcp *dcp;
bool runs;

device_lock(dev);
dcp = dev->driver ? dev_get_drvdata(dev) : NULL;
runs = !dev->driver || (dcp && dcp->sleep_fw_runs);
device_unlock(dev);

return runs;
}
EXPORT_SYMBOL_GPL(dcp_sleep_keeps_firmware);

static int dcp_platform_suspend(struct device *dev)
{
struct apple_dcp *dcp = dev_get_drvdata(dev);

dcp->sleep_fw_runs = false;
/* Its power sequences may crash the DCP and blank the panel. */
if (dcp_takeover_was_aborted(dcp))
return -EBUSY;
Expand Down Expand Up @@ -10115,7 +10142,10 @@ static int dcp_platform_suspend(struct device *dev)
return ret;
}
dcp_t8132_sleep_stopped(dcp);
dcp->sleep_fw_runs = !iomfb_m4_sleep_stopped(dcp);
device_set_wakeup_path(dev);
if (dcp->sleep_fw_runs)
dcp_sleep_hold_phys(dcp);
return 0;
}
if (dcp_is_ext26(dcp) && pm_suspend_target_state != PM_SUSPEND_TO_IDLE) {
Expand Down Expand Up @@ -10170,7 +10200,9 @@ static int dcp_platform_suspend(struct device *dev)
/* Pair with the H17P unpark; native26 has its own retained resume. */
if (dcp_is_external_h17p(dcp))
dcp_typec_route_park(dcp);
dcp->sleep_fw_runs = true;
device_set_wakeup_path(dev);
dcp_sleep_hold_phys(dcp);
if (dcp_is_ext26(dcp))
dev_dbg(dev, "native26 retained s2idle stop; firmware and supplier leases held\n");
return 0;
Expand All @@ -10193,7 +10225,21 @@ static int dcp_platform_suspend(struct device *dev)

if (dcp->hdmi_hpd_irq) {
disable_irq(dcp->hdmi_hpd_irq);
if (!dcp->active_typec_route) {
/*
* The firmware runs through this sleep, so the HDMI output
* keeps its link as through DPMS off (see dcp_poweroff()), and
* resume lights it again through dcp_poweron(). Only a display
* that is gone is reported and released here. Releasing one
* that stays attached reports it unplugged, and nothing
* connects it again after the wake: its HPD stays high, so no
* edge comes, and a CRTC userspace turned off for the unplug
* never runs dcp_poweron(). A T6030 native output's resume sets
* its PHY and crossbar up again (dcp_fabric_hdmi_reinit()),
* which needs the link down, so it is still released.
*/
if (!dcp->active_typec_route &&
(dcp->external_native ||
gpiod_get_value_cansleep(dcp->hdmi_hpd) <= 0)) {
disconnected_hpd_event(dcp->connector);
dcp_dptx_disconnect(dcp, 0);
}
Expand All @@ -10203,17 +10249,26 @@ static int dcp_platform_suspend(struct device *dev)
* domains to stay on. We need this as we do not support full
* shutdown properly yet.
*/
dcp->sleep_fw_runs = true;
device_set_wakeup_path(dev);
dcp_sleep_hold_phys(dcp);
/* Last: the steps above still talk to the coprocessor. */
dcp_hold_for_sleep(dcp);

return 0;
}

void dcp_hdmi_disconnect(struct apple_dcp *dcp)
{
disconnected_hpd_event(dcp->connector);
dcp_dptx_disconnect(dcp, 0);
}

static int dcp_platform_resume(struct device *dev)
{
struct apple_dcp *dcp = dev_get_drvdata(dev);

dcp->sleep_fw_runs = false;
if (dcp_takeover_was_aborted(dcp))
return 0;
if (dcp_is_iboot(dcp))
Expand Down Expand Up @@ -10257,6 +10312,9 @@ static int dcp_platform_resume(struct device *dev)
/* The HDMI output's PHY and crossbar may have lost their setup in sleep. */
if (dcp->external_native)
dcp_fabric_hdmi_reinit(dcp, "after system sleep");
/* Before the HPD IRQ comes back: an edge from now on is replayed. */
if (dcp->hdmi_hpd_irq)
dcp_hdmi_unplugged_in_sleep(dcp);
/* Observe future edges before sampling any edges lost in sleep. */
if (dcp->hdmi_hpd_irq)
dcp_fabric_run_resume(&dcp_resume_ops, dcp);
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/apple/dcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct apple_encoder {
#define to_apple_encoder(x) container_of(x, struct apple_encoder, base)

void dcp_poweroff(struct platform_device *pdev);
bool dcp_sleep_keeps_firmware(struct device *dev);
int dcp_typec_prepare_route(struct apple_dcp *dcp);
void dcp_poweron(struct platform_device *pdev);
void dcp_external_recover(struct platform_device *pdev);
Expand Down Expand Up @@ -183,6 +184,8 @@ bool apple_t8122_25g83_board(void);

void dcp_typec_hybrid_first_dt(void);
void dcp_fabric_hdmi_unplugged(struct apple_dcp *dcp);
void dcp_hdmi_unplugged_in_sleep(struct apple_dcp *dcp);
void dcp_hdmi_disconnect(struct apple_dcp *dcp);
void dcp_fabric_hybrid_kick(struct apple_dcp *dcp, unsigned int delay_ms);
void dcp_hdmi_yield_link(struct apple_dcp *dcp);
void dcp_link_recovery_schedule(struct apple_dcp *dcp);
Expand Down
17 changes: 17 additions & 0 deletions drivers/gpu/drm/apple/iomfb_m4.c
Original file line number Diff line number Diff line change
Expand Up @@ -5836,6 +5836,23 @@ bool iomfb_m4_ext_stopped(struct apple_dcp *owner)
return stopped;
}

/*
* Its CPU is down for the sleep: an external DCP stopped for a deep sleep, or
* an internal one powered down with its domains (iomfb_m4_power_gate()).
*/
bool iomfb_m4_sleep_stopped(struct apple_dcp *owner)
{
struct iomfb_m4 *dcp = owner->v26_6;
bool stopped;

if (!dcp)
return false;
mutex_lock(&dcp->lock);
stopped = dcp->ext_stopped || dcp->gated;
mutex_unlock(&dcp->lock);
return stopped;
}

/* apple-drm, a consumer of this device, has blanked the panel before this. */
int iomfb_m4_suspend(struct apple_dcp *owner)
{
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/apple/iomfb_m4.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ void iomfb_m4_ext_relink_lost(struct apple_dcp *dcp);
void iomfb_m4_ext_relink_wait(struct apple_dcp *dcp, unsigned long deadline);
int iomfb_m4_ext_relink_end(struct apple_dcp *dcp);
bool iomfb_m4_ext_stopped(struct apple_dcp *dcp);
bool iomfb_m4_sleep_stopped(struct apple_dcp *dcp);

/* The caller has waited for the producer fence before publishing the DMA GEM. */
int iomfb_m4_present(struct apple_dcp *dcp, struct drm_framebuffer *fb,
Expand Down Expand Up @@ -164,6 +165,7 @@ static inline void iomfb_m4_ext_relink_lost(struct apple_dcp *dcp) { }
static inline void iomfb_m4_ext_relink_wait(struct apple_dcp *dcp, unsigned long deadline) { }
static inline int iomfb_m4_ext_relink_end(struct apple_dcp *dcp) { return 0; }
static inline bool iomfb_m4_ext_stopped(struct apple_dcp *dcp) { return false; }
static inline bool iomfb_m4_sleep_stopped(struct apple_dcp *dcp) { return false; }

static inline int iomfb_m4_present(struct apple_dcp *dcp, struct drm_framebuffer *fb,
dma_addr_t dva, size_t mapped)
Expand Down
Loading
Loading