Skip to content
Merged
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
7 changes: 7 additions & 0 deletions drivers/gpu/drm/apple/connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ static void dcp_connector_set_dict(struct apple_connector *connector,
void dcp_connector_update_dict(struct apple_connector *connector, const char *key,
struct dcp_chunks *chunks)
{
if (!connector) {
kvfree(chunks->data);
chunks->data = NULL;
chunks->length = 0;
return;
}

mutex_lock(&connector->chunk_lock);
if (!strcmp(key, "ColorElements"))
dcp_connector_set_dict(connector, &connector->color_elements, chunks);
Expand Down
40 changes: 21 additions & 19 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5173,32 +5173,15 @@ int dcp_start(struct platform_device *pdev)
if (ret) {
dev_warn(dcp->dev, "Failed to start DPTX endpoint: %d\n",
ret);
} else if (dcp->rtkit_adopted &&
dptx_service_available(&dcp->dptxport[0])) {
/*
* The boot stage that handed this DCP over left the
* port's display up on a link it trained. Release it,
* so that the next connect trains the link and reads
* the sink again: until then the firmware only has its
* default modes and no EDID. Its HPD goes low as well;
* dcp_dptx_connect() raises it again after the link wait,
* so that the firmware sees the display plugged.
*/
ret = dptxport_set_hpd(dcp->dptxport[0].service, false);
if (!ret)
ret = dptxport_release_display(dcp->dptxport[0].service);
if (ret)
dev_warn(dcp->dev, "adopted DPTX display not released: %d\n",
ret);
ret = 0;
#ifdef DCP_DPTX_DISCONNECT_ON_INIT
/*
* This disconnect / connect cycle on init is only necessary
* when using dcp0 on j473, j474s and presumedly j475c.
* Since dcp0 is not used at the moment let's avoid this
* since it is possibly the cause for startup issues.
*/
} else if (dptx_service_available(&dcp->dptxport[0])) {
} else if (!dcp->rtkit_adopted &&
dptx_service_available(&dcp->dptxport[0])) {
bool connected;
/* force disconnect on start - necessary if the display
* is already up from m1n1
Expand All @@ -5224,6 +5207,25 @@ int dcp_start(struct platform_device *pdev)
return ret;
}

if (dcp->rtkit_adopted && dptx_service_available(&dcp->dptxport[0])) {
/*
* The boot stage that handed this DCP over left the port's
* display up on a link it trained. Release it after IOMFB is
* up so firmware observes the disconnect and delivers the
* connect hotplug on the next connect, which trains the link
* and reads the sink again. Its HPD goes low as well;
* dcp_dptx_connect() raises it again, so that the firmware
* sees the display plugged.
*/
ret = dptxport_set_hpd(dcp->dptxport[0].service, false);
if (!ret)
ret = dptxport_release_display(dcp->dptxport[0].service);
if (ret)
dev_warn(dcp->dev, "adopted DPTX display not released: %d\n",
ret);
ret = 0;
}

/* On the board they have run on; elsewhere these endpoints are not started, as before. */
if (dcp->v27_j714s && !dcp->external && dcp_has_panel(dcp)) {
ret = panelavep_init(dcp);
Expand Down
23 changes: 18 additions & 5 deletions drivers/gpu/drm/apple/epic/dpavservep-identity-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ static const struct dpavid_case dpavid_cases[] = {
"DCPDPService", 3, 3, false },

/*
* AFKV2 on the classic DPAV endpoint: the MCDP29xx converters and the
* M3/M4 Airs' generic DCPDP13Service, with EPICUnit 0 and a bounded
* dynamic interface-id. AppleDCPDP2HDMI and the other classes stay refused.
* AFKV2 on the classic DPAV endpoint: the MCDP29xx/PS186 converters
* and the generic external DP classes (DCPDP13Service, DCPDPService),
* with EPICUnit 0 and a bounded dynamic interface-id. AppleDCPDP2HDMI
* and other classes stay refused.
*/
{ "v2 ep 0x28: DP13 unit 0", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPDP13Service", 0, 7, true },
Expand All @@ -75,6 +76,10 @@ static const struct dpavid_case dpavid_cases[] = {
"AppleDCPMCDP2900", 0, 1, true },
{ "v2 ep 0x28: MCDP2900 unit 1", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"AppleDCPMCDP2900", 1, 1, false },
{ "v2 ep 0x28: PS186 unit 0", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"AppleDCPPS186", 0, 5, true },
{ "v2 ep 0x28: PS186 unit 1", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"AppleDCPPS186", 1, 5, false },
{ "v2 ep 0x28: other MCDP part", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"AppleDCPMCDP2800", 0, 1, false },
{ "v2 ep 0x28: unit 0, channel at u16 max", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
Expand All @@ -87,8 +92,16 @@ static const struct dpavid_case dpavid_cases[] = {
"DCPDP13Service", 0, 0x10000, false },
{ "v2 ep 0x28: no class", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
NULL, 0, 7, false },
{ "v2 ep 0x28: DCPDPService class", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPDPService", 0, 7, false },
{ "v2 ep 0x28: DCPDPService unit 0", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPDPService", 0, 7, true },
{ "v2 ep 0x28: DCPDPService unit 1", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPDPService", 1, 7, false },
{ "v2 ep 0x28: DCPDPService channel 0", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPDPService", 0, 0, false },
{ "v2 ep 0x28: DCPDPService channel over u16", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPDPService", 0, 0x10000, false },
{ "v2 ep 0x28: unknown class", DPAVID_V2, DPAVSERV_ENDPOINT, DPAVID_NAME,
"DCPUnknownService", 0, 7, false },

/* AFKV2 on any other endpoint. */
{ "v2 other endpoint", DPAVID_V2, 0x29, DPAVID_NAME, "DCPDP13Service", 0, 7, false },
Expand Down
20 changes: 12 additions & 8 deletions drivers/gpu/drm/apple/epic/dpavservep.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ static bool dcpavserv_hdr_class(const char *class)
!strcmp(class, "DCPDPService") ||
!strcmp(class, "AppleDCPDP2HDMI") ||
!strcmp(class, "AppleDCPMCDP29XX") ||
!strcmp(class, "AppleDCPMCDP2900"));
!strcmp(class, "AppleDCPMCDP2900") ||
!strcmp(class, "AppleDCPPS186"));
}

static bool dcpavserv_identity(struct apple_epic_service *service, const char *name,
Expand All @@ -63,17 +64,20 @@ static bool dcpavserv_identity(struct apple_epic_service *service, const char *n
return (!strcmp(class, "AppleDCPDP2HDMI") ||
!strcmp(class, "DCPDP13Service")) && unit == service->channel;
/*
* Firmware 27 names an MCDP29xx DP-to-HDMI converter's AV service after
* its part (the M2 Mac mini's HDMI port, USB-C to HDMI adapters) and
* announces it on the classic DPAV endpoint with EPICUnit 0; its
* interface-id (the channel) is dynamic across reconnects. The M3 and
* M4 Airs' external processors announce the generic DCPDP13Service
* there the same way.
* Firmware 27 names DP-to-HDMI converter AV services after their part
* (MCDP29xx on M2 Mac mini HDMI and USB-C adapters, PS186 on USB-C to
* HDMI docks) and announces them on the classic DPAV endpoint with
* EPICUnit 0; the interface-id (the channel) is dynamic across
* reconnects. External display processors announce the generic
* DCPDP13Service (M3/M4 Air) and DCPDPService (M1 dcpext) there the
* same way.
*/
return service->ep->endpoint == DPAVSERV_ENDPOINT && unit == 0 &&
(!strcmp(class, "AppleDCPMCDP29XX") ||
!strcmp(class, "AppleDCPMCDP2900") ||
!strcmp(class, "DCPDP13Service"));
!strcmp(class, "AppleDCPPS186") ||
!strcmp(class, "DCPDP13Service") ||
!strcmp(class, "DCPDPService"));
}

static bool dcpavserv_admission_current(struct apple_dcp *dcp, u64 generation)
Expand Down
Loading