From 5ddc1539c28e9d08e0711b25894bca091ee15790 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Fri, 13 Nov 2026 11:08:47 -0600 Subject: [PATCH] soc: apple: aop: Start AFK endpoints 0x2f and 0x30 The AFK endpoint table covered 0x20 to 0x2e. The T6050 firmware also lists 0x2f and 0x30 in its endpoint map. With those two not started, the firmware stalled after its early boot lines: it logged one notice about endpoint 0x2f in a loop, sent hellos on five endpoints only and never printed its ready line. The sound cards did not register. Raise AFK_ENDPOINT_COUNT to 0x11. Endpoints the firmware does not advertise are still skipped by has_endpoint(). Tested on a MacBook Pro 14-inch (M5 Max, k114c): with 0x2f and 0x30 started the firmware prints its ready line, all 16 endpoints complete the AFK handshake and two ALSA cards register. That run used a debug build with a different start order; this exact patch is not yet run on hardware. The unit tests check the default start order and the index helper. They fail with the old count and pass with the new one (run in a host harness; the kunit run is not done). Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> --- drivers/soc/apple/aop.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/soc/apple/aop.rs b/drivers/soc/apple/aop.rs index 2452ae5035d7..78eb0f980f55 100644 --- a/drivers/soc/apple/aop.rs +++ b/drivers/soc/apple/aop.rs @@ -100,7 +100,7 @@ const FW_REGION_MAX_SIZE: u64 = 0x10_0000; /// The DART page size the firmware segments are mapped with. const FW_REGION_PAGE: u64 = 0x4000; const AFK_ENDPOINT_START: u8 = 0x20; -const AFK_ENDPOINT_COUNT: u8 = 0xf; +const AFK_ENDPOINT_COUNT: u8 = 0x11; const AFK_OPC_GET_BUF: u64 = 0x89; const AFK_OPC_INIT: u64 = 0x80; const AFK_OPC_INIT_RX: u64 = 0x8b; @@ -3221,3 +3221,28 @@ module_platform_driver! { description: "AOP driver", license: "Dual MIT/GPL", } + +#[kunit_tests(apple_aop)] +mod tests { + use super::*; + + /// Every endpoint a firmware can advertise, 0x20 to 0x30, is started. The + /// T6050 endpoint map ends at 0x30 and its firmware stalls at boot until + /// 0x2f and 0x30 are started. + #[test] + fn default_order_covers_every_advertised_endpoint() { + let mut order = AfkOrder::new(&[]); + for ep in 0x20..=0x30u8 { + assert_eq!(order.next(), Some(ep)); + } + assert_eq!(order.next(), None); + } + + #[test] + fn endpoint_index_covers_the_last_endpoint_only() { + assert_eq!(afk_endpoint_index(0x20), Some(0)); + assert_eq!(afk_endpoint_index(0x30), Some(0x10)); + assert_eq!(afk_endpoint_index(0x31), None); + assert_eq!(afk_endpoint_index(0x1f), None); + } +}