From c57bde2634d87779b75c227adaf07e0b9cc6d550 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 19 Nov 2026 23:28:19 +1100 Subject: [PATCH 1/3] soc: apple: sleep: say whether the device tree describes a sleep Several drivers select their T6050 (M5 Pro and Max) deep-sleep handling with a list of boards, the ones the sleep has run on (J714s, J716c). What those boards have in common is in the device tree: an available sleep-controller node, compatible "apple,t6050-sleep". No other board in the tree has one; a board gains it with its sleep description. Add apple_sleep_described(compatible), true when an available node with that compatible exists, and apple_t6050_sleep_described() for "apple,t6050-sleep". Both are static inline and independent of CONFIG_APPLE_SOC_SLEEP, as the board checks they replace are. Signed-off-by: Ryan Murray --- include/linux/soc/apple/sleep.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/linux/soc/apple/sleep.h b/include/linux/soc/apple/sleep.h index cec1e88452676..25ad980bec878 100644 --- a/include/linux/soc/apple/sleep.h +++ b/include/linux/soc/apple/sleep.h @@ -9,6 +9,7 @@ #include #include #include +#include #include struct device; @@ -36,6 +37,32 @@ struct apple_sleep_smc_saved_ops { int (*pmvc)(void *data); }; +/* + * Whether the device tree describes a deep sleep with the sleep controller @compatible: an + * available node with that compatible. The per-device handling that belongs to such a sleep + * (what a block keeps or puts back across it, the steps it takes for it) is selected by this, + * not by the boards the sleep has run on, so a board gains it with its sleep description. + * It tells what the hardware description has, independent of CONFIG_APPLE_SOC_SLEEP. + */ +static inline bool apple_sleep_described(const char *compatible) +{ + struct device_node *np; + + for_each_compatible_node(np, NULL, compatible) { + if (of_device_is_available(np)) { + of_node_put(np); + return true; + } + } + return false; +} + +/* The T6050's (M5 Pro and Max) deep sleep, apple,t6050-sleep. */ +static inline bool apple_t6050_sleep_described(void) +{ + return apple_sleep_described("apple,t6050-sleep"); +} + #if IS_ENABLED(CONFIG_APPLE_SOC_SLEEP) const struct apple_sleep_smc_policy *apple_sleep_smc_policy(void); /* J813 experiment: send the final SMC notice after the peer idle handshakes. */ From 248690bf2d40ceef6ac3045ccbf1414294484457 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 19 Nov 2026 23:30:11 +1100 Subject: [PATCH 2/3] drm/apple: select the T6050 v27 sleep transport by the sleep description Besides the J714s's own firmware 27.0 path, the generic 27.0 sleep transport was taken on a machine that is "apple,j716c" and "apple,t6050". It belongs to the T6050 sleep, so take it where the device tree describes that sleep (apple,t6050-sleep). Nothing changes in the tree today: the J716c is as before; the J714s takes its own path first when the firmware is 27.0, and with any other firmware the generic transport's own 27.0 check refuses it, as the board check did; no other board describes the sleep. The J714s-only rules (dcp_j714s_ext(), v27_j714s, the fabric's sticky pipeline and the peer limit) are left as they are: the J716c runs a different method table and panel profile and has not run them. Fixes: fd5cc59f4794 ("drm/apple: v27: the T6050 sleep transport on the J716c") Signed-off-by: Ryan Murray --- 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..19381dd1fb430 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -5788,8 +5788,11 @@ static bool dcp_v27_sleep_transport_supported(struct apple_dcp *dcp) return false; if (dcp->v27_j714s) return true; - if (!of_machine_is_compatible("apple,j716c") || - !of_machine_is_compatible("apple,t6050") || + /* + * Elsewhere, where the T6050 sleep is described: the generic 27.0 transport, with the + * live session adopted and the default method table (first run on the J716c). + */ + if (!apple_t6050_sleep_described() || !(of_device_is_compatible(dev->of_node, "apple,t6050-dcp") || of_device_is_compatible(dev->of_node, "apple,t6050-dcpext")) || !dcp->hw.adopt_live_session || From b9165cee410798d640fe77938d217dd2d84b8c10 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 19 Nov 2026 23:30:18 +1100 Subject: [PATCH 3/3] drm/asahi: g17: select the M5 provider translation by the sleep description The wrapped provider translation for the GPU's commit stop was used on a machine that is "apple,t6050" and "apple,j714s" or "apple,j716c". It belongs to the T6050 deep sleep, so use it for an "apple,agx-g17s" where the device tree describes that sleep (apple,t6050-sleep): the same two boards in the tree today, so nothing changes. Fixes: 541d9be901a8 ("drm/asahi: g17: the M5 Pro's commit stop on the J716c too") Signed-off-by: Ryan Murray --- 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..0d3d2bb494074 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: where the + * device tree describes the T6050 sleep (apple,t6050-sleep). 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"); }