diff --git a/devices/d11/firmware.json b/devices/d11/firmware.json index 40784c2a..30c1d374 100644 --- a/devices/d11/firmware.json +++ b/devices/d11/firmware.json @@ -116,6 +116,12 @@ } }, "sha256": "5c0822a78a10191b56edd468f100b331b0e86bcafa3fdcc5d974dadc427dbec9" + }, + "adc-hephaestus.bin.gz": { + "ipsw": { + "rootfs": "System/Library/PrivateFrameworks/H9ISPServices.framework/adc-hephaestus.bin.gz" + }, + "sha256": "4c7daf55b545a59a9f1d6ce3b226cfc7b76e08793cd20745e686e7b30d237fc3" } }, "outputs": [ @@ -298,6 +304,16 @@ "coprocessor": "AOP_ext" } ] + }, + { + "destination": "lib/firmware/apple/isp-t8010.bin", + "sha256": "91c02c29d866626d3630dbbbba65c3b1bfce4130aa9da5715eaf8a59a57b07bc", + "steps": [ + { + "step": "gunzip@1", + "input": "adc-hephaestus.bin.gz" + } + ] } ] } diff --git a/devices/d111/firmware.json b/devices/d111/firmware.json index 0dc1116f..9c5fa5df 100644 --- a/devices/d111/firmware.json +++ b/devices/d111/firmware.json @@ -116,6 +116,12 @@ } }, "sha256": "5c0822a78a10191b56edd468f100b331b0e86bcafa3fdcc5d974dadc427dbec9" + }, + "adc-hephaestus.bin.gz": { + "ipsw": { + "rootfs": "System/Library/PrivateFrameworks/H9ISPServices.framework/adc-hephaestus.bin.gz" + }, + "sha256": "4c7daf55b545a59a9f1d6ce3b226cfc7b76e08793cd20745e686e7b30d237fc3" } }, "outputs": [ @@ -298,6 +304,16 @@ "coprocessor": "AOP_ext" } ] + }, + { + "destination": "lib/firmware/apple/isp-t8010.bin", + "sha256": "91c02c29d866626d3630dbbbba65c3b1bfce4130aa9da5715eaf8a59a57b07bc", + "steps": [ + { + "step": "gunzip@1", + "input": "adc-hephaestus.bin.gz" + } + ] } ] } diff --git a/docs/bring-up/d111-camera.md b/docs/bring-up/d111-camera.md new file mode 100644 index 00000000..1e3b3c80 --- /dev/null +++ b/docs/bring-up/d111-camera.md @@ -0,0 +1,212 @@ +# iPhone 7 Plus (D111) cameras + +The A10's camera ISP ("H9") and what the iPhone 7 Plus needs to use it. +Measurements below are from the 15.8.8 (19H422) IPSW and the `d111` ADT, read +on 2026-12-03; anything not measured says so. + +## State + +- **Kernel:** OrchardLinux/linux#157 (merged 2026-12-05) adds the + telephoto to the A10 ISP driver + (`drivers/media/platform/apple/isp/t8010_isp.c`, from linux#86) and the + cameras to every iPhone 7 and 7 Plus device tree. The driver's cameras + are a per-SoC table: on the A10 rear (channel 0), telephoto (channel 1) + and front (channel 2); on the A9 rear and front (channel 1). The + telephoto is registered on boards whose `&isp` has + `tele-shutdown-gpios`, so the 7 Plus gets three video nodes and the + iPhone 7 keeps two. For bring-up the driver also exposes debugfs + `t8010-isp/` (`power`, `boot`, `cmd`, `queue`, `frame`, `regs`, `pins`, + `meta`). +- **Device tree:** `t8010-7.dtsi` holds the camera block for all four + boards (`d10`, `d101`, `d11`, `d111`): the four rails, the rear and front + shutdown lines, the flash supply and the firmware name. Each board adds + only its camera platform (`0x90` on the iPhone 7, `0x91` on the 7 Plus) + and, on the 7 Plus, the telephoto's shutdown line (GPIO 69). `t8010.dtsi` + muxes all three reference-clock pads (66, 70, 72) for every iPhone 7 and + 7 Plus. +- **Boards:** `d111` was tested (below). `d11` (the Qualcomm 7 Plus) has the + same ADT values in the 19H422 `d11ap` device tree (sensor-type `0x91`, + shutdown lines 65, 69, 43, reference clocks 66, 70, 72, torch 176) and gets + the same description; it is untested. +- **Firmware:** `lib/firmware/apple/isp-t8010.bin` is `adc-hephaestus.bin.gz` + from `H9ISPServices.framework`, gunzipped (sha256 `4c7daf55…d237fc3`, + 4,575,240 bytes gunzipped, release 17.56.00). Orchard's recipes install it + for `d10` and `d101` (orchard#429), and for `d111` and `d11` from their + shared 19H422 IPSW (orchard#548). +- **Orchard:** orchard builds the kernel commit its lock names + (`kernel/upstream.lock`); the cameras reach users once a take step moves + the lock past linux#157. The catalog's `camera = "missing"` for `d11` and + `d111` moves with it. + +## What the board says + +ADT `arm-io` addresses omit the `0x2_00000000` base the Linux tree uses +(`aic` `0x0e100000` ↔ `0x20e100000`), so the ISP is `0x205b00000`. + +| ADT | d111 | d10 | Linux tree | +|---|---|---|---| +| `arm-io/isp` `sensor-type` | `0x91` | `0x90` | `apple,platform-id` | +| `function-sensor_shutdown` | GPIO 65 | GPIO 65 | `rear-shutdown-gpios` | +| `function-sensor_shutdown2` | GPIO 69 | GPIO 69 | `tele-shutdown-gpios` | +| `function-sensor_shutdown3` | GPIO 43 | GPIO 43 | `front-shutdown-gpios` | +| `function-torch_enable` | GPIO 176 | GPIO 176 | `strobe-gpios` | +| `arm-io/isp` `reg` | `0x205b00000` + `0x140000` | same | `isp`, `isp-hi` | +| `arm-io/dart-isp` | `0x205b28000` (dart), `0x205b2c000` (smmu) | same | `dart_isp` | +| interrupts | ISP 108-111, DART 112 | same | `t8010.dtsi` | + +`apple,platform-id` is not decoration: the driver passes it to the firmware as +the seventh boot argument (`args[6]`), and the firmware selects the sensor and +platform configuration from it. `d10`'s DTS uses `0x90`, which is exactly its +ADT `sensor-type`; `d111`'s is `0x91`. + +The shared `&isp` node carries the window, the DART, ten PMGR domains, +`iommu` streams 0-3 and the three pinctrl states (`GPIO`, function 1 and +function 2 for the reference-clock pads). What the boards add, as `t8010-d10.dts` had +it before linux#157 moved it into `t8010-7.dtsi`: + +```dts +&isp { + cam-avdd-supply = <&cam_avdd>; + cam-avdd2-supply = <&cam_avdd2>; + cam-avdd3-supply = <&cam_avdd3>; + cam0-supply = <&cam0>; + rear-shutdown-gpios = <&pinctrl_ap 65 GPIO_ACTIVE_HIGH>; + front-shutdown-gpios = <&pinctrl_ap 43 GPIO_ACTIVE_HIGH>; + strobe-gpios = <&pinctrl_ap 176 GPIO_ACTIVE_HIGH>; + apple,platform-id = <0x90>; + firmware-name = "apple/isp-t8010.bin"; + status = "okay"; +}; +``` + +For `d111` the same block with `apple,platform-id = <0x91>` and a +`tele-shutdown-gpios = <&pinctrl_ap 69 GPIO_ACTIVE_HIGH>` line. The driver +takes it, brings the telephoto out of shutdown with the other sensors, and +registers the telephoto camera because the line is there. + +## The camera itself + +`d111`'s rear is the same 12 MP class as `d10`'s and its front the same 7 MP, +so the driver's hardcoded mode tables fit; the firmware, not the driver, +finds the sensors and runs their exposure, white balance and focus. The third +sensor, the 12 MP telephoto, is covered in the next section. + +The camera tuning files (`apple/isp-t8010-set-.bin`) are optional; without +them the firmware runs its default tuning and the driver says so once. + +## The telephoto + +The third camera is firmware channel 1 (rear 0, front 2), and the driver +registers it as `video1` for a board whose `&isp` has `tele-shutdown-gpios`; +`d10`/`d101` keep two nodes, so nothing changes for them. It gets the rear +mode table (same 12 MP class) and autofocus, no torch. + +With the block above and no other change, the firmware reported +`channel 1: present 0x0, sensor 0x0` and logged `No sensor found on channel 1 !`: +the telephoto had no reference clock. The shared `t8010.dtsi` muxed only +GPIO 66 (rear) and 72 (front) for the ISP's `extclk` pads, but every iPhone 7 +and 7 Plus ADT lists three (`function-sensor_extclk`, `...2`, `...3` = GPIO 66, +70, 72). Adding pin 70 to the three `isp_refclk_*` states made the sensor +appear: `channel 1: present 0x9, sensor 0x313`. + +All three stream on `d111`: rear `video0`, telephoto `video1`, front `video2`. + +## Result (2026-12-03) + +Built with the block above and `isp-t8010.bin` in the payload, and booted in +RAM on the iPhone 7 Plus (checkm8/palera1n route): + +``` +t8010-isp 205b00000.isp: no apple/isp-t8010-set-5111.bin, default tuning +``` + +The driver as merged in linux#157 names each camera's node at probe, one line +each: + +``` +t8010-isp 205b00000.isp: 10 power domains, platform 0x91; debugfs t8010-isp/ +t8010-isp 205b00000.isp: rear camera: video0 +t8010-isp 205b00000.isp: tele camera: video1 +t8010-isp 205b00000.isp: front camera: video2 +``` + +Debugfs `power` then `boot` both return 0, and `regs` shows: + +``` +powered 1 booted 1 window 0x00000000f0000000 + 192 MB, pins function 1 +refclk 81000016 81000016 81000016 +version 00060020 cpu 00000030 base f0000000 irq pending 00000000 enable 0000000f +gpio 00000000 0000af40 00000100 00000000 00000000 00000000 00000000 08042006 +TERMINAL type 2 src 0 slots 512 at 0x600700 cursor 43 +IO type 0 src 1 slots 8 at 0x608700 cursor 6 +DEBUG type 0 src 1 slots 8 at 0x608900 cursor 0 +BUF_H2T type 0 src 2 slots 64 at 0x608b00 cursor 0 +BUF_T2H type 1 src 3 slots 64 at 0x609b00 cursor 0 +SHAREDMALLOC type 1 src 3 slots 8 at 0x60ab00 cursor 7 +IO_T2H type 1 src 3 slots 8 at 0x60ad00 cursor 0 +``` + +`ISP_VERSION` is `0x00060020` (version 6, the A10's) and the firmware built +its channel table: the H9 ISP accepts platform ID 0x91 and runs with no +tuning set-file. + +Both cameras streamed NV12 through V4L2, thirty frames each: + +| Node | Format | Y plane (last frame) | +|---|---|---| +| `/dev/video0` (rear) | 1920x1080 | min 1, max 237, mean 105, every pixel nonzero | +| `/dev/video0` (rear) | 4032x3024 (18,289,152-byte frames) | min 0, max 195, mean 93 | +| `/dev/video1` (telephoto) | 1920x1080 | min 13, max 190, mean 99, every pixel nonzero | +| `/dev/video1` (telephoto) | 4032x3024 | min 30, max 161, mean 112, every pixel nonzero | +| `/dev/video2` (front) | 1920x1080 | min 6, max 255, mean 101, every pixel nonzero | + +The channel probe at boot, with dynamic debug on: + +``` +channel 0: present 0x9, sensor 0x303 (rear) +channel 1: present 0x9, sensor 0x313 (telephoto) +channel 2: present 0x5, sensor 0x314 (front) +``` + +The same three cameras come up in an **installed Omarchy A** built from these +patches (`orchard build --kernel DIR`, then `orchard install`): the kernel +layer carries the patched DTB, the install adds `isp-t8010.bin`, udev loads +`t8010_isp` by itself, and the desktop sees the cameras. Rear and telephoto +streamed there too (`/dev/video0` mean 103, `/dev/video1` mean 104), and +PipeWire lists them as video devices with "Rear camera" as a source. + +The first frame after `STREAMON` can be black while the firmware's AE settles; +a capture that takes a dozen frames gets a normal picture. Nothing was +written to the phone's installed system: the kernel came from a local tree +(`orchard build --device d111 --kernel …`) booted in RAM, and the test +payload carried the firmware in its initramfs. + +## Reproducing it + +1. An `OrchardLinux/linux` tree with linux#157 (the `main` branch). +2. `devices/d111/firmware.json` (or `d11`'s) installs `isp-t8010.bin`. +3. `orchard build --device d111 --kernel DIR`, boot it in RAM, load + `t8010_isp.ko` with `mc`/`videodev`/`videobuf2-*`, and look for + `platform 0x91` and the rear, tele and front camera lines in `dmesg`. +4. `echo 1 > /sys/kernel/debug/t8010-isp/power` then `boot`, and capture from + `/dev/video0`, `/dev/video1` (tele) or `/dev/video2` (front). + +## Open questions + +- The telephoto uses the rear camera's mode table and it works for the sizes + tried (1920x1080 and 4032x3024), so its sensor presets line up with the + rear's at least there. Whether it has its own set of modes (for example a + 2x-crop still mode) is not known. +- The driver's own frame table (`isp_rear_modes`/`isp_front_modes`) was + written from `d10`/`d101`; nothing ties it to the telephoto's sensor beyond + this test. +- The camera tuning set-files (`apple/isp-t8010-set-.bin`) are still not + installed by any recipe; the firmware runs its defaults. + +## Firmware details + +`adc-hephaestus.bin.gz` gunzips to a 4.5 MB "FFW Application" ARM64 image +(version 17.56.00, Sep 2020) that the ISP runs from DRAM at relative address 0 +behind its DART. The framework also carries `adc-dionysus.bin.gz` and +`adc-thaos.bin.gz`; `hephaestus` is the one iOS gives the iPhone 7 family +(orchard#429).