Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
9 changes: 4 additions & 5 deletions drivers/gpu/drm/asahi/g17/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
27 changes: 27 additions & 0 deletions include/linux/soc/apple/sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/compiler_types.h>
#include <linux/errno.h>
#include <linux/kconfig.h>
#include <linux/of.h>
#include <linux/types.h>

struct device;
Expand Down Expand Up @@ -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. */
Expand Down
Loading