From 186be17549d0ba4f756e62b444252d216a9f76f2 Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Tue, 17 Nov 2026 19:45:15 -0500 Subject: [PATCH 01/37] drm/apple: send a paired mode set's calls in the engine's firmware 27 build The paired mode set (a mode too wide for one engine, run on two) sends its IOMFB calls through dcp_peer_video_call_stream(), naming them by their 27.0 IDs. Firmware 27.2 renumbered the IOMobileFramebufferAP methods, and an ID the firmware does not know panics it: on a 27.2 stub the paired prepare's set_display_device went out as A411 and crashed both engines. Translate each call's ID through the engine's build-selected table (iomfb_v27_tag()): a method the tables name takes this build's ID, and on 27.2 another A4xx ID (A449) moves up by 50 with the rest of IOMobileFramebufferAP. Other IDs, and every ID on 27.0, are sent as before. Developed with Claude Code. Signed-off-by: Erik Bourget --- .../drm/apple/dcp-peer-video-probe-v27.inc | 3 +- drivers/gpu/drm/apple/iomfb.h | 2 + drivers/gpu/drm/apple/iomfb_v27.c | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/apple/dcp-peer-video-probe-v27.inc b/drivers/gpu/drm/apple/dcp-peer-video-probe-v27.inc index 3560cfc447a99..e5c896ae44013 100644 --- a/drivers/gpu/drm/apple/dcp-peer-video-probe-v27.inc +++ b/drivers/gpu/drm/apple/dcp-peer-video-probe-v27.inc @@ -46,7 +46,8 @@ static int dcp_peer_video_call_stream(struct apple_dcp *dcp, bool independent, wait = kzalloc(sizeof(*wait), GFP_KERNEL); if (!wait) return -ENOMEM; - memcpy(method.tag, tag, sizeof(method.tag)); + /* The calls name 27.0 IDs: this engine's build may number them differently. */ + iomfb_v27_tag(dcp->v27_methods, tag, method.tag); wait->size = out_size; init_completion(&wait->done); kref_init(&wait->refs); diff --git a/drivers/gpu/drm/apple/iomfb.h b/drivers/gpu/drm/apple/iomfb.h index e230a9eac9c5c..1d52ca712b119 100644 --- a/drivers/gpu/drm/apple/iomfb.h +++ b/drivers/gpu/drm/apple/iomfb.h @@ -220,6 +220,8 @@ struct dcp_method_entry { /* The IOMFB method table of a firmware 27.x build, by its compat string; NULL if unknown. */ const struct dcp_method_entry *iomfb_v27_methods(const char *compat); +bool iomfb_v27_methods_renumbered(const struct dcp_method_entry *methods); +void iomfb_v27_tag(const struct dcp_method_entry *methods, const char *tag, char *out); const struct dcp_method_entry *iomfb_v27_methods_j714s(struct device *dev, const struct dcp_method_entry *methods); /* The first method of a firmware 27.x table that has no ID, NULL if none. */ diff --git a/drivers/gpu/drm/apple/iomfb_v27.c b/drivers/gpu/drm/apple/iomfb_v27.c index a1ccdb537d54f..d98df23791908 100644 --- a/drivers/gpu/drm/apple/iomfb_v27.c +++ b/drivers/gpu/drm/apple/iomfb_v27.c @@ -2,6 +2,7 @@ /* Copyright The Asahi Linux Contributors */ /* Copyright 2026 Aurora Silicon */ +#include #include #include @@ -269,6 +270,47 @@ const struct dcp_method_entry *iomfb_v27_methods(const char *compat) return NULL; } +/* + * @tag, a 27.0 ID the paired-mode calls name directly, in the build of @methods + * (into @out, 4 bytes). A method the tables name takes this build's ID; on 27.2, + * which moved IOMobileFramebufferAP up by 50, another A4xx ID (and A500) does too. + * Anything else keeps its 27.0 ID. + */ +void iomfb_v27_tag(const struct dcp_method_entry *methods, const char *tag, char *out) +{ + unsigned int i, id; + char in[4]; + + memcpy(in, tag, 4); + tag = in; + memcpy(out, tag, 4); + if (!iomfb_v27_methods_renumbered(methods)) + return; + for (i = 0; i < dcpep_num_methods; i++) { + if (dcp_methods_27_0[i].tag[0] && !memcmp(dcp_methods_27_0[i].tag, tag, 4) && + methods[i].tag[0]) { + memcpy(out, methods[i].tag, 4); + return; + } + } + if (methods != dcp_methods_27_2 || tag[0] != 'A' || !isdigit(tag[1]) || + !isdigit(tag[2]) || !isdigit(tag[3])) + return; + id = (tag[1] - '0') * 100 + (tag[2] - '0') * 10 + (tag[3] - '0'); + if (id < 400 || id > 500) + return; + id += 50; + out[1] = '0' + id / 100; + out[2] = '0' + id / 10 % 10; + out[3] = '0' + id % 10; +} + +/* Whether @methods is a build's table whose AP method IDs differ from 27.0's. */ +bool iomfb_v27_methods_renumbered(const struct dcp_method_entry *methods) +{ + return methods && (methods == dcp_methods_27_2 || methods == dcp_methods_27_3); +} + /* * The 27.0 table for the J714s, the board the firmware 27 sleep has run on (dcp->v27_j714s): a * copy with the sleep's A500 added. The shared table keeps the methods it had, so every other From f5e28012ecb907c4711e2a0de0c1e0a21e0be332 Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Tue, 17 Nov 2026 19:45:15 -0500 Subject: [PATCH 02/37] drm/apple: send the firmware 27 calls named by ID in the engine's build Besides the paired calls, the firmware 27 paths name some calls by their 27.0 IDs: the primary's paired mode set (A413) and power step (A484), the paired background swap (A408), the sleep's power and A500 steps, the display stage calls and A442. On 27.2, which renumbered IOMobileFramebufferAP, several of those IDs are other methods: the paired mode's power step ran one and failed, and the second engine of a 4K240 mode never started. Translate each of them through the engine's build-selected table (iomfb_v27_tag()). The J714s's A407 swap keeps its ID, which only its 27.0 table names, and its diagnostic now refuses a pair whose engines take different swap forms. 27.0 sends what it sent. Developed with Claude Code. Signed-off-by: Erik Bourget --- drivers/gpu/drm/apple/dcp-peer-modeset-probe-v27.inc | 10 ++++++---- drivers/gpu/drm/apple/dcp-peer-swap-probe-v27.inc | 8 ++++++-- drivers/gpu/drm/apple/iomfb.c | 10 +++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp-peer-modeset-probe-v27.inc b/drivers/gpu/drm/apple/dcp-peer-modeset-probe-v27.inc index a5aa449b446dd..3d73c5f47dbe0 100644 --- a/drivers/gpu/drm/apple/dcp-peer-modeset-probe-v27.inc +++ b/drivers/gpu/drm/apple/dcp-peer-modeset-probe-v27.inc @@ -7,11 +7,12 @@ static int dcp_peer_probe_power(struct apple_dcp *dcp, struct apple_dcp *peer, bool on) { struct dcp_peer_video_wait *wait; - struct dcp_method_entry method = { .name = "peer_power_test", - .tag = {'A', '4', '8', '4'} }; + struct dcp_method_entry method = { .name = "peer_power_test" }; u8 power[16] = {}, response[8]; int ret; + iomfb_v27_tag(dcp->v27_methods, "A484", method.tag); + wait = kzalloc(sizeof(*wait), GFP_KERNEL); if (!wait) return -ENOMEM; @@ -134,13 +135,14 @@ static int dcp_peer_probe_modeset(struct apple_dcp *dcp, struct apple_dcp *peer, bool firmware_requires_merge) { struct dcp_peer_video_wait *wait; - struct dcp_method_entry method = { .name = "peer_modeset_test", - .tag = {'A', '4', '1', '3'} }; + struct dcp_method_entry method = { .name = "peer_modeset_test" }; __le32 mode[2] = {video->color_id, video->timing_id}; u32 primary_id, peer_id, phase, status; unsigned long deadline; int ret; + iomfb_v27_tag(dcp->v27_methods, "A413", method.tag); + { guard(mutex)(&dcp_peer_lock); if (dcp->peer_reserved != peer || peer->peer_owner != dcp || diff --git a/drivers/gpu/drm/apple/dcp-peer-swap-probe-v27.inc b/drivers/gpu/drm/apple/dcp-peer-swap-probe-v27.inc index ed73f355eda7e..5a87e1973b9f2 100644 --- a/drivers/gpu/drm/apple/dcp-peer-swap-probe-v27.inc +++ b/drivers/gpu/drm/apple/dcp-peer-swap-probe-v27.inc @@ -26,10 +26,11 @@ static void dcp_peer_background_start(struct apple_dcp *dcp, { struct dcp_peer_background *background = container_of(transaction, struct dcp_peer_background, transaction); - struct dcp_method_entry method = { .name = "peer_background_test", - .tag = {'A', '4', '0', '8'} }; + struct dcp_method_entry method = { .name = "peer_background_test" }; struct dcp_swap_submit_resp_v27 failed = { .ret = ~0U }; + iomfb_v27_tag(dcp->v27_methods, "A408", method.tag); + background->sent = true; if (!dcp_present_begin_h17p(&dcp->present_state_h17p, background->wire.swap.swap_id)) { @@ -185,6 +186,7 @@ static void dcp_peer_a407_background_start(struct apple_dcp *dcp, { struct dcp_peer_a407_background *background = container_of(transaction, struct dcp_peer_a407_background, transaction); + /* The J714s's 27.0 swap form, whose table names A407 (iomfb_v27_methods_j714s()). */ struct dcp_method_entry method = { .name = "peer_background_test", .tag = {'A', '4', '0', '7'} }; struct dcp_swap_submit_resp_v27 failed = { .ret = ~0U }; @@ -345,6 +347,8 @@ static ssize_t peer_swap_test_store(struct device *dev, dcp->crtc->base.state->active || peer->crtc->base.state->active || dcp->fw_compat != DCP_FIRMWARE_V_27_0 || peer->fw_compat != DCP_FIRMWARE_V_27_0 || + /* Both engines must take the swap form the owner sends. */ + dcp->v27_a407 != peer->v27_a407 || !device_trylock(peer->dev)) { ret = -EBUSY; goto out; diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index 1f3e97e6c5e9f..e7f6a4e8df361 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -892,11 +892,11 @@ static void iomfb_v27_sleep_start(struct apple_dcp *dcp, rpc->data, iomfb_v27_sleep_done, rpc); dcp->push_out_prefill = NULL; if ((rpc->a442 || rpc->a442_key) && !rpc->oob) { - static const struct dcp_method_entry a442 = { - .name = "v27_a442", .tag = { 'A', '4', '4', '2' }, - }; + struct dcp_method_entry a442 = { .name = "v27_a442" }; u8 in[92]; + iomfb_v27_tag(dcp->v27_methods, "A442", a442.tag); + memset(in, 0xaa, sizeof(in)); memset(in, 0, 16); in[8] = rpc->a442_key ?: 0x41; @@ -1002,7 +1002,7 @@ static int iomfb_v27_rpc(struct apple_dcp *dcp, bool a500, bool on, bool flags) rpc->method = (struct dcp_method_entry) { .name = a500 ? "v27_sleep_500" : "v27_sleep_power", }; - memcpy(rpc->method.tag, a500 ? "A500" : "A484", 4); + iomfb_v27_tag(dcp->v27_methods, a500 ? "A500" : "A484", rpc->method.tag); /* * Off, before each DCP's and DCPEXT's sleep idle: A484 with the sleep's flags, then * A500's sleep form. On, after the wake: A500's wake form, then A484 with the flags. @@ -1091,7 +1091,7 @@ static int iomfb_v27_call(struct apple_dcp *dcp, const char *tag, const void *in rpc->transaction.start = iomfb_v27_sleep_start; rpc->transaction.release = iomfb_v27_sleep_release; rpc->method = (struct dcp_method_entry) { .name = "v27_display_stage" }; - memcpy(rpc->method.tag, tag, 4); + iomfb_v27_tag(dcp->v27_methods, tag, rpc->method.tag); rpc->input = in_len; rpc->output = out_len; rpc->inout = inout; From aff9b6100741329c6d46dd09abefaf03898ae328 Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Tue, 17 Nov 2026 20:16:22 -0500 Subject: [PATCH 03/37] drm/apple: the J716c's display sleep transport on firmware 27.2 too The J716c's display processors take part in a deep sleep through the firmware 27 endpoint transport, which was admitted on a 27.0 compatibility build only. On a 27.2 stub no processor registered for the sleep, and every deep sleep was refused ("display 0: no provider"). Admit 27.2.0 as well. Its endpoint transport is the 27.0 one, and the IOMFB calls the sleep makes are sent with the build's IDs. Developed with Claude Code. Signed-off-by: Erik Bourget --- drivers/gpu/drm/apple/dcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 7cde46e009096..0b85bd658f606 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -5797,9 +5797,12 @@ static bool dcp_v27_sleep_transport_supported(struct apple_dcp *dcp) dcp->fw_compat != DCP_FIRMWARE_V_27_0) return false; - /* The enum also covers later 27.x method tables. */ + /* + * The enum also covers later 27.x method tables. 27.2 keeps the endpoint + * transport; its renumbered IOMFB calls go through iomfb_v27_tag(). + */ return dcp_read_fw_version(dev, "apple,firmware-compat", compat) >= 0 && - !strcmp(compat, "27.0.0"); + (!strcmp(compat, "27.0.0") || !strcmp(compat, "27.2.0")); } static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev) From 2d03b4d14b90e0b778a215c968cb335721cb54a2 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:39 -0700 Subject: [PATCH 04/37] of: export of_update_property() A driver built as a module needs it to complete its own node at probe: the Apple display driver adds a mailbox that the boot loader must not see in mboxes. Signed-off-by: Jens Axboe --- drivers/of/base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index f63a9486b1305..1e7b2e90f2f9a 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1916,6 +1916,7 @@ int of_update_property(struct device_node *np, struct property *newprop) return rc; } +EXPORT_SYMBOL_GPL(of_update_property); static void of_alias_add(struct alias_prop *ap, struct device_node *np, int id, const char *stem, int stem_len) From 89dbf78dc5c8ad59491514797bca7da695afb903 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:39 -0700 Subject: [PATCH 05/37] soc: apple: rtkit: a step between the AP idle and the IOP idle A coprocessor with a second (secure) mailbox port takes its IOP idle only after that port's AP idle, sent between the main mailbox's AP idle and its IOP idle. The display coprocessor of T6050 firmware 27.2 is one: without it the IOP idle is never acknowledged. - apple_rtkit_v27_set_after_ap(): a callback the atomic idle runs once the AP state is acknowledged, before the IOP request. An error from it fails the idle. - apple_rtkit_v27_port_ap_idle_atomic(): a port's AP idle, sent and awaited by polling, for that callback. - apple_rtkit_idle_strict_with(): the same step for the sleeping idle. No caller yet. Signed-off-by: Jens Axboe --- drivers/soc/apple/rtkit-v27-late.inc | 57 +++++++++++++++++++++++++ drivers/soc/apple/rtkit.c | 11 ++++- include/linux/soc/apple/dcp-v27-sleep.h | 2 + include/linux/soc/apple/rtkit.h | 1 + 4 files changed, 70 insertions(+), 1 deletion(-) diff --git a/drivers/soc/apple/rtkit-v27-late.inc b/drivers/soc/apple/rtkit-v27-late.inc index 6f3bfd84ab0a5..44d3b92cb27b8 100644 --- a/drivers/soc/apple/rtkit-v27-late.inc +++ b/drivers/soc/apple/rtkit-v27-late.inc @@ -7,8 +7,23 @@ struct apple_rtkit_v27_scope { DECLARE_KFIFO(deferred, struct apple_mbox_msg, 64); bool held, stopped, failed; int error; + /* + * Run once between the AP state's acknowledgment and the IOP request, interrupts off. + * An error fails the idle. + */ + int (*after_ap)(void *data); + void *after_ap_data; }; +void apple_rtkit_v27_set_after_ap(struct apple_rtkit_v27_scope *s, int (*fn)(void *), void *data) +{ + if (s) { + s->after_ap = fn; + s->after_ap_data = data; + } +} +EXPORT_SYMBOL_GPL(apple_rtkit_v27_set_after_ap); + bool apple_rtkit_v27_live(struct apple_rtkit *rtk) { return !rtk->crashed && !rtk->shutting_down && @@ -118,6 +133,43 @@ int apple_rtkit_v27_check(struct apple_rtkit_v27_scope *s) } EXPORT_SYMBOL_GPL(apple_rtkit_v27_check); +/* + * A second port's AP idle with interrupts off: sent, and its acknowledgment awaited by polling + * the port's mailbox, for at most @us. The port's tracked state is not updated. + */ +int apple_rtkit_v27_port_ap_idle_atomic(struct apple_rtkit *rtk, unsigned int us) +{ + struct apple_mbox_msg msg = { + .msg0 = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_MGMT_SET_AP_PWR_STATE) | + FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, APPLE_RTKIT_PWR_STATE_IDLE), + .msg1 = APPLE_RTKIT_EP_MGMT, + }; + unsigned int i, n = us / 10; + int ret = -ETIMEDOUT; + + for (i = 0; i < n; i++) { + ret = apple_mbox_send_nowait(rtk->mbox, msg); + if (ret != -EAGAIN && ret != -EBUSY) + break; + udelay(10); + } + if (ret) + return ret; + for (; i < n; i++) { + struct apple_mbox_msg in; + + ret = apple_mbox_recv_nowait(rtk->mbox, &in); + if (ret < 0 && ret != -EBUSY) + return ret; + if (ret > 0 && in.msg1 == APPLE_RTKIT_EP_MGMT && + FIELD_GET(APPLE_RTKIT_MGMT_TYPE, in.msg0) == APPLE_RTKIT_MGMT_SET_AP_PWR_STATE_ACK) + return 0; + udelay(10); + } + return -ETIMEDOUT; +} +EXPORT_SYMBOL_GPL(apple_rtkit_v27_port_ap_idle_atomic); + int apple_rtkit_v27_idle_atomic(struct apple_rtkit_v27_scope *s) { struct apple_rtkit *rtk; @@ -180,6 +232,11 @@ int apple_rtkit_v27_idle_atomic(struct apple_rtkit_v27_scope *s) type == APPLE_RTKIT_MGMT_SET_AP_PWR_STATE_ACK && arg == APPLE_RTKIT_PWR_STATE_IDLE) { ap_ack = true; + if (s->after_ap) { + ret = s->after_ap(s->after_ap_data); + if (ret) + goto poison; + } } else if (msg.msg1 == APPLE_RTKIT_EP_MGMT && iop_sent && !iop_ack && type == APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE_ACK && arg == APPLE_RTKIT_PWR_STATE_IDLE) { diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index 22a7fad956426..babd3cc635248 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -2776,6 +2776,13 @@ static int apple_rtkit_strict_idle_state(struct apple_rtkit *rtk, bool ap) } int apple_rtkit_idle_strict(struct apple_rtkit *rtk) +{ + return apple_rtkit_idle_strict_with(rtk, NULL, NULL); +} +EXPORT_SYMBOL_GPL(apple_rtkit_idle_strict); + +/* As apple_rtkit_idle_strict(), with a step between the AP state's and the IOP state's. */ +int apple_rtkit_idle_strict_with(struct apple_rtkit *rtk, void (*after_ap)(void *data), void *data) { int ret; @@ -2786,6 +2793,8 @@ int apple_rtkit_idle_strict(struct apple_rtkit *rtk) reinit_completion(&rtk->strict_idle_done); WRITE_ONCE(rtk->strict_idle_waiting, true); ret = apple_rtkit_strict_idle_state(rtk, true); + if (!ret && after_ap) + after_ap(data); if (!ret) ret = apple_rtkit_strict_idle_state(rtk, false); if (!ret && !wait_for_completion_timeout(&rtk->strict_idle_done, @@ -2798,7 +2807,7 @@ int apple_rtkit_idle_strict(struct apple_rtkit *rtk) rtk->strict_idle_poisoned = true; return ret; } -EXPORT_SYMBOL_GPL(apple_rtkit_idle_strict); +EXPORT_SYMBOL_GPL(apple_rtkit_idle_strict_with); int apple_rtkit_warm_restart_strict(struct apple_rtkit *rtk) { diff --git a/include/linux/soc/apple/dcp-v27-sleep.h b/include/linux/soc/apple/dcp-v27-sleep.h index 5e56c40141903..3484c04a98c2c 100644 --- a/include/linux/soc/apple/dcp-v27-sleep.h +++ b/include/linux/soc/apple/dcp-v27-sleep.h @@ -39,6 +39,8 @@ int apple_rtkit_v27_arm(struct apple_rtkit *, struct apple_rtkit_v27_scope **); bool apple_rtkit_v27_live(struct apple_rtkit *); int apple_rtkit_v27_check(struct apple_rtkit_v27_scope *); int apple_rtkit_v27_idle_atomic(struct apple_rtkit_v27_scope *); +int apple_rtkit_v27_port_ap_idle_atomic(struct apple_rtkit *rtk, unsigned int us); +void apple_rtkit_v27_set_after_ap(struct apple_rtkit_v27_scope *s, int (*fn)(void *), void *data); int apple_rtkit_v27_disarm(struct apple_rtkit_v27_scope *, bool stopped); int apple_dart_v27_claim(struct device *provider, struct device *firmware, diff --git a/include/linux/soc/apple/rtkit.h b/include/linux/soc/apple/rtkit.h index 4db916bb89f09..01b6f604148de 100644 --- a/include/linux/soc/apple/rtkit.h +++ b/include/linux/soc/apple/rtkit.h @@ -285,6 +285,7 @@ int apple_rtkit_idle(struct apple_rtkit *rtk); /* The mailbox's receive-enable bit (I2A_CONTROL bit 0): off once a slept firmware has answered its idle. */ void apple_rtkit_set_recv_enabled(struct apple_rtkit *rtk, bool enabled); int apple_rtkit_idle_strict(struct apple_rtkit *rtk); +int apple_rtkit_idle_strict_with(struct apple_rtkit *rtk, void (*after_ap)(void *data), void *data); int apple_rtkit_warm_restart_strict(struct apple_rtkit *rtk); int apple_rtkit_warm_restart_stopped(struct apple_rtkit *rtk); From 10bb0501d56985adeb6d2808b521a7ce9264d687 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:39 -0700 Subject: [PATCH 06/37] drm/apple: V27 sleep: no filler in firmware 27.2's A492 27.0's A442 takes 0xaa filler after its key. 27.2's A492 reads an index count and a block size there and rejects the call (its syslog shows idx_count 0xaaaaaaaa). Send zeros, which it accepts. Run on a K116s (16-inch M5 Pro, 27.2): the internal DCP and the four DCPEXT sleep and wake with it. Signed-off-by: Jens Axboe --- drivers/gpu/drm/apple/iomfb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index e7f6a4e8df361..d8038e0fbcb49 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -904,6 +904,9 @@ static void iomfb_v27_sleep_start(struct apple_dcp *dcp, if (rpc->a442_key) { memset(in + 80, 0, 12); in[84] = 0x20; + } else if (iomfb_v27_methods_renumbered(dcp->v27_methods)) { + /* 27.2 reads the filler as an index count and a block size */ + memset(in + 16, 0, sizeof(in) - 16); } dcp_push(dcp, true, &a442, sizeof(in), 4100, in, iomfb_v27_a442_done, NULL); } From 2402ea5e896392dff5feccc1fe07f2848a011a7d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:40 -0700 Subject: [PATCH 07/37] drm/apple: V27 sleep: the DCP's secure port (firmware 27.2) On T6050 firmware 27.2 the internal display coprocessor has a secure mailbox port (ADT /arm-io/dcp-exclave-mailbox, iop,secure-rtbuddy-proxy), as on T8140. With it unanswered the firmware acknowledges the AP idle and never the IOP idle: the sleep's late stop fails, and so does the stop and restart in the wake. - The port may be named by apple,secure-mbox where mboxes must stay the one ASC mailbox: the boot loader refuses the display handoff otherwise. It is added to the live node's mboxes at probe. - A coprocessor with the port is no longer refused the V27 sleep. Its poller stops at .prepare. - Late stop: the port's AP idle between the main mailbox's AP idle and its IOP idle, polled, interrupts off. Not acknowledged in 5 ms, it fails the stop. - Wake: the stop and restart cycle idles the port the same way and stops its poller, which otherwise reads the mailbox with the display's domain off (SError). The port is restarted before RUN and turned on after the boot. All of it follows the port's presence, not the board. Tested on a K116s: with this the IOP idle is acknowledged within 2 ms. Signed-off-by: Jens Axboe --- drivers/gpu/drm/apple/dcp-v27-sleep.inc | 81 +++++++++++++++++++++---- drivers/gpu/drm/apple/dcp.c | 30 +++++++++ 2 files changed, 100 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp-v27-sleep.inc b/drivers/gpu/drm/apple/dcp-v27-sleep.inc index dc37f122bb8ef..fabeb596933be 100644 --- a/drivers/gpu/drm/apple/dcp-v27-sleep.inc +++ b/drivers/gpu/drm/apple/dcp-v27-sleep.inc @@ -248,6 +248,41 @@ static int dcp_v27_ext_cycle_ready(struct apple_dcp *dcp) return dcp->s2r_dcp_dart ? 0 : -ENODEV; } +/* + * A restart with the secure port (firmware 27.2), as dcp_s2r_warm_restart() does it: the + * port restarted before RUN, mapped between the main mailbox's IOP report and its AP on, then on. + */ +static int dcp_v27_warm_restart(struct apple_dcp *dcp, bool strict) +{ + int ret; + + if (dcp->secure_rtk && dcp->secure_answered) { + dcp_secure_poll_stop(dcp); + ret = apple_rtkit_port_restart(dcp->secure_rtk); + if (ret) + dev_warn(dcp->dev, "V27 wake: secure port restart: %d\n", ret); + } + return strict ? apple_rtkit_warm_restart_strict(dcp->rtk) : + apple_rtkit_warm_restart_stopped(dcp->rtk); +} + +static int dcp_v27_boot(struct apple_dcp *dcp) +{ + bool secure = dcp->secure_rtk && dcp->secure_answered; + int ret; + + ret = apple_rtkit_boot_with(dcp->rtk, secure ? dcp_secure_port_map : NULL, dcp); + if (ret || !secure) + return ret; + ret = dcp->secure_map_ret ?: apple_rtkit_port_on(dcp->secure_rtk, DCP_SECURE_TIMEOUT_MS); + if (ret) + dev_warn(dcp->dev, "V27 wake: secure port map %d (%lld us), on %d\n", + dcp->secure_map_ret, dcp->secure_map_us, ret); + else + dcp_secure_poll_start(dcp); + return 0; +} + /* * macOS's DCP stop/restart between its wake steps: sessions closed, AP and IOP * idle, IDLE_DONE, receive off, CPU_CONTROL RUN off; dart-dcp stopped, the display's domain off and, @@ -271,7 +306,11 @@ static int dcp_v27_rtkit_cycle(struct apple_dcp *dcp, unsigned int pause_ms) if (s && s->cycle_failed) return -ECANCELED; dcp_v27_sessions(dcp, false); - ret = apple_rtkit_idle_strict(dcp->rtk); + /* With a secure port: the IOP idle is taken only after the port's AP idle */ + if (dcp->secure_rtk && dcp->secure_answered) + ret = apple_rtkit_idle_strict_with(dcp->rtk, dcp_secure_port_idle, dcp); + else + ret = apple_rtkit_idle_strict(dcp->rtk); if (ret) { dev_warn(dcp->dev, "V27 wake: RTKit cycle: idle %d\n", ret); dcp_v27_sessions(dcp, true); @@ -347,12 +386,12 @@ static int dcp_v27_rtkit_cycle(struct apple_dcp *dcp, unsigned int pause_ms) dev_warn(dcp->dev, "V27 wake: RTKit cycle: display DART rewrite %d\n", ret); } } - ret = apple_rtkit_warm_restart_strict(dcp->rtk); + ret = dcp_v27_warm_restart(dcp, true); if (!ret) { writel(readl(dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL) | APPLE_DCP_COPROC_CPU_CONTROL_RUN, dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL); run_status = readl(dcp->coproc_reg + APPLE_DCP_COPROC_CPU_STATUS); - ret = apple_rtkit_boot(dcp->rtk); + ret = dcp_v27_boot(dcp); } /* * An external processor that did not start is not left down: its DART, power words and @@ -371,13 +410,13 @@ static int dcp_v27_rtkit_cycle(struct apple_dcp *dcp, unsigned int pause_ms) ret = apple_dart_m5_display_cycle(dcp->s2r_dcp_dart, true); } if (!ret) - ret = apple_rtkit_warm_restart_stopped(dcp->rtk); + ret = dcp_v27_warm_restart(dcp, false); if (!ret) { writel(readl(dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL) | APPLE_DCP_COPROC_CPU_CONTROL_RUN, dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL); run_status = readl(dcp->coproc_reg + APPLE_DCP_COPROC_CPU_STATUS); - ret = apple_rtkit_boot(dcp->rtk); + ret = dcp_v27_boot(dcp); } } if (ret) { @@ -1210,6 +1249,8 @@ static int dcp_v27_reopen_live(struct apple_dcp *dcp) return 0; } +static int dcp_v27_secure_idle_atomic(void *data); + static int dcp_v27_late_arm(void *data) { struct dcp_v27_sleep *s = data; @@ -1239,6 +1280,8 @@ static int dcp_v27_late_arm(void *data) ret = apple_rtkit_v27_arm(dcp->rtk, &s->rx); if (ret) dev_info(dcp->dev, "V27 arm: RTKit %d\n", ret); + else + apple_rtkit_v27_set_after_ap(s->rx, dcp_v27_secure_idle_atomic, dcp); } if (ret) { if (s->display && !s->display_early) { @@ -1257,6 +1300,20 @@ static int dcp_v27_late_arm(void *data) return 0; } +/* + * With a secure port (firmware 27.2): its AP idle between the main mailbox's AP idle and + * its IOP idle, polled, as this runs with interrupts off. Not acknowledged, it fails the stop: + * the firmware would not take the IOP idle. + */ +static int dcp_v27_secure_idle_atomic(void *data) +{ + struct apple_dcp *dcp = data; + + if (!dcp->secure_rtk || !dcp->secure_answered) + return 0; + return apple_rtkit_v27_port_ap_idle_atomic(dcp->secure_rtk, 5000); +} + static int dcp_v27_late_check(void *data) { struct dcp_v27_sleep *s = data; @@ -1391,9 +1448,11 @@ static int dcp_v27_sleep_prepare(struct apple_dcp *dcp) dev_warn(dcp->dev, "V27 sleep: no sleep RPC arguments in the DT\n"); return -EOPNOTSUPP; } - if (!dcp->retain_dma || IS_ERR_OR_NULL(dcp->rtk) || !dcp->active || dcp->crashed || dcp->quiescing || - dcp->secure_rtk) - return dcp_v27_refuse(dcp, "coprocessor not live (dma, rtkit, active, crashed, quiescing, secure)"); + if (!dcp->retain_dma || IS_ERR_OR_NULL(dcp->rtk) || !dcp->active || dcp->crashed || dcp->quiescing) + return dcp_v27_refuse(dcp, "coprocessor not live (dma, rtkit, active, crashed, quiescing)"); + /* The secure port is idled from the late stop, with nothing else reading it. */ + if (dcp->secure_rtk && dcp->secure_answered) + dcp_secure_poll_stop(dcp); /* Mode-config suspend is the actual DRM scanout-owner boundary. No HPD * shortcut: external firmware still executes A484/A500/AFK and late IDLE. */ @@ -1639,7 +1698,7 @@ static int dcp_v27_sleep_restart(struct apple_dcp *dcp) if (s->phase == V27_STOPPED) { ret = apple_sleep_display_v27_power_ready(dcp->dev); if (!ret) - ret = apple_rtkit_warm_restart_strict(dcp->rtk); + ret = dcp_v27_warm_restart(dcp, true); /* * The final step stopped this CPU and it is still stopped: the firmware boots * from its reset vector next, so the state tracked before the stop does not @@ -1648,12 +1707,12 @@ static int dcp_v27_sleep_restart(struct apple_dcp *dcp) if (ret == -EUCLEAN && READ_ONCE(dcp->s2r_fw_down) && !(readl(dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL) & APPLE_DCP_COPROC_CPU_CONTROL_RUN)) - ret = apple_rtkit_warm_restart_stopped(dcp->rtk); + ret = dcp_v27_warm_restart(dcp, false); if (ret) return dcp_v27_fail(s, ret); writel(readl(dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL) | APPLE_DCP_COPROC_CPU_CONTROL_RUN, dcp->coproc_reg + APPLE_DCP_COPROC_CPU_CONTROL); - ret = apple_rtkit_boot(dcp->rtk); + ret = dcp_v27_boot(dcp); if (ret) return dcp_v27_fail(s, ret); } diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 0b85bd658f606..a4844eed19a3d 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -270,6 +270,36 @@ static int dcp_secure_port_init(struct apple_dcp *dcp) { struct device *dev = dcp->dev; + /* + * The secure mailbox named outside mboxes, which the boot loader wants to be the one ASC + * mailbox (it refuses the display handoff otherwise). Added to the live node here. + */ + if (of_property_match_string(dev->of_node, "mbox-names", "secure") < 0 && + of_property_present(dev->of_node, "apple,secure-mbox")) { + static const char names[] = "mbox\0secure"; + struct property *boxes, *nm; + const __be32 *main_box, *sec; + __be32 *v; + int len; + + main_box = of_get_property(dev->of_node, "mboxes", &len); + sec = of_get_property(dev->of_node, "apple,secure-mbox", NULL); + boxes = devm_kzalloc(dev, sizeof(*boxes), GFP_KERNEL); + nm = devm_kzalloc(dev, sizeof(*nm), GFP_KERNEL); + v = devm_kcalloc(dev, 2, sizeof(*v), GFP_KERNEL); + if (main_box && len == 4 && sec && boxes && nm && v) { + v[0] = main_box[0]; + v[1] = sec[0]; + boxes->name = "mboxes"; + boxes->value = v; + boxes->length = 8; + nm->name = "mbox-names"; + nm->value = (void *)names; + nm->length = sizeof(names); + if (!of_update_property(dev->of_node, boxes)) + of_update_property(dev->of_node, nm); + } + } if (of_property_match_string(dev->of_node, "mbox-names", "secure") < 0) return 0; From 484930ed5a093931e41d98ec48ff3b6aa9fb4770 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:40 -0700 Subject: [PATCH 08/37] drm/apple: V27 sleep: wait out a busy endpoint before closing it An endpoint that is still taking a message answers -EBUSY to the close for a moment, and the sleep was refused; undoing it then crashed the internal DCP. Seen on endpoint 0x31 of a K116s DCPEXT, where a service is announced late ("close-31 -16"), more often with a verbose console. Poll afk_v27_sleep_check() for up to 300 ms first, as the other steps do. Signed-off-by: Jens Axboe --- drivers/gpu/drm/apple/dcp-v27-sleep.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/apple/dcp-v27-sleep.inc b/drivers/gpu/drm/apple/dcp-v27-sleep.inc index fabeb596933be..a29b3c9ea539b 100644 --- a/drivers/gpu/drm/apple/dcp-v27-sleep.inc +++ b/drivers/gpu/drm/apple/dcp-v27-sleep.inc @@ -1617,7 +1617,18 @@ static int dcp_v27_sleep_prepare(struct apple_dcp *dcp) if (ret) goto uncertain; for (i = ARRAY_SIZE(v27_sleep_endpoints); i-- > 0;) { - ret = afk_v27_sleep_control(dcp->sleep_v27_ep[v27_sleep_endpoints[i] - 0x20], false); + struct apple_dcp_afkep *ep = dcp->sleep_v27_ep[v27_sleep_endpoints[i] - 0x20]; + int check; + + /* + * An endpoint still taking a message (a service announced late, seen on 0x31 of + * a K116s DCPEXT) answers -EBUSY for a moment: wait it out as the other steps do, + * rather than refuse the sleep. + */ + if (ep) + read_poll_timeout(afk_v27_sleep_check, check, check != -EBUSY, 1000, + 300 * USEC_PER_MSEC, false, ep); + ret = afk_v27_sleep_control(ep, false); if (ret) { char name[12]; From 1eabbff0fab5b4ffc51610aefa5c73b3e4426ca7 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:40 -0700 Subject: [PATCH 09/37] drm/apple: V27 wake: mode set once the firmware has reported the panel After a V27 sleep the first mode set of the internal panel is kept, not sent: on the J714s (27.0) the firmware brings link and mode back once frames arrive. That mode set also comes before the firmware has announced the panel's video interface again. On firmware 27.2 it now waits for two events of the wake and is then sent: the open of the panel's video interface (up to 1.5 s) and the firmware's hotplug report that follows it (up to 250 ms). A wait that runs out is logged. On the K116s the firmware answers that the mode is already set and the link up. 27.0 keeps the mode as before. Whether 27.2 needs the mode set has not been tested separately. Signed-off-by: Jens Axboe --- drivers/gpu/drm/apple/dcp-internal.h | 4 ++++ drivers/gpu/drm/apple/dcp-v27-sleep.inc | 2 ++ drivers/gpu/drm/apple/dcp.c | 2 ++ drivers/gpu/drm/apple/epic/panelavep.c | 4 +++- drivers/gpu/drm/apple/iomfb_template.c | 15 +++++++++++++++ drivers/gpu/drm/apple/iomfb_v27.c | 3 +++ 6 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/apple/dcp-internal.h b/drivers/gpu/drm/apple/dcp-internal.h index ea38c3fd64de7..ab0c3d21ae9b6 100644 --- a/drivers/gpu/drm/apple/dcp-internal.h +++ b/drivers/gpu/drm/apple/dcp-internal.h @@ -944,6 +944,10 @@ struct apple_dcp { /* V27 sleep: the panel's next mode set is the mode it already has */ bool v27_keep_mode; + /* Since the V27 wake: the panel's video interface opened, the firmware reported the panel */ + struct completion v27_wake_video, v27_wake_hotplug; +#define V27_WAKE_VIDEO_MS 1500 +#define V27_WAKE_HOTPLUG_MS 250 /* V27 sleep: the output area of the call being pushed holds this (an in/out word) */ const void *push_out_prefill; diff --git a/drivers/gpu/drm/apple/dcp-v27-sleep.inc b/drivers/gpu/drm/apple/dcp-v27-sleep.inc index a29b3c9ea539b..5f19e3a556226 100644 --- a/drivers/gpu/drm/apple/dcp-v27-sleep.inc +++ b/drivers/gpu/drm/apple/dcp-v27-sleep.inc @@ -1204,6 +1204,8 @@ static int dcp_v27_reopen_live(struct apple_dcp *dcp) return ret; s->soft_off = false; } + reinit_completion(&dcp->v27_wake_video); + reinit_completion(&dcp->v27_wake_hotplug); WRITE_ONCE(dcp->v27_keep_mode, true); } else if (s->ext_wake) { ret = dcp_v27_ext_wake_calls(s); diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index a4844eed19a3d..f3bb2aff2fdf9 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -7026,6 +7026,8 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) INIT_LIST_HEAD(&dcp->swapped_out_fbs); mutex_init(&dcp->swapped_out_fbs_lock); + init_completion(&dcp->v27_wake_video); + init_completion(&dcp->v27_wake_hotplug); ret = dcp_backlight_init(dcp, dev); if (ret) return ret; diff --git a/drivers/gpu/drm/apple/epic/panelavep.c b/drivers/gpu/drm/apple/epic/panelavep.c index cd4507b2bf78f..6e7a0cb682bcf 100644 --- a/drivers/gpu/drm/apple/epic/panelavep.c +++ b/drivers/gpu/drm/apple/epic/panelavep.c @@ -131,9 +131,11 @@ static void panelav_open_worker(struct work_struct *work) if (ret) dev_warn(service->ep->dcp->dev, "panel AV: video interface %u OPEN failed: %d\n", service->channel, ret); - else + else { + complete(&service->ep->dcp->v27_wake_video); dev_info(service->ep->dcp->dev, "panel AV: video interface %u opened\n", service->channel); + } afk_service_put(service); kfree(w); } diff --git a/drivers/gpu/drm/apple/iomfb_template.c b/drivers/gpu/drm/apple/iomfb_template.c index 066c7a5f1cfdd..c8c5fcc8e677f 100644 --- a/drivers/gpu/drm/apple/iomfb_template.c +++ b/drivers/gpu/drm/apple/iomfb_template.c @@ -4249,6 +4249,21 @@ int DCP_FW_NAME(iomfb_modeset)(struct apple_dcp *dcp, keep_mode = dcp->v27_j714s && xchg(&dcp->v27_keep_mode, false) && dcp->mode.color_mode_id == mode->color_mode_id && dcp->mode.timing_mode_id == mode->timing_mode_id; + /* + * Firmware 27.2: sent once the panel's video interface is open again and the firmware + * has reported the panel, which it does after the open. + */ + if (keep_mode && iomfb_v27_methods_renumbered(dcp->v27_methods)) { + if (!wait_for_completion_timeout(&dcp->v27_wake_video, + msecs_to_jiffies(V27_WAKE_VIDEO_MS))) + dev_warn(dcp->dev, "V27 wake: panel video interface not open after %u ms\n", + V27_WAKE_VIDEO_MS); + else if (!wait_for_completion_timeout(&dcp->v27_wake_hotplug, + msecs_to_jiffies(V27_WAKE_HOTPLUG_MS))) + dev_warn(dcp->dev, "V27 wake: no hotplug report %u ms after the panel's open\n", + V27_WAKE_HOTPLUG_MS); + keep_mode = false; + } #endif dcp->mode = (struct dcp_set_digital_out_mode_req){ .color_mode_id = mode->color_mode_id, diff --git a/drivers/gpu/drm/apple/iomfb_v27.c b/drivers/gpu/drm/apple/iomfb_v27.c index d98df23791908..6c8e26d45c2aa 100644 --- a/drivers/gpu/drm/apple/iomfb_v27.c +++ b/drivers/gpu/drm/apple/iomfb_v27.c @@ -448,6 +448,9 @@ static bool trampoline_hotplug_h17p(struct apple_dcp *dcp, int tag, if (!(request->tiled_display_null & 1)) memcpy(out, request->tiled_display, sizeof(request->tiled_display)); + /* The V27 wake's mode set waits for the firmware's report of the panel */ + if (request->connected && dcp->v27_j714s) + complete(&dcp->v27_wake_hotplug); return trampoline_hotplug(dcp, tag, out, in); } From 562444936a390ead17fdb5f61551bf7c605b13a0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:40 -0700 Subject: [PATCH 10/37] soc: apple: rtkit: serve an endpoint's first buffer under the ANS hold The T6050 ANS wake holds the buffers: a request under the hold fails the wake with -EBUSY and the driver then holds all I/O. ANS on firmware 27.0 asks for none. On 27.2 it asks for its syslog buffer (endpoint 2, 0x4000 bytes) about 2.4 s into the wake, having none yet. A first buffer for an endpoint replaces nothing the hold protects: serve it. A request for an endpoint that has a buffer is refused as before. With it ANS comes back and the controller is rebuilt after a deep sleep on a K116s (27.2). Signed-off-by: Jens Axboe --- drivers/soc/apple/rtkit.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index babd3cc635248..af1ef284dd22b 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -558,11 +558,9 @@ static void apple_rtkit_management_rx(struct apple_rtkit *rtk, u64 msg) } } -static int apple_rtkit_alloc_shmem(struct apple_rtkit *rtk, u8 ep, - struct apple_rtkit_shmem *buffer) +static int apple_rtkit_alloc_first_shmem(struct apple_rtkit *rtk, u8 ep, + struct apple_rtkit_shmem *buffer) { - if (READ_ONCE(rtk->ans_hold)) - return apple_rtkit_ans_fail(rtk, -EBUSY); /* The crash log's buffer is asked for only at a crash: serve it after a strict restart too. */ if (READ_ONCE(rtk->strict_retained_buffers) && ep != APPLE_RTKIT_EP_CRASHLOG) return -EPROTO; @@ -577,6 +575,14 @@ static int apple_rtkit_alloc_shmem(struct apple_rtkit *rtk, u8 ep, return buffer->buffer ? 0 : -ENOMEM; } +static int apple_rtkit_alloc_shmem(struct apple_rtkit *rtk, u8 ep, + struct apple_rtkit_shmem *buffer) +{ + if (READ_ONCE(rtk->ans_hold)) + return apple_rtkit_ans_fail(rtk, -EBUSY); + return apple_rtkit_alloc_first_shmem(rtk, ep, buffer); +} + static int apple_rtkit_common_rx_get_buffer(struct apple_rtkit *rtk, struct apple_rtkit_shmem *buffer, u8 ep, u64 msg) @@ -650,7 +656,8 @@ static int apple_rtkit_common_rx_get_buffer(struct apple_rtkit *rtk, goto error; } - err = apple_rtkit_alloc_shmem(rtk, ep, &request); + /* The endpoint has no buffer yet: a first one replaces nothing the ANS hold protects */ + err = apple_rtkit_alloc_first_shmem(rtk, ep, &request); if (err) goto error; *buffer = request; From 3a8aaee193ca210d0d2c86cbb2285d055e1096d3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:39:40 -0700 Subject: [PATCH 11/37] soc: apple: sleep: T6050: a sleep with no RTC alarm armed is not refused The T6050 entry refuses a sleep unless the PMU's RTC alarm is armed and unmasked ("SoC check: -16"), so a lid close with no alarm set never sleeps. The alarm is one wake source among several: the SMC wakes the machine for the lid and the keyboard without it. Accept a sleep with no alarm armed. The alarm is then not held against the sleep timer in the final check and not rearmed after the commit. With an alarm armed nothing changes. Tested on a K116s: deep sleep with no alarm, woken by the lid. Signed-off-by: Jens Axboe --- drivers/soc/apple/sleep-t6050.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/soc/apple/sleep-t6050.h b/drivers/soc/apple/sleep-t6050.h index b9744f3a5e36c..b4b9dfce1f659 100644 --- a/drivers/soc/apple/sleep-t6050.h +++ b/drivers/soc/apple/sleep-t6050.h @@ -623,8 +623,9 @@ static int t6050_sleep_check_alarm(struct apple_sleep *s) ret = t6050_sleep_pmu_xfer(s, T6050_SPMI_EXT_READL, T6050_RTC_CTL, NULL, &control, 1); if (!ret) ret = t6050_sleep_pmu_xfer(s, T6050_SPMI_EXT_READL, T6050_RTC_MASK, NULL, &mask, 1); + /* No armed alarm is no refusal: the SMC's wake sources (lid, keys) do not need it */ if (!ret && (!(control & T6050_RTC_CTL_ARMED) || (mask & BIT(0)))) - ret = -EBUSY; + return 0; if (!ret) ret = t6050_sleep_pmu_xfer(s, T6050_SPMI_EXT_READL, T6050_RTC_COMPARE, NULL, r->alarm_compare, 4); @@ -2750,6 +2751,9 @@ static int t6050_sleep_final_check(struct apple_sleep *s) ret = t6050_sleep_check_alarm(s); if (ret) return ret; + /* No alarm armed: nothing to hold against the sleep timer */ + if (!r->alarm_valid) + return 0; ret = t6050_sleep_pmu_xfer(s, T6050_SPMI_EXT_READL, T6050_RTC_COUNTER, NULL, ticks, 6); if (ret) return ret; From 7500130efdca80ddf5aa7b0ab875521865fb2a0b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:27:07 -0700 Subject: [PATCH 12/37] soc: apple: sleep: tell whether a T6050 machine describes the sleep The drivers that take part in T6050's firmware-driven sleep each name the boards it has run on. Whether a board sleeps that way is in its device tree: it has an enabled apple,t6050-sleep node or it does not. Add apple_t6050_sleep_described() for that. What differs from one description to another is a property of the node, read with apple_t6050_sleep_property(). Signed-off-by: Jens Axboe --- include/linux/soc/apple/sleep.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/include/linux/soc/apple/sleep.h b/include/linux/soc/apple/sleep.h index cec1e88452676..db45c2c5615d9 100644 --- a/include/linux/soc/apple/sleep.h +++ b/include/linux/soc/apple/sleep.h @@ -9,10 +9,33 @@ #include #include #include +#include #include struct device; -struct device_node; + +/* + * A T6050 machine whose device tree describes the firmware-driven sleep. What a + * driver does for that sleep follows the description, not a list of boards. + * With @prop: the description also has that property. + */ +static inline bool apple_t6050_sleep_property(const char *prop) +{ + struct device_node *np; + bool ret; + + if (!of_machine_is_compatible("apple,t6050")) + return false; + np = of_find_compatible_node(NULL, NULL, "apple,t6050-sleep"); + ret = np && of_device_is_available(np) && (!prop || of_property_read_bool(np, prop)); + of_node_put(np); + return ret; +} + +static inline bool apple_t6050_sleep_described(void) +{ + return apple_t6050_sleep_property(NULL); +} /* The SMC's sleep messages: the pmVC value and the spacings between them, used as floors */ struct apple_sleep_smc_policy { From 584046ee756e98e2d2c50a24018d1f3a03607363 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 08:12:11 -0700 Subject: [PATCH 13/37] dt-bindings: soc: apple,t6050-sleep: add apple,display-method-sleep The drivers tell one T6050 sleep description from another by the board or by the node's compatible. What differs for the display coprocessors is how they take the sleep: through their firmware 27 method table, with the panel's AV and DP services, or through the sleep's endpoint transport alone. Say so in the description. Signed-off-by: Jens Axboe --- .../devicetree/bindings/soc/apple/apple,t6050-sleep.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml b/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml index c32148802bd18..7d26c0049f8ac 100644 --- a/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml +++ b/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml @@ -144,6 +144,14 @@ properties: The GFX die's wake sources left enabled for a sleep. From the ADT, set by the bootloader. + apple,display-method-sleep: + type: boolean + description: | + The display coprocessors take the sleep through their firmware 27 method + table: its sleep call and its swap, the panel's AV and DP services and the + external processors' handling around a sleep. Without it they keep the + method table they had and take the sleep's endpoint transport alone. + apple,clk-gating-boot: $ref: /schemas/types.yaml#/definitions/uint32-matrix items: From c854c1f791a056465900daa60cbfd093a9c8e87c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 08:12:11 -0700 Subject: [PATCH 14/37] dt-bindings: mfd: apple,smc: add the wake reasons' numbering The bits of the SMC's wake record are numbered per board: the ADT's smc-pmu node gives each a name (event_name-bitN). Let the device tree carry the bits and their names. Signed-off-by: Jens Axboe --- .../devicetree/bindings/mfd/apple,smc.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/apple,smc.yaml b/Documentation/devicetree/bindings/mfd/apple,smc.yaml index c35e7d0e10faa..34416179acfa0 100644 --- a/Documentation/devicetree/bindings/mfd/apple,smc.yaml +++ b/Documentation/devicetree/bindings/mfd/apple,smc.yaml @@ -68,6 +68,22 @@ properties: hwmon: $ref: /schemas/hwmon/apple,smc-hwmon.yaml + apple,wake-reasons: + $ref: /schemas/types.yaml#/definitions/uint32-array + minItems: 1 + maxItems: 64 + items: + maximum: 63 + description: | + The bits of the SMC's wake record that have a name on this board, as the + ADT's smc-pmu node numbers them (event_name-bitN). + + apple,wake-reason-names: + $ref: /schemas/types.yaml#/definitions/string-array + minItems: 1 + maxItems: 64 + description: The names of the bits in apple,wake-reasons, in the same order. + additionalProperties: false required: From 99ec438b08f116762011436f02be387fe22e5a47 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 08:12:12 -0700 Subject: [PATCH 15/37] arm64: dts: apple: t6050-j714s: the display's sleep method and the SMC's wake reasons Both were tied to the board's name in the drivers: the display coprocessors' sleep through their firmware 27 method table, and the numbering of the SMC's wake record. Describe them, the latter as the J714s ADT's smc-pmu node has it. Signed-off-by: Jens Axboe --- arch/arm64/boot/dts/apple/t6050-j714s.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 383ec08bedbe2..e5336dd726ebf 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -717,6 +717,19 @@ #include "t6050-j714s-sleep-soc.dtsi" #include "t6050-j714s-sleep-adt.dtsi" +/* The display coprocessors take the sleep through their firmware 27 method table */ +&sleep { + apple,display-method-sleep; +}; + +/* The SMC's wake reasons (ADT smc-pmu, event_name-bitN) */ +&smc { + apple,wake-reasons = <0 8 9 11 13 35 40 41 42 43 44 45 48>; + apple,wake-reason-names = "pwrbtn", "lid", "sdconn", "charger", "wifibt", + "trackpadkeyboard", "acattach", "acdetach", "USB-C_plug", + "USB2_plug", "USB2_wake", "aupo", "rtc"; +}; + /* * Sound through the AOP, as on J813: its audio service runs the serializers, the * CS42L84 headphone jack on admac-base-ns TX2/RX2 and the six SN012776 speaker amps From 43e1a33cb66887c82e64625e56f3da05cc613f71 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:27:21 -0700 Subject: [PATCH 16/37] soc: apple: sleep: check a profile's CPU inventory, not its board's name A profile that names a machine is refused at probe on any other board, whatever its CPUs. The node's compatible already chose the profile, and what the entry depends on is the inventory: the boot CPU's MPIDR and the CPU count. Check those alone. The K116s (16-inch M5 Pro) binds apple,t6050-sleep with the J714s's 18-core layout and sleeps with that profile. Signed-off-by: Jens Axboe --- drivers/soc/apple/sleep.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/apple/sleep.c b/drivers/soc/apple/sleep.c index 465e30fef8236..c5420f6436373 100644 --- a/drivers/soc/apple/sleep.c +++ b/drivers/soc/apple/sleep.c @@ -1893,10 +1893,10 @@ static int apple_sleep_validate_cpu_topology(struct apple_sleep *s) soc->cpu_cores_per_cluster > 32) return dev_err_probe(s->dev, -EINVAL, "invalid CPU-start geometry\n"); - if (soc->machine && (!of_machine_is_compatible(soc->machine) || - cpu_logical_map(0) != soc->boot_mpidr || - num_possible_cpus() != soc->cpu_count)) - return dev_err_probe(s->dev, -EINVAL, "unsupported board/CPU inventory\n"); + /* The node's compatible chose the profile: its machine is where it was measured */ + if (soc->machine && (cpu_logical_map(0) != soc->boot_mpidr || + num_possible_cpus() != soc->cpu_count)) + return dev_err_probe(s->dev, -EINVAL, "unsupported CPU inventory\n"); index = of_property_match_string(np, "reg-names", "cpu-start"); if (index < 0) From 203f2619698a7022c623ff8c074613e663c8cfdc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:27:46 -0700 Subject: [PATCH 17/37] irqchip/apple-aic: keep the T6050 controller where the sleep is described The save and restore for T6050's deep sleep are set up on a list of boards. Set them up wherever the device tree describes that sleep. Signed-off-by: Jens Axboe --- drivers/irqchip/irq-apple-aic.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index 0a9aeced27721..d1a3cd69dcd0f 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -286,8 +287,8 @@ struct aic_info { bool siq_cfg_routing; /* A firmware-driven suspend powers the controller down: aic_syscore_ops keep it. */ bool fw_suspend; - /* If set, fw_suspend holds on these boards only */ - const char *const *fw_suspend_boards; + /* If set, fw_suspend holds only where this says the sleep is described */ + bool (*fw_suspend_described)(void); }; static const struct aic_info aic1_info __initconst = { @@ -336,12 +337,9 @@ static const struct aic_info aic3_info __initconst = { /* * The M5 Pro's sleep: the last steps mask every interrupt and acknowledge events by hand. The - * save and restore are set up on the boards with a T6050 sleep, the J714s and the J716c; + * save and restore are set up on the boards whose device tree describes a T6050 sleep; * another T6050 board is as one without them. */ -static const char *const aic3_t6050_sleep_boards[] __initconst = { - "apple,j714s", "apple,j716c", NULL -}; static const struct aic_info aic3_t6050_info __initconst = { .version = 3, @@ -349,7 +347,7 @@ static const struct aic_info aic3_t6050_info __initconst = { .fast_ipi = true, .local_fast_ipi = true, .fw_suspend = true, - .fw_suspend_boards = aic3_t6050_sleep_boards, + .fw_suspend_described = apple_t6050_sleep_described, }; static const struct aic_info aic3_t8140_info __initconst = { @@ -1280,8 +1278,7 @@ static struct syscore aic_syscore = { static void __init aic_sleep_init(struct aic_irq_chip *irqc) { if (!irqc->info.fw_suspend || - (irqc->info.fw_suspend_boards && - !of_machine_compatible_match(irqc->info.fw_suspend_boards))) + (irqc->info.fw_suspend_described && !irqc->info.fw_suspend_described())) return; aic_sleep.irq_cfg = kcalloc(irqc->nr_die * irqc->nr_irq, sizeof(u32), GFP_KERNEL); From 7aa0316fc9cf4042208b03a76e405866d71200ab Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:30 -0700 Subject: [PATCH 18/37] mfd: macsmc: the T6050 saved-context path where the sleep is described The saved-context lane is for T6050's deep sleep and was enabled on the boards named here. Enable it wherever the device tree describes that sleep. The J714s's numbering of the wake record was a table picked by the board's name. It is the ADT's smc-pmu numbering: read it from the SMC's node (apple,wake-reasons, apple,wake-reason-names). Without them the SoC's table is used as before. Signed-off-by: Jens Axboe --- drivers/mfd/macsmc-test.c | 7 +++++-- drivers/mfd/macsmc.c | 41 ++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/mfd/macsmc-test.c b/drivers/mfd/macsmc-test.c index 95eff75a72da2..471d322f32615 100644 --- a/drivers/mfd/macsmc-test.c +++ b/drivers/mfd/macsmc-test.c @@ -352,6 +352,9 @@ static void macsmc_lid_wake_test(struct kunit *test) static void macsmc_wake_reason_test(struct kunit *test) { + static const struct apple_smc_wake_reason j714s[] = { + { 8, "lid" }, { 9, "sdconn" }, { 13, "wifibt" }, { } + }; struct macsmc_test_context *ctx = test->priv; char names[128]; @@ -371,8 +374,8 @@ static void macsmc_wake_reason_test(struct kunit *test) KUNIT_EXPECT_EQ(test, apple_smc_wake_reason_bit(&ctx->smc, "lid"), 8); KUNIT_EXPECT_EQ(test, apple_smc_wake_reason_bit(&ctx->smc, "ipd_touch"), -1); - /* The J714s's: T8132's lid and radio bits, its SD reader at bit 9. */ - ctx->smc.wake_reasons = apple_smc_j714s_wake_reasons; + /* A device tree's own, here the J714s's: its SD reader at bit 9. */ + ctx->smc.wake_reasons = j714s; apple_smc_wake_reason_names(&ctx->smc, BIT_ULL(8) | BIT_ULL(9) | BIT_ULL(10) | BIT_ULL(13), names, sizeof(names)); KUNIT_EXPECT_STREQ(test, names, "lid sdconn wifibt"); diff --git a/drivers/mfd/macsmc.c b/drivers/mfd/macsmc.c index 5204c960ebe9d..f3421668a5b6c 100644 --- a/drivers/mfd/macsmc.c +++ b/drivers/mfd/macsmc.c @@ -622,12 +622,29 @@ static const struct apple_smc_wake_reason apple_smc_t8132_wake_reasons[] = { { 44, "USB2_wake" }, { 45, "aupo" }, { 48, "rtc" }, { } }; -/* The J714s's: T8132's numbering, with the SD reader's and the keyboard's own bits */ -static const struct apple_smc_wake_reason apple_smc_j714s_wake_reasons[] = { - { 0, "pwrbtn" }, { 8, "lid" }, { 9, "sdconn" }, { 11, "charger" }, { 13, "wifibt" }, - { 35, "trackpadkeyboard" }, { 40, "acattach" }, { 41, "acdetach" }, { 42, "USB-C_plug" }, - { 43, "USB2_plug" }, { 44, "USB2_wake" }, { 45, "aupo" }, { 48, "rtc" }, { } -}; +/* A board's own numbering, from its device tree (apple,wake-reasons and their names) */ +static const struct apple_smc_wake_reason *apple_smc_dt_wake_reasons(struct device *dev) +{ + struct device_node *np = dev->of_node; + struct apple_smc_wake_reason *r; + int i, n; + + n = of_property_count_u32_elems(np, "apple,wake-reasons"); + if (n <= 0 || n != of_property_count_strings(np, "apple,wake-reason-names")) + return NULL; + r = devm_kcalloc(dev, n + 1, sizeof(*r), GFP_KERNEL); + if (!r) + return NULL; + for (i = 0; i < n; i++) { + u32 bit; + + if (of_property_read_u32_index(np, "apple,wake-reasons", i, &bit) || bit > 63 || + of_property_read_string_index(np, "apple,wake-reason-names", i, &r[i].name)) + return NULL; + r[i].bit = bit; + } + return r; +} static int apple_smc_probe(struct platform_device *pdev) { @@ -640,18 +657,16 @@ static int apple_smc_probe(struct platform_device *pdev) smc = devm_kzalloc(dev, sizeof(*smc), GFP_KERNEL); if (!smc) return -ENOMEM; - smc->wake_reasons = of_device_is_compatible(dev->of_node, "apple,t8132-smc") ? - apple_smc_t8132_wake_reasons : apple_smc_t8140_wake_reasons; + smc->wake_reasons = apple_smc_dt_wake_reasons(dev); + if (!smc->wake_reasons) + smc->wake_reasons = of_device_is_compatible(dev->of_node, "apple,t8132-smc") ? + apple_smc_t8132_wake_reasons : apple_smc_t8140_wake_reasons; mutex_init(&smc->mutex); spin_lock_init(&smc->lock); smc->dev = &pdev->dev; - smc->saved_enabled = of_machine_is_compatible("apple,t6050") && - (of_machine_is_compatible("apple,j714s") || - of_machine_is_compatible("apple,j716c")) && + smc->saved_enabled = apple_t6050_sleep_described() && of_device_is_compatible(dev->of_node, "apple,t6050-smc"); - if (smc->saved_enabled && of_machine_is_compatible("apple,j714s")) - smc->wake_reasons = apple_smc_j714s_wake_reasons; /* J813's late notice needs the bounded, IRQ-independent transport too. */ if (of_machine_is_compatible("apple,j813")) smc->saved_enabled = true; From 5e9523ebf5a32fe767c7e5dc121e762dc07e11b9 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:30 -0700 Subject: [PATCH 19/37] soc: apple: rtkit: acknowledge the v2 PMP's CoreAnalytics events on any board The empty CoreAnalytics event on the PMP's endpoint 7 is acknowledged on the J714s only. It is the firmware's doing, not the board's: a K116s's PMP sends it too, on the same endpoint. Acknowledge it for every registry-v2 PMP. Signed-off-by: Jens Axboe --- drivers/soc/apple/rtkit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index af1ef284dd22b..d3a09760f8f9f 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -2280,8 +2280,7 @@ static struct apple_rtkit *__apple_rtkit_init(struct device *dev, void *cookie, goto free_rtk; rtk->pmp_registry_v2 = of_device_is_compatible(dev->of_node, "apple,t6050-pmp-v2"); - rtk->pmp_ca_event_ack = rtk->pmp_registry_v2 && - of_machine_is_compatible("apple,j714s"); + rtk->pmp_ca_event_ack = rtk->pmp_registry_v2; init_completion(&rtk->epmap_completion); init_completion(&rtk->coreanalytics_completion); From 2951a0aee87fdb7eeb1f8f576c50a411c1b16c23 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:30 -0700 Subject: [PATCH 20/37] dmaengine: apple-sio: the T6050 description where the sleep is described The T6050 description, which stops the SIO at the sleep's commit, was in force on the J714s by name. Follow the device tree: the boards that describe the sleep. The J716c describes it and leaves its SIO disabled, so nothing changes there. Signed-off-by: Jens Axboe --- drivers/dma/apple-sio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dma/apple-sio.c b/drivers/dma/apple-sio.c index d4d954708a8d2..da9c47ded7084 100644 --- a/drivers/dma/apple-sio.c +++ b/drivers/dma/apple-sio.c @@ -697,12 +697,13 @@ static const struct sio_hw_data sio_hw_t6050 = { }; /* - * The T6050 description is in force on the board it has run on. On another T6050 board the - * node is taken as before: by its generic compatible. + * The T6050 description, with its stop at the sleep's commit, is in force on the boards + * that describe the sleep. On another T6050 board the node is taken as before: by its + * generic compatible. */ static bool sio_t6050_board(void) { - return of_machine_is_compatible("apple,j714s"); + return apple_t6050_sleep_described(); } static const struct of_device_id sio_of_match[] = { From c34ce2112ef7e8f2477d622297742e275f2f2a1b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:30 -0700 Subject: [PATCH 21/37] nvme: apple: the T6050 ANS2 sleep attachment where the sleep is described The attachment was made on two boards by name. Make it wherever the device tree describes T6050's deep sleep; the node's own properties still decide the rest. Signed-off-by: Jens Axboe --- drivers/nvme/host/apple-m5-sleep.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/apple-m5-sleep.h b/drivers/nvme/host/apple-m5-sleep.h index f22d6902bf256..50bcaeabde604 100644 --- a/drivers/nvme/host/apple-m5-sleep.h +++ b/drivers/nvme/host/apple-m5-sleep.h @@ -167,10 +167,8 @@ static int apple_nvme_m5_attach(struct apple_nvme *anv) { int ret; - /* Both boards use T6050 ANS2's split NVMe/NVMMU layout and retained SART. */ - if (!of_machine_is_compatible("apple,t6050") || - (!of_machine_is_compatible("apple,j714s") && - !of_machine_is_compatible("apple,j716c"))) + /* T6050 ANS2's split NVMe/NVMMU layout and retained SART, where the sleep is described. */ + if (!apple_t6050_sleep_described()) return -EOPNOTSUPP; /* The wait before the restart after a sleep comes from the DT; without it, no sleep. */ if (of_property_read_u32(anv->dev->of_node, "apple,sleep-wake-delay-ms", From 9daf2a980717f9abc3744c8335eec56e9d1cf0ce Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:30 -0700 Subject: [PATCH 22/37] PCI: apple: T6050: the radio host's deep sleep where the sleep is described The host registered for T6050's deep sleep on two boards by name. Register wherever the device tree describes that sleep. Signed-off-by: Jens Axboe --- drivers/pci/controller/pcie-apple.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index 8e20a36cc575e..9c7037389dfa7 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -5426,8 +5426,7 @@ static void apple_pcie_t6050_sleep_probe(struct platform_device *pdev, struct ap { struct apple_pcie_port *port; - if (pcie->managed_sids || !(of_machine_is_compatible("apple,j714s") || - of_machine_is_compatible("apple,j716c"))) + if (pcie->managed_sids || !apple_t6050_sleep_described()) return; /* The one port a boot loader trained; an endpoint Linux powers is parked instead. */ list_for_each_entry(port, &pcie->ports, entry) From d6ad429b34227248596d3ef8fe93a82ec035c93d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:30 -0700 Subject: [PATCH 23/37] iommu/apple-dart: the T6050 sleep rules where the sleep is described The display DARTs' V27 provider was admitted on two boards by name and the ISP DART's sleep on one. Take both wherever the device tree describes T6050's deep sleep: the sleep takes the ISP DART's stream registers on any of them. Signed-off-by: Jens Axboe --- drivers/iommu/apple-dart-v27-admission.inc | 4 +--- drivers/iommu/apple-dart.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/apple-dart-v27-admission.inc b/drivers/iommu/apple-dart-v27-admission.inc index 906be5ef222ef..7b6c2be51b903 100644 --- a/drivers/iommu/apple-dart-v27-admission.inc +++ b/drivers/iommu/apple-dart-v27-admission.inc @@ -10,9 +10,7 @@ static bool apple_dart_v27_provider(struct device *dev, resource_size_t base) unsigned int i; if (!IS_ENABLED(CONFIG_APPLE_SOC_SLEEP) || - !(of_machine_is_compatible("apple,j714s") || - (of_machine_is_compatible("apple,j716c") && - of_machine_is_compatible("apple,t6050"))) || + !apple_t6050_sleep_described() || !of_device_is_compatible(dev->of_node, "apple,t6050-dart")) return false; for (i = 0; i < ARRAY_SIZE(ids); i++) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 4bb6491eedb8c..114dc4bb0f3cc 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -5458,7 +5458,7 @@ static int apple_dart_probe(struct platform_device *pdev) if (dart->cold_ane && !IS_BUILTIN(CONFIG_APPLE_DART)) return -EOPNOTSUPP; dart->isp_host = of_device_is_compatible(dev->of_node, "apple,t6050-isp-dart"); - dart->isp_sleep = dart->isp_host && of_machine_is_compatible("apple,j714s"); + dart->isp_sleep = dart->isp_host && apple_t6050_sleep_described(); dart->power_retained = dart->isp_host; dart->per_stream = dart->isp_host || of_device_is_compatible(dev->of_node, "apple,t8140-dart") || From 4386fbfeda1aa2127cb8414d2afae3718bc6fb52 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:31 -0700 Subject: [PATCH 24/37] phy: apple: atc-t6050: the combo PHY's deep-sleep rules where the sleep is described The rules were in force on two boards by name. Apply them wherever the device tree describes T6050's deep sleep. Signed-off-by: Jens Axboe --- drivers/phy/apple/atc-t6050-combo.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/phy/apple/atc-t6050-combo.h b/drivers/phy/apple/atc-t6050-combo.h index 7dceb224d2556..d67abe3f04a41 100644 --- a/drivers/phy/apple/atc-t6050-combo.h +++ b/drivers/phy/apple/atc-t6050-combo.h @@ -122,13 +122,13 @@ static void combo_pipe_fault(struct t6050_dp *dp, const char *what, int ret) /* * What the combo PHY gained for a deep sleep outside its sleep callbacks (a wrapper domain * still held at a stop is released, a safe state with a domain still held is stopped again, - * the always-on domain's hold over the sleep) is in force on the boards with a T6050 sleep, - * the J714s and the J716c. On another T6050 board the stop, the safe state and the probe are + * the always-on domain's hold over the sleep) is in force on the boards whose device tree + * describes a T6050 sleep. On another T6050 board the stop, the safe state and the probe are * as before. */ static bool combo_sleep_board(void) { - return of_machine_is_compatible("apple,j714s") || of_machine_is_compatible("apple,j716c"); + return apple_t6050_sleep_described(); } static bool combo_domains_held(struct t6050_dp *dp) From b0980659aba74af9e897ce1df790c336a283dcab Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:31 -0700 Subject: [PATCH 25/37] usb: apple: follow the device tree, not a list of boards The dwc3 glue and the port controllers took T6050's sleep rules on the boards named in each. - dwc3 and the SN201202x's lines and retried start: wherever the device tree describes T6050's sleep. The retried start was the J714s's alone. - The system power state command's rules: every controller with apple,sleep-ssps, which is what makes it send the command around a sleep. This drops the J813 and J815 from the list too; the J700's controllers have the property and now take the rules. Signed-off-by: Jens Axboe --- drivers/usb/dwc3/dwc3-apple.c | 6 ++--- drivers/usb/typec/tipd/core.c | 42 +++++++++++++---------------------- drivers/usb/typec/tipd/spmi.c | 14 +++++------- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-apple.c b/drivers/usb/dwc3/dwc3-apple.c index 4d9b4ac0d8346..10eeb79d7de04 100644 --- a/drivers/usb/dwc3/dwc3-apple.c +++ b/drivers/usb/dwc3/dwc3-apple.c @@ -1083,12 +1083,12 @@ static void dwc3_apple_check_hub_later(struct dwc3_apple *appledwc) /* * Waiting for a Type-C PHY that is not started after sleep is specific to the T6050 boards - * whose port controllers take the sleep's power states (J714s, J716c). The notifier work - * and its admission rules apply to every board. + * whose port controllers take the sleep's power states: those whose device tree describes + * the sleep. The notifier work and its admission rules apply to every board. */ static bool dwc3_apple_sleep_board(void) { - return of_machine_is_compatible("apple,j714s") || of_machine_is_compatible("apple,j716c"); + return apple_t6050_sleep_described(); } /* diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 6ad1d66a67fb9..5024c09bf6453 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -354,16 +354,13 @@ static int tps6598x_disconnect(struct tps6598x *tps, u32 status) /* * The sleep's rules for the port controllers' system power state command (the controller is * woken first, the command's end is read at intervals, a failed S3 refuses the sleep, the - * command's limit and its lines) apply on the J714s, J716c, J813 and J815. - * These boards send the command (apple,sleep-ssps) during firmware-driven - * sleep. Other boards retain the original command behavior. + * command's limit and its lines) apply to every controller that sends the command around a + * firmware-driven sleep (apple,sleep-ssps). Other controllers retain the original command + * behavior. */ -static bool tipd_sleep_ssps_rules(void) +static bool tipd_sleep_ssps_rules(const struct tps6598x *tps) { - return of_machine_is_compatible("apple,j714s") || - of_machine_is_compatible("apple,j716c") || - of_machine_is_compatible("apple,j813") || - of_machine_is_compatible("apple,j815"); + return device_property_read_bool(tps->dev, "apple,sleep-ssps"); } /* @@ -419,11 +416,11 @@ static int tps6598x_exec_cmd_gap(struct tps6598x *tps, const char *cmd, * its last read was made at. Elsewhere a read made past the limit is a timeout, * as before. */ - if ((val || !tipd_sleep_ssps_rules()) && time_is_before_jiffies(timeout)) + if ((val || !tipd_sleep_ssps_rules(tps)) && time_is_before_jiffies(timeout)) return -ETIMEDOUT; /* A command with a long limit is not waited for in silence: a line each second */ if (val && cmd_timeout_ms > 1000 && time_is_before_jiffies(note) && - tipd_sleep_ssps_rules()) { + tipd_sleep_ssps_rules(tps)) { dev_info(tps->dev, "command %.4s not done after %u ms (limit %u ms)\n", cmd, jiffies_to_msecs(jiffies - (timeout - msecs_to_jiffies(cmd_timeout_ms))), cmd_timeout_ms); @@ -1719,17 +1716,12 @@ static int cd321x_prepare(struct tps6598x *tps) cancel_delayed_work_sync(&cd321x->rearm_work); /* As macOS does a second or so before the commit, measured on the same controller. */ - if (pm_suspend_via_firmware() && device_property_read_bool(tps->dev, "apple,sleep-ssps")) { + if (pm_suspend_via_firmware() && tipd_sleep_ssps_rules(tps)) { ktime_t start = ktime_get(); guard(mutex)(&tps->lock); ret = tps->data->switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S3); - /* Without the rules: the lines and their levels as they were */ - if (!tipd_sleep_ssps_rules() && ret) - dev_warn(tps->dev, "didn't take system power state S3: %d\n", ret); - else if (!tipd_sleep_ssps_rules()) - dev_dbg(tps->dev, "system power state S3\n"); - else if (ret) + if (ret) dev_warn(tps->dev, "didn't take system power state S3: %d after %lld ms%s\n", ret, ktime_ms_delta(ktime_get(), start), sleep_s3_refuse ? ": sleep refused" : ""); @@ -1737,7 +1729,7 @@ static int cd321x_prepare(struct tps6598x *tps) dev_info(tps->dev, "system power state S3 in %lld ms\n", ktime_ms_delta(ktime_get(), start)); } - if (ret && sleep_s3_refuse && tipd_sleep_ssps_rules()) + if (ret && sleep_s3_refuse) return -EBUSY; return 0; } @@ -1916,14 +1908,12 @@ static void cd321x_complete(struct tps6598x *tps) cd321x->pm.setup_pending = true; cd321x->reset_by_cut = true; } - if (pm_suspend_via_firmware() && device_property_read_bool(tps->dev, "apple,sleep-ssps")) { + if (pm_suspend_via_firmware() && tipd_sleep_ssps_rules(tps)) { ktime_t start = ktime_get(); int ret = tps->data->switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0); /* After a sleep or a refused one: never waited for in silence, and never longer */ - if (!tipd_sleep_ssps_rules()) - ret = 0; - else if (ret) + if (ret) dev_warn(tps->dev, "didn't take system power state S0: %d after %lld ms; set up again by its next event\n", ret, ktime_ms_delta(ktime_get(), start)); else @@ -2395,7 +2385,7 @@ static int cd321x_switch_power_state(struct tps6598x *tps, u8 target_state) * Under the sleep's rules the command goes to a controller that has just been sent its * bus's wake command and has answered it, whatever it was doing: woken, read, commanded. */ - if (tps->wake && tipd_sleep_ssps_rules()) { + if (tps->wake && tipd_sleep_ssps_rules(tps)) { ret = tps->wake(tps); if (ret) return ret; @@ -2413,13 +2403,13 @@ static int cd321x_switch_power_state(struct tps6598x *tps, u8 target_state) * the sleep's rules. Under them S0 and S3 have the sleep's own limit and are read with * gaps. */ - if ((target_state == TPS_SYSTEM_POWER_STATE_S0 || tipd_sleep_ssps_rules()) && + if ((target_state == TPS_SYSTEM_POWER_STATE_S0 || tipd_sleep_ssps_rules(tps)) && device_is_compatible(tps->dev, "apple,sn201202x")) ret = tps6598x_exec_cmd_gap(tps, "SSPS", sizeof(target_state), &target_state, 0, NULL, - tipd_sleep_ssps_rules() ? + tipd_sleep_ssps_rules(tps) ? clamp(sleep_ssps_ms, 1000U, 5000U) : 5000, 0, - tipd_sleep_ssps_rules() ? CD321X_SSPS_READ_GAP_US : 0); + tipd_sleep_ssps_rules(tps) ? CD321X_SSPS_READ_GAP_US : 0); else ret = tps6598x_exec_cmd(tps, "SSPS", sizeof(target_state), &target_state, 0, NULL); diff --git a/drivers/usb/typec/tipd/spmi.c b/drivers/usb/typec/tipd/spmi.c index 4865a65d9792d..2a93d3b3b9a82 100644 --- a/drivers/usb/typec/tipd/spmi.c +++ b/drivers/usb/typec/tipd/spmi.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -734,7 +735,7 @@ static bool sn201202x_sleep_event(struct tps6598x *tps) } /* - * On the T6050 boards that sleep (J714s, J716c), the probe and the sleep's SLEEP command print a + * On the T6050 boards that describe a deep sleep, the probe and the sleep's SLEEP command print a * line; on every other machine they don't. A controller without a connector (the MagSafe one, * hpm5) is probed as any other: it registers its Type-C port and power supply, and with * apple,sleep-ssps it follows the system's sleep as the USB-C ports' controllers do (woken and @@ -743,12 +744,7 @@ static bool sn201202x_sleep_event(struct tps6598x *tps) */ static bool sn201202x_sleep_board(void) { - return of_machine_is_compatible("apple,j714s") || of_machine_is_compatible("apple,j716c"); -} - -static bool sn201202x_j714s(void) -{ - return of_machine_is_compatible("apple,j714s"); + return apple_t6050_sleep_described(); } /* @@ -760,7 +756,7 @@ static bool sn201202x_j714s(void) * -EINVAL. Both ports, and every USB, Thunderbolt and DisplayPort device on them, stayed gone * until the next boot. * - * On that board a failed probe is tried again after a growing wait. After the third failed try + * On these boards a failed probe is tried again after a growing wait. After the third failed try * the controller's firmware is cold-reset ("Gaid", as the debug link's recovery does), unless * it is in the debug mode of the boot loader's debug link, and it is tried twice more. Each try * runs in a devres group of its own, so what a failed try set up is released before the next. @@ -817,7 +813,7 @@ static int sn201202x_init(struct sn201202x *sn) void *group; int ret; - if (!sn201202x_j714s()) { + if (!sn201202x_sleep_board()) { ret = tipd_init(tps); if (ret) cancel_delayed_work_sync(&sn->ldcm_work); From e3537b0b66b65c1e4ce5c0f3f49e93dfbc214496 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:31 -0700 Subject: [PATCH 26/37] drm/asahi: g17: the M5 commit stop where the sleep is described The wrapped provider for T6050's deep sleep was used on two boards by name. Use it wherever the device tree describes that sleep. Signed-off-by: Jens Axboe --- drivers/gpu/drm/asahi/g17/sleep.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/asahi/g17/sleep.c b/drivers/gpu/drm/asahi/g17/sleep.c index 917965e360142..37a6642fe323f 100644 --- a/drivers/gpu/drm/asahi/g17/sleep.c +++ b/drivers/gpu/drm/asahi/g17/sleep.c @@ -46,14 +46,13 @@ #define ASC_CPU_CONTROL 0x44 #define ASC_CPU_CONTROL_RUN BIT(4) -/* Only the M5 boards with a deep sleep need a wrapped provider translation here: the J714s - * and the J716c. Other G17 clients retain their established direct-domain methods below. +/* Only the M5 boards with a deep sleep need a wrapped provider translation here: those whose + * device tree describes it. Other G17 clients retain their established direct-domain methods + * below. */ static bool asahi_g17_m5_provider(struct device *dev) { - return (of_machine_is_compatible("apple,j714s") || - of_machine_is_compatible("apple,j716c")) && - of_machine_is_compatible("apple,t6050") && + return apple_t6050_sleep_described() && of_device_is_compatible(dev->of_node, "apple,agx-g17s"); } From a5b23f7d15f297a4f7f29176697da843c5df3cea Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 05:28:31 -0700 Subject: [PATCH 27/37] drm/apple: v27: the J714s's sleep and panel paths by the sleep's description The V27 sleep's paths for the internal panel (the 27.0 method table with the sleep call and the A407 swap, the panel's AV and DP services) and what the external processors gained around it were in force on the J714s by name. Follow the device tree: a sleep description with apple,display-method-sleep. The J716c's has none and keeps its endpoint transport. Signed-off-by: Jens Axboe --- drivers/gpu/drm/apple/dcp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index f3bb2aff2fdf9..42d0e9d41103a 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -495,12 +495,13 @@ MODULE_PARM_DESC(t6050_ext_sleep, /* * What a T6050 external display processor gained outside the firmware 27 sleep itself (the * Type-C reconnect skipped for a crashed one, a crashed one refusing a deep sleep before - * anything is stopped, the link line) is in force on the board it has run on, the J714s. - * Elsewhere, other boards with the same SoC included, these are as before. + * anything is stopped, the link line) is in force where the sleep's description has the + * display coprocessors sleep by their method table (apple,display-method-sleep). Elsewhere, + * other boards with the same SoC included, these are as before. */ static bool dcp_j714s_ext(struct device *dev) { - return of_machine_is_compatible("apple,j714s") && + return apple_t6050_sleep_property("apple,display-method-sleep") && of_device_is_compatible(dev->of_node, "apple,t6050-dcpext"); } @@ -7035,7 +7036,7 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev) dcp->fw_compat = fw_compat; dcp->v27_j714s = fw_compat == DCP_FIRMWARE_V_27_0 && - of_machine_is_compatible("apple,j714s"); + apple_t6050_sleep_property("apple,display-method-sleep"); /* * Probe-lifetime like the desktop state: component bind opens a devres * group on this device and releases it on failure or unbind. From 26306d2958da41257711139cb0601087b7ff773d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:40:14 -0700 Subject: [PATCH 28/37] arm64: dts: apple: t6050-k116s: Add the PMU's RTC Describe the RTC of the PMU on nub-spmi0, as the J714s does: the registers are the T6041 PMU's, at the addresses this board's ADT gives. It is a second RTC beside the SMC's and the only one with an alarm. The PMU raises no alarm interrupt on this SoC, so the alarm is a wake source for a firmware sleep only. Signed-off-by: Jens Axboe --- arch/arm64/boot/dts/apple/t6050-k116s.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index fe6468edc72c1..df11957d72a59 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116s.dts @@ -913,3 +913,19 @@ &avd { status = "okay"; }; + +/* + * The PMU's RTC and its alarm. ADT: the PMU's info-rtc (0x2002), + * info-rtc_alarm_offset (0x2008), info-rtc_irq_mask_offset (0x200e), + * info-rtc_alarm_ctrl (0x2000) and info-rtc_scrpad (0x2100), the registers of + * the T6041 PMU. It raises no interrupt on this SoC: an armed alarm can only + * wake the machine from a firmware sleep, not from s2idle. + */ +&pmu { + pmu_rtc: rtc { + compatible = "apple,t6050-pmu-rtc", "apple,t6041-pmu-rtc"; + nvmem-cells = <&rtc_offset>; + nvmem-cell-names = "rtc_offset"; + wakeup-source; + }; +}; From 819d4848942d6bd0adfcff4bd3d3e0224361f2c3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:40:14 -0700 Subject: [PATCH 29/37] arm64: dts: apple: t6050-k116s: enable the video encoder's power states iBoot leaves VENC0_SYS on (PS word 0xf0003ff). Its node is disabled on the K116s, so nothing ever turns it off, and FAB0_SOC stays up behind it. The J714s enables these power states for its encoder. With VENC0_SYS on, the SoC does not enter the firmware-driven sleep: the whole entry runs, and the machine resets about 5 s after the commit word. macOS has VENC0_SYS off at its commit on this board (register state read with macOS as an aura guest, the commit withheld). Enable ps_fab1_piogw (firmware-owned), ps_fab0_soc (always-on) and the ps_venc0_* states as on the J714s. Unused, genpd turns them off at boot. No encoder is described yet. Tested on a K116s: venc0-sys and its children read off after boot, and the J714s commit sequence then sleeps. Signed-off-by: Jens Axboe --- arch/arm64/boot/dts/apple/t6050-k116s.dts | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index df11957d72a59..ca0a339c8e7bd 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116s.dts @@ -929,3 +929,42 @@ wakeup-source; }; }; + +/* + * The video encoder's power states, as on the J714s. iBoot leaves VENC0_SYS on, and the SoC does + * not enter the firmware-driven sleep with it on. Enabled and unused, genpd turns it off at + * boot. No encoder is described yet. + */ +&ps_fab1_piogw { + apple,firmware-owned; + status = "okay"; +}; + +&ps_fab0_soc { + apple,always-on; + status = "okay"; +}; + +&ps_venc0_sys { + status = "okay"; +}; + +&ps_venc0_dma { + status = "okay"; +}; + +&ps_venc0_pipe4 { + status = "okay"; +}; + +&ps_venc0_pipe5 { + status = "okay"; +}; + +&ps_venc0_me0 { + status = "okay"; +}; + +&ps_venc0_me1 { + status = "okay"; +}; From 76ad6c3189bdb49c8edd82838c2e84213cba1a09 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:40:15 -0700 Subject: [PATCH 30/37] arm64: dts: apple: t6050-j714s-sleep-soc: make the CIO sleep part optional The SoC values file ends with the J714s's USB4 router sleep (acio2, its DART, the clock protection syscon), which needs nodes only t6050-max.dtsi has. A board that includes the SoC values without that router defines T6050_SLEEP_SOC_NO_CIO first. No change for the J714s. Signed-off-by: Jens Axboe --- arch/arm64/boot/dts/apple/t6050-j714s-sleep-soc.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-sleep-soc.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-sleep-soc.dtsi index 9b0f2f0c3376e..5ef086dee5765 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-sleep-soc.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-sleep-soc.dtsi @@ -4576,7 +4576,11 @@ * taking that DART down and back to the live value before using it again. The router's host * also needs the port's PHY, which it stops after the router and starts before it. The left * port's router was never up in a trace: it has none of this and is powered off for a sleep. + * + * A board that includes these SoC values without that router (no acio2) defines + * T6050_SLEEP_SOC_NO_CIO first. */ +#ifndef T6050_SLEEP_SOC_NO_CIO &die0 { ps_prot: syscon@2803f0000 { compatible = "apple,t6050-ps-prot", "syscon"; @@ -4595,3 +4599,4 @@ &apciec2_dart { apple,clock-protection = <&ps_prot 31>; }; +#endif /* T6050_SLEEP_SOC_NO_CIO */ From c14e3c4ace7690860d220214f7f319e6b55b4ef1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 07:33:57 -0700 Subject: [PATCH 31/37] dt-bindings: mailbox: apple: add the T6050 secure RTBuddy port The internal DCP of a T6050 on firmware 27.2 has the secure port T8140's has (ADT dcp-exclave-mailbox, iop,secure-rtbuddy-proxy). Signed-off-by: Jens Axboe --- Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml b/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml index 8afd38261fe30..71c6458c15310 100644 --- a/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml +++ b/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml @@ -81,6 +81,7 @@ properties: iop,secure-rtbuddy-proxy. It is polled, with no interrupts described. items: - enum: + - apple,t6050-secure-rtbuddy-proxy - apple,t8140-secure-rtbuddy-proxy - const: apple,secure-rtbuddy-proxy From 46d84519ecc52a643f0b79f60654f69ebe030e39 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 07:33:57 -0700 Subject: [PATCH 32/37] dt-bindings: soc: apple,t6050-sleep: allow an empty apple,pinctrl-skip-pins Without the property no pin is saved. A board whose ADT names no pin to leave alone, the K116s, has every pin saved: the property is there and empty. Signed-off-by: Jens Axboe --- .../devicetree/bindings/soc/apple/apple,t6050-sleep.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml b/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml index 7d26c0049f8ac..a8908c524d1ae 100644 --- a/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml +++ b/Documentation/devicetree/bindings/soc/apple/apple,t6050-sleep.yaml @@ -117,10 +117,12 @@ properties: description: The AP pin controller, whose pins a deep sleep resets. apple,pinctrl-skip-pins: - $ref: /schemas/types.yaml#/definitions/uint32-array + oneOf: + - $ref: /schemas/types.yaml#/definitions/uint32-array + - type: boolean description: | Pins neither saved nor restored. From the ADT, set by the bootloader; - without it no pin is saved. + without it no pin is saved. Empty where every pin is saved. apple,sleep-low-pins: $ref: /schemas/types.yaml#/definitions/uint32-array From 4c6b87ef998f63eaaca90a691881d8bb9ead67b5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 07:33:57 -0700 Subject: [PATCH 33/37] dt-bindings: display: apple,dcp: add apple,secure-mbox The boot loader hands the display over only to a node whose mboxes is the one ASC mailbox. A machine whose internal DCP has a secure port names it in a property of its own there, and the driver takes it as the "secure" mailbox. Signed-off-by: Jens Axboe --- Documentation/devicetree/bindings/display/apple,dcp.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/display/apple,dcp.yaml b/Documentation/devicetree/bindings/display/apple,dcp.yaml index d4d30bbe11ed9..9386a075ec05c 100644 --- a/Documentation/devicetree/bindings/display/apple,dcp.yaml +++ b/Documentation/devicetree/bindings/display/apple,dcp.yaml @@ -92,6 +92,14 @@ properties: - const: mbox - const: secure + apple,secure-mbox: + $ref: /schemas/types.yaml#/definitions/phandle + description: + The coprocessor's secure RTBuddy port, on a machine whose boot loader + hands the display over only to a node with a single mailbox in mboxes. + The driver takes it as the "secure" mailbox. Elsewhere the port is the + second entry of mboxes. + iommus: maxItems: 1 From 4a72ae65f77ae48c0ba8ffbc04364fb3aca595f3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 18 Nov 2026 06:40:15 -0700 Subject: [PATCH 34/37] arm64: dts: apple: t6050-k116s: describe and enable the deep sleep The J714s's sleep controller description and SoC values on the K116s (16-inch M5 Pro, firmware 27.2), with what differs on this board: - apple,pinctrl-skip-pins is empty: the K116s ADT's gpio0 has no no-restore-gpio-pins. With the J714s's list the panel stays dark after a deep sleep. - The display coprocessor's secure mailbox (ADT dcp-exclave-mailbox), named by apple,secure-mbox so that mboxes stays the one ASC mailbox for the boot loader. - The MagSafe port's PD controller (hpm5), so that the sleep puts it in S3. - dcpext0 without its Type-C route, as dcpext1 to 3: the engine must bind for the sleep to stop its firmware. - apple,sram-keep <0x56000 0x9b000> for the PMP: its __DATA starts at 0x56000 on 27.2 (ADT segment-ranges). With the J714s's range the PMP does not come back from the sleep. - The four clock words are parked with 0x80100000, as macOS does on this board (J714s: 0x80100400). - apple,panel-video-open-delay-us 10000: the panel's plug takes about 2.9 ms here, and with 2500 us the open landed before the firmware's close. - No CIO sleep part: no USB4 router is described. - apple,display-method-sleep and the SMC's wake reasons, as on the J714s: the K116s ADT's smc-pmu node numbers them the same way. Needs a boot loader that hands the four DCPEXT to the kernel on 27.2 (aura with ext = true for the V27_2 images) and publishes the S2R mailbox. Tested on a K116s: sleep and wake by RTC alarm and by the lid, several cycles a boot, and one sleep of 7.7 hours; display, NVMe, Wi-Fi and Bluetooth work after the wake. The values taken from the J714s (commit schedule, SMC policy, MCC and clock sequences) have not been checked against this board one by one. Signed-off-by: Jens Axboe --- .../boot/dts/apple/t6050-k116s-sleep.dtsi | 279 ++++++++++++++++++ arch/arm64/boot/dts/apple/t6050-k116s.dts | 49 +++ 2 files changed, 328 insertions(+) create mode 100644 arch/arm64/boot/dts/apple/t6050-k116s-sleep.dtsi diff --git a/arch/arm64/boot/dts/apple/t6050-k116s-sleep.dtsi b/arch/arm64/boot/dts/apple/t6050-k116s-sleep.dtsi new file mode 100644 index 0000000000000..058bed3fa682d --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-k116s-sleep.dtsi @@ -0,0 +1,279 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Deep sleep (suspend to RAM) on the K116s: the J714s description with this board's differences + * (the pins, the display coprocessor's secure mailbox, dcpext0). The sleep controller and what + * it needs from the rest of the tree. + */ + +/ { + aliases { + /* The boot loader finds the SIO by this alias */ + sio = &sio; + }; + + sleep: sleep-controller@280600000 { + compatible = "apple,t6050-sleep"; + reg = <0x2 0x80600000 0x0 0x4000>, + <0x2 0x80900000 0x0 0x4000>, + <0x2 0x88300000 0x0 0xc000>, + <0x23 0x00e80000 0x0 0x4000>, + <0x23 0x80600000 0x0 0xc000>, + <0x23 0x88300000 0x0 0x4000>, + <0x2 0x80760000 0x0 0x10000>, + <0x2 0x807d4000 0x0 0x4000>, + <0x2 0x80930000 0x0 0x4000>, + <0x23 0x00e90000 0x0 0x4000>, + <0x23 0x80760000 0x0 0x10000>, + <0x2 0x80700000 0x0 0x20000>, + <0x23 0x80700000 0x0 0x14000>, + <0x2 0x807ec000 0x0 0x4000>, + <0x2 0x80950000 0x0 0x4000>, + <0x23 0x807dc000 0x0 0x4000>, + <0x2 0x80620000 0x0 0x4000>, + <0x2 0x8062c000 0x0 0x4000>, + <0x2 0x80688000 0x0 0x4000>, + <0x2 0x88f04000 0x0 0x4000>, + <0x2 0x8836c000 0x0 0x4000>, + <0x2 0x88330000 0x0 0x4000>, + <0x2 0x80920000 0x0 0x4000>, + <0x2 0x8a014000 0x0 0x4000>, + <0x2 0x86700000 0x0 0x14000>, + <0x2 0x86806000 0x0 0x3000>, + <0x2 0x84240000 0x0 0x20000>, + <0x2 0x803f0000 0x0 0x4000>, + <0x2 0x88370000 0x0 0x4000>, + <0x23 0x88370000 0x0 0x4000>, + <0x2 0x10e40000 0x0 0x10000>, + <0x2 0x11e40000 0x0 0x10000>, + <0x2 0x12e40000 0x0 0x10000>, + <0x4 0x17020000 0x0 0x4000>, + <0x4 0x17980000 0x0 0x4000>, + <0x2 0x80000000 0x0 0x4000>, + <0x2 0x80078000 0x0 0x4000>, + <0x23 0x80078000 0x0 0x4000>, + <0x22 0x20200000 0x0 0x8000>, + <0x22 0x20400000 0x0 0x8000>, + <0x22 0x20600000 0x0 0x8000>, + <0x22 0x20800000 0x0 0x8000>, + <0x22 0x22200000 0x0 0x8000>, + <0x2 0x88004000 0x0 0x4000>, + <0x23 0x88004000 0x0 0x4000>, + <0x23 0x80400000 0x0 0x4000>; + reg-names = "ps0", "ps1", "ps-aon", "ps-gpx", "ps-media", "ps-gfx-aon", + "clk", "clk-soc", "clk1", "afr-clk", "media-clk", + "perf", "media-perf", "table0", "table1", "media-table", + "cluster", "pwrgate", "cpu-start", "commit", "wdt", "wdt-aux", + "disp-gate", "spmi", "pmc-voters", "pmc-rails", "ptd", "gapf", + "aon-clk", "media-aon-clk", "cpm0", "cpm1", "cpm2", + "storage-phy", "storage-phy-ip", + "clkgen", "clkgen-78", "media-clkgen-78", + "mcc22", "mcc23", "mcc24", "mcc25", "mcc26", + "wake", "wake-gfx", "aic-gfx"; + apple,display-coprocessors = <&dcp>, <&dcpext0>, <&dcpext1>, <&dcpext2>, <&dcpext3>; + apple,spmi-buses = <&nub_spmi_a0>, <&nub_spmi2>, <&nub_spmi_a1>, <&nub_spmi3>, + <&aop_spmi0>; + /* SEP's, PMP0's, SIO's and the DCP's DART, stopped in the sleep's last steps */ + apple,sleep-darts = <&sep_dart>, <&pmp0_dart>, <&sio_dart>, <&dcp_dart>; + /* The N1's host: its link is shut down for the sleep and brought back after it */ + apple,radio-pcie = <&pcie0>; + apple,pinctrl = <&pinctrl_ap>; + /* The display coprocessors take the sleep through their firmware 27 method table */ + apple,display-method-sleep; + }; +}; + +/* The SMC's wake reasons (ADT smc-pmu, event_name-bitN) */ +&smc { + apple,wake-reasons = <0 8 9 11 13 35 40 41 42 43 44 45 48>; + apple,wake-reason-names = "pwrbtn", "lid", "sdconn", "charger", "wifibt", + "trackpadkeyboard", "acattach", "acdetach", "USB-C_plug", + "USB2_plug", "USB2_wake", "aupo", "rtc"; +}; + +/* + * The N1's warm reset (ADT pci-bridge0 function-warm_reset: the SMC, key 'bpli'). The N1's + * firmware does not survive a sleep; the host resets the N1 after the wake, before its link + * trains. The writes that give the reset are the boot loader's to add (see the binding). + */ +&port00 { + apple,function-warm-reset = <&smc 0x62706c69 0x1000000>; +}; + +/* On through the commit: the sleep stops their users in its last steps. */ +&ps_pmp { + apple,always-on; +}; + +&ps_pms_sram { + apple,always-on; +}; + +&ps_gfx { + apple,always-on; +}; + +&ps_spi_p { + apple,always-on; +}; + +&ps_atc3_usb_aon { + apple,always-on; +}; + +&ps_sio { + apple,always-on; + status = "okay"; +}; + +&ps_sio_cpu { + apple,always-on; + status = "okay"; +}; + +/* The port controllers put in system power state S3 before the commit, then SLEEP */ +&hpm1 { + apple,sleep-ssps; +}; + +&hpm2 { + apple,sleep-ssps; +}; + +/* + * The MagSafe port's PD controller (ADT hpm5, nub-spmi-a0 0x08), described as + * on the J714s so that the sleep puts it in S3 with the others. + */ +&nub_spmi_a0 { + hpm5: usb-pd@8 { + compatible = "apple,sn201202x"; + reg = <0x8 SPMI_USID>; + apple,no-liquid-detection; + apple,sleep-ssps; + }; +}; + +&{/soc@200000000} { + /* + * The cores' power-gate enables, /arm-io/pmgr reg[0] + 0x2c000, one word per core: the + * boot loader leaves core 0's (the boot core's) and core 12's clear. Without them the + * boot cluster never powers down, and the sleep never gets past its first sequence. + */ + cluster_pwrgate: power-gate@28062c000 { + compatible = "apple,t6050-cluster-pwrgate", "apple,cluster-pwrgate"; + reg = <0x2 0x8062c000 0x0 0x4>, + <0x2 0x8062c0c0 0x0 0x4>; + }; +}; + +/* AOP2, running until the commit: its ASC mailbox at the AOP2 ASC + 0x8000 */ +&{/soc@200000000} { + aop2_mbox: mailbox@291608000 { + compatible = "apple,t6050-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x2 0x91608000 0x0 0x4000>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + }; +}; + +&aop2 { + reg = <0x2 0x91600000 0x0 0x4000>; + reg-names = "asc"; + /delete-property/ interrupts; + mboxes = <&aop2_mbox>; + mbox-names = "mbox"; + apple,dma-range = <0x110 0x0 0x10 0x0>; + status = "okay"; +}; + +/* + * The SIO, running until the sleep's own stop: its ASC bank split around its mailbox. The boot + * loader enables it with its firmware and tables. + */ +/delete-node/ &sio; + +&{/soc@200000000} { + sio_mbox: mailbox@505e08000 { + compatible = "apple,t6050-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x5 0x5e08000 0x0 0x4000>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + power-domains = <&ps_sio_cpu>; + #mbox-cells = <0>; + }; + + sio: dma-controller@505e00000 { + compatible = "apple,t6050-sio", "apple,sio"; + reg = <0x5 0x5e00000 0x0 0x8000>, + <0x5 0x5850000 0x0 0x4000>, + <0x5 0x5e0c000 0x0 0x7c000>; + reg-names = "asc", "auxiliary", "asc-tail"; + #dma-cells = <1>; + dma-channels = <128>; + mboxes = <&sio_mbox>; + iommus = <&sio_dart 0>; + power-domains = <&ps_sio_cpu>; + clocks = <&peripheral_clocks 359>, <&peripheral_clocks 358>; + status = "disabled"; + }; +}; + +&sio_dart { + power-domains = <&ps_sio_cpu>; + status = "okay"; +}; + +/* + * The AP pins a deep sleep neither saves nor restores: none. The K116s ADT's gpio0 has no + * no-restore-gpio-pins (the J714s's has 5 6 7 112 141), and with those skipped the panel stayed + * dark after a deep sleep. Without the property no pin is saved at all. + */ +&sleep { + apple,pinctrl-skip-pins = <>; +}; + +/* + * The display coprocessor's secure mailbox (ADT /arm-io/dcp-exclave-mailbox, + * iop,secure-rtbuddy-proxy, reg 0x4cae7c000). Firmware 27.2 acknowledges no IOP power state + * while nothing answers it, as on T8140. + */ +&{/soc@200000000} { + dcp_secure_mbox: mailbox@4cae7c000 { + compatible = "apple,t6050-secure-rtbuddy-proxy", "apple,secure-rtbuddy-proxy"; + reg = <0x4 0xcae7c000 0x0 0x4000>; + #mbox-cells = <0>; + }; +}; + +/* + * Not in mboxes: the boot loader hands the display over only to a node whose mboxes is the one + * ASC mailbox. The driver adds it to the live tree at probe. + */ +&dcp { + apple,secure-mbox = <&dcp_secure_mbox>; +}; + +/* + * dcpext0 without its Type-C route, as dcpext1 to 3 are here. Its PHY's DP side + * is not described on this board, and the engine's probe waits for it and gives the engine + * up; a deep sleep needs the engine bound, to stop its firmware. + */ +&dcpext0 { + /delete-property/ apple,connector-type; + /delete-property/ apple,dptx-die; + /delete-property/ apple,typec-dptx-phys; + /delete-property/ apple,typec-mux-indices; + /delete-property/ phys; + /delete-property/ phy-names; + /delete-property/ mux-controls; + /delete-property/ mux-control-names; + /delete-node/ typec-routes; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index ca0a339c8e7bd..f049736e9489f 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116s.dts @@ -968,3 +968,52 @@ &ps_venc0_me1 { status = "okay"; }; + +/* + * Deep sleep: the sleep controller's description and the J714s's SoC values, then what differs + * on this board (firmware 27.2). + */ +#include "t6050-k116s-sleep.dtsi" +/* No USB4 router is described on this board: without the J714s's CIO sleep part. */ +#define T6050_SLEEP_SOC_NO_CIO +#include "t6050-j714s-sleep-soc.dtsi" + +/* + * macOS on this board parks the four clock words with 0x80100000 in the last 0.5 ms before its + * commit (traced as an aura guest); the J714s's values have bit 10 set. + */ +&sleep { + apple,seq-commit-sio = + <0x0 17 0x290 0x400024f>, + <0x0 17 0x2a0 0x400024f>, + <0x1 51 0xa0 0x0>, + <0x0 51 0xa0 0x80100000>, + <0x1 51 0xa0 0x0>, + <0x1 51 0xa4 0x0>, + <0x0 51 0xa4 0x80100000>, + <0x1 51 0xa4 0x0>, + <0x1 51 0x94 0x0>, + <0x0 51 0x94 0x80100000>, + <0x1 51 0x94 0x0>, + <0x1 51 0x90 0x0>, + <0x0 51 0x90 0x80100000>, + <0x1 51 0x90 0x0>; +}; + +/* + * The PMP firmware's __DATA starts at 0x56000 on 27.2 (ADT pmp0 segment-ranges: __TEXT 0x56000 + * bytes, __DATA 0x9b000 bytes), not at the J714s's 0x58000. With the wrong range kept over the + * sleep the PMP does not come back (endpoint discovery -62). + */ +&pmp0 { + apple,sram-keep = <0x56000 0x9b000>; +}; + +/* + * The panel's plug takes about 2.9 ms here from the video interface's announcement to the + * firmware's "ioav i/f is now closed", and the next round of reports follows about 33 ms later. + * With the J714s's 2500 us the open landed 25 us before the close. + */ +&dcp { + apple,panel-video-open-delay-us = <10000>; +}; From 83cc6c1181b8bee5cccf306063eb535b2ccaf787 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 09:54:29 -0700 Subject: [PATCH 35/37] dt-bindings: display: apple,dcp: add apple,merged-mode-limit The platform's limit on merged modes belongs to the external display coprocessors of a machine, not to its sleep. Give it a property of their nodes. Signed-off-by: Jens Axboe --- Documentation/devicetree/bindings/display/apple,dcp.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/display/apple,dcp.yaml b/Documentation/devicetree/bindings/display/apple,dcp.yaml index 9386a075ec05c..e09b6a0848c93 100644 --- a/Documentation/devicetree/bindings/display/apple,dcp.yaml +++ b/Documentation/devicetree/bindings/display/apple,dcp.yaml @@ -100,6 +100,13 @@ properties: The driver takes it as the "secure" mailbox. Elsewhere the port is the second entry of mboxes. + apple,merged-mode-limit: + type: boolean + description: + The platform's limit on merged modes applies to this external display + coprocessor. A display takes a second coprocessor as its pair only + while one is left for every external display that is present. + iommus: maxItems: 1 From 3bfcef5f596fd3cf9d12da91cda8957eb54a6745 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 09:54:29 -0700 Subject: [PATCH 36/37] arm64: dts: apple: t6050-j714s: the merged-mode limit of the external display coprocessors The driver applies the limit on the J714s. Say so on its four external display coprocessors, for the driver to read. Signed-off-by: Jens Axboe --- arch/arm64/boot/dts/apple/t6050-j714s.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index e5336dd726ebf..ea1de8acef251 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -717,6 +717,23 @@ #include "t6050-j714s-sleep-soc.dtsi" #include "t6050-j714s-sleep-adt.dtsi" +/* A merged mode's pair is given only while every external display has an engine */ +&dcpext0 { + apple,merged-mode-limit; +}; + +&dcpext1 { + apple,merged-mode-limit; +}; + +&dcpext2 { + apple,merged-mode-limit; +}; + +&dcpext3 { + apple,merged-mode-limit; +}; + /* The display coprocessors take the sleep through their firmware 27 method table */ &sleep { apple,display-method-sleep; From 965c1b5a16325b5d78d9e63d79b4f51a1e1e3b4f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Nov 2026 09:54:29 -0700 Subject: [PATCH 37/37] drm/apple: v27: the merged-mode limit by the coprocessor's own property dcp_peer_limit_applies() rode on dcp_j714s_ext(), which follows the sleep's description now. The limit is of the display engines, not of the sleep: read apple,merged-mode-limit from the coprocessor's node. The J714s sets it, so nothing changes there, and no other board takes the limit. Signed-off-by: Jens Axboe --- drivers/gpu/drm/apple/dcp-peer-v27.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp-peer-v27.inc b/drivers/gpu/drm/apple/dcp-peer-v27.inc index a824ab7e99265..34ee3e472d3ef 100644 --- a/drivers/gpu/drm/apple/dcp-peer-v27.inc +++ b/drivers/gpu/drm/apple/dcp-peer-v27.inc @@ -8,12 +8,14 @@ module_param(peer_allocation_probe, bool, 0444); MODULE_PARM_DESC(peer_allocation_probe, "Firmware27 logical peer allocation for merged modes (default: on)"); /* - * The platform limit on merged modes (dcp_fabric_merged_fits()) holds on the - * board it has run on, for the J714s's T6050 external display processors. + * The platform limit on merged modes (dcp_fabric_merged_fits()) holds for the + * external display processors whose node says so (apple,merged-mode-limit). */ static bool dcp_peer_limit_applies(struct apple_dcp *dcp) { - return dcp->fw_compat == DCP_FIRMWARE_V_27_0 && dcp_j714s_ext(dcp->dev); + return dcp->fw_compat == DCP_FIRMWARE_V_27_0 && + of_device_is_compatible(dcp->dev->of_node, "apple,t6050-dcpext") && + of_property_read_bool(dcp->dev->of_node, "apple,merged-mode-limit"); } /* @@ -68,8 +70,7 @@ void dcp_peer_limit_update_v27(struct drm_device *drm) unsigned int n = 0, i; struct drm_crtc *crtc; - /* Neither a board without the limit nor a device without CRTCs. */ - if (!of_machine_is_compatible("apple,j714s") || !drm->mode_config.num_crtc) + if (!drm->mode_config.num_crtc) return; scoped_guard(mutex, &dcp_peer_lock) { drm_for_each_crtc(crtc, drm) {