diff --git a/drivers/gpu/drm/apple/connector.c b/drivers/gpu/drm/apple/connector.c index e3c8c876a215a..550f396bb4ec3 100644 --- a/drivers/gpu/drm/apple/connector.c +++ b/drivers/gpu/drm/apple/connector.c @@ -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); diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index d2a97ff93f641..509d4297367da 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -5173,24 +5173,6 @@ 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 @@ -5198,7 +5180,8 @@ int dcp_start(struct platform_device *pdev) * 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 @@ -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); diff --git a/drivers/gpu/drm/apple/epic/dpavservep-identity-test.c b/drivers/gpu/drm/apple/epic/dpavservep-identity-test.c index 584b37ccd4ff1..ee2d7da9b3818 100644 --- a/drivers/gpu/drm/apple/epic/dpavservep-identity-test.c +++ b/drivers/gpu/drm/apple/epic/dpavservep-identity-test.c @@ -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 }, @@ -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, @@ -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 }, diff --git a/drivers/gpu/drm/apple/epic/dpavservep.c b/drivers/gpu/drm/apple/epic/dpavservep.c index de678ef34b675..5d48bcc23cb34 100644 --- a/drivers/gpu/drm/apple/epic/dpavservep.c +++ b/drivers/gpu/drm/apple/epic/dpavservep.c @@ -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, @@ -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)