From b9c322966c40447932e67ecb154fd4899de15675 Mon Sep 17 00:00:00 2001 From: Dylan Ironside Date: Sat, 14 Nov 2026 20:51:12 +0000 Subject: [PATCH 1/4] dt-bindings: media: apple,prores: Name the T8132 initialization table T8132 takes a per-machine initialization table like T6041 and T6050. Name it in the description. Signed-off-by: Dylan Ironside --- Documentation/devicetree/bindings/media/apple,prores.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/media/apple,prores.yaml b/Documentation/devicetree/bindings/media/apple,prores.yaml index 0446d7aa9599..6d9c2231222c 100644 --- a/Documentation/devicetree/bindings/media/apple,prores.yaml +++ b/Documentation/devicetree/bindings/media/apple,prores.yaml @@ -12,9 +12,10 @@ maintainers: description: | The APR is a directly programmed ProRes engine with its own DART. Jobs are descriptors in a DMA ring; the engine signals completion with an - interrupt. On T6041 and T6050 a per-machine initialization table, - apple/prores-t6041-init.bin or apple/prores-t6050-init.bin, takes the - place of any rows built into the driver. Other supported variants have no + interrupt. On T8132, T6041 and T6050 a per-machine initialization table, + apple/prores-t8132-init.bin, apple/prores-t6041-init.bin or + apple/prores-t6050-init.bin, takes the place of any rows built into the + driver. Other supported variants have no firmware. The engine's power domain also resets it. From f8cc03c1bf355130259320890ea85d152634c4b0 Mon Sep 17 00:00:00 2001 From: Dylan Ironside Date: Sat, 14 Nov 2026 20:51:12 +0000 Subject: [PATCH 2/4] media: apple: prores: Add the T8132 (M4) engine The M4's ProRes engine has T6041's register windows (core, AXI wrapper and SCODEC system) and job format. macOS brings it up as it does T6041's, with read-modify-write tables applied before the ring is installed, but its wrapper table has 48 rows instead of 62 (traced on a J604 under the hypervisor: 82 SCODEC-system, 80 core and 48 wrapper rows, the same in two sessions, all below +0x4040 in the wrapper window). Add the T8132 variant on the T6041 path. Its rows come from apple/prores-t8132-init.bin, the T6041 container with soc 0x8132 and a 48-entry wrapper block (2,560 bytes). There are no built-in rows, so without the file the engine stays unbound. Signed-off-by: Dylan Ironside --- drivers/media/platform/apple/prores/Kconfig | 9 ++-- .../platform/apple/prores/apple-prores-drv.c | 18 ++++++++ .../platform/apple/prores/apple-prores-fw.c | 14 +++++++ .../platform/apple/prores/apple-prores-test.c | 42 +++++++++++++++++++ .../platform/apple/prores/apple-prores.h | 5 +++ .../platform/apple/prores/t6041-apri.rst | 10 +++++ 6 files changed, 94 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/apple/prores/Kconfig b/drivers/media/platform/apple/prores/Kconfig index d41429f7757e..27ffadcfcad5 100644 --- a/drivers/media/platform/apple/prores/Kconfig +++ b/drivers/media/platform/apple/prores/Kconfig @@ -9,10 +9,11 @@ config VIDEO_APPLE_PRORES select VIDEOBUF2_DMA_CONTIG help V4L2 memory-to-memory driver for the ProRes encoder engine (APR) - in Apple M1 Pro (T6000), M4 Pro (T6041), M5 (T8142), M5 Pro/Max - (T6050) and A18 Pro (T8140) SoCs. On T6041, T8142 and T6050 a - per-machine apple/prores--init.bin takes the place of the - built-in initialization rows. It encodes 8 + in Apple M1 Pro (T6000), M4 (T8132), M4 Pro (T6041), M5 (T8142), + M5 Pro/Max (T6050) and A18 Pro (T8140) SoCs. On T6041, T8142 and + T6050 a per-machine apple/prores--init.bin takes the place of + the built-in initialization rows; T8132 has no built-in rows and + binds only with apple/prores-t8132-init.bin. It encodes 8 and 16 bit 4:2:2 and 4:4:4 frames to ProRes 422 Proxy, LT, 422, HQ, 4444 and 4444 XQ. diff --git a/drivers/media/platform/apple/prores/apple-prores-drv.c b/drivers/media/platform/apple/prores/apple-prores-drv.c index e5f7d939297c..f75dd6d5b3d2 100644 --- a/drivers/media/platform/apple/prores/apple-prores-drv.c +++ b/drivers/media/platform/apple/prores/apple-prores-drv.c @@ -1045,6 +1045,22 @@ static const struct apr_variant apr_t6041 = { .apri = &apri_t6041, }; +/* T6041's engine and windows, with T8132's own wrapper table; no built-in rows. */ +static const struct apr_variant apr_t8132 = { + .build_desc = apr_build_desc, + .stats = { + { APR_REG_STATS0_LO, APR_REG_STATS0_HI, APR_REG_STATS0_SIZE }, + { APR_REG_STATS1_LO, APR_REG_STATS1_HI, APR_REG_STATS1_SIZE }, + }, + .reg_names = { "core", "wrapper", "aux" }, + .num_regs = 3, + .num_irqs = 1, + .ring_bytes = APR_RING_BYTES, + .desc_bytes = APR_DESC_BYTES, + .firmware_name = APRI_T8132_FIRMWARE_NAME, + .apri = &apri_t8132, +}; + /* T6041's engine plus the SCODEC control window. */ static const struct apr_variant apr_t6050 = { .build_desc = apr_build_desc, @@ -2162,6 +2178,7 @@ static const struct of_device_id apr_of_match[] = { { .compatible = "apple,t6000-prores", .data = &apr_t6000 }, { .compatible = "apple,t6041-prores", .data = &apr_t6041 }, { .compatible = "apple,t6050-prores", .data = &apr_t6050 }, + { .compatible = "apple,t8132-prores", .data = &apr_t8132 }, { .compatible = "apple,t8140-prores", .data = &apr_t8140 }, { .compatible = "apple,t8142-prores", .data = &apr_t8142 }, { } @@ -2183,4 +2200,5 @@ MODULE_DESCRIPTION("Apple ProRes encoder"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(APRI_T6041_FIRMWARE_NAME); MODULE_FIRMWARE(APRI_T6050_FIRMWARE_NAME); +MODULE_FIRMWARE(APRI_T8132_FIRMWARE_NAME); MODULE_FIRMWARE(APRI_T8142_FIRMWARE_NAME); diff --git a/drivers/media/platform/apple/prores/apple-prores-fw.c b/drivers/media/platform/apple/prores/apple-prores-fw.c index 2b1b9f227c89..66b64c4ddbcf 100644 --- a/drivers/media/platform/apple/prores/apple-prores-fw.c +++ b/drivers/media/platform/apple/prores/apple-prores-fw.c @@ -24,6 +24,10 @@ static_assert(APRI_T6050_FIRMWARE_SIZE == APRI_HEADER_SIZE + APRI_T6050_BLOCKS * APRI_BLOCK_HEADER_SIZE + (APRI_SYSTEM_COUNT + APRI_CORE_COUNT + APRI_WRAPPER_COUNT + APRI_CONTROL_COUNT) * APRI_ENTRY_SIZE); +static_assert(APRI_T8132_FIRMWARE_SIZE == + APRI_HEADER_SIZE + APRI_T6041_BLOCKS * APRI_BLOCK_HEADER_SIZE + + (APRI_SYSTEM_COUNT + APRI_CORE_COUNT + APRI_T8132_WRAPPER_COUNT) * + APRI_ENTRY_SIZE); static_assert(APRI_T8142_FIRMWARE_SIZE == APRI_HEADER_SIZE + APRI_T8142_BLOCKS * APRI_BLOCK_HEADER_SIZE + @@ -50,6 +54,16 @@ const struct apri_layout apri_t6050 = { }; EXPORT_SYMBOL_IF_KUNIT(apri_t6050); +/* T8132 has T6041's three blocks; its wrapper table is 48 rows. */ +const struct apri_layout apri_t8132 = { + .soc = 0x8132, + .blocks = APRI_T6041_BLOCKS, + .size = APRI_T8132_FIRMWARE_SIZE, + .counts = { APRI_SYSTEM_COUNT, APRI_CORE_COUNT, APRI_T8132_WRAPPER_COUNT }, + .limits = { 0x4000, 0x4000, 0x1000000 }, +}; +EXPORT_SYMBOL_IF_KUNIT(apri_t8132); + /* * T8142 has T6050's four blocks. macOS 27.2.1 on a J815 writes the same 82 * system, 80 core and 12 control offsets, and 38 wrapper rows. diff --git a/drivers/media/platform/apple/prores/apple-prores-test.c b/drivers/media/platform/apple/prores/apple-prores-test.c index 7e5479327142..7e6fdd60199f 100644 --- a/drivers/media/platform/apple/prores/apple-prores-test.c +++ b/drivers/media/platform/apple/prores/apple-prores-test.c @@ -442,6 +442,47 @@ static void apr_test_apri_t6050(struct kunit *test) KUNIT_EXPECT_EQ(test, apr_parse_init(&apri_t6050, data, pos, init), -EINVAL); } +/* A T8132 container: T6041's blocks with a 48-row wrapper table. */ +static void apr_test_apri_t8132(struct kunit *test) +{ + static const u32 counts[APRI_T6041_BLOCKS] = { + APRI_SYSTEM_COUNT, APRI_CORE_COUNT, APRI_T8132_WRAPPER_COUNT, + }; + struct apr_init_data *init = kunit_kzalloc(test, sizeof(*init), GFP_KERNEL); + u8 *data = kunit_kzalloc(test, APRI_T8132_FIRMWARE_SIZE, GFP_KERNEL); + size_t pos = 16; + u32 block, entry; + + KUNIT_ASSERT_NOT_NULL(test, init); + KUNIT_ASSERT_NOT_NULL(test, data); + memcpy(data, "APRI", 4); + put_unaligned_le32(1, data + 4); + put_unaligned_le32(0x8132, data + 8); + put_unaligned_le32(APRI_T6041_BLOCKS, data + 12); + for (block = 0; block < APRI_T6041_BLOCKS; block++) { + put_unaligned_le32(block + 1, data + pos); + put_unaligned_le32(counts[block], data + pos + 4); + pos += 8; + for (entry = 0; entry < counts[block]; entry++, pos += 12) { + put_unaligned_le32(entry * 4, data + pos); + put_unaligned_le32(0xffffffff, data + pos + 4); + put_unaligned_le32(entry, data + pos + 8); + } + } + KUNIT_ASSERT_EQ(test, pos, (size_t)APRI_T8132_FIRMWARE_SIZE); + KUNIT_EXPECT_EQ(test, apr_parse_init(&apri_t8132, data, pos, init), 0); + KUNIT_EXPECT_EQ(test, init->blocks[APRI_WRAPPER_BLOCK].count, + (u32)APRI_T8132_WRAPPER_COUNT); + /* T6041 does not take it, nor T8132 a T6041 SoC field. */ + KUNIT_EXPECT_EQ(test, apr_parse_init(&apri_t6041, data, pos, init), -EINVAL); + put_unaligned_le32(0x6041, data + 8); + KUNIT_EXPECT_EQ(test, apr_parse_init(&apri_t8132, data, pos, init), -EINVAL); + put_unaligned_le32(0x8132, data + 8); + /* A wrapper row past its window. */ + put_unaligned_le32(0x1000000, data + pos - 12); + KUNIT_EXPECT_EQ(test, apr_parse_init(&apri_t8132, data, pos, init), -EINVAL); +} + /* A T8142 container: T6050's blocks with a 38-row wrapper. */ static void apr_test_apri_t8142(struct kunit *test) { @@ -578,6 +619,7 @@ static struct kunit_case apr_test_cases[] = { KUNIT_CASE(apr_test_output), KUNIT_CASE(apr_test_apri_valid), KUNIT_CASE(apr_test_apri_t6050), + KUNIT_CASE(apr_test_apri_t8132), KUNIT_CASE(apr_test_apri_t8142), KUNIT_CASE(apr_test_apri_header_rejects), KUNIT_CASE(apr_test_apri_shape_rejects), diff --git a/drivers/media/platform/apple/prores/apple-prores.h b/drivers/media/platform/apple/prores/apple-prores.h index aa909be80883..67bf19c93370 100644 --- a/drivers/media/platform/apple/prores/apple-prores.h +++ b/drivers/media/platform/apple/prores/apple-prores.h @@ -57,12 +57,16 @@ #define APRI_T6041_FIRMWARE_SIZE 2728 #define APRI_T6050_FIRMWARE_NAME "apple/prores-t6050-init.bin" #define APRI_T6050_FIRMWARE_SIZE 2880 +#define APRI_T8132_FIRMWARE_NAME "apple/prores-t8132-init.bin" +#define APRI_T8132_FIRMWARE_SIZE 2560 #define APRI_T8142_FIRMWARE_NAME "apple/prores-t8142-init.bin" #define APRI_T8142_FIRMWARE_SIZE 2592 #define APRI_SYSTEM_COUNT 82 #define APRI_CORE_COUNT 80 #define APRI_WRAPPER_COUNT 62 #define APRI_CONTROL_COUNT 12 +/* T8132 brings up its AXI wrapper with fewer rows than T6041 */ +#define APRI_T8132_WRAPPER_COUNT 48 /* T8142's AXI-to-fabric wrapper takes 38 rows where T6041 and T6050 take 62. */ #define APRI_T8142_WRAPPER_COUNT 38 #define APRI_MAX_COUNT APRI_SYSTEM_COUNT @@ -171,6 +175,7 @@ int apr_build_desc_v0(const struct apr_frame *f, u8 *desc); int apr_check_output(const u8 *out, size_t capacity, u32 *frame_bytes); extern const struct apri_layout apri_t6041; extern const struct apri_layout apri_t6050; +extern const struct apri_layout apri_t8132; extern const struct apri_layout apri_t8142; int apr_parse_init(const struct apri_layout *layout, const u8 *data, size_t size, struct apr_init_data *init); diff --git a/drivers/media/platform/apple/prores/t6041-apri.rst b/drivers/media/platform/apple/prores/t6041-apri.rst index ebd9c03bb96a..3ebc28c49652 100644 --- a/drivers/media/platform/apple/prores/t6041-apri.rst +++ b/drivers/media/platform/apple/prores/t6041-apri.rst @@ -55,6 +55,16 @@ The container deliberately has no MMIO addresses, selectors, power policy, or arbitrary write commands. File integrity is the responsibility of the package that installs the per-Mac file. +T8132 +===== + +``apple/prores-t8132-init.bin`` is the T6041 container with ``soc = 0x8132`` +and a wrapper block of 48 entries instead of 62: 2,560 bytes in all. macOS +brings up the T8132 engine with read-modify-write tables of 82 (SCODEC +system), 80 (core) and 48 (AXI wrapper) rows, below ``+0x4040`` in the +wrapper window. The driver has no built-in T8132 rows, so that engine probes +only with the file. + T6050 ===== From 131893ed9e2ee8a7096e8525a3ce55f4f859d316 Mon Sep 17 00:00:00 2001 From: Dylan Ironside Date: Sun, 15 Nov 2026 09:35:33 +0000 Subject: [PATCH 3/4] arm64: dts: apple: t8132: Name the ProRes windows; enable ProRes on the J604 The driver maps the ProRes windows by name. Name the T8132 node's three windows, and enable the engine and its DART on the J604. The engine binds only on request and with its per-machine initialization table installed. Signed-off-by: Dylan Ironside --- arch/arm64/boot/dts/apple/t8132-j604.dts | 12 ++++++++++++ arch/arm64/boot/dts/apple/t8132-peripherals.dtsi | 1 + 2 files changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8132-j604.dts b/arch/arm64/boot/dts/apple/t8132-j604.dts index 3bdcefeb622a..f01c6d3f9525 100644 --- a/arch/arm64/boot/dts/apple/t8132-j604.dts +++ b/arch/arm64/boot/dts/apple/t8132-j604.dts @@ -630,3 +630,15 @@ min-duty-cycle-bp = <542>; max-duty-cycle-bp = <3500>; }; + +/* + * ProRes: the engine and its DART. The driver binds the T8132 engine only on request, + * with apple/prores-t8132-init.bin installed. + */ +&dart_apr0 { + status = "okay"; +}; + +&apr { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/apple/t8132-peripherals.dtsi b/arch/arm64/boot/dts/apple/t8132-peripherals.dtsi index a3fb9d53331b..f8a5a351d011 100644 --- a/arch/arm64/boot/dts/apple/t8132-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t8132-peripherals.dtsi @@ -443,6 +443,7 @@ reg = <0x2 0x81000000 0x0 0x4000>, <0x2 0x80000000 0x0 0x1000000>, <0x2 0x810c0000 0x0 0x4000>; + reg-names = "core", "wrapper", "aux"; interrupt-parent = <&aic>; interrupts = , ; From fe6a33124f19e11dd90853efeb2769c3835ae889 Mon Sep 17 00:00:00 2001 From: Dylan Ironside Date: Sat, 21 Nov 2026 03:13:55 +0000 Subject: [PATCH 4/4] arm64: dts: apple: t8132: Say when the J604 ProRes engine binds The T8132 ProRes engine no longer waits for a module parameter: the driver binds it whenever apple/prores-t8132-init.bin is installed and leaves the engine off without it. Say so in the J604 comment. Signed-off-by: Dylan Ironside --- arch/arm64/boot/dts/apple/t8132-j604.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t8132-j604.dts b/arch/arm64/boot/dts/apple/t8132-j604.dts index f01c6d3f9525..e0dac7b96e73 100644 --- a/arch/arm64/boot/dts/apple/t8132-j604.dts +++ b/arch/arm64/boot/dts/apple/t8132-j604.dts @@ -632,8 +632,8 @@ }; /* - * ProRes: the engine and its DART. The driver binds the T8132 engine only on request, - * with apple/prores-t8132-init.bin installed. + * ProRes: the engine and its DART. The driver binds the T8132 engine whenever + * apple/prores-t8132-init.bin is installed and leaves it off without it. */ &dart_apr0 { status = "okay";