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 || 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"); } 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. */