From e89c721216c684edf23ac184069b7b0f53242d0f Mon Sep 17 00:00:00 2001 From: Acelogic Date: Fri, 4 Dec 2026 20:55:04 +0000 Subject: [PATCH 1/2] arm64: dts: apple: t6031-dcp: match ADT disp-0..disp-4 register windows In the T6031 ADT, /arm-io/disp0 exposes five display register windows (disp-0 as a single 0x4000000 aperture, disp-1..disp-3, and disp-4 at 0x2903d0000 for the PMP bandwidth update window). t6031-dcp.dtsi split disp-0 into two 0x690000 windows as on T6030, shifting disp-4 to 0x386800000 and apple,bw-scratch to index 5. Firmware 27.2 queries D003 (rt_bandwidth) and then maps reg index 4 via D411 (map_reg[4]); with index 4 pointing at 0x386800000 instead of 0x2903d0000, writing the bandwidth dashboard offset during active-link power-off hit an invalid fabric address and raised an EL1h SError (ESR=0xffffffffbe000000). Align dcp reg/reg-names with the T6031 ADT and point apple,bw-scratch at disp-4 (index 4). Signed-off-by: Acelogic --- arch/arm64/boot/dts/apple/t6031-dcp.dtsi | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi index bc92c519843d1..77787c2fc99c2 100644 --- a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi @@ -76,10 +76,9 @@ mbox-names = "mbox"; iommus = <&dcp_dart 5>; reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3", - "disp-4", "disp-5", "iop-vbar"; + "disp-4", "iop-vbar"; reg = <0x3 0x86c00000 0x0 0x4000>, - <0x3 0x84000000 0x0 0x690000>, - <0x3 0x84800000 0x0 0x690000>, + <0x3 0x84000000 0x0 0x4000000>, <0x3 0x85320000 0x0 0x4000>, <0x3 0x85344000 0x0 0x4000>, <0x3 0x86800000 0x0 0x800000>, @@ -87,8 +86,8 @@ <0x3 0x86850000 0x0 0x4000>; power-domains = <&ps_disp_fe>; clocks = <&clk_disp0>; - /* PTD bandwidth request entry 577 in the disp-5 update window. */ - apple,bw-scratch = <&pmgr_dcp 0 5 0x1208>; + /* PTD bandwidth request entry 577 in the disp-4 update window. */ + apple,bw-scratch = <&pmgr_dcp 0 4 0x1208>; /* The 14.x/27.2 firmware runs once the PMP acknowledges this request. */ apple,pmp-report = <&pmp_report_disp>; #address-cells = <2>; From 3917a28b13adbcd3c47c970f81f136fefe7b4fae Mon Sep 17 00:00:00 2001 From: Acelogic Date: Fri, 4 Dec 2026 20:55:05 +0000 Subject: [PATCH 2/2] drm/apple: dts: apple: t6031: enable dcpext0 external display on 27.2 Enable the first external display processor (dcpext0, 306c00000.dcp) on T6031 (M3 Max) when running the pinned macOS 27.2 (26B123) DCP firmware image alongside a handed-over internal display: - dt-bindings: document apple,t6031-dcpext-firmware-ready on apple,dcp. - include/linux/soc/apple/display.h: add apple_t6031_dcp_v27_2() and apple_t6031_dcpext_v27_2() pinned to the 26B123 DCP image UUID. - display-gate: admit T6031 dcpext0 through the shared-image gate when the boot loader marks apple,t6031-dcpext-firmware-ready, enabling its PMP report entry (report@11), raising dispext0_fe/dispext0_cpu min state to active, keeping the 3-port ATC crossbar array sized for T6031, and propagating the inherited display scanout window. - appledrm: add apple_dcp_hw_t6031_dcpext and firmware-27 admission / clock-table / failsafe / 41-bit DMA setup matching T8122 dcpext. - dts (t6031-dcp.dtsi, t6031-j516c.dts): keep apple,dma-range on display-subsystem, describe dcpext0 using its 5-window ADT layout (disp-0..disp-3 + disp-4 bw-scratch at 0x1210), and wire USB-C Type-C DP routes on typec0/typec1/typec2. - selftests: include the T6031 display.h helpers in apple-dcp/boot.py. Signed-off-by: Acelogic --- .../bindings/display/apple,dcp.yaml | 7 ++ arch/arm64/boot/dts/apple/t6031-dcp.dtsi | 41 ++++++++ arch/arm64/boot/dts/apple/t6031-j516c.dts | 98 +++++++++++++++++++ drivers/gpu/drm/apple/dcp.c | 38 ++++++- drivers/soc/apple/display-gate.c | 70 ++++++++++--- include/linux/soc/apple/display.h | 47 +++++++++ .../selftests/drivers/gpu/apple-dcp/boot.py | 8 +- 7 files changed, 291 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/display/apple,dcp.yaml b/Documentation/devicetree/bindings/display/apple,dcp.yaml index 416ee116e62c1..425f7bd950046 100644 --- a/Documentation/devicetree/bindings/display/apple,dcp.yaml +++ b/Documentation/devicetree/bindings/display/apple,dcp.yaml @@ -389,6 +389,13 @@ properties: because kernels that share the display DART unconditionally accept 1 and nothing else. + apple,t6031-dcpext-firmware-ready: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2] + description: + Set by the boot loader on a T6031 external coprocessor whose firmware + it has reserved for the kernel's display gate. + apple,pmp: $ref: /schemas/types.yaml#/definitions/phandle description: Native PMP supplier, independent of the report request entry. diff --git a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi index 77787c2fc99c2..c6ea06137307a 100644 --- a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi @@ -27,6 +27,8 @@ display: display-subsystem { compatible = "apple,t6031-display-subsystem"; iommus = <&disp0_dart 0>; + /* Keep the inherited scanout alias when adding external streams. */ + apple,dma-range = /bits/ 64 <0x10000000000 0x1000000000>; status = "disabled"; }; }; @@ -118,3 +120,42 @@ &pmp_report { apple,pmp = <&pmp>; }; + +/* + * External display processor 0 (dcpext0): the boot loader reserves its + * firmware, and the display gate enables it and its routes once ready. + */ +&dispext0_dart { + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + power-domains = <&ps_dispext0_fe>; +}; + +&dcpext0_dart { + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + power-domains = <&ps_dispext0_fe>; +}; + +&dcpext0_mbox { + power-domains = <&ps_dispext0_fe>; +}; + +&dcpext0 { + iommus = <&dcpext0_dart 5>; + reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; + reg = <0x3 0x6c00000 0x0 0x4000>, + <0x3 0x4000000 0x0 0x4000000>, + <0x3 0x5320000 0x0 0x4000>, + <0x3 0x5344000 0x0 0x4000>, + <0x3 0x6800000 0x0 0x800000>; + power-domains = <&ps_dispext0_fe>; + resets = <&ps_dispext0_cpu>; + apple,bw-scratch = <&pmgr_dcp 0 4 0x1210>; + apple,pmp-report = <&pmp_report_dispext0>; + apple,dcp-index = <1>; + + piodma { + iommus = <&dispext0_dart 4>; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6031-j516c.dts b/arch/arm64/boot/dts/apple/t6031-j516c.dts index 2d29b482c0b13..448ce70159ba0 100644 --- a/arch/arm64/boot/dts/apple/t6031-j516c.dts +++ b/arch/arm64/boot/dts/apple/t6031-j516c.dts @@ -16,6 +16,10 @@ / { compatible = "apple,j516c", "apple,t6031", "apple,arm-platform"; model = "Apple MacBook Pro (16-inch, M3 Max, 16 CPU cores, Nov 2023)"; + + aliases { + dcpext0 = &dcpext0; + }; }; &mtp_mt { @@ -154,3 +158,97 @@ apple,sleep-report = /bits/ 8 <0x21 0x00>; }; }; + +/* + * External display on any of the three USB-C ports: dcpext0 is crossbar state 0 + * of each ATC and its DPTX target is the ATC index. The display gate enables it + * and the routes once the boot loader has readied its firmware. + */ +&dcpext0 { + apple,connector-type = "USB-C"; + phys = <&atcphy0 PHY_TYPE_DP>, <&atcphy1 PHY_TYPE_DP>, + <&atcphy2 PHY_TYPE_DP>; + phy-names = "typec0", "typec1", "typec2"; + mux-controls = <&atcphy0_xbar 0>, <&atcphy1_xbar 0>, + <&atcphy2_xbar 0>; + mux-control-names = "typec0", "typec1", "typec2"; + apple,typec-mux-indices = <0 0 0>; + apple,typec-dptx-phys = <0 1 2>; + + typec-routes { + #address-cells = <1>; + #size-cells = <0>; + + route@0 { + reg = <0>; + mode-switch; + status = "disabled"; + + port { + dcpext0_typec0: endpoint { + remote-endpoint = <&typec0_dcpext0>; + }; + }; + }; + + route@1 { + reg = <1>; + mode-switch; + status = "disabled"; + + port { + dcpext0_typec1: endpoint { + remote-endpoint = <&typec1_dcpext0>; + }; + }; + }; + + route@2 { + reg = <2>; + mode-switch; + status = "disabled"; + + port { + dcpext0_typec2: endpoint { + remote-endpoint = <&typec2_dcpext0>; + }; + }; + }; + }; +}; + +&typec0 { + ports { + port@3 { + reg = <3>; + + typec0_dcpext0: endpoint { + remote-endpoint = <&dcpext0_typec0>; + }; + }; + }; +}; + +&typec1 { + ports { + port@3 { + reg = <3>; + + typec1_dcpext0: endpoint { + remote-endpoint = <&dcpext0_typec1>; + }; + }; + }; +}; + +&typec2 { + ports { + port@3 { + reg = <3>; + + typec2_dcpext0: endpoint { + remote-endpoint = <&dcpext0_typec2>; + }; + }; + }; +}; diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index b2d5d93fbc820..4009e35fdb092 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -7265,6 +7265,14 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev) return DCP_FIRMWARE_UNKNOWN; } + if (of_device_is_compatible(dev->of_node, "apple,t6031-dcpext") && + dcp_firmware_27(dev, &version)) { + if (apple_t6031_dcpext_v27_2(dev->of_node)) + return version; + dev_err(dev, "T6031 external display not started: unpinned 27.x DCP firmware\n"); + return DCP_FIRMWARE_UNKNOWN; + } + /* * TEST: the T6030 external processors on firmware 27 run only the idle-only session of * the 27.2 image, never the generic firmware-27 pipe (they have no such lifecycle). @@ -7333,6 +7341,14 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev) return DCP_FIRMWARE_UNKNOWN; } + if (of_device_is_compatible(dev->of_node, "apple,t6031-dcpext")) { + if (apple_t6031_dcpext_v27_2(dev->of_node)) + return dcp_v27_method_table(dev, compat_str); + dev_err(dev, "T6031 external display not started: DCP firmware-compat %s is not the 27.2 image\n", + compat_str); + return DCP_FIRMWARE_UNKNOWN; + } + /* The internal panels with a board record (T6030, J613): the same. */ v14_board = iomfb_v14_7_board(dev); if (IS_ERR(v14_board)) @@ -7581,9 +7597,10 @@ static int dcp_firmware_clocks_v27(struct apple_dcp *dcp) dcp->num_firmware_clocks = 2; return 0; } - /* External processors without a provider clock table (T6041, T8122). */ + /* External processors without a provider clock table (T6031, T6041, T8122). */ if (!of_property_present(dev->of_node, "apple,clock-ids") && - (of_device_is_compatible(dev->of_node, "apple,t6041-dcpext") || + (of_device_is_compatible(dev->of_node, "apple,t6031-dcpext") || + of_device_is_compatible(dev->of_node, "apple,t6041-dcpext") || of_device_is_compatible(dev->of_node, "apple,t8122-dcpext"))) return 0; clocks = of_property_count_u32_elems(dev->of_node, "apple,clock-ids"); @@ -8195,6 +8212,7 @@ static void dcp_ext_give_up(struct apple_dcp *dcp, int err, const char *when); static bool dcp_ext_is_failsafe(struct device_node *np) { return of_device_is_compatible(np, "apple,t8122-dcpext") || + of_device_is_compatible(np, "apple,t6031-dcpext") || of_device_is_compatible(np, "apple,t6041-dcpext") || of_device_is_compatible(np, "apple,t6050-dcpext") || of_device_is_compatible(np, "apple,t8142-dcpext") || @@ -9265,6 +9283,14 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) dcp->hw.s2r_ext = true; dcp->hw.s2r_dart_save_restore = true; } + if (fw_compat == DCP_FIRMWARE_V_27_0 && + of_device_is_compatible(dev->of_node, "apple,t6031-dcpext")) { + if (!dcp->hw.firmware_dma_bits) + dcp->hw.firmware_dma_bits = 41; + dcp->hw.num_dptx_ports = 2; + dcp->hw.fw_14_7_endpoints = false; + dcp->hw.adopt_live_session = false; + } if (fw_compat == DCP_FIRMWARE_V_27_0 && of_device_is_compatible(dev->of_node, "apple,t6041-dcpext")) { if (!dcp->hw.firmware_dma_bits) @@ -13842,6 +13868,13 @@ static const struct apple_dcp_hw_data apple_dcp_hw_t6030_dcpext = { .num_dptx_ports = 1, }; +static const struct apple_dcp_hw_data apple_dcp_hw_t6031_dcpext = { + .external_processor = true, + .num_dptx_ports = 2, + .afk_name_fallback = true, + .no_ext_idle = true, +}; + static const struct apple_dcp_hw_data apple_dcp_hw_t8122_dcpext = { .external_processor = true, .num_dptx_ports = 2, @@ -13993,6 +14026,7 @@ static const struct of_device_id of_match[] = { { .compatible = "apple,t6030-dcpext", .data = &apple_dcp_hw_t6030_dcpext, }, { .compatible = "apple,t8122-dcp", .data = &apple_dcp_hw_t8122, }, { .compatible = "apple,t6031-dcp", .data = &apple_dcp_hw_t6031, }, + { .compatible = "apple,t6031-dcpext", .data = &apple_dcp_hw_t6031_dcpext, }, { .compatible = "apple,t8122-dcpext", .data = &apple_dcp_hw_t8122_dcpext, }, { .compatible = "apple,dcp", .data = &apple_dcp_hw_dcp, }, { .compatible = "apple,dcpext", .data = &apple_dcp_hw_dcpext, }, diff --git a/drivers/soc/apple/display-gate.c b/drivers/soc/apple/display-gate.c index 3ac3efd069b00..81f640a317c86 100644 --- a/drivers/soc/apple/display-gate.c +++ b/drivers/soc/apple/display-gate.c @@ -322,6 +322,7 @@ static const struct gate_soc gate_t6031 __initconst = { .reuse_pmp = true, .pmp_compat = "apple,t6031-pmp-v2", .ans_entry = "report@21", + .dispext_entry = "report@11", .ps_chain = { PMP_PS_DISP_FE, PMP_PS_DISP_CPU, PMP_PS_DISP_SYS }, .pmp_ps_any_pmgr = true, .describe = true, @@ -667,6 +668,20 @@ static struct device_node *__init gate_report_entry(struct device_node *report, return NULL; } +/* Match a PMP report entry regardless of status (for disabled dispext entries). */ +static struct device_node *__init gate_report_entry_any(struct device_node *report, + const char *full_name) +{ + struct device_node *child; + + for_each_child_of_node(report, child) { + if (!strcmp(of_node_full_name(child), full_name) && + of_device_is_compatible(child, "apple,t6000-pmp-v2-report-entry")) + return child; + } + return NULL; +} + /* * The PMP topology a device tree describes itself (T8122, T6031): the report, * linked to its PMP by apple,pmp; the PMP, disabled and with no values yet, @@ -1883,8 +1898,8 @@ static void __init gate_describe(void) /* The changeset that enabled the dcpext; only the KUnit test reverts it. */ static struct of_changeset *gate_t8122_dcpext_cs __initdata; -/* The most display crossbars a T8122 dcpext's routes switch: ATC0's and ATC1's. */ -#define GATE_T8122_XBARS 2 +/* The most display crossbars a dcpext's routes switch (2 on T8122, 3 on T6031). */ +#define GATE_T8122_XBARS 4 /* * The ATC common power state above display crossbar @xbar: the crossbar sits @@ -1969,7 +1984,7 @@ static int __init gate_t8122_dcpext_alias(struct of_changeset *cs, const struct property *window; int i, ret = 0; - dcp = of_find_compatible_node(NULL, NULL, "apple,t8122-dcp"); + dcp = of_find_compatible_node(NULL, NULL, gate_soc->dcp_compat); panel_dart = dcp ? of_parse_phandle(dcp, "iommus", 0) : NULL; of_node_put(dcp); window = panel_dart ? of_find_property(panel_dart, "apple,dma-range", NULL) : NULL; @@ -2026,13 +2041,17 @@ static int __init gate_t8122_dcpext_shares_dart(struct device_node *np, static void __init gate_t8122_dcpext_one(struct device_node *np) { struct device_node *dart = NULL, *mbox = NULL, *piodma = NULL; - struct device_node *disp_dart = NULL, *ps = NULL, *entry = NULL, *link; + struct device_node *disp_dart = NULL, *ps = NULL, *ps_cpu = NULL; + struct device_node *entry = NULL, *link; struct device_node *fbdma = NULL; struct device_node *xbar[GATE_T8122_XBARS] = {}; struct device_node *common[GATE_T8122_XBARS] = {}; struct of_phandle_args args; struct of_changeset *cs; const char *label; + bool is_t6031 = gate_soc == &gate_t6031; + const char *ready_prop = is_t6031 ? "apple,t6031-dcpext-firmware-ready" + : "apple,t8122-dcpext-firmware-ready"; int share_dart, ret, i, nxbar = 0; u32 ready; @@ -2040,13 +2059,15 @@ static void __init gate_t8122_dcpext_one(struct device_node *np) gate_warn("%pOF is not disabled; external display gate skipped\n", np); return; } - if (of_property_read_u32(np, "apple,t8122-dcpext-firmware-ready", &ready) || + if (of_property_read_u32(np, ready_prop, &ready) || (ready != 1 && ready != 2)) { gate_ext_refuse(np, "the boot loader did not reserve its firmware"); return; } - if (!gate_ext_firmware_ok(np) && !apple_t8122_dcpext_v27_2(np)) { - gate_ext_refuse(np, "its firmware is neither 14.7.0 nor the 27.2 image"); + if (is_t6031 ? !apple_t6031_dcpext_v27_2(np) + : (!gate_ext_firmware_ok(np) && !apple_t8122_dcpext_v27_2(np))) { + gate_ext_refuse(np, is_t6031 ? "its firmware is not the 27.2 image" + : "its firmware is neither 14.7.0 nor the 27.2 image"); return; } if (!of_property_present(np, "memory-region")) { @@ -2095,8 +2116,21 @@ static void __init gate_t8122_dcpext_one(struct device_node *np) goto put; } ps = of_parse_phandle(np, "power-domains", 0); - if (!ps || !of_device_is_compatible(ps, gate_soc->pwrstate_compat) || - of_property_read_string(ps, "label", &label) || strcmp(label, "dispext_cpu")) { + if (is_t6031) { + if (!ps || !of_device_is_compatible(ps, gate_soc->pwrstate_compat) || + of_property_read_string(ps, "label", &label) || + strcmp(label, "dispext0_fe")) { + gate_ext_refuse(np, "its power state is not dispext0_fe"); + goto put; + } + ps_cpu = gate_ps_parent(ps); + if (!gate_ps_is(ps_cpu, "dispext0_cpu")) { + gate_ext_refuse(np, "its parent power state is not dispext0_cpu"); + goto put; + } + } else if (!ps || !of_device_is_compatible(ps, gate_soc->pwrstate_compat) || + of_property_read_string(ps, "label", &label) || + strcmp(label, "dispext_cpu")) { gate_ext_refuse(np, "its power state is not dispext_cpu"); goto put; } @@ -2107,8 +2141,9 @@ static void __init gate_t8122_dcpext_one(struct device_node *np) * It is the device tree's own entry, which the dcpext names in * apple,pmp-report, and nothing requests it yet. */ - entry = gate_reuse.report ? - gate_report_entry(gate_reuse.report, gate_soc->dispext_entry) : NULL; + entry = gate_reuse.report && gate_soc->dispext_entry ? + (is_t6031 ? gate_report_entry_any(gate_reuse.report, gate_soc->dispext_entry) + : gate_report_entry(gate_reuse.report, gate_soc->dispext_entry)) : NULL; link = of_parse_phandle(np, "apple,pmp-report", 0); of_node_put(link); if (!entry || !entry->phandle || link != entry || @@ -2124,18 +2159,22 @@ static void __init gate_t8122_dcpext_one(struct device_node *np) goto put; } ret = gate_set_u32(cs, ps, "apple,min-state", PMGR_PS_ACTIVE); + if (!ret && ps_cpu) + ret = gate_set_u32(cs, ps_cpu, "apple,min-state", PMGR_PS_ACTIVE); /* * The driver waits for this request's acknowledgment before RUN. It * is seeded with the display's, by soc-device record, and a missing * acknowledgment must not hold up the panel. */ + if (!ret && gate_disabled(entry)) + ret = of_changeset_update_prop_string(cs, entry, "status", "okay"); if (!ret) ret = gate_add_bool(cs, entry, "apple,always-on"); if (!ret) ret = gate_add_bool(cs, entry, "apple,soc-device-record"); if (!ret) ret = gate_add_bool(cs, entry, "apple,defer-startup-ack"); - if (!ret && apple_t8122_dcpext_v27_2(np)) + if (!ret && (apple_t8122_dcpext_v27_2(np) || apple_t6031_dcpext_v27_2(np))) ret = gate_t8122_dcpext_alias(cs, dart, disp_dart); else if (!ret) ret = gate_t8122_dcpext_piodma_window(cs, piodma, disp_dart); @@ -2192,6 +2231,7 @@ static void __init gate_t8122_dcpext_one(struct device_node *np) } of_node_put(fbdma); of_node_put(entry); + of_node_put(ps_cpu); of_node_put(ps); of_node_put(disp_dart); of_node_put(piodma); @@ -2201,9 +2241,11 @@ static void __init gate_t8122_dcpext_one(struct device_node *np) static void __init gate_t8122_dcpext(bool panel, bool display_driver) { + const char *compat = gate_soc == &gate_t6031 ? "apple,t6031-dcpext" + : "apple,t8122-dcpext"; struct device_node *np; - for_each_compatible_node(np, NULL, "apple,t8122-dcpext") { + for_each_compatible_node(np, NULL, compat) { if (!panel) gate_ext_refuse(np, "the internal display was not handed over"); /* @@ -2240,7 +2282,7 @@ static void __init gate_run(bool display_driver) /* External processors need the panel's PMP; without it they stay off. */ if (gate_soc->dcpext) gate_dcpext(panel ? NULL : "the internal display was not handed over"); - if (gate_soc == &gate_t8122) + if (gate_soc == &gate_t8122 || gate_soc == &gate_t6031) gate_t8122_dcpext(panel, display_driver); gate_reuse_put(); of_node_put(aic); diff --git a/include/linux/soc/apple/display.h b/include/linux/soc/apple/display.h index 9f252caabea75..89834a30d3052 100644 --- a/include/linux/soc/apple/display.h +++ b/include/linux/soc/apple/display.h @@ -147,4 +147,51 @@ static inline bool apple_t8122_dcpext_v27_2(const struct device_node *np) return internal; } +/* T6031 DCP image shipped with macOS 27.2 (26B123). */ +#define APPLE_T6031_DCP_26B123_UUID "0C885956-0484-36CA-97D6-0255FA2D4F9E" + +/* The T6031 internal display processor, handed over on the 27.2 image. */ +static inline bool apple_t6031_dcp_v27_2(const struct device_node *np) +{ + return apple_dcp_image_v27_2(np, "apple,t6031-dcp", + APPLE_T6031_DCP_26B123_UUID); +} + +/* + * A T6031 external display processor on the 27.2 image. It shares the internal + * processor's image (__TEXT); it qualifies when its own firmware version and + * compatibility are 27.2.0 and the internal DCP was handed over on 27.2. + */ +static inline bool +apple_t6031_dcpext_v27_2_for_internal(const struct device_node *np, + const struct device_node *internal_dcp) +{ + u32 fw[3], compat[3]; + + if (!np || !of_device_is_compatible(np, "apple,t6031-dcpext") || + of_property_count_u32_elems(np, "apple,firmware-version") != 3 || + of_property_count_u32_elems(np, "apple,firmware-compat") != 3 || + of_property_read_u32_array(np, "apple,firmware-version", fw, 3) || + of_property_read_u32_array(np, "apple,firmware-compat", compat, 3) || + fw[0] != 27 || fw[1] != 2 || fw[2] != 0 || + compat[0] != 27 || compat[1] != 2 || compat[2] != 0) + return false; + + return apple_t6031_dcp_v27_2(internal_dcp); +} + +static inline bool apple_t6031_dcpext_v27_2(const struct device_node *np) +{ + struct device_node *dcp; + bool internal; + + if (!np || !of_device_is_compatible(np, "apple,t6031-dcpext")) + return false; + + dcp = of_find_compatible_node(NULL, NULL, "apple,t6031-dcp"); + internal = apple_t6031_dcpext_v27_2_for_internal(np, dcp); + of_node_put(dcp); + return internal; +} + #endif diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py index c510b280e4729..779fe70019576 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py @@ -223,15 +223,19 @@ def _v27_prelude(root): """Host stand-ins for OF and legacy board checks, then the live selector.""" display_h = (root / 'include/linux/soc/apple/display.h').read_text() uuid_defines = [line for line in display_h.splitlines() - if line.startswith(('#define APPLE_T6041_DCP_26B123_UUID ', + if line.startswith(('#define APPLE_T6031_DCP_26B123_UUID ', + '#define APPLE_T6041_DCP_26B123_UUID ', '#define APPLE_T8122_DCP_26B123_UUID ', '#define APPLE_T8132_DCP_26B123_UUID '))] - assert len(uuid_defines) == 3 + assert len(uuid_defines) == 4 helpers = ('static inline bool apple_dcp_image_v27_2(', 'static inline bool apple_t8132_dcp_v27_2(', 'static inline bool apple_t6041_dcp_any_v27_2(', 'static inline bool apple_t6041_dcp_v27_2(', 'static inline bool apple_t6041_dcpext_v27_2(', + 'static inline bool apple_t6031_dcp_v27_2(', + 'static inline bool\napple_t6031_dcpext_v27_2_for_internal(', + 'static inline bool apple_t6031_dcpext_v27_2(', 'static inline bool apple_t8122_dcp_v27_2(', 'static inline bool\napple_t8122_dcpext_v27_2_for_internal(', 'static inline bool apple_t8122_dcpext_v27_2(')