From 56f475d3ccb8e86a14efc99ed3f8051f57e60736 Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Fri, 27 Nov 2026 01:21:13 -0500 Subject: [PATCH] media: apple: ave: admit the T6050 26B123 encoder firmware build The T6050 26B123 encoder firmware build (TEXT 0x158000, DATA 0x134000, TEXT CRC 0xd33ed3b4) matches the 26C5035 segment sizes and speaks the 26A428 command layout. Add AVE_FW_TEXT_CRC_T6050_26B123 to the T6050 build table, known-CRC list, command-layout matcher, and AVE ABI KUnit expectations so the encoder binds, encodes H.264 and HEVC, and lets venc0-sys runtime-suspend when idle. Signed-off-by: Erik Bourget --- .../media/platform/apple/ave/ave-abi-test.c | 21 +++++++++++++++---- drivers/media/platform/apple/ave/ave-drv.c | 7 ++++--- drivers/media/platform/apple/ave/ave-fw.c | 3 ++- drivers/media/platform/apple/ave/ave-layout.c | 7 ++++--- drivers/media/platform/apple/ave/ave.h | 3 +++ 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/apple/ave/ave-abi-test.c b/drivers/media/platform/apple/ave/ave-abi-test.c index 1698e8a97ec94..1789f30cd596a 100644 --- a/drivers/media/platform/apple/ave/ave-abi-test.c +++ b/drivers/media/platform/apple/ave/ave-abi-test.c @@ -1677,14 +1677,27 @@ static void ave_t6041_text_boot_word(struct kunit *test) KUNIT_EXPECT_EQ(test, ave_t8132.builds[0].text_crc, AVE_FW_TEXT_CRC_T8132_26B123); KUNIT_EXPECT_EQ(test, ave_t8132.text_link_cell, 0U); /* - * The M5 Pro/Max 26A428 build: the same word, which differs per boot on - * the J775D. The 26C5035 build has none set: its CRC matches as it is. + * T6050 26A428 sets the per-boot TEXT word; 26B123 and 26C5035 have + * none set, share the larger TEXT segment, and speak the 26A428 + * command layout. */ - KUNIT_ASSERT_EQ(test, ave_t6050.build_count, 2U); + KUNIT_ASSERT_EQ(test, ave_t6050.build_count, 3U); KUNIT_EXPECT_EQ(test, ave_t6050.builds[0].text_boot_word, off); KUNIT_EXPECT_EQ(test, ave_t6050.builds[0].text_crc, AVE_FW_TEXT_CRC_T6050_26A428); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_size, 0x158000U); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].data_size, 0x134000U); KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_boot_word, 0U); - KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_crc, AVE_FW_TEXT_CRC_T6050_26C5035); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[1].text_crc, AVE_FW_TEXT_CRC_T6050_26B123); + KUNIT_EXPECT_TRUE(test, ave_fw_known_crc(AVE_FW_TEXT_CRC_T6050_26B123)); + KUNIT_EXPECT_PTR_EQ(test, ave_layout_for_crc(AVE_FW_TEXT_CRC_T6050_26B123), + &ave_layout_26a428); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_size, 0x158000U); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].data_size, 0x134000U); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_boot_word, 0U); + KUNIT_EXPECT_EQ(test, ave_t6050.builds[2].text_crc, AVE_FW_TEXT_CRC_T6050_26C5035); + KUNIT_EXPECT_TRUE(test, ave_fw_known_crc(AVE_FW_TEXT_CRC_T6050_26C5035)); + KUNIT_EXPECT_PTR_EQ(test, ave_layout_for_crc(AVE_FW_TEXT_CRC_T6050_26C5035), + &ave_layout_26a428); KUNIT_EXPECT_EQ(test, ave_t6050.text_link_cell, 0U); for (u32 i = 0; i < size; i++) text[i] = i * 7 + 3; diff --git a/drivers/media/platform/apple/ave/ave-drv.c b/drivers/media/platform/apple/ave/ave-drv.c index bd3568d34deae..e20fb08d5105f 100644 --- a/drivers/media/platform/apple/ave/ave-drv.c +++ b/drivers/media/platform/apple/ave/ave-drv.c @@ -224,10 +224,11 @@ static const struct ave_variant ave_t8140 = { static const struct ave_fw_build ave_t6050_builds[] = { { "26A428", 0x154000, 0x134000, AVE_FW_TEXT_CRC_T6050_26A428, 0x4224 }, /* - * macOS 27.3 beta 1 (iBoot 20457.60.65): TEXT is 0x4000 larger, DATA - * keeps its size. It starts as 26A428 does and takes 26A428's command - * layout (ave_layout_for_crc()). + * 26B123 and 26C5035: TEXT is 0x4000 larger, DATA keeps its size. + * Both start as 26A428 does and take 26A428's command layout + * (ave_layout_for_crc()). */ + { "26B123", 0x158000, 0x134000, AVE_FW_TEXT_CRC_T6050_26B123 }, { "26C5035", 0x158000, 0x134000, AVE_FW_TEXT_CRC_T6050_26C5035 }, }; diff --git a/drivers/media/platform/apple/ave/ave-fw.c b/drivers/media/platform/apple/ave/ave-fw.c index 9522672040711..b4357f52543b7 100644 --- a/drivers/media/platform/apple/ave/ave-fw.c +++ b/drivers/media/platform/apple/ave/ave-fw.c @@ -41,6 +41,7 @@ static const u32 ave_known_text_crc[] = { AVE_FW_TEXT_CRC_T6040_25G83, /* encoder firmware 9003.78.0 / T6040 */ AVE_FW_TEXT_CRC_T6041_25G83, /* encoder firmware 9003.78.0 / M4 Max */ AVE_FW_TEXT_CRC_T6050_26A428, /* encoder firmware macOS 27.0 26A428 / T6050 */ + AVE_FW_TEXT_CRC_T6050_26B123, /* encoder firmware 27.2 26B123 / T6050 */ AVE_FW_TEXT_CRC_T6050_26C5035, /* encoder firmware macOS 27.3 26C5035r / T6050 */ AVE_FW_TEXT_CRC_T8142_26A428, /* encoder firmware 9013.45.1, macOS 27.0 26A428 / T8142 */ AVE_FW_TEXT_CRC_T8122_26B123, /* encoder firmware macOS 27.2 26B123 / T8122 */ @@ -159,7 +160,7 @@ int ave_fw_text_id_crc(const void *text, size_t size, u32 cell_off, return 0; } -static bool ave_fw_known_crc(u32 crc) +bool ave_fw_known_crc(u32 crc) { for (unsigned int i = 0; i < ARRAY_SIZE(ave_known_text_crc); i++) if (crc == ave_known_text_crc[i]) diff --git a/drivers/media/platform/apple/ave/ave-layout.c b/drivers/media/platform/apple/ave/ave-layout.c index b05103511532f..5142884c83880 100644 --- a/drivers/media/platform/apple/ave/ave-layout.c +++ b/drivers/media/platform/apple/ave/ave-layout.c @@ -1001,10 +1001,11 @@ const struct ave_fw_layout *ave_layout_for_crc(u32 crc) crc == AVE_FW_TEXT_CRC_T8142_26A428) return &ave_layout_26a428; /* - * The macOS 27.3 beta 1 build speaks the same command layout: H.264 - * and HEVC encode with it on a J714s. + * T6050 builds 26B123 and 26C5035 speak the same 26A428 command layout: + * H.264 and HEVC encode with 26B123 on J716c and 26C5035 on J714s. */ - if (crc == AVE_FW_TEXT_CRC_T6050_26C5035) + if (crc == AVE_FW_TEXT_CRC_T6050_26B123 || + crc == AVE_FW_TEXT_CRC_T6050_26C5035) return &ave_layout_26a428; if (crc == AVE_FW_TEXT_CRC_T8132_26B123 || crc == AVE_FW_TEXT_CRC_T8122_26B123 || diff --git a/drivers/media/platform/apple/ave/ave.h b/drivers/media/platform/apple/ave/ave.h index 331c866381399..6388444aa00bc 100644 --- a/drivers/media/platform/apple/ave/ave.h +++ b/drivers/media/platform/apple/ave/ave.h @@ -176,6 +176,8 @@ enum ave_opcode { */ #define AVE_FW_TEXT_CRC_T6041_25G83 0x9a080cad #define AVE_FW_TEXT_CRC_T6050_26A428 0x87279429 +/* Firmware 27.2 (26B123) / T6050: TEXT 0x158000, DATA 0x134000. */ +#define AVE_FW_TEXT_CRC_T6050_26B123 0xd33ed3b4 /* macOS 27.3 beta 1 (26C5035r) / T6050: TEXT 0x158000, DATA 0x134000. */ #define AVE_FW_TEXT_CRC_T6050_26C5035 0xc25b4ddb /* The M5 (T8142) build of the same 26A428 firmware (encoder firmware 9013.45.1). */ @@ -585,6 +587,7 @@ extern const struct ave_variant ave_t6000, ave_t6041, ave_t6050, ave_t8112, u64 ave_fw_vcbar(const struct ave_variant *variant, u64 text_iova); int ave_fw_probe(struct ave_dev *ave); bool ave_fw_sizes_match(const struct ave_variant *v, size_t text, size_t data); +bool ave_fw_known_crc(u32 crc); const struct ave_variant *ave_fw_select_build(const struct ave_variant *v, size_t text, size_t data); int ave_fw_text_id_crc(const void *text, size_t size, u32 cell_off,