Skip to content
Merged
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
2 changes: 1 addition & 1 deletion tools/asahi/display-sleep-merge-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run(name, code, negative=False, extra=()):
pre = common + r'''
#define READ_ONCE(x) (x)
#define WRITE_ONCE(x,v) ((x)=(v))
struct apple_dcp { bool v27, native26, crashed, sleep_cold_stopped, ext26_blocked, ext26_pm_preparing, ext26_pm_work_off; int ext26_blank_work; };
struct apple_dcp { bool v27, native26, crashed, sleep_cold_stopped, ext26_blocked, ext26_pm_preparing, ext26_pm_work_off; int ext26_blank_work; struct dcp_ext272 *ext272; };
struct device { struct apple_dcp *d; };
static int invalidations, cancellations, disables; static bool firmware;
static void *dev_get_drvdata(struct device *v) { return v->d; }
Expand Down
12 changes: 11 additions & 1 deletion tools/testing/selftests/drivers/gpu/apple-dcp/boot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
# Copyright 2026 Ryan Murray
"""RTKit event dispatch and ACK policies with public synthetic messages."""
import re

from common import block

def oslog(root):
Expand Down Expand Up @@ -259,6 +261,7 @@ def _v27_prelude(root):
'static enum dcp_firmware_version dcp_v27_method_table(',
'enum dcp_v27_admission dcp_v27_admission(',
'static bool dcp_firmware_27(',
'static bool dcp_ext272_admitted(',
'static enum dcp_firmware_version dcp_check_firmware_version(',
))
return r'''
Expand Down Expand Up @@ -399,6 +402,10 @@ def v27_panel_handoff(root):
match = '\n'.join(block(source, f'static const struct apple_dcp_hw_data apple_dcp_hw_{soc} =')
+ ';' for soc in profiles)
profile = block(source, 'static void dcp_apply_dt_profile(')
internal = (root / 'drivers/gpu/drm/apple/dcp-internal.h').read_text()
layouts = block(internal, 'struct dcp_s2r_layout {') + ';\n' + ''.join(
block(source, f'static const struct dcp_s2r_layout {name} =') + ';\n'
for name in sorted(set(re.findall(r'\.s2r_layout = &(\w+),', match))))
return r'''
#include <assert.h>
#include <stdbool.h>
Expand All @@ -418,6 +425,9 @@ def v27_panel_handoff(root):
const char *iboot_handoff;
unsigned num_dptx_ports;
u8 firmware_dma_bits;
/* Set in the T6030 profile, not read by dcp_apply_dt_profile(). */
bool afk_name_fallback, v27_early_stop;
const struct dcp_s2r_layout *s2r_layout;
};
struct apple_dcp {
struct device *dev;
Expand All @@ -441,7 +451,7 @@ def v27_panel_handoff(root):
/* All probes see the same DART aperture and panel-only topology. */
static u8 dcp_dart_dma_bits(struct device_node *np) { return 41; }
static bool dcp_is_internal_panel_only(struct apple_dcp *dcp) { return true; }
''' + match + '\n' + profile + r'''
''' + layouts + match + '\n' + profile + r'''
static void check(struct apple_dcp_hw_data hw, struct device_node node, bool live)
{
struct device dev = { .of_node = &node };
Expand Down
12 changes: 9 additions & 3 deletions tools/testing/selftests/drivers/gpu/apple-dcp/edid.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def function(file,signature):
#define dev_err(...) do { diagnostic_errors++; } while (0)
#define dev_dbg(dev,fmt,...) do { if(!strcmp(fmt,"DCPAVSERV: legacy EDID service published\n")) legacy_publishes++; } while (0)
#define dev_info(...) do { diagnostic_information++; } while (0)
#define dev_info_ratelimited(...) do { diagnostic_information++; } while (0)

static unsigned diagnostic_errors,diagnostic_information,legacy_publishes;
#define DCP_FIRMWARE_H17P 17
Expand Down Expand Up @@ -94,19 +95,20 @@ def function(file,signature):
struct { u64 generation,epoch; } admission;void *cookie;
bool pending_open;const char *pending_name,*pending_class;s64 pending_unit;
};
/* v27_closed_teardown: set only by a J714s firmware 27 sleep. */
struct apple_dcp_afkep { u8 *command_tags;bool lock,stopping;void *wq;struct work_struct service_work;struct apple_dcp *dcp;const struct apple_epic_service_ops *ops,*unmatched_ops;bool wire_v2,inline_v2,match_epic_name,v27_closed_teardown;u32 endpoint;unsigned int num_channels;int service_wq;struct apple_epic_service services[AFK_MAX_CHANNEL]; };
/* v27_closed_teardown: set only by a J714s firmware 27 sleep; j516s_panel_service only by a T6030 one. */
struct apple_dcp_afkep { u8 *command_tags;bool lock,stopping;void *wq;struct work_struct service_work;struct apple_dcp *dcp;const struct apple_epic_service_ops *ops,*unmatched_ops;bool wire_v2,inline_v2,match_epic_name,v27_closed_teardown,j516s_panel_service;u32 endpoint;unsigned int num_channels;int service_wq;struct apple_epic_service services[AFK_MAX_CHANNEL]; };
#define wake_up_all(q) ((void)(q))
struct apple_connector { void *dcp;bool connected,edid_invalidation_pending;struct { int registration_state; } base;unsigned int hotplug_wq; };
struct apple_dcp {
void *dev;int fw_compat;struct apple_dcp_afkep *dcpavservep;struct apple_connector *connector;
void *desktop;
bool external_physically_absent,hpd_mutex,quiescing,typec_cable_connected;u64 typec_generation;unsigned int nr_modes;
struct { int iomfb_method_profile,firmware_compat; bool fw_14_7_endpoints,afk_announced_names; unsigned int num_dptx_ports; unsigned char dptx_endpoint; } hw; bool ext_dead,external_native;
struct { int iomfb_method_profile,firmware_compat; bool fw_14_7_endpoints,afk_announced_names,afk_name_fallback; unsigned int num_dptx_ports; unsigned char dptx_endpoint; } hw; bool ext_dead,external_native;
struct { bool lock,enabled;u64 epoch;int enable_completion;struct apple_epic_service *service,*opened;
u64 opened_epoch,close_gen,terminated_epoch,close_epoch;bool opening;struct work_struct close_wq; } dcpavserv;
/* A J714s firmware 27 processor's: this one is not. */
bool v27_j714s, v27_sleep_transport; struct apple_dcp_afkep *sleep_v27_ep[0x20], *panelav[0x20];
enum { DCP_V27_TX_LIVE, DCP_V27_TX_REPLIES, DCP_V27_TX_PANEL_OPEN } sleep_v27_closed;
/* Not a dcpext and no external output: none of these scenarios is an external processor. */
bool dcpext; unsigned int nr_typec_routes; void *fixed_phy;
};
Expand Down Expand Up @@ -719,6 +721,8 @@ def function(file, signature):
/* A J714s firmware 27 processor's: none is one here. */
bool v27_j714s, v27_sleep_transport, sleep_v27_unhandled;
struct apple_dcp_afkep *sleep_v27_ep[0x20], *panelav[0x20];
/* The T6030 firmware 27 service endpoints: none is started here. */
struct apple_dcp_afkep *v27_early_svc_ep[0x20];
};
struct drm_edid { int identity; };
'''+internal_inline(root,'dcp_is_v14_7_external')+r'''static unsigned int reads, allocations, legacy_reads, receives;
Expand Down Expand Up @@ -1001,6 +1005,8 @@ def function(text, signature):
/* A J714s firmware 27 processor's: this one is not. */
bool v27_j714s, v27_sleep_transport, sleep_v27_unhandled;
struct apple_dcp_afkep *sleep_v27_ep[0x20], *panelav[0x20];
/* The T6030 firmware 27 service endpoints: none is started here. */
struct apple_dcp_afkep *v27_early_svc_ep[0x20];
};
struct afk_receive_message_work { struct apple_dcp_afkep *ep; u64 message; struct work_struct work; };
struct apple_rtkit_ops { void (*recv_message)(void *,u8,u64); void (*recv_message_timed)(void *,u8,u64,u64); };
Expand Down
Loading