From 24e2dad49c8796690596d601998153ed6aa49410 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 14 Nov 2026 13:30:42 +0700 Subject: [PATCH 1/4] dt-bindings: media: apple,jpeg: Add apple,t8142-jpeg The M5 (T8142) has two JPEG engines that the driver programs as on T6050. Take the T8142 compatible beside T8132's and T6050's, with the same register and interrupt layout. Assisted-by: Claude Opus 5.5 Signed-off-by: Nick --- Documentation/devicetree/bindings/media/apple,jpeg.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/media/apple,jpeg.yaml b/Documentation/devicetree/bindings/media/apple,jpeg.yaml index 7571f1969c42c..00aa5c9429ad4 100644 --- a/Documentation/devicetree/bindings/media/apple,jpeg.yaml +++ b/Documentation/devicetree/bindings/media/apple,jpeg.yaml @@ -39,6 +39,7 @@ select: - apple,t8132-jpeg - apple,t6050-jpeg - apple,t8140-jpeg + - apple,t8142-jpeg required: - compatible @@ -57,6 +58,7 @@ allOf: enum: - apple,t8132-jpeg - apple,t6050-jpeg + - apple,t8142-jpeg required: - compatible then: @@ -66,6 +68,7 @@ allOf: - enum: - apple,t8132-jpeg - apple,t6050-jpeg + - apple,t8142-jpeg - const: apple,jpeg reg: From 74213b07384275a500d948e8575c746cd5ddfcab Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 14 Nov 2026 13:30:42 +0700 Subject: [PATCH 2/4] media: apple: jpeg: Support the T8142 (M5) engines, programmed as on T6050 The T8142 ADT describes jpeg0 and jpeg1 as "jpeg,t8101" with hw-type 0x110010, the HWREV a J815 reads back. Traced under aura's hypervisor on a J815 running macOS 27.2.1 (26B131), VideoToolbox JPEG encodes and hardware decodes: AppleJPEGDriver writes T6050's 124-write reset image unchanged, the same twelve DMA identifiers, and T6050's encode job: CODEC and PX_MODE 3, tiles 2/16 and 2/8, ENC_CTRL 0x35, the addresses low words first, prefetch, PRE_ENCODE 0, MODE 0x74f, IO flags 0xb2, 16-bit quantiser tables, Huffman 0x550 and QTBL_SEL 0x14. (It also fills tables 2 and 3, which QTBL_SEL never selects.) So apple,t8142-jpeg takes T6050's data, as T8132 takes T6041's. Tested on a J815 (7.3.0, integration/aurora): NV12 to JPEG on both engines at 1280x720 and 1920x1080, 30 frames each, decoded by ffmpeg: worst luma PSNR 42.6 dB, interrupts rising on each run; the driver's KUnit suite passes (14/14). Assisted-by: Claude Opus 5.5 Signed-off-by: Nick --- Documentation/admin-guide/media/apple-jpeg.rst | 5 ++++- drivers/media/platform/apple/jpeg/apple-jpeg-drv.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/media/apple-jpeg.rst b/Documentation/admin-guide/media/apple-jpeg.rst index bdcdb8d34ab55..8a475cf7879d6 100644 --- a/Documentation/admin-guide/media/apple-jpeg.rst +++ b/Documentation/admin-guide/media/apple-jpeg.rst @@ -24,12 +24,15 @@ apple,t8112-jpeg wide64 0x0e0008 apple,t8122-jpeg wide64 0x0f0008 apple,t8132-jpeg wide64 0x100008 apple,t8140-jpeg wide64 0x110000 +apple,t8142-jpeg wide64 0x110010 =================== ========= ======================== On the wide64 engines the HWREV readback equals the hardware description's ``hw-type`` with the stepping nibble masked (read back on T8112 and T6041), so the T8122 and T8132 rows use their ``hw-type``. T8132 has the T6041 -identity and shares its data. The T8103 engines report the legacy selector +identity and shares its data. T8142 (read back on a J815) has the T6050 +identity and shares its data: macOS 27.2.1 programs its engines with T6050's +reset image and job sequence, write for write. The T8103 engines report the legacy selector 0x0a0103 there, which is not a HWREV, so T8103 has no row yet. Identification powers the domain, writes MODE=0x147 and reads the selected diff --git a/drivers/media/platform/apple/jpeg/apple-jpeg-drv.c b/drivers/media/platform/apple/jpeg/apple-jpeg-drv.c index 837d3d044d326..2a1b2b636241e 100644 --- a/drivers/media/platform/apple/jpeg/apple-jpeg-drv.c +++ b/drivers/media/platform/apple/jpeg/apple-jpeg-drv.c @@ -889,6 +889,8 @@ static const struct of_device_id aj_of_match[] = { { .compatible = "apple,t6041-jpeg", .data = &apple_jpeg_t6041 }, { .compatible = "apple,t8132-jpeg", .data = &apple_jpeg_t6041 }, { .compatible = "apple,t6050-jpeg", .data = &apple_jpeg_t6050 }, + /* T6050's revision, reset image and job programming (traced on a J815). */ + { .compatible = "apple,t8142-jpeg", .data = &apple_jpeg_t6050 }, { .compatible = "apple,t8140-jpeg", .data = &apple_jpeg_t8140 }, { } }; From c7611d3156203d1b51e393177f7e3c15969d7047 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 14 Nov 2026 13:30:43 +0700 Subject: [PATCH 3/4] arm64: dts: apple: t8142: Add the JPEG engines jpeg0 (0x301000000, IRQ 1156) and jpeg1 (0x301060000, IRQ 1159) share dart-jpeg as SIDs 0 and 1 (vm-base 0x100_0000_0000). Their power gates JPG0-V/JPG1-V are virtual PMGR entries under JPG (pmgr device 64, +0x2a0). Describe the JPG power state, the DART's power domain and range, and both engines, disabled. Assisted-by: Claude Opus 5.5 Signed-off-by: Nick --- .../boot/dts/apple/t8142-peripherals.dtsi | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8142-peripherals.dtsi b/arch/arm64/boot/dts/apple/t8142-peripherals.dtsi index caf5902393d51..949f6da167a89 100644 --- a/arch/arm64/boot/dts/apple/t8142-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t8142-peripherals.dtsi @@ -226,11 +226,37 @@ status = "disabled"; }; + /* ADT dart-jpeg: one DART for both engines, jpeg0 on SID 0, jpeg1 on SID 1. */ jpeg_dart: iommu@301020000 { compatible = "apple,t8142-dart", "apple,t8110-dart"; reg = <0x3 0x1020000 0x0 0xc000>; interrupts = ; #iommu-cells = <1>; + /* ADT vm-base 0x100_0000_0000, vm-size 0x300_0000_0000 */ + apple,dma-range = <0x100 0x0 0x300 0x0>; + power-domains = <&ps_jpg>; + status = "disabled"; + }; + + /* + * ADT jpeg0/jpeg1 ("jpeg,t8101", hw-type 0x110010). Their power-gates + * JPG0-V/JPG1-V are virtual PMGR entries under JPG. + */ + jpeg0: jpeg@301000000 { + compatible = "apple,t8142-jpeg", "apple,jpeg"; + reg = <0x3 0x1000000 0x0 0x4000>; + interrupts = ; + iommus = <&jpeg_dart 0>; + power-domains = <&ps_jpg>; + status = "disabled"; + }; + + jpeg1: jpeg@301060000 { + compatible = "apple,t8142-jpeg", "apple,jpeg"; + reg = <0x3 0x1060000 0x0 0x4000>; + interrupts = ; + iommus = <&jpeg_dart 1>; + power-domains = <&ps_jpg>; status = "disabled"; }; @@ -529,6 +555,16 @@ }; &pmgr { + /* ADT pmgr device JPG (id 64), parent AFISOCNI1 (no power state). */ + ps_jpg: power-controller@2a0 { + compatible = "apple,t8142-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x2a0 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "jpg"; + status = "disabled"; + }; + /* ADT pmgr device ANE_SYS (id 73), parent AFISOCNI3 (no power state). */ ps_ane_sys: power-controller@2e8 { compatible = "apple,t8142-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; From c3c1417eadb1c6d7535e7e349cc3b1da817bd62b Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 14 Nov 2026 13:30:43 +0700 Subject: [PATCH 4/4] arm64: dts: apple: t8142-j815: Enable the JPEG engines Assisted-by: Claude Opus 5.5 Signed-off-by: Nick --- arch/arm64/boot/dts/apple/t8142-j815.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8142-j815.dts b/arch/arm64/boot/dts/apple/t8142-j815.dts index a11d808ff22a0..3f4171f4c955f 100644 --- a/arch/arm64/boot/dts/apple/t8142-j815.dts +++ b/arch/arm64/boot/dts/apple/t8142-j815.dts @@ -204,3 +204,20 @@ &ane { status = "okay"; }; + +/* Both JPEG engines and their DART. */ +&ps_jpg { + status = "okay"; +}; + +&jpeg_dart { + status = "okay"; +}; + +&jpeg0 { + status = "okay"; +}; + +&jpeg1 { + status = "okay"; +};