From 59b1859fc369a15772d370ffa492b0a88f146a03 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Sat, 7 Nov 2026 20:07:43 -0500 Subject: [PATCH 01/10] iommu: apple-dart: adopt T8132 main external display handoff A T8132 main DCP wired to fixed HDMI uses six firmware segments and shares the retained SID 0/SID 16 frontend contract with the external display path. Qualify that layout from the available main DCP and its connector role. Validate its physical framebuffer separately from inherited mappings and preserve both frontend streams without a board-name gate. Signed-off-by: Sean Dolbec --- drivers/iommu/apple-dart-dcp-format.h | 17 +++++++++++++- drivers/iommu/apple-dart-dcp-shared.h | 12 ++++++---- drivers/iommu/apple-dart-dcp.h | 26 ++++++++++++++++---- drivers/iommu/apple-dart.c | 34 +++++++++++++++++++++++++-- 4 files changed, 78 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/apple-dart-dcp-format.h b/drivers/iommu/apple-dart-dcp-format.h index 52b853b59d973..a2344756b2111 100644 --- a/drivers/iommu/apple-dart-dcp-format.h +++ b/drivers/iommu/apple-dart-dcp-format.h @@ -54,6 +54,8 @@ struct dcp_adt_instance { static const u32 dcp_adt_kinds_internal[] = {1, 0, 10, 2, 2, 2, 2}; static const u32 dcp_adt_kinds_external[] = {1, 0, 10, 2}; +/* T8132 main external DCP (iop-dcp-nub lists six segments). */ +static const u32 dcp_adt_kinds_main_external[] = {1, 0, 10, 2, 2, 2}; static const struct dcp_adt_instance dcp_adt_internal = { .dart = "dart-dcp", @@ -65,6 +67,17 @@ static const struct dcp_adt_instance dcp_adt_internal = { .num_segments = ARRAY_SIZE(dcp_adt_kinds_internal), }; +/* Main external DCP: internal node names and six firmware segments. */ +static const struct dcp_adt_instance dcp_adt_main_external = { + .dart = "dart-dcp", + .dcp = "dcp", + .nub = "iop-dcp-nub", + .disp = "dart-disp0", + .segment_names = "__TEXT;__DATA;__OS_LOG;unknown;unknown;unknown", + .kinds = dcp_adt_kinds_main_external, + .num_segments = ARRAY_SIZE(dcp_adt_kinds_main_external), +}; + /* The external DCPs run the same firmware with a single extra segment. */ static const struct dcp_adt_instance dcp_adt_external[] = { { @@ -383,10 +396,12 @@ static inline int dcp_adt_parse_instance(const void *data, size_t size, /* Parse metadata only: live MMIO, RAM exclusion and page tables remain unproven. */ static inline int dcp_adt_parse_frontend(const void *data, size_t size, + const struct dcp_adt_instance *inst, struct dcp_adt_tables *firmware, struct dcp_adt_frontend *frontend) { - int ret = dcp_adt_parse_common(data, size, &dcp_adt_internal, firmware, frontend); + int ret = dcp_adt_parse_common(data, size, inst ? inst : &dcp_adt_internal, + firmware, frontend); if (ret) return ret; diff --git a/drivers/iommu/apple-dart-dcp-shared.h b/drivers/iommu/apple-dart-dcp-shared.h index 2396ac5e1d33c..94b01309ab162 100644 --- a/drivers/iommu/apple-dart-dcp-shared.h +++ b/drivers/iommu/apple-dart-dcp-shared.h @@ -280,7 +280,8 @@ static int __apple_dart_dcp_dispext_map(struct device *piodma, unsigned int sid, if (ret) return ret; pio = to_dart_domain(iommu_get_domain_for_dev(piodma))->dcp; - if (pio->sid != 16 || !pio->dart->dispext) + if (pio->sid != 16 || + (!pio->dart->dispext && !pio->dart->t8132_main_external)) return -ENODEV; dcp = sid ? pio : pio->dart->frontend[0]; if (!dcp) @@ -369,7 +370,8 @@ int apple_dart_dcp_dispext_stream_ok(struct device *piodma, unsigned int sid) if (!domain || domain->owner != &apple_dart_iommu_ops || (sid != 0 && sid != 16)) return -ENODEV; pio = to_dart_domain(domain)->dcp; - if (!pio || pio->sid != 16 || !pio->dart->dispext) + if (!pio || pio->sid != 16 || + (!pio->dart->dispext && !pio->dart->t8132_main_external)) return -ENODEV; dcp = sid ? pio : pio->dart->frontend[0]; if (!dcp) @@ -403,7 +405,8 @@ static void *__apple_dart_dcp_dispext_scanout_alloc(struct device *piodma, size_ if (ret) return ERR_PTR(ret); pio = to_dart_domain(iommu_get_domain_for_dev(piodma))->dcp; - if (pio->sid != 16 || !pio->dart->dispext) + if (pio->sid != 16 || + (!pio->dart->dispext && !pio->dart->t8132_main_external)) return ERR_PTR(-ENODEV); dcp = pio->dart->frontend[0]; if (!dcp) @@ -515,7 +518,8 @@ static struct apple_dart_dcp *apple_dart_dcp_dispext_pio(struct device *piodma) if (!domain || domain->owner != &apple_dart_iommu_ops) return NULL; pio = to_dart_domain(domain)->dcp; - if (!pio || pio->sid != 16 || !pio->dart->dispext) + if (!pio || pio->sid != 16 || + (!pio->dart->dispext && !pio->dart->t8132_main_external)) return NULL; return pio; } diff --git a/drivers/iommu/apple-dart-dcp.h b/drivers/iommu/apple-dart-dcp.h index 813dd46c07df6..6b45f24bc5d56 100644 --- a/drivers/iommu/apple-dart-dcp.h +++ b/drivers/iommu/apple-dart-dcp.h @@ -297,7 +297,8 @@ static int apple_dart_dcp_read_adt(struct apple_dart *dart, struct dcp_adt_table ret = dcp_adt_parse_common(data, resource_size(&res), dart->dcp_instance, tables, frontend); else - ret = frontend ? dcp_adt_parse_frontend(data, resource_size(&res), tables, + ret = frontend ? dcp_adt_parse_frontend(data, resource_size(&res), + dart->dcp_instance, tables, frontend) : dcp_adt_parse_instance(data, resource_size(&res), dart->dcp_instance, tables); @@ -734,7 +735,9 @@ static int apple_dart_frontend_validate(struct apple_dart_dcp *dcp, { struct device_node *alias; struct of_phandle_args spec; - u32 wanted = dcp->sid == 0 ? BIT(4) | BIT(6) : BIT(5); + bool main_external = dcp->dart->dcp_instance == &dcp_adt_main_external; + u32 wanted = dcp->sid == 0 ? + (main_external ? BIT(4) : BIT(4) | BIT(6)) : BIT(5); u32 seen = 0; unsigned long flags; int nr, ret; @@ -768,7 +771,9 @@ static int apple_dart_frontend_validate(struct apple_dart_dcp *dcp, alias = of_find_node_by_path(dcp->sid == 0 ? "disp0" : "disp0_piodma"); ret = alias && consumer == alias && of_device_is_available(alias) && - of_property_read_bool(alias, "apple,j713-inherited-mappings") ? 0 : -ENODEV; + (main_external || + of_property_read_bool(alias, "apple,j713-inherited-mappings")) ? + 0 : -ENODEV; of_node_put(alias); if (ret) return ret; @@ -793,6 +798,9 @@ static int apple_dart_frontend_validate(struct apple_dart_dcp *dcp, struct resource res; const __be32 *maps; unsigned int matches = 0; + bool retained_framebuffer = main_external && dcp->sid == 0 && + of_property_match_string(consumer, "memory-region-names", + "framebuffer") == i; int bytes; if (!node) @@ -806,6 +814,15 @@ static int apple_dart_frontend_validate(struct apple_dart_dcp *dcp, rmem->base != res.start || rmem->size != resource_size(&res)) goto put_node; maps = of_get_property(node, "iommu-addresses", &bytes); + /* + * The retained scanout framebuffer is a physical handoff, not a + * frontend-DART segment. Keep requiring the reserved no-map region, + * but only region94 participates in SID0's inherited table contract. + */ + if (retained_framebuffer) { + ret = maps ? -EINVAL : 0; + goto put_node; + } if (!maps || bytes <= 0 || bytes % (5 * sizeof(*maps))) goto put_node; for (int j = 0; j < bytes / sizeof(*maps); j += 5) { @@ -1068,7 +1085,8 @@ static int apple_dart_dcp_validate(struct apple_dart_dcp *dcp, struct device *de } if (!of_device_is_compatible(dev->of_node, - dcp->dart->dcp_instance == &dcp_adt_internal ? + (dcp->dart->dcp_instance == &dcp_adt_internal || + dcp->dart->dcp_instance == &dcp_adt_main_external) ? "apple,t8132-dcp" : "apple,t8132-dcpext") || !apple_dart_dcp_firmware(dev->of_node) || (dcp->owner && dcp->owner != dev)) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 5064a2ef90be0..ce7aac56d2fc7 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -492,6 +492,7 @@ struct apple_dart { /* The display coprocessor whose firmware DART (SID23) this is. */ const struct dcp_adt_instance *dcp_instance; bool preserve_display; + bool t8132_main_external; /* A J713 external display DART, borrowed from its external DCP */ bool dispext; /* @@ -928,6 +929,21 @@ static const char *apple_dart_board(void) return board ?: "unknown board"; } +/* A fixed HDMI connector makes the T8132 main DCP an external pipeline. */ +static bool apple_dart_t8132_main_external(void) +{ + struct device_node *dcp; + const char *connector; + bool qualified; + + dcp = of_find_compatible_node(NULL, NULL, "apple,t8132-dcp"); + qualified = dcp && of_device_is_available(dcp) && + !of_property_read_string(dcp, "apple,connector-type", &connector) && + !strcmp(connector, "HDMI-A"); + of_node_put(dcp); + return qualified; +} + static int apple_dart_dcp_invalidate_tlb(struct apple_dart_stream_map *stream_map); #include "apple-dart-dcp.h" @@ -5661,6 +5677,7 @@ static int apple_dart_probe(struct platform_device *pdev) "usb4-pcie-tunnel-"); bool j713_display, j713_dcpext, j713_dispext, j713_radio; bool cold_avd = of_device_is_compatible(dev->of_node, "apple,t8152-avd-dart"); + bool t8132_main_external; /* * The M4 internal display DARTs are live: DCP firmware (SID23) @@ -5672,6 +5689,7 @@ static int apple_dart_probe(struct platform_device *pdev) j713_display = res && !tunneled && of_device_is_compatible(dev->of_node, "apple,t8132-dart") && (res->start == 0x30a300000ULL || res->start == 0x30a340000ULL); + t8132_main_external = j713_display && apple_dart_t8132_main_external(); /* The external DCP firmware DARTs (SID23) of dcpext0 and dcpext1. */ j713_dcpext = res && !tunneled && apple_t8132_firmware_path() && of_device_is_compatible(dev->of_node, "apple,t8132-dart") && @@ -5810,6 +5828,7 @@ static int apple_dart_probe(struct platform_device *pdev) if (ret) return ret; dart->preserve_display = j713_display || j713_dcpext || j713_dispext; + dart->t8132_main_external = t8132_main_external; dart->dispext = j713_dispext; dart->power_gated = j713_dispext; if (j713_display && of_property_present(dev->of_node, "apple,clock-protection")) { @@ -5831,7 +5850,8 @@ static int apple_dart_probe(struct platform_device *pdev) else if (j713_dispext) dart->dcp_instance = &dcp_adt_external[res->start == 0x48a300000ULL]; else if (j713_display) - dart->dcp_instance = &dcp_adt_internal; + dart->dcp_instance = t8132_main_external ? + &dcp_adt_main_external : &dcp_adt_internal; if (tunneled) { pd_np = of_parse_phandle(dev->of_node, "power-domains", 0); if (pd_np) { @@ -8043,7 +8063,17 @@ int apple_dart_dcp_dispext_state(struct device_node *consumer) if (!device_is_bound(&pdev->dev) || pdev->dev.driver != &apple_dart_driver.driver) goto out; dart = platform_get_drvdata(pdev); - if (!dart || !dart->dispext || !dart->frontend[1]) + if (!dart || !dart->frontend[1]) + goto out; + if (!dart->dispext && dart->t8132_main_external) { + if (!dart->frontend[0] || !apple_dart_dcp_registers(dart->frontend[0]) || + !apple_dart_dcp_registers(dart->frontend[1]) || apple_dart_fault_pending(dart)) + ret = -EIO; + else + ret = 0; + goto out; + } + if (!dart->dispext) goto out; ret = apple_dart_dispext_verify(dart, "after power-up"); out: From 4e0b2749bb8f8ead178faa1986deb7593913b8c7 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Sat, 7 Nov 2026 20:07:44 -0500 Subject: [PATCH 02/10] drm: apple: dcp: adopt a T8132 main external output Some T8132 desktops route the main DCP through a fixed DPTX-to-HDMI path instead of an internal panel. Use the connector-type property as that role contract, prepare the PHY and converter rails, adopt the retained firmware session, and register it through the external-output KMS path. Accept the retained physical framebuffer without manual bind controls or machine-name checks. Use a J773g M4 profile without panel timing and continue to refuse machines without a profile. J773g does not use the J713 panel admission parameters because the external path skips apple_pmp_j713_display_prepare() and has no internal panel timing or panel power admission. Keep an empty external device from replacing simpledrm, and retain an adopted session when its initial HDMI DPTX connect fails. The external KMS layer still caps the device at two outputs, so two adopted dcpext outputs leave the fixed HDMI output unregistered. Signed-off-by: Sean Dolbec --- drivers/gpu/drm/apple/apple_drv.c | 71 +++++++++++++---- drivers/gpu/drm/apple/dcp-m4-profile.h | 15 ++++ drivers/gpu/drm/apple/dcp.c | 78 +++++++++++++++++-- drivers/gpu/drm/apple/dcp.h | 1 + drivers/gpu/drm/apple/iomfb_m4.c | 16 ++-- drivers/gpu/drm/apple/t8132_ext_drm.c | 29 ++++++- .../drivers/gpu/apple-dcp/lifecycle.py | 8 ++ 7 files changed, 193 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/apple/apple_drv.c b/drivers/gpu/drm/apple/apple_drv.c index 17d1416d636d2..8a1110f2cf487 100644 --- a/drivers/gpu/drm/apple/apple_drv.c +++ b/drivers/gpu/drm/apple/apple_drv.c @@ -1646,6 +1646,8 @@ static int apple_probe_typec_ports(struct drm_device *drm, return 0; } +static bool apple_t8132_main_external_present(void); + static int apple_get_fb_resource(struct device *dev, const char *name, struct resource *fb_r) { @@ -1665,7 +1667,9 @@ static int apple_get_fb_resource(struct device *dev, const char *name, goto err; } - if (!of_device_is_compatible(node, "framebuffer")) { + if (!of_device_is_compatible(node, "framebuffer") && + !(apple_t8132_main_external_present() && + of_device_is_compatible(node, "apple,asc-mem"))) { dev_err(dev, "reserved-memory node '%s' is incompatible\n", node->full_name); goto err; @@ -1726,6 +1730,16 @@ static const struct of_device_id apple_dcp_id_tbl[] = { {}, }; +static bool apple_t8132_main_external_present(void) +{ + struct device_node *np = of_find_compatible_node(NULL, NULL, + "apple,t8132-dcp"); + bool present = dcp_t8132_main_external(np) && of_device_is_available(np); + + of_node_put(np); + return present; +} + /* * A supported firmware-described external provider participates in component * matching. A T6030 external display processor is a pipe of this DRM device @@ -1734,7 +1748,7 @@ static const struct of_device_id apple_dcp_id_tbl[] = { */ static bool apple_dcp_usable(struct device_node *np) { - return of_device_is_available(np) && + return of_device_is_available(np) && !dcp_t8132_main_external(np) && (!of_device_is_compatible(np, "apple,t6030-dcpext") || dcp_t6030_ext_native(np)) && (!of_device_is_compatible(np, "apple,t8140-dcpext") || @@ -1789,6 +1803,15 @@ static void apple_dcp_start_fn(struct work_struct *work) w->ret = dcp_start(w->dcp); } +static bool apple_drm_has_output(struct drm_device *drm) +{ + struct drm_crtc *crtc; + + drm_for_each_crtc(crtc, drm) + return true; + return false; +} + static int apple_drm_init_dcp(struct device *dev) { struct apple_drm_private *apple = dev_get_drvdata(dev); @@ -1846,8 +1869,17 @@ static int apple_drm_init_dcp(struct device *dev) num_dcp++; } - if (num_dcp < 1) - return -ENODEV; + if (num_dcp < 1) { + if (!apple_t8132_main_external_present()) + return -ENODEV; + ret = t8132_ext_drm_init(&apple->drm); + if (ret) + dev_warn(dev, "T8132 main external output was not registered: %d\n", + ret); + else if (!apple_drm_has_output(&apple->drm)) + ret = -ENODEV; + return ret; + } /* * Build the Type-C port connectors before starting any pipeline: a @@ -1994,9 +2026,11 @@ static int apple_drm_init(struct device *dev) */ apple->drm.mode_config.prefer_shadow = true; - ret = component_bind_all(dev, apple); - if (ret) - return ret; + if (!apple_t8132_main_external_present()) { + ret = component_bind_all(dev, apple); + if (ret) + return ret; + } ret = apple_drm_init_dcp(dev); if (ret) @@ -2115,7 +2149,8 @@ static int apple_drm_init(struct device *dev) err_unbind: t8132_ext_drm_fini(&apple->drm); apple_drm_quiesce_connectors(&apple->drm); - component_unbind_all(dev, NULL); + if (!apple_t8132_main_external_present()) + component_unbind_all(dev, NULL); dcp_unlink(&apple->drm); return ret; } @@ -2143,7 +2178,8 @@ static void apple_drm_uninit(struct device *dev) drm_dev_unplug(&apple->drm); drm_atomic_helper_shutdown(&apple->drm); - component_unbind_all(dev, NULL); + if (!apple_t8132_main_external_present()) + component_unbind_all(dev, NULL); dcp_unlink(&apple->drm); dev_set_drvdata(dev, NULL); @@ -2218,10 +2254,14 @@ static int apple_platform_probe(struct platform_device *pdev) /* add DCP components, handle less than 1 as probe error */ num_dcp = add_dcp_components(mdev, &match); - if (num_dcp < 1) - return -ENODEV; - - ret = component_master_add_with_match(mdev, &apple_drm_ops, match); + if (num_dcp < 1) { + if (!apple_t8132_main_external_present()) + return -ENODEV; + ret = apple_drm_init(mdev); + } else { + ret = component_master_add_with_match(mdev, &apple_drm_ops, + match); + } if (ret) return ret; @@ -2237,7 +2277,10 @@ static int apple_platform_probe(struct platform_device *pdev) static void apple_platform_remove(struct platform_device *pdev) { pm_vt_switch_unregister(&pdev->dev); - component_master_del(&pdev->dev, &apple_drm_ops); + if (apple_t8132_main_external_present()) + apple_drm_uninit(&pdev->dev); + else + component_master_del(&pdev->dev, &apple_drm_ops); } static const struct of_device_id of_match[] = { diff --git a/drivers/gpu/drm/apple/dcp-m4-profile.h b/drivers/gpu/drm/apple/dcp-m4-profile.h index 438f734f87d06..54952950e1941 100644 --- a/drivers/gpu/drm/apple/dcp-m4-profile.h +++ b/drivers/gpu/drm/apple/dcp-m4-profile.h @@ -58,6 +58,20 @@ static const struct dcp_m4_profile dcp_m4_profile_j713 = { .timing = dcp_m4_timing_j713, .timing_elements = 1, }; +/* The J773g uses the shared firmware ABI for an external output, not a panel. */ +static const struct dcp_m4_profile dcp_m4_profile_j773g = { + .name = "J773g", .machine = "apple,j773g", + .panel_width = 2560, .panel_height = 1664, .notch_rows = 64, + .boot_stride = 10240, + .swap_size = 0x1bd8, .swap_surface = 0x588, .swap_dva = 0xe38, + .swap_nullable = 0x1bcb, .swap_tail = 0x1bd6, .swap_nits = 0x35e, + .swap_intent = 0x17c, + .disabled_color = 0xff000000, + .done_method = 590, .done_size = 0x730, .open_method = 457, + .brightness_max = 500, .brightness_default = 120, + .width_mm = 0, .height_mm = 0, +}; + /* The J715's panel timing, as macOS reports it (TimingElements, ID 2). */ static const u32 dcp_m4_timing_j715[2][8] = { { 2880, 2960, 8, 32, 40, 7710975, 1, 0 }, @@ -106,6 +120,7 @@ static const struct dcp_m4_profile dcp_m4_profile_j604 = { static const struct dcp_m4_profile *const dcp_m4_profiles[] = { &dcp_m4_profile_j713, + &dcp_m4_profile_j773g, &dcp_m4_profile_j715, &dcp_m4_profile_j604, }; diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 76092501c2bd4..66f01378c12dd 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -6370,6 +6370,13 @@ static int dcp_connector_type_from_dt(struct device_node *np) return DRM_MODE_CONNECTOR_Unknown; } +/* A T8132 main DCP can serve a fixed external output instead of a panel. */ +bool dcp_t8132_main_external(struct device_node *np) +{ + return np && of_device_is_compatible(np, "apple,t8132-dcp") && + dcp_connector_type_from_dt(np) == DRM_MODE_CONNECTOR_HDMIA; +} + /* * The fixed route's crossbar selection and Type-C mux are taken at probe and * must be released with the device: a crossbar left selected blocks the next @@ -7393,6 +7400,47 @@ static int dcp_desktop_probe_routes(struct apple_dcp *dcp) return 0; } +/* + * A fixed HDMI main DCP reaches its sink through a T8122-style DPTX PHY and + * two converter power GPIOs. Require every resource and leave it powered for + * the retained firmware session. + */ +static int dcp_m4_hdmi_prepare(struct apple_dcp *dcp) +{ + struct device *dev = dcp->dev; + int ret; + + dcp->hw.num_dptx_ports = 1; + dcp->phy = devm_phy_get(dev, "dp-phy"); + if (IS_ERR(dcp->phy)) + return dev_err_probe(dev, PTR_ERR(dcp->phy), + "HDMI DP PHY unavailable\n"); + dcp->fixed_phy = dcp->phy; + ret = phy_init(dcp->phy); + if (ret) + return dev_err_probe(dev, ret, "HDMI DP PHY init failed\n"); + ret = phy_power_on(dcp->phy); + if (ret) { + phy_exit(dcp->phy); + return dev_err_probe(dev, ret, "HDMI DP PHY power failed\n"); + } + ret = devm_add_action_or_reset(dev, dcp_desktop_phy_off, dcp->phy); + if (ret) + return ret; + + dcp->hdmi_pwren = devm_gpiod_get(dev, "hdmi-pwren", GPIOD_OUT_HIGH); + if (IS_ERR(dcp->hdmi_pwren)) + return dev_err_probe(dev, PTR_ERR(dcp->hdmi_pwren), + "HDMI power GPIO unavailable\n"); + dcp->dp2hdmi_pwren = devm_gpiod_get(dev, "dp2hdmi-pwren", GPIOD_OUT_HIGH); + if (IS_ERR(dcp->dp2hdmi_pwren)) + return dev_err_probe(dev, PTR_ERR(dcp->dp2hdmi_pwren), + "DP2HDMI power GPIO unavailable\n"); + msleep(100); + dev_info(dev, "fixed HDMI PHY and converter rails prepared\n"); + return 0; +} + /* * An adopted T8132 dcpext offers its Type-C routes. It is no component of * the DRM device (its outputs are added by t8132_ext_drm.c): the routes @@ -7763,8 +7811,18 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) return ret; if (iomfb_is_m4(dcp)) { - dcp->fixed_connector_type = DRM_MODE_CONNECTOR_eDP; - dcp->connector_type = DRM_MODE_CONNECTOR_eDP; + bool main_external = dcp_t8132_main_external(dev->of_node); + + if (main_external) { + dcp->fixed_connector_type = DRM_MODE_CONNECTOR_HDMIA; + dcp->connector_type = DRM_MODE_CONNECTOR_HDMIA; + ret = dcp_m4_hdmi_prepare(dcp); + if (ret) + return ret; + } else { + dcp->fixed_connector_type = DRM_MODE_CONNECTOR_eDP; + dcp->connector_type = DRM_MODE_CONNECTOR_eDP; + } bitmap_zero(dcp->iomfb_surfaces, DCP_MAX_PLANES); set_bit(0, dcp->iomfb_surfaces); ret = iomfb_m4_init(dcp); @@ -7774,11 +7832,20 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) * An external DCP is no component of the DRM device. Once * adoption starts, its session outlives the device. */ - if (of_device_is_compatible(dev->of_node, "apple,t8132-dcpext")) { + if (of_device_is_compatible(dev->of_node, "apple,t8132-dcpext") || + main_external) { ret = dcp_pin_live_session(dcp); if (!ret) ret = iomfb_m4_adopt_external(dcp); - if (!ret) + if (!ret && main_external) { + ret = dcp_desktop_dptx_connect(dcp, 0); + if (ret) { + dev_warn(dev, "initial HDMI DPTX connect failed: %d\n", + ret); + ret = 0; + } + } + if (!ret && !main_external) dcp_t8132_ext_routes(dcp); return ret; } @@ -8330,7 +8397,8 @@ static void dcp_platform_remove(struct platform_device *pdev) if (dcp) av_audiosrv_quiesce(dcp); /* An adopted external DCP never joined the DRM device. */ - if (of_device_is_compatible(pdev->dev.of_node, "apple,t8132-dcpext")) { + if (of_device_is_compatible(pdev->dev.of_node, "apple,t8132-dcpext") || + dcp_t8132_main_external(pdev->dev.of_node)) { /* Enabled with its Type-C routes, see dcp_t8132_ext_routes(). */ if (dcp) disable_delayed_work_sync(&dcp->typec_reconnect_wq); diff --git a/drivers/gpu/drm/apple/dcp.h b/drivers/gpu/drm/apple/dcp.h index 0989d8d6a2437..0e233366d36b4 100644 --- a/drivers/gpu/drm/apple/dcp.h +++ b/drivers/gpu/drm/apple/dcp.h @@ -15,6 +15,7 @@ bool dcp_h17p_external_supported(struct device_node *np); bool dcp_h17p_external_ready(struct device_node *np); +bool dcp_t8132_main_external(struct device_node *np); struct apple_atomic_state { struct drm_atomic_commit base; diff --git a/drivers/gpu/drm/apple/iomfb_m4.c b/drivers/gpu/drm/apple/iomfb_m4.c index a85010b15c719..29af70a4ccfc0 100644 --- a/drivers/gpu/drm/apple/iomfb_m4.c +++ b/drivers/gpu/drm/apple/iomfb_m4.c @@ -2690,9 +2690,11 @@ int iomfb_m4_init(struct apple_dcp *owner) u32 ready = 0; int ret; /* An external DCP the boot loader handed over: same firmware, no panel. */ - bool external = of_device_is_compatible(dev->of_node, "apple,t8132-dcpext"); + bool dcpext = of_device_is_compatible(dev->of_node, "apple,t8132-dcpext"); + bool main_external = dcp_t8132_main_external(dev->of_node); + bool external = dcpext || main_external; - if (external && + if (dcpext && (of_property_read_u32(dev->of_node, "apple,t8132-dcpext-firmware-ready", &ready) || ready != 1)) return dev_err_probe(dev, -ENODEV, "external DCP not handed over\n"); @@ -2712,10 +2714,14 @@ int iomfb_m4_init(struct apple_dcp *owner) if (ret) return ret; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "coproc"); - if (!res || resource_size(res) != SZ_16K || - (external ? res->start != 0x286e00000ULL && res->start != 0x48ae00000ULL : + if (!res) + return dev_err_probe(dev, -ENODEV, "missing coproc resource\n"); + if (resource_size(res) != SZ_16K || + (dcpext ? res->start != 0x286e00000ULL && res->start != 0x48ae00000ULL : res->start != 0x30ae00000ULL)) - return -ENODEV; + return dev_err_probe(dev, -ENODEV, + "unqualified %s DCP coproc resource %pa-%pa\n", + dcpext ? "external" : "main", &res->start, &res->end); /* Resolve the fallible supplier before creating a mailbox owner. */ ret = external ? 0 : apple_pmp_j713_display_prepare(dev); if (ret) diff --git a/drivers/gpu/drm/apple/t8132_ext_drm.c b/drivers/gpu/drm/apple/t8132_ext_drm.c index 8bcb7da6c9001..93cce72097c6e 100644 --- a/drivers/gpu/drm/apple/t8132_ext_drm.c +++ b/drivers/gpu/drm/apple/t8132_ext_drm.c @@ -49,6 +49,7 @@ #include #include +#include "dcp.h" #include "iomfb_m4.h" #include "t8132_ext_drm.h" @@ -1145,7 +1146,8 @@ static int t8132_ext_out_init(struct drm_device *drm, struct platform_device *pd goto err_crtc; out->encoder.possible_crtcs = drm_crtc_mask(&out->crtc); ret = drm_connector_init(drm, &out->connector, &t8132_ext_connector_funcs, - DRM_MODE_CONNECTOR_DisplayPort); + dcp_t8132_main_external(pdev->dev.of_node) ? + DRM_MODE_CONNECTOR_HDMIA : DRM_MODE_CONNECTOR_DisplayPort); if (ret) goto err_encoder; drm_connector_helper_add(&out->connector, &t8132_ext_connector_helpers); @@ -1222,6 +1224,31 @@ int t8132_ext_drm_init(struct drm_device *drm) put_device(&pdev->dev); ret = ret ?: err; } + /* A main DCP can describe a fixed external output instead of a panel. */ + if (count < T8132_EXT_MAX) { + struct platform_device *pdev; + + np = of_find_compatible_node(NULL, NULL, "apple,t8132-dcp"); + if (dcp_t8132_main_external(np) && of_device_is_available(np)) { + pdev = of_find_device_by_node(np); + if (pdev) { + if (!device_is_bound(&pdev->dev)) { + ret = ret ?: -EPROBE_DEFER; + } else { + err = t8132_ext_out_init(drm, pdev, mine); + if (err) + dev_err(&pdev->dev, + "no main external DRM output: %d\n", + err); + else + count++; + ret = ret ?: err; + } + put_device(&pdev->dev); + } + } + of_node_put(np); + } if (count || ret) drm_info(drm, "%u T8132 external output(s): %d\n", count, ret); return ret; diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py index 6fec3f172d381..ad8612893f451 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py @@ -1525,6 +1525,7 @@ def function(source, marker): + function(drm, 'struct apple_dcp_start_work {') + ';\n' + function(drm, 'static void apple_dcp_start_fn(')) if 'static void apple_dcp_start_fn(' in drm else '', + function(drm, 'static bool apple_drm_has_output('), function(drm, 'static int apple_drm_init_dcp('), 'static int publish_provider(struct platform_device *pdev, struct apple_dcp *dcp)\n' '{\n\tstruct device *dev = &pdev->dev;\n\tint ret;\n' @@ -1569,6 +1570,11 @@ def function(source, marker): struct { int iomfb_method_profile; } hw; struct work_struct external_audio_work; }; +/* This J700 fixture has neither a T8132 main DCP nor its fixed HDMI path. */ +static bool __attribute__((unused)) dcp_t8132_main_external(struct device_node *n) +{ (void)n; return false; } +static bool __attribute__((unused)) apple_t8132_main_external_present(void) +{ return false; } /* This readiness fixture has no AV owner or native audio initializer. */ static void av_audiosrv_quiesce(struct apple_dcp *d) { assert(!d->external_native); } @@ -1591,6 +1597,8 @@ def function(source, marker): static void __attribute__((unused)) iomfb_v14_7_external_refuse(struct apple_dcp *d, const char *why) { (void)d; (void)why; assert(!"T6030 external processor in a J700 scenario"); } struct drm_device { int unused; }; +struct drm_crtc { int unused; }; +#define drm_for_each_crtc(crtc, drm) for ((void)(drm), (crtc) = NULL; (crtc); ) struct drm_encoder { int unused; }; /* Not a J713: production registers no T8132 external outputs and returns 0. */ static int __attribute__((unused)) t8132_ext_drm_init(struct drm_device *drm) { (void)drm; return 0; } From 781261379a41178f061cda28b06fa3cff2036f43 Mon Sep 17 00:00:00 2001 From: Niklas Sheth Date: Tue, 18 Aug 2026 09:57:36 +0000 Subject: [PATCH 03/10] phy: apple: dptx: add the T8122 PHY T8122 (as used on T8132) needs its own cold activation: the T8112 core power steps, moved enable/clear bits (0x2218, 0x2234), a different 0x2230 setting, no 0x4008/0x420c/0x4404/0x4408/0x4600 steps, and an AUX impedance calibration whose result is copied into 0x4228. At link-rate change it clears 0x222c bit 1 instead of 0x2220 bit 7, takes the T6020 settings for 0x20b0, the first 0x20b4 write and 0x20b8 bit 16, then clears 0x20b4 bit 1 and skips the 0x20b8 bit 21 clear. For T8122 only, enable runtime PM before creating the PHY so the generic PHY core propagates runtime-PM references to the provider. The T8112, T6020 and T6050 paths are unchanged. Link: https://github.com/GravityLinux/linux/commit/877c574dfa4f31434129b05da6d907abfb21bbef Signed-off-by: Niklas Sheth [Sean: extracted the T8122 hunk; rebased over T6050; runtime PM for T8122 only; calibration code from the readback] Signed-off-by: Sean Dolbec --- drivers/phy/apple/dptx.c | 116 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 110 insertions(+), 6 deletions(-) diff --git a/drivers/phy/apple/dptx.c b/drivers/phy/apple/dptx.c index 7405b7d1c7ad0..bf20a7a8da713 100644 --- a/drivers/phy/apple/dptx.c +++ b/drivers/phy/apple/dptx.c @@ -36,6 +36,7 @@ enum apple_dptx_type { DPTX_PHY_T8112, DPTX_PHY_T6020, DPTX_PHY_T6050, + DPTX_PHY_T8122, }; /* The PLL core calibration the board describes, in t6050_pll_core_cfg() order. */ @@ -153,6 +154,82 @@ static int dptx_phy_set_active_lane_count(struct apple_dptx_phy *phy, u32 num_la return 0; } +static int dptx_phy_activate_t8122(struct apple_dptx_phy *phy, u32 dcp_index) +{ + u32 done, code, val; + + dev_dbg(phy->dev, "T8122 PHY activation: begin (DCP %u)\n", + dcp_index); + + /* Firmware raises the private PHY gate immediately before this callback. */ + usleep_range(5000, 6000); + + readl(phy->regs.core + 0x10); + writel(dcp_index, phy->regs.core + 0x10); + + set32(phy->regs.core + 0x48, 0x010); + set32(phy->regs.core + 0x48, 0x020); + clear32(phy->regs.core + 0x48, 0x040); + set32(phy->regs.core + 0x48, 0x100); + set32(phy->regs.core + 0x48, 0x200); + clear32(phy->regs.core + 0x48, 0x400); + set32(phy->regs.core + 0x48, 0x001); + set32(phy->regs.core + 0x48, 0x002); + clear32(phy->regs.core + 0x48, 0x004); + + val = readl(phy->regs.dptx + 0x2014); + writel((val & ~0x3f0000) | (0x30 << 16), + phy->regs.dptx + 0x2014); + set32(phy->regs.dptx + 0x20b8, 0x010000); + clear32(phy->regs.dptx + 0x2220, 0x0000002); + set32(phy->regs.dptx + 0x222c, 0x000800); + set32(phy->regs.dptx + 0x222c, 0x000100); + set32(phy->regs.dptx + 0x2230, 0x0200000); + clear32(phy->regs.dptx + 0x2278, 0x08000000); + set32(phy->regs.dptx + 0x22a4, 0x0000001); + + for (u32 loff = DPTX_LANE0_OFFSET; loff < DPTX_LANE_END; + loff += DPTX_LANE_STRIDE) { + val = readl(phy->regs.dptx + loff + 0x40); + writel((val & ~0xe00000) | 0x200000, + phy->regs.dptx + loff + 0x40); + } + for (u32 loff = DPTX_LANE0_OFFSET; loff < DPTX_LANE_END; + loff += DPTX_LANE_STRIDE) + set32(phy->regs.dptx + loff + 0x40, 0x080000); + for (u32 loff = DPTX_LANE0_OFFSET; loff < DPTX_LANE_END; + loff += DPTX_LANE_STRIDE) + clear32(phy->regs.dptx + loff + 0x244, 0x10); + + set32(phy->regs.dptx + 0x2218, 0x001); + clear32(phy->regs.dptx + 0x2234, 0x00000001); + set32(phy->regs.dptx + 0x2200, 0x0002); + clear32(phy->regs.dptx + 0x1000, 0x00000002); + set32(phy->regs.dptx + 0x4004, 0x08); + + dptx_phy_set_active_lane_count(phy, 0); + + dev_dbg(phy->dev, "T8122 PHY activation: calibration start\n"); + set32(phy->regs.dptx + 0x4224, 1); + set32(phy->regs.dptx + 0x4200, 0x3c0); + set32(phy->regs.dptx + 0x4200, 1); + udelay(125); + done = readl(phy->regs.dptx + 0x4204) & 1; + clear32(phy->regs.dptx + 0x4200, 1); + code = (readl(phy->regs.dptx + 0x4210) >> 18) & 0x7f; + if (!done) { + dev_err(phy->dev, "impedance calibration did not complete (0x4204 %#x)\n", + readl(phy->regs.dptx + 0x4204)); + return -ETIMEDOUT; + } + mask32(phy->regs.dptx + 0x4228, 0x7f0000, code << 16); + set32(phy->regs.dptx + 0x4228, 0x8000); + dev_dbg(phy->dev, "T8122 PHY activation: complete, calibration code %#x\n", + code); + + return 0; +} + static int dptx_phy_activate(struct apple_dptx_phy *phy, u32 dcp_index) { u32 val_2014; @@ -160,6 +237,8 @@ static int dptx_phy_activate(struct apple_dptx_phy *phy, u32 dcp_index) u32 val_4408; dev_dbg(phy->dev, "activate(dcp:%u)\n", dcp_index); + if (phy->hw.type == DPTX_PHY_T8122) + return dptx_phy_activate_t8122(phy, dcp_index); // MMIO: R.4 0x23c500010 (dptx-phy[1], offset 0x10) = 0x0 // MMIO: W.4 0x23c500010 (dptx-phy[1], offset 0x10) = 0x0 @@ -409,13 +488,17 @@ static int dptx_phy_set_link_rate(struct apple_dptx_phy *phy, u32 link_rate) // MMIO: R.4 0x23c542220 (dptx-phy[0], offset 0x2220) = 0x11090a0 // MMIO: W.4 0x23c542220 (dptx-phy[0], offset 0x2220) = 0x1109020 - clear32(phy->regs.dptx + 0x2220, 0x0000080); + if (phy->hw.type == DPTX_PHY_T8122) + clear32(phy->regs.dptx + 0x222c, 0x0000002); + else + clear32(phy->regs.dptx + 0x2220, 0x0000080); // MMIO: R.4 0x23c5420b0 (dptx-phy[0], offset 0x20b0) = 0x1e0e01c2 // MMIO: W.4 0x23c5420b0 (dptx-phy[0], offset 0x20b0) = 0x1e0e01c2 val_20b0 = readl(phy->regs.dptx + 0x20b0); /* TODO: what happens on dptx-phy */ - if (phy->hw.type == DPTX_PHY_T6020) + if (phy->hw.type == DPTX_PHY_T6020 || + phy->hw.type == DPTX_PHY_T8122) val_20b0 = (val_20b0 & ~0x3ff) | 0x2a3; writel(val_20b0, phy->regs.dptx + 0x20b0); @@ -423,7 +506,8 @@ static int dptx_phy_set_link_rate(struct apple_dptx_phy *phy, u32 link_rate) // MMIO: W.4 0x23c5420b4 (dptx-phy[0], offset 0x20b4) = 0x7fffffe val_20b4 = readl(phy->regs.dptx + 0x20b4); /* TODO: what happens on dptx-phy */ - if (phy->hw.type == DPTX_PHY_T6020) + if (phy->hw.type == DPTX_PHY_T6020 || + phy->hw.type == DPTX_PHY_T8122) val_20b4 = (val_20b4 | 0x4000000) & ~0x0008000; writel(val_20b4, phy->regs.dptx + 0x20b4); @@ -431,7 +515,9 @@ static int dptx_phy_set_link_rate(struct apple_dptx_phy *phy, u32 link_rate) // MMIO: W.4 0x23c5420b4 (dptx-phy[0], offset 0x20b4) = 0x7fffffe val_20b4 = readl(phy->regs.dptx + 0x20b4); /* TODO: what happens on dptx-phy */ - if (phy->hw.type == DPTX_PHY_T6020) + if (phy->hw.type == DPTX_PHY_T8122) + val_20b4 &= ~0x0000002; + else if (phy->hw.type == DPTX_PHY_T6020) val_20b4 = (val_20b4 | 0x0000001) & ~0x0000004; writel(val_20b4, phy->regs.dptx + 0x20b4); @@ -446,13 +532,15 @@ static int dptx_phy_set_link_rate(struct apple_dptx_phy *phy, u32 link_rate) // MMIO: R.4 0x23c5420b8 (dptx-phy[0], offset 0x20b8) = 0x654800 // MMIO: W.4 0x23c5420b8 (dptx-phy[0], offset 0x20b8) = 0x654800 /* TODO: unclear */ - if (phy->hw.type == DPTX_PHY_T6020) + if (phy->hw.type == DPTX_PHY_T6020 || + phy->hw.type == DPTX_PHY_T8122) set32(phy->regs.dptx + 0x20b8, 0x010000); else set32(phy->regs.dptx + 0x20b8, 0); // MMIO: R.4 0x23c5420b8 (dptx-phy[0], offset 0x20b8) = 0x654800 // MMIO: W.4 0x23c5420b8 (dptx-phy[0], offset 0x20b8) = 0x454800 - clear32(phy->regs.dptx + 0x20b8, 0x200000); + if (phy->hw.type != DPTX_PHY_T8122) + clear32(phy->regs.dptx + 0x20b8, 0x200000); // MMIO: R.4 0x23c5420b8 (dptx-phy[0], offset 0x20b8) = 0x454800 // MMIO: W.4 0x23c5420b8 (dptx-phy[0], offset 0x20b8) = 0x454800 @@ -1120,6 +1208,17 @@ static int dptx_phy_probe(struct platform_device *pdev) mutex_init(&dptx_phy->lock); + /* + * The generic PHY core only propagates runtime-PM references to the + * provider when runtime PM was enabled before devm_phy_create(). + */ + if (dptx_phy->hw.type == DPTX_PHY_T8122) { + ret = devm_pm_runtime_enable(dev); + if (ret) + return dev_err_probe(dev, ret, + "failed to enable runtime PM\n"); + } + dptx_phy->regs.core = devm_platform_ioremap_resource_byname(pdev, "core"); if (IS_ERR(dptx_phy->regs.core)) @@ -1190,10 +1289,15 @@ static const struct apple_dptx_phy_hw apple_dptx_hw_t6050 = { .type = DPTX_PHY_T6050, }; +static const struct apple_dptx_phy_hw apple_dptx_hw_t8122 = { + .type = DPTX_PHY_T8122, +}; + static const struct of_device_id dptx_phy_match[] = { { .compatible = "apple,t6020-dptx-phy", .data = &apple_dptx_hw_t6020 }, { .compatible = "apple,t8112-dptx-phy", .data = &apple_dptx_hw_t8112 }, { .compatible = "apple,t6050-dptx-phy", .data = &apple_dptx_hw_t6050 }, + { .compatible = "apple,t8122-dptx-phy", .data = &apple_dptx_hw_t8122 }, {}, }; MODULE_DEVICE_TABLE(of, dptx_phy_match); From 8178cc304bb2af74f174bbf9ce8092e2a8e695d8 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Thu, 19 Nov 2026 09:54:03 -0500 Subject: [PATCH 04/10] dt-bindings: display: apple,display-subsystem: allow dma-noncoherent The T8132 display subsystem node has carried dma-noncoherent since it was added, and the binding does not list it. dtbs_check did not notice: the node is disabled in the shared tree and enabled by the boot loader on the boards with a panel. A board that enables it in its device tree gets display-subsystem: Unevaluated properties are not allowed ('dma-noncoherent' was unexpected) Allow the property. Signed-off-by: Sean Dolbec --- .../devicetree/bindings/display/apple,display-subsystem.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml b/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml index ac106575a9672..0b144b2bfd50b 100644 --- a/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml +++ b/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml @@ -36,6 +36,8 @@ properties: minItems: 1 maxItems: 8 + dma-noncoherent: true + memory-region: minItems: 1 maxItems: 64 From 1c6166f32cd5dc702ceefb91126b4efc8e36ee9d Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Sat, 7 Nov 2026 20:07:55 -0500 Subject: [PATCH 05/10] arm64: dts: apple: t8132-j773g: enable HDMI display The Mac mini routes its main DCP through the T8122 DPTX PHY and an HDMI converter controlled by two SMC GPIOs. Describe that fixed path and enable the retained DCP, mailbox, and display DART nodes. Do not attach the DCP or mailbox to DISP_CPU: iBoot leaves that domain in auto mode and direct PMGR writes fault on this machine. The display subsystem node has no registers and is enabled here, so it is described at the root rather than under the simple-bus (dtbs_check: "soc: display-subsystem: 'ranges' is a required property"); the disp0 alias follows its label. The move renames the platform device from soc:display-subsystem to display-subsystem, changing its path under /sys/bus/platform/devices. The /dev/dri/by-path links that use that platform-device name also change. Update any userspace configuration pinned to the old path. Signed-off-by: Sean Dolbec --- arch/arm64/boot/dts/apple/t8132-j773g.dts | 60 +++++++++++++++++++++-- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t8132-j773g.dts b/arch/arm64/boot/dts/apple/t8132-j773g.dts index 2a8ca64d3a638..4edbdadb79ba5 100644 --- a/arch/arm64/boot/dts/apple/t8132-j773g.dts +++ b/arch/arm64/boot/dts/apple/t8132-j773g.dts @@ -34,13 +34,63 @@ }; }; +&soc { + dptx_phy: phy@39a700000 { + compatible = "apple,t8122-dptx-phy", "apple,dptx-phy"; + reg = <0x3 0x9a700000 0x0 0x4000>, + <0x3 0x9a740000 0x0 0x10000>; + reg-names = "core", "dptx"; + power-domains = <&ps_dptx_phy>; + #phy-cells = <0>; + status = "okay"; + }; +}; + +&dcp_mbox { + /* iBoot leaves DISP_CPU in auto mode; Linux must not switch it. */ + /delete-property/ power-domains; + status = "okay"; +}; + +&dcp_dart { + status = "okay"; +}; + +&disp0_dart { + status = "okay"; +}; + +&dcp { + /* iBoot leaves DISP_CPU in auto mode; Linux must not switch it. */ + /delete-property/ power-domains; + apple,connector-type = "HDMI-A"; + apple,dptx-phy = <4>; + phys = <&dptx_phy>; + phy-names = "dp-phy"; + hdmi-pwren-gpios = <&smc_gpio 15 GPIO_ACTIVE_HIGH>; + dp2hdmi-pwren-gpios = <&smc_gpio 26 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&disp0_piodma { + status = "okay"; +}; + /* - * iBoot scans out through dispext0 to the HDMI port (dptx-phy and a - * DP-to-HDMI converter at i2c0 0x08, hot-plug on AOP GPIO 41): keep the - * power domains used for it on. + * The scanout frontend has no registers. The shared tree keeps it, disabled, + * under /soc, where the loader enables it for the boards with a panel. This + * board enables it here, and a node without reg cannot be a child of the + * simple-bus: describe it at the root instead. It is found by the disp0 + * alias, which follows the label. */ -&framebuffer0 { - power-domains = <&ps_dispext0_fe>, <&ps_dptx_phy>; +/delete-node/ &display; + +/ { + display: display-subsystem { + compatible = "apple,t8132-display-subsystem", "apple,t8132-display-diagnostics"; + iommus = <&disp0_dart 0>; + dma-noncoherent; + }; }; /* From 1064b09b246d85d9c514c5b53159ae206172c6cd Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Sat, 14 Nov 2026 01:38:59 -0500 Subject: [PATCH 06/10] arm64: dts: apple: t8132-j773g: complete the HDMI display description With only the HDMI path described, the Mac mini still has no display: - The DPTX PHY sits on ps_dptx_phy, which the J713 PMGR policy (applied to every M4 board that does not state the domain) keeps from Linux. phy-apple-dptx and the DCP behind it wait for it until the deferred probe timeout (-110). State the domain for this board, as it already does for the ATC2 and ATC3 domains. - The DCP's PIODMA child owns iommu-addresses entries in /reserved-memory, so the DCP node needs #address-cells and #size-cells; the display DART's admission otherwise warns that both are missing. - The loader and the display DART look the PIODMA stream up by the disp0_piodma alias, as on T8122; add it. - genpd powers ps_dptx_phy off over a suspend-to-idle and the PHY keeps no state, so the modeset replayed on resume fails ("DPTXPort: firmware reports link fault 22 on target 0:4", then -67). Mark the domain apple,always-on. Found and tested by Diljit Singh on a J773g (macOS 26.6.2): the display is restored on 3 of 3 resumes. Signed-off-by: Sean Dolbec --- arch/arm64/boot/dts/apple/t8132-j773g.dts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8132-j773g.dts b/arch/arm64/boot/dts/apple/t8132-j773g.dts index 4edbdadb79ba5..c844f0f3fd631 100644 --- a/arch/arm64/boot/dts/apple/t8132-j773g.dts +++ b/arch/arm64/boot/dts/apple/t8132-j773g.dts @@ -22,6 +22,11 @@ model = "Apple Mac mini (M4, 2024)"; chassis-type = "desktop"; + aliases { + /* The loader and the display DART find the PIODMA stream by it. */ + disp0_piodma = &disp0_piodma; + }; + /* * The speaker amp's shutdown line (SDZ, AP GPIO 15, the ADT * function-reset; low = shutdown). @@ -63,6 +68,9 @@ &dcp { /* iBoot leaves DISP_CPU in auto mode; Linux must not switch it. */ /delete-property/ power-domains; + /* Its PIODMA child owns iommu-addresses entries in /reserved-memory. */ + #address-cells = <2>; + #size-cells = <2>; apple,connector-type = "HDMI-A"; apple,dptx-phy = <4>; phys = <&dptx_phy>; @@ -93,6 +101,17 @@ }; }; +/* + * The DPTX PHY's domain: the J713 PMGR policy keeps it from Linux, and the + * PHY (and the DCP that waits on it) would never probe. Keep it on: the PHY + * holds no state across a power-off, and after a suspend-to-idle the + * replayed modeset fails with a link fault. + */ +&ps_dptx_phy { + apple,always-on; + status = "okay"; +}; + /* * Without this, the PMP firmware faults in the PMC block (0x382800000) * shortly after it starts on this board. J713 keeps ps_pmc out of Linux From 69b613cc4a4b0c82c56b6ed5f538719fcba4cf91 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Mon, 23 Nov 2026 21:01:48 -0500 Subject: [PATCH 07/10] iommu: apple-dart: accept a schema-compliant main display PIODMA alias Prefer disp0-piodma for SID16 and retain the original underscore alias for deployed loader and J713 device trees. Apply the same lookup to admission, validation, reservations and the diagnostic attribute. Name the J773g alias disp0-piodma while leaving the target label alone. Signed-off-by: Sean Dolbec --- arch/arm64/boot/dts/apple/t8132-j773g.dts | 2 +- drivers/iommu/apple-dart-dcp.h | 27 +++++++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t8132-j773g.dts b/arch/arm64/boot/dts/apple/t8132-j773g.dts index c844f0f3fd631..213556e515171 100644 --- a/arch/arm64/boot/dts/apple/t8132-j773g.dts +++ b/arch/arm64/boot/dts/apple/t8132-j773g.dts @@ -24,7 +24,7 @@ aliases { /* The loader and the display DART find the PIODMA stream by it. */ - disp0_piodma = &disp0_piodma; + disp0-piodma = &disp0_piodma; }; /* diff --git a/drivers/iommu/apple-dart-dcp.h b/drivers/iommu/apple-dart-dcp.h index 6b45f24bc5d56..cad19e42c5fc1 100644 --- a/drivers/iommu/apple-dart-dcp.h +++ b/drivers/iommu/apple-dart-dcp.h @@ -402,16 +402,29 @@ static int apple_dart_dcp_arena(struct apple_dart_dcp *dcp) return slots >= DCP_DART_SCANOUT_SLOTS ? 0 : -ENOSPC; } +/* Legacy firmware trees use an underscore in the SID16 alias. */ +static struct device_node *apple_dart_frontend_node(bool piodma) +{ + struct device_node *node; + + if (!piodma) + return of_find_node_by_path("disp0"); + + node = of_find_node_by_path("disp0-piodma"); + return node ? node : of_find_node_by_path("disp0_piodma"); +} + /* Snapshot only this consumer's real no-map reservations, before table admission. */ static int apple_dart_dcp_leaf_regions(struct apple_dart_dcp *dcp) { struct device_node *consumer, *node; - /* An external display DART's SID16 serves its dcpext's memory. */ - const char *alias = dcp->sid == 23 || dcp->dart->dispext ? - dcp->dart->dcp_instance->dcp : dcp->sid == 0 ? "disp0" : "disp0_piodma"; int count, ret = 0; - consumer = of_find_node_by_path(alias); + /* An external display DART's SID16 serves its dcpext's memory. */ + if (dcp->sid == 23 || dcp->dart->dispext) + consumer = of_find_node_by_path(dcp->dart->dcp_instance->dcp); + else + consumer = apple_dart_frontend_node(dcp->sid != 0); if (!consumer) return -ENODEV; count = of_property_count_u32_elems(consumer, "memory-region"); @@ -769,7 +782,7 @@ static int apple_dart_frontend_validate(struct apple_dart_dcp *dcp, if (ret) return ret; - alias = of_find_node_by_path(dcp->sid == 0 ? "disp0" : "disp0_piodma"); + alias = apple_dart_frontend_node(dcp->sid != 0); ret = alias && consumer == alias && of_device_is_available(alias) && (main_external || of_property_read_bool(alias, "apple,j713-inherited-mappings")) ? @@ -1006,7 +1019,7 @@ static int apple_dart_frontend_prepare(struct apple_dart *dart) ret = apple_dart_dcp_import(dart, i ? 16 : 0, bounds, &borrowed[i]); if (ret) return ret; - node = of_find_node_by_path(i ? "disp0_piodma" : "disp0"); + node = apple_dart_frontend_node(i); ret = node ? apple_dart_frontend_validate(borrowed[i], node) : -ENODEV; of_node_put(node); if (ret) @@ -1032,7 +1045,7 @@ static ssize_t j713_display_state_show(struct device *dev, if (!dart->frontend[0] || !dart->frontend[1] || !READ_ONCE(dart->iommu.ready)) return -ENODEV; for (unsigned int i = 0; i < 2; i++) { - struct device_node *node = of_find_node_by_path(i ? "disp0_piodma" : "disp0"); + struct device_node *node = apple_dart_frontend_node(i); status[i] = node ? apple_dart_frontend_validate(dart->frontend[i], node) : -ENODEV; of_node_put(node); From d503d12519df109432f8dfb8ee08f85053e679a4 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Mon, 23 Nov 2026 21:04:38 -0500 Subject: [PATCH 08/10] drm: apple: dcp: wait for HDMI HPD after enabling the T8132 converter Use J773g's ADT HDMI HPD GPIO to detect a connected sink instead of sleeping unconditionally after enabling the rails. Bound the wait at the old 100 ms budget and keep adopting the DCP session if the output is unplugged. Preserve the original settle delay when the GPIO is absent or cannot be read. Attach the GPIO to the main DCP, which owns the HDMI route in this firmware path. Signed-off-by: Sean Dolbec --- arch/arm64/boot/dts/apple/t8132-j773g.dts | 2 ++ drivers/gpu/drm/apple/dcp.c | 26 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t8132-j773g.dts b/arch/arm64/boot/dts/apple/t8132-j773g.dts index 213556e515171..5740ac26efa3e 100644 --- a/arch/arm64/boot/dts/apple/t8132-j773g.dts +++ b/arch/arm64/boot/dts/apple/t8132-j773g.dts @@ -75,6 +75,8 @@ apple,dptx-phy = <4>; phys = <&dptx_phy>; phy-names = "dp-phy"; + /* ADT dp2hdmi-gpio0: hdmi_hpd on AOP GPIO 41. */ + hdmi-hpd-gpios = <&pinctrl_aop 41 GPIO_ACTIVE_HIGH>; hdmi-pwren-gpios = <&smc_gpio 15 GPIO_ACTIVE_HIGH>; dp2hdmi-pwren-gpios = <&smc_gpio 26 GPIO_ACTIVE_HIGH>; status = "okay"; diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 66f01378c12dd..dc56b830784fc 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -7408,7 +7408,12 @@ static int dcp_desktop_probe_routes(struct apple_dcp *dcp) static int dcp_m4_hdmi_prepare(struct apple_dcp *dcp) { struct device *dev = dcp->dev; - int ret; + struct gpio_desc *hpd; + int hpd_level, ret; + + hpd = devm_gpiod_get_optional(dev, "hdmi-hpd", GPIOD_IN); + if (IS_ERR(hpd)) + return dev_err_probe(dev, PTR_ERR(hpd), "HDMI HPD GPIO unavailable"); dcp->hw.num_dptx_ports = 1; dcp->phy = devm_phy_get(dev, "dp-phy"); @@ -7436,7 +7441,24 @@ static int dcp_m4_hdmi_prepare(struct apple_dcp *dcp) if (IS_ERR(dcp->dp2hdmi_pwren)) return dev_err_probe(dev, PTR_ERR(dcp->dp2hdmi_pwren), "DP2HDMI power GPIO unavailable\n"); - msleep(100); + /* + * Give a connected sink time to assert HPD after the rails turn on. + * An unplugged output can stay low indefinitely, so a timeout does + * not prevent adoption of the retained DCP session. + */ + if (hpd) { + ret = read_poll_timeout(gpiod_get_value_cansleep, hpd_level, + hpd_level != 0, 1000, 100000, false, hpd); + if (hpd_level < 0) { + dev_warn(dev, "failed to sample HDMI HPD: %d\n", hpd_level); + msleep(100); + } else if (ret) { + dev_dbg(dev, "HDMI HPD stayed low during converter startup\n"); + } + } else { + /* Older device trees do not expose HPD. Keep their settle time. */ + msleep(100); + } dev_info(dev, "fixed HDMI PHY and converter rails prepared\n"); return 0; } From c0dab5fc6e54bb5fe22ca83dca1bb743ec9ec172 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Mon, 23 Nov 2026 22:16:04 -0500 Subject: [PATCH 09/10] arm64: dts: apple: describe the J773g retained display DART domain The DCP firmware and frontend DARTs share the DISP_CPU state, as on J713. Expose its firmware-owned domain so the DARTs have their real dependency without allowing Linux to read, reset or switch the locked state register. Signed-off-by: Sean Dolbec --- arch/arm64/boot/dts/apple/t8132-j773g.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8132-j773g.dts b/arch/arm64/boot/dts/apple/t8132-j773g.dts index 5740ac26efa3e..fa850c21cf95c 100644 --- a/arch/arm64/boot/dts/apple/t8132-j773g.dts +++ b/arch/arm64/boot/dts/apple/t8132-j773g.dts @@ -58,10 +58,12 @@ }; &dcp_dart { + power-domains = <&ps_disp_cpu>; status = "okay"; }; &disp0_dart { + power-domains = <&ps_disp_cpu>; status = "okay"; }; @@ -103,6 +105,16 @@ }; }; +/* + * Both retained display DARTs sit in DISP_CPU. iBoot leaves this + * state under firmware control and Linux must not touch its register. + * Give the DARTs a logical, always-on domain without a consumer switch. + */ +&ps_disp_cpu { + apple,firmware-owned; + status = "okay"; +}; + /* * The DPTX PHY's domain: the J713 PMGR policy keeps it from Linux, and the * PHY (and the DCP that waits on it) would never probe. Keep it on: the PHY From fb51f87ad7d47d673ced6d3c5b02fc50639fd0e7 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Wed, 2 Dec 2026 07:10:29 -0500 Subject: [PATCH 10/10] selftests: apple-dart: update DCP host fixtures for J773g HDMI Include the shared frontend alias lookup in the placeholder test and model the main external DCP flag in the dispext window test shim. Signed-off-by: Sean Dolbec --- tools/asahi/apple-dart-dcp-placeholder-tests.py | 3 ++- tools/asahi/apple-dart-dispext-window-tests.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/asahi/apple-dart-dcp-placeholder-tests.py b/tools/asahi/apple-dart-dcp-placeholder-tests.py index 5303997b15a5a..ecf559d1ae98b 100755 --- a/tools/asahi/apple-dart-dcp-placeholder-tests.py +++ b/tools/asahi/apple-dart-dcp-placeholder-tests.py @@ -34,6 +34,7 @@ def definition(source, name): args = parser.parse_args() source = (ROOT / 'drivers/iommu/apple-dart-dcp.h').read_text() +frontend = definition(source, 'static struct device_node *apple_dart_frontend_node(') region = definition(source, 'static int apple_dart_dcp_region(') leaf = definition(source, 'static int apple_dart_dcp_leaf_regions(') validate = definition(source, 'static int apple_dart_dcp_validate(') @@ -101,7 +102,7 @@ def definition(source, name): rmem.size = n->size; return &rmem; } -''' + region + '\n' + leaf + r''' +''' + frontend + '\n' + region + '\n' + leaf + r''' static const struct dcp_instance ext0 = { "dcpext0" }; static struct apple_dart dart = { false, &ext0 }; static int run(struct apple_dart_dcp *d, unsigned int sid, bool dispext) diff --git a/tools/asahi/apple-dart-dispext-window-tests.py b/tools/asahi/apple-dart-dispext-window-tests.py index 53749deec1413..7e6339c52d499 100755 --- a/tools/asahi/apple-dart-dispext-window-tests.py +++ b/tools/asahi/apple-dart-dispext-window-tests.py @@ -165,6 +165,7 @@ def apply_mutation(bodies, mutation): struct apple_dart { struct apple_dart_dcp *frontend[2]; bool dispext; + bool t8132_main_external; bool retired; bool regs_bad; bool fault_pending;