Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 12 additions & 2 deletions drivers/gpu/drm/apple/dcp-fabric.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,10 @@ static int dcp_typec_route_activate(struct apple_dcp_typec_route *route,
if (xbar == route->xbar && dcp_typec_route_no_dp_alt(route))
return -EOPNOTSUPP;

ret = dcp_ext_idle_wake(dcp);
if (ret)
return ret;

dcp_firmware_metadata_connection(dcp, READ_ONCE(dcp->typec_generation), false);

/*
Expand All @@ -685,14 +689,18 @@ static int dcp_typec_route_activate(struct apple_dcp_typec_route *route,
* (a no-op otherwise), or connecting the borrowed route returns early.
*/
ret = dcp_dptx_disconnect(dcp, 0);
if (ret)
if (ret) {
dcp_ext_idle_kick(dcp);
return ret;
}

if (dcp->fixed_route_selected) {
ret = mux_control_deselect(dcp->fixed_xbar);
dcp->fixed_route_selected = false;
if (ret)
if (ret) {
dcp_ext_idle_kick(dcp);
return ret;
}
}

/*
Expand Down Expand Up @@ -749,6 +757,7 @@ static int dcp_typec_route_activate(struct apple_dcp_typec_route *route,
"failed to restore fixed display route: %d\n",
restore_ret);
}
dcp_ext_idle_kick(dcp);
return ret;
}

Expand Down Expand Up @@ -905,6 +914,7 @@ static int dcp_typec_route_deactivate(struct apple_dcp_typec_route *route)
ended_attachment = dcp_modes_end_typec(dcp, route);
if (dcp->active_typec_route == route)
dcp->active_typec_route = NULL;
dcp_ext_idle_kick(dcp);

if (connector && connector->dcp == to_platform_device(dcp->dev)) {
/*
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/apple/dcp-fabric.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ void dcp_fabric_shutdown_dptx(struct apple_dcp *dcp);
/* DPTX operations supplied by the DCP firmware layer. */
int dcp_dptx_connect(struct apple_dcp *dcp, u32 port);
int dcp_dptx_disconnect(struct apple_dcp *dcp, u32 port);
int dcp_ext_idle_wake(struct apple_dcp *dcp);
void dcp_ext_idle_kick(struct apple_dcp *dcp);
bool dcp_is_external_h17p(struct apple_dcp *dcp);
bool dcp_is_retained_external(struct apple_dcp *dcp);

Expand Down
15 changes: 15 additions & 0 deletions drivers/gpu/drm/apple/dcp-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,21 @@ struct apple_dcp {
bool active;
/* A successful initial enable keeps the H17P pipe running across DPMS. */
bool pipe_enabled_h17p;
/* External DCP runtime idle power-gating (when no display/cable attached) */
struct mutex ext_idle_lock;
struct delayed_work ext_idle_wq;
enum {
DCP_EXT_IDLE_ON,
DCP_EXT_IDLE_OFF,
DCP_EXT_IDLE_FAILED,
DCP_EXT_IDLE_CLOSED,
} ext_idle_state;
int ext_idle_err;
bool ext_idle_armed;
bool ext_idle_paused;
bool ext_idle_domains_off;
bool ext_idle_initialized;

/* Messages from the coprocessor are held in the mailbox for sleep. */
bool rx_held;

Expand Down
Loading
Loading