From 6f6d672bfd6ae6093e618ba66a6476298185146d Mon Sep 17 00:00:00 2001 From: AxxzyWasTaken Date: Thu, 26 Nov 2026 15:26:40 +0000 Subject: [PATCH 1/4] arm64: dts: apple: t6041: enable second video encoder (ave1) Enable the second H.264/HEVC video encoder (ave1), its two DARTs (ave1_dart0/1), and its six PMGR power states (ps_venc1_sys through ps_venc1_me1) on T6041 (M4 Max), where ave1 is SoC-wide with no board wiring. Verified against the J616c ADT: - /arm-io/ave1 shares the same firmware UUID and register/IRQ layout already described in t6041.dtsi, and lists VENC1-SOC-VMAX (0x1c4) in power-gates matching ave0's VENC0-SOC-VMAX; add pmc_soc_max ("perf") to ave1 to match ave0. - /arm-io/dart-ave1 (dart,t8110, 2 DAPF slices at reg[3]) matches dart-ave0. - Add ave and ave1 aliases so the boot loader's DAPF pass programs both dart-ave0 and dart-ave1; kboot's dt_set_aves() reserves both firmware instances and disables ave1 automatically if absent in ADT. Signed-off-by: AxxzyWasTaken --- arch/arm64/boot/dts/apple/t6041.dtsi | 39 ++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6041.dtsi b/arch/arm64/boot/dts/apple/t6041.dtsi index 837aeb8177e04..d06ac655a23bd 100644 --- a/arch/arm64/boot/dts/apple/t6041.dtsi +++ b/arch/arm64/boot/dts/apple/t6041.dtsi @@ -831,8 +831,10 @@ /* * The second video encoder (ADT ave1, soc-id t6041), unique to the M4 Max. * Its six PMGR power states (VENC1_SYS through VENC1_ME1) live in pmgr_aux - * (0x5028002a0..0x5028002c8). All nodes stay disabled until a bootloader - * handoff preloads and qualifies ave1's firmware. + * (0x5028002a0..0x5028002c8), and it shares the VENC1-SOC-VMAX performance + * vote (pmc_soc_max) like ave0. It has no board wiring, so it is enabled on + * every M4 Max board; the boot loader reserves its preloaded firmware, sets + * up dart-ave1's DAPF filter, and disables it if absent from the ADT. */ &pmgr_aux { ps_venc1_sys: power-controller@2a0 { @@ -842,7 +844,7 @@ #reset-cells = <0>; label = "venc1_sys"; power-domains = <&ps_fab0_soc>; - status = "disabled"; + status = "okay"; }; ps_venc1_dma: power-controller@2a8 { @@ -852,7 +854,7 @@ #reset-cells = <0>; label = "venc1_dma"; power-domains = <&ps_venc1_sys>; - status = "disabled"; + status = "okay"; }; ps_venc1_pipe4: power-controller@2b0 { @@ -862,7 +864,7 @@ #reset-cells = <0>; label = "venc1_pipe4"; power-domains = <&ps_venc1_dma>; - status = "disabled"; + status = "okay"; }; ps_venc1_pipe5: power-controller@2b8 { @@ -872,7 +874,7 @@ #reset-cells = <0>; label = "venc1_pipe5"; power-domains = <&ps_venc1_dma>; - status = "disabled"; + status = "okay"; }; ps_venc1_me0: power-controller@2c0 { @@ -882,7 +884,7 @@ #reset-cells = <0>; label = "venc1_me0"; power-domains = <&ps_venc1_dma>; - status = "disabled"; + status = "okay"; }; ps_venc1_me1: power-controller@2c8 { @@ -892,7 +894,7 @@ #reset-cells = <0>; label = "venc1_me1"; power-domains = <&ps_venc1_me0>; - status = "disabled"; + status = "okay"; }; }; @@ -905,7 +907,7 @@ interrupt-parent = <&aic>; interrupts = ; power-domains = <&ps_venc1_sys>; - status = "disabled"; + status = "okay"; }; ave1_dart0: iommu@2850a0000 { @@ -916,7 +918,7 @@ interrupt-parent = <&aic>; interrupts = ; power-domains = <&ps_venc1_sys>; - status = "disabled"; + status = "okay"; }; ave1: video-codec@285100000 { @@ -932,10 +934,11 @@ , ; power-domains = <&ps_venc1_dma>, <&ps_venc1_pipe4>, - <&ps_venc1_pipe5>, <&ps_venc1_me0>, <&ps_venc1_me1>; - power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1"; + <&ps_venc1_pipe5>, <&ps_venc1_me0>, <&ps_venc1_me1>, + <&pmc_soc_max>; + power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1", "perf"; iommus = <&ave1_dart0 0>, <&ave1_dart1 0>; - status = "disabled"; + status = "okay"; }; }; @@ -998,8 +1001,7 @@ * The first video encoder (ADT ave0, soc-id t6040), its DARTs and its power * domains. It has no board wiring, so it is enabled on every M4 Max board. * iBoot preloads its firmware; the driver refuses a firmware layout it does - * not know at probe. The second encoder (ave1, soc-id t6041) is not - * described. + * not know at probe. */ &ps_venc0_sys { status = "okay"; @@ -1040,10 +1042,15 @@ #include "t6041-pmgr.dtsi" #include "t6041-sleep-pmgr.dtsi" -/* The loader uses this alias to enable SIO after placing its firmware. */ +/* + * The loader uses these aliases to enable SIO after placing its firmware + * and to program the encoder DAPF filters (dart-ave0, dart-ave1). + */ / { aliases { sio = &sio; + ave = &ave; + ave1 = &ave1; }; }; From 48c9893f0eeb2f21d0e879007ee2c88c286f7f56 Mon Sep 17 00:00:00 2001 From: AxxzyWasTaken Date: Thu, 26 Nov 2026 16:40:16 +0000 Subject: [PATCH 2/4] arm64: dts: apple: t6041: attach DART stream 12 to ave and ave1 Attach DART stream 12 alongside stream 0 on both ave (ave0_dart0/1) and ave1 (ave1_dart0/1) in t6041.dtsi. Both /arm-io/dart-ave0 and /arm-io/dart-ave1 in the J616c ADT expose streams 0 and 12 (sid = <0 12>), matching T8140. Because apple,t6041-dart remaps streams into the Linux domain (TCR[12] = REMAP_ENABLE | 0), ave_dart_audit() classifies stream 12 as AVE_DART_STREAM_OURS without affecting normal encode while satisfying ave_mctf_check_build() once T6041 MCTF is qualified. Keeping this in t6041.dtsi leaves T6040 (M4 Pro) unaffected. Signed-off-by: AxxzyWasTaken --- arch/arm64/boot/dts/apple/t6041.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/apple/t6041.dtsi b/arch/arm64/boot/dts/apple/t6041.dtsi index d06ac655a23bd..50a0da521adb3 100644 --- a/arch/arm64/boot/dts/apple/t6041.dtsi +++ b/arch/arm64/boot/dts/apple/t6041.dtsi @@ -18,6 +18,8 @@ <&ps_venc0_pipe5>, <&ps_venc0_me0>, <&ps_venc0_me1>, <&pmc_soc_max>; power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1", "perf"; + iommus = <&ave0_dart0 0>, <&ave0_dart0 12>, + <&ave0_dart1 0>, <&ave0_dart1 12>; }; /* The loader supplies the ANE firmware and reservations. */ @@ -937,7 +939,8 @@ <&ps_venc1_pipe5>, <&ps_venc1_me0>, <&ps_venc1_me1>, <&pmc_soc_max>; power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1", "perf"; - iommus = <&ave1_dart0 0>, <&ave1_dart1 0>; + iommus = <&ave1_dart0 0>, <&ave1_dart0 12>, + <&ave1_dart1 0>, <&ave1_dart1 12>; status = "okay"; }; }; From 6ae0cdf8337ad739500228cc6a966c6aef9b1005 Mon Sep 17 00:00:00 2001 From: AxxzyWasTaken Date: Thu, 26 Nov 2026 19:15:53 +0000 Subject: [PATCH 3/4] media: apple: ave: read per-encoder firmware CRCs from device node before /chosen Multi-encoder Apple Silicon SoCs (such as T6041 with ave0 and ave1) preload independent firmware copies whose per-instance CRCs can differ. Read aurora,ave-{text,data}-crc32 from the encoder's own DT node first, failing closed if the per-node property is present but malformed, and falling back to /chosen only when absent (-EINVAL) for compatibility with older Aura bootloaders. Signed-off-by: AxxzyWasTaken --- drivers/media/platform/apple/ave/ave-fw.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/apple/ave/ave-fw.c b/drivers/media/platform/apple/ave/ave-fw.c index 9522672040711..45a1fa3175753 100644 --- a/drivers/media/platform/apple/ave/ave-fw.c +++ b/drivers/media/platform/apple/ave/ave-fw.c @@ -51,12 +51,19 @@ static const u32 ave_known_text_crc[] = { 0x25bfd039, /* encoder firmware 6070.11.1 / T8112 */ }; -static int ave_fw_chosen_crc(struct ave_dev *ave, const char *name, u32 *crc) +static int ave_fw_dt_crc(struct ave_dev *ave, const char *name, u32 *crc) { - struct device_node *chosen = of_find_node_by_path("/chosen"); + struct device_node *chosen; const char *str; int ret; + ret = of_property_read_string(ave->dev->of_node, name, &str); + if (!ret) + return kstrtou32(str, 16, crc); + if (ret != -EINVAL) + return ret; + + chosen = of_find_node_by_path("/chosen"); if (!chosen) return -ENOENT; ret = of_property_read_string(chosen, name, &str); @@ -331,7 +338,7 @@ int ave_fw_probe(struct ave_dev *ave) ret = ave_fw_crc(&ave->text, &text_crc, NULL); if (ret) return ret; - ret = ave_fw_chosen_crc(ave, "aurora,ave-text-crc32", &want); + ret = ave_fw_dt_crc(ave, "aurora,ave-text-crc32", &want); if (ret || text_crc != want) return dev_err_probe(dev, -ENODEV, "firmware text differs from loader CRC\n"); @@ -371,7 +378,7 @@ int ave_fw_probe(struct ave_dev *ave) * The loader records the DATA checksum before anything runs. If it * differs, the firmware already ran and there is no clean copy left. */ - ret = ave_fw_chosen_crc(ave, "aurora,ave-data-crc32", &want); + ret = ave_fw_dt_crc(ave, "aurora,ave-data-crc32", &want); if (ret || data_crc != want) { ret = dev_err_probe(dev, -ENODEV, "firmware data is not in its boot state\n"); From 98dba80cccd073cc3a6e08370794dfe5a9f0d115 Mon Sep 17 00:00:00 2001 From: AxxzyWasTaken Date: Fri, 27 Nov 2026 15:14:38 +0000 Subject: [PATCH 4/4] dt-bindings: media: apple,t8140-ave: document per-encoder firmware CRC properties Document the bootloader-injected aurora,ave-text-crc32 and aurora,ave-data-crc32 hexadecimal CRC32 string properties on encoder nodes (including the legacy /chosen fallback when absent) and add a post-loader example validated against the closed schema. Signed-off-by: AxxzyWasTaken --- .../bindings/media/apple,t8140-ave.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Documentation/devicetree/bindings/media/apple,t8140-ave.yaml b/Documentation/devicetree/bindings/media/apple,t8140-ave.yaml index 50d2f123cb2aa..c214d96768d69 100644 --- a/Documentation/devicetree/bindings/media/apple,t8140-ave.yaml +++ b/Documentation/devicetree/bindings/media/apple,t8140-ave.yaml @@ -120,6 +120,24 @@ allOf: - description: Preloaded firmware text - description: Preloaded firmware data + aurora,ave-text-crc32: + $ref: /schemas/types.yaml#/definitions/string + pattern: '^[0-9a-fA-F]{1,8}$' + description: | + Hexadecimal CRC32 of this encoder's preloaded firmware text region, + injected by the bootloader at boot. When absent, the driver falls + back to /chosen/aurora,ave-text-crc32 for compatibility with older + bootloaders; if present, it takes precedence and must be valid. + + aurora,ave-data-crc32: + $ref: /schemas/types.yaml#/definitions/string + pattern: '^[0-9a-fA-F]{1,8}$' + description: | + Hexadecimal CRC32 of this encoder's clean preloaded firmware data + region, injected by the bootloader at boot. When absent, the driver + falls back to /chosen/aurora,ave-data-crc32 for compatibility with + older bootloaders; if present, it takes precedence and must be valid. + required: - compatible - reg @@ -167,3 +185,36 @@ allOf: additionalProperties: false unevaluatedProperties: false + +examples: + - | + #include + #include + + soc { + #address-cells = <2>; + #size-cells = <2>; + + video-codec@285100000 { + compatible = "apple,t6041-ave"; + reg = <0x2 0x85100000 0x0 0x45c000>, + <0x2 0x85050000 0x0 0x4000>, + <0x2 0x85800000 0x0 0x800000>; + reg-names = "codec", "mailbox", "coproc"; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + ; + power-domains = <&ps_venc1_dma>, <&ps_venc1_pipe4>, + <&ps_venc1_pipe5>, <&ps_venc1_me0>, + <&ps_venc1_me1>, <&pmc_soc_max>; + power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1", "perf"; + iommus = <&ave1_dart0 0>, <&ave1_dart0 12>, + <&ave1_dart1 0>, <&ave1_dart1 12>; + memory-region = <&ave1_fw_text>, <&ave1_fw_data>; + aurora,ave-text-crc32 = "9a080cad"; + aurora,ave-data-crc32 = "6e66c376"; + }; + };