From 746c4cd98c07cb1a5fc118f1a2375ef9921ab664 Mon Sep 17 00:00:00 2001 From: Kazuhide Takahashi Date: Sat, 21 Nov 2026 23:10:48 +0000 Subject: [PATCH] dapf: take the T8132 handoff from the tree, not a board list dapf_init_fdt() called dapf_init_j713() only for the J713 and the J604. dapf_init_j713() already does nothing unless /chosen carries linux-enablement-mac,dapf-handoff, and it hands off only the consumers that property names (and programs those in dapf-halted-handoff as halted consumers). The board list adds nothing beyond the property, and every other T8132 Mac has to be added to it by hand. Drop the list and call dapf_init_j713() on every T8132 tree. A tree without the property keeps today's behaviour: the firmware's filter state is preserved. The host test drops its fdt_node_check_compatible() stub, which nothing calls any more, and now runs dapf_init_fdt() itself on T8132: with the property it reaches dapf_init_j713(), without it or without a tree it changes nothing, and a control that bypasses dapf_init_j713() fails. Tested on a J715 (15-inch M4 Air) with OS firmware 26.6.2, with the J715 tree naming /arm-io/mtp in dapf-halted-handoff as the J604's does: the MTP is cold-started by Linux, and the keyboard, trackpad, AOP microphones, display, GPU and speakers all come up. Signed-off-by: Kazuhide Takahashi --- src/dapf.c | 17 ++++++++--------- tests/python/test_j713_dapf_instance.py | 7 +++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/dapf.c b/src/dapf.c index dd7a0afff..dd4617819 100644 --- a/src/dapf.c +++ b/src/dapf.c @@ -844,15 +844,14 @@ int dapf_init_fdt(const void *fdt) j614s_isp_ready = false; dapf_nprogrammed = dapf_nfailed = 0; if (chip_id == T8132) { - /* M4 laptops whose trees state the same DAPF handoff contract as the J713. */ - static const char *const boards[] = {"apple,j713", "apple,j604", NULL}; - bool known = false; - - for (const char *const *board = boards; fdt && *board; board++) - known |= !fdt_node_check_compatible(fdt, 0, *board); - if (!known) - return 0; /* No other M4 board's power/DAPF contract is qualified. */ - return dapf_init_j713((void *)fdt); + /* + * The tree states the handoff contract itself: /chosen's + * linux-enablement-mac,dapf-handoff names the consumers whose filters + * are handed off, and dapf_init_j713() preserves the firmware state + * of a tree that names none. No board list: a T8132 Mac whose tree + * carries the property gets the handoff with no change here. + */ + return fdt ? dapf_init_j713((void *)fdt) : 0; } int ret = 0; diff --git a/tests/python/test_j713_dapf_instance.py b/tests/python/test_j713_dapf_instance.py index 1b5d4fb02..1ba6d47ee 100644 --- a/tests/python/test_j713_dapf_instance.py +++ b/tests/python/test_j713_dapf_instance.py @@ -120,8 +120,6 @@ def block(source, marker): if(!strcmp(key,"linux-enablement-mac,dapf-halted-handoff"))return (halted_requested&(1U<<(n-4)))?0:-1; return ((!strcmp(key,"linux-enablement-mac,dapf-handoff")?requested:power_requested)&(1U<<(n-4)))?0:-1; } -static int fdt_node_check_compatible(const void *dt,int node,const char *compat) -{(void)dt;(void)node;(void)compat;return 0;} ''' TESTS = r''' @@ -200,6 +198,10 @@ def block(source, marker): reset();halted_requested=2;assert(dapf_init_j713((void *)1)==1); assert(asc_inits==1&&!asc_frees);preserved(); reset();assert(dapf_init_j713((void *)1)==1);assert(!asc_inits);preserved(); + /* The tree, not a board list, decides: every T8132 tree reaches dapf_init_j713(). */ + reset();assert(dapf_init_fdt((void *)1)==1); + reset();handoff=false;assert(!dapf_init_fdt((void *)1));preserved(); + reset();assert(!dapf_init_fdt(NULL));preserved(); /* The central T8132 branch is the only change to the legacy flow. */ reset();chip_id=0x8110;dart_gates=true;assert(!dapf_init("/arm-io/dart-aop",1)); assert(filter_writes==5*(nodes[0].config_len/52)&&dart_enables==1&&disables==1); @@ -253,6 +255,7 @@ def run(text, negative=False, label="production"): ("inactive consumer", 'if (powered <= 0)', 'if (powered <= 0 && false)'), ("halted check", "bool running = !asc || asc_cpu_running(asc);", "bool running = !asc || (asc_cpu_running(asc) && false);"), + ("tree decides", "return fdt ? dapf_init_j713((void *)fdt) : 0;", "return 0;"), ] for title, old, new in controls: bad = harness.replace(old, new, 1)