Skip to content

media: apple: isp, arm64: dts: support 8-AMCC T6041 and NV12 LIM_RANGE - #2216

Merged
DjDeveloperr merged 3 commits into
aurora-silicon:integration/aurorafrom
astaff:t6041/j616c-isp-camera
Nov 19, 2026
Merged

DjDeveloperr merged 3 commits into
aurora-silicon:integration/aurorafrom
astaff:t6041/j616c-isp-camera

Conversation

@astaff

@astaff astaff commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge order: Please merge after #1954.

This branch starts from integration/aurora and merges cleanly on top of #1954 with zero conflicts.

Companion PRs:

Summary

This series enables apple-isp camera streaming on 8-AMCC T6041 (J616c, MacBook Pro 16" M4 Max), fixes NV12 quantization metadata, and exposes the detected camera sensor module name in sysfs:

  1. media: apple: isp, arm64: dts: support 8-AMCC T6041 and NV12 LIM_RANGE (4749bc96f242):
    • Add AMCC 6 (0x22c004000..0x22c1d62fc) and AMCC 7 (0x22e004000..0x22e1d62fc) filter ranges to &isp_dart0 in t6041.dtsi.
    • Add apple_isp_hw_t6041: count active AMCC ranges on isp_dart0 and size fw_mmio and DSID broadcast-clear windows to match, supporting both 6-AMCC binned and 8-AMCC full-die T6041 chips across >5 s runtime power-off and reopen cycles.
    • Set V4L2_QUANTIZATION_LIM_RANGE on NV12 in isp-v4l2.c to match P010, and update isp-v4l2-test.c.
  2. media: apple: isp: expose detected camera sensor name in sysfs (b4018aeb078d):
    • Expose a read-only sensor attribute on the apple-isp platform device (/sys/class/video4linux/videoX/device/sensor, documented in Documentation/ABI/testing/sysfs-driver-apple-isp) backed by canonical sensor module names in isp_setfiles[] (such as "imx958-uw" and "imx558").
    • Return -ENODATA prior to deferred camera startup so userspace (aurora-silicon/camera-denoise#14) can key low-light thresholds and framing capabilities on sensor identity rather than board lists.

Testing

  • ./scripts/checkpatch.pl --strict reports 0 errors, 0 warnings, 0 checks.
  • tools/asahi/run-host-tests.py --only isp-: 18 / 18 suites passed (including isp_test_sensor_names and isp_test_sensor_sysfs).
  • Hardware testing on J616c (M4 Max, 8 AMCCs) verifies NV12 and P010 capture at 1920x1080@30, runtime power-down and reopen (>6 s idle), and zero DART faults.

Still to do

  1. Have aurora-installer extract the sensor tuning file (apple/isp_2224_01XX.dat from /usr/libexec/appleh16camerad) into /lib/firmware/apple/ on first boot.

@astaff

astaff commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Added a second commit (b4018aeb078d, media: apple: isp: expose detected camera sensor name in sysfs) exposing a read-only sensor attribute on the apple-isp platform device (/sys/class/video4linux/videoX/device/sensor, documented in Documentation/ABI/testing/sysfs-driver-apple-isp, returning -ENODATA until deferred camera detection completes) so aurora-silicon/camera-denoise#14 can key camera profiles on [sensor:imx958-uw] rather than board lists.

astaff and others added 3 commits November 19, 2026 14:14
Enable camera support on full-die 8-AMCC T6041 parts (J616c) and fix NV12
quantization metadata:

- Add AMCC 6 (0x22c004000..0x22c1d62fc) and AMCC 7
  (0x22e004000..0x22e1d62fc) to &isp_dart0 in t6041.dtsi.
- Add apple_isp_hw_t6041 in isp-drv.c. The driver counts active AMCC ranges
  on isp_dart0 and sizes fw_mmio and DSID broadcast-clear windows to match.
  This supports 6-AMCC binned and 8-AMCC full-die T6041 chips across >5 s
  runtime power-off reopen cycles.
- Set V4L2_QUANTIZATION_LIM_RANGE on NV12 in isp-v4l2.c to match P010, and
  update isp-v4l2-test.c.

Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Expose a read-only 'sensor' sysfs attribute on the apple-isp platform
device (/sys/class/video4linux/videoX/device/sensor) backed by canonical
sensor module names in isp_setfiles[] (such as "imx958-uw" for the 12 MP
Center Stage ultra-wide IMX958 module and "imx558" for IMX558).

On hardware with deferred camera startup, sensor_show() returns -ENODATA
until the first stream detects the camera, then emits the detected sensor
identifier under video_lock so userspace services can select tuning and
framing capabilities by sensor property rather than per-board lists.

Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
apple,t6041-isp is the ISP of both T6040 (M4 Pro) and T6041 (M4 Max):
t604x.dtsi gives it that compatible for both. With the T6041 hardware
description, apple_isp_select_hw() fell back to six AMCCs unless
isp_dart0's apple,dapf-ranges listed six to eight. T6040's lists four,
so the J614s and J616s would map AMCC 4 and 5 windows and have the
firmware broadcast-clear two DSID windows the chip does not have.

Accept four to eight described AMCCs and keep four without a
description, as every apple,t6041-isp node used before. With four, the
mapped windows and the DSID clear request are those of the T6040
description it replaces.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Rebasing onto integration/aurora 6ae9c3c (no content change; the isp-drv.c conflict with #2229 keeps the T6041 tables and drops the static T8132 DAPF tables #2229 moved to the device tree). One extra commit on top, see the next comment.

@DjDeveloperr
DjDeveloperr force-pushed the t6041/j616c-isp-camera branch from b4018ae to 5f25058 Compare November 19, 2026 19:16
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Added 5f25058 (media: apple: isp: keep the T6040 ISP at its four AMCC windows). @astaff apple,t6041-isp is also the T6040 ISP (t604x.dtsi:1426 gives both chips that compatible), so the J614s/J616s now get apple_isp_hw_t6041. Their isp_dart0 apple,dapf-ranges (t6040.dtsi:659) lists four AMCC windows, so apple_isp_select_hw() fell back to six, and the M4 Pro would map AMCC 4/5 and have the firmware broadcast-clear two DSID windows it doesn't have. The fix accepts 4 to 8 described AMCCs and keeps 4 when none are described. With 4, the mapped windows and the H17 DSID clear request match the old apple_isp_hw_t6040 exactly (same window set, same first four bases, same 8 slots). J616c is unchanged: its tree lists 8, and aura#304 rewrites the list from the ADT on 6-AMCC parts. checkpatch --strict is clean on all three commits.

DjDeveloperr added a commit to astaff/camera-denoise that referenced this pull request Nov 19, 2026
[sensor:imx958-uw] replaced [apple,j616s], but the sensor key comes
from the apple-isp sysfs attribute that only kernels with
aurora-silicon/linux#2216 have, and those report it only once the
camera has been detected. Until then the J616s matched no section and
lost its low-light thresholds and framing capability.

Keep [apple,j616s] with the same values as the compatible fallback, and
test that the J616s without a sensor still gets it.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Review of 5f25058, from the angle of boards other than the J616c:

  1. NV12 LIM_RANGE (isp-v4l2.c:898) applies to every apple-isp, the Neo and M5 included. It changes only the reported colorimetry, not the pixels. For Rec.709 YCbCr, V4L2_QUANTIZATION_DEFAULT already means limited range, so PipeWire/GStreamer consumers and camera-denoise (full_range only for SPA_VIDEO_COLOR_RANGE_0_255) behave the same. The difference is that an S_FMT asking for full range no longer gets it echoed back. Fine by me; the Neo row will compare a capture.
  2. Binned T6041 with an older aura. t6041.dtsi now lists all eight AMCC windows on isp_dart0, and apple_isp_select_hw() trusts that count. A 6-AMCC M4 Max booted by an aura without J700: allow USB wake from s2idle (AIC wake IRQs, dwc3-apple wake IRQ + running xHC, VL122, mt7932 wakeup flag) #304 (the 26.6.2 path, or any loader that doesn't rewrite apple,dapf-ranges from the ADT) would map and DSID-clear AMCC 6/7, which that die doesn't have. Failing safe would mean listing the six windows every T6041 has and letting aura#304 add 6/7 from dapf-instance-0 on full-die parts. Your call. The 8-AMCC J616c is fine either way.
  3. The sensor attribute is on every apple-isp device (dev_groups), so the Neo (imx558) and the M5 report one too once their camera is detected. That's intended for camera-denoise#14. Note that this PR's CI runs only dt-checks and host-tests, so isp_test_sensor_names/isp_test_sensor_sysfs don't run in CI. The Neo lane's kernel build is the compile check for them.

The rebase onto 6ae9c3c kept #2229's DT-driven T8132 address filter: apple_isp_hw_t8132 still has dapf_from_dt, and the static T8132 tables are gone. All 50 setfile entries carry a sensor name after the rebase, and checkpatch --strict is clean on the three commits.

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor

Tested on a J616c with the 6-AMCC (binned) T6041, which complements your 8-AMCC result. It's a 14-core / 32-core-GPU M4 Max on 25G83.

  • This boot's ADT dart-isp0 dapf lists six AMCC windows (0x220004000..0x22a004000). The boot DTB's apple,dapf-ranges has the same six, so apple_isp_hw_t6041 picks amccs = 6. Before, it used the T6040 table with four DSIDs.
  • The driver is drivers/media/platform/apple/isp from this head (5f25058), on a 7.3 daily that otherwise predates it. I loaded it as a module (rmmod/modprobe, no reboot). run-host-tests.py --only isp- passes 18/18.
  • sensor reads imx958-uw, and NV12 reports Limited Range.
  • I captured 60 frames of 1080p NV12 with v4l2-ctl, left it idle for 8 s (all isp_* domains off-0), then captured 60 frames again. Both captures came through, with 0 DART or ISP faults.

I didn't test P010, other presets, or suspend-to-RAM with the camera open.

Disclosure: prepared with an AI tool; tested as described.

@DjDeveloperr
DjDeveloperr merged commit a26b265 into aurora-silicon:integration/aurora Nov 19, 2026
2 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Merged as a26b265 under the same runner-outage rule as #1954. ISP host tests are identical to the base and all pass; the M5 test kernel ran this exact head. MacBook Neo (J700) A/B with the whole J616c set: no regression (work: display, G17P dEQP smoke, ANE, AOP, camera stream/runtime-PM/reopen, deep sleep). M5 Pro (J714s, T6050) A/B: PASS on every row. The NV12 change is metadata-only: V4L2 DEFAULT already maps to LIM_RANGE for Rec.709 Y'CbCr, and the frame data is unchanged on Neo and M5. The sensor attribute returns -ENODATA until first detection, as documented.

@RyanTheTide

Copy link
Copy Markdown
Contributor

M4 Pro (J616s, T6040) row on 5f25058: pass. The camera works at the four AMCC windows.

Booted with aura main + #373 + #265 + #304 as Stage 2.

  • /dev/video0 (apple-isp, sensor 0x958) streams 60 frames of 1920x1080 NV12 in 2.469 s. The production kernel takes 2.474 s on the same machine.
  • device/sensor reads imx958-uw before the first stream and still after it.
  • NV12 now reports Quantization: Limited Range. Production reports Default (maps to Limited Range).
  • 0 ISP errors, 0 DART faults. Enforcing, 0 failed units, 0 AVC, s2idle 2/2. AVE encodes are byte-identical to production.

Frames went to /dev/null and none were kept.

  • ANE: the only ANE lines carrying the word "error" are H16 CE state/error <state> 0 status lines. The error field is 0 on every boot. Production fleet75 prints the same two extra lines after two s2idle cycles.
Rows on every test boot
boot Stage 2 kernel result
production aura b10 fleet75 baseline
A main 8fb038f + aura#373 0e35033e + aura#265 230c9f34 fleet75 pass
control main 8fb038f fleet75 pass
B production b10 linux#1954 d3a9ec7 pass
C A + aura#304 22f12251 linux#2216 5f25058 pass
D A + aura#304 22f12251 linux#1954 d3a9ec7 pass

Each test boot: SELinux enforcing, 0 failed units, 0 AVC denials, 0 kernel lines at err level, s2idle 2/2 (rtcwake, Wi-Fi reconnects, gateway ping ok), 0 DART faults, NVMe/USB/Wi-Fi up, eDP connected with 6 modes, AVE H.264 and HEVC 120-frame encodes byte-identical to production, GL and Vulkan both report "Apple M4 Pro (G16S B1)", AOP RTKit up with 8 IIO devices, ANE bound. Aura ran as a one-shot ESP Stage 2 (Stage 1 unchanged); kernels were built from the exact PR heads with the fleet75 config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants