Skip to content

iPhone 5s (N51): touchscreen and Wi-Fi - #151

Merged
henrikklee merged 10 commits into
OrchardLinux:mainfrom
ashtonamory:n51-touch-wifi
Dec 4, 2026
Merged

henrikklee merged 10 commits into
OrchardLinux:mainfrom
ashtonamory:n51-touch-wifi

Conversation

@ashtonamory

Copy link
Copy Markdown

iPhone 5s (N51): touchscreen and Wi-Fi

Brings up the touchscreen and Wi-Fi on the iPhone 5s (S5L8960X). Both are verified on an N51 running installed Omarchy A 0.4.8. The orchard side (device data, firmware recipes, docs) follows in OrchardLinux/orchard and needs this merged first.

Touchscreen (5 commits)

  • regulator: apple-pmic-touch: the touch core LDO on the D2045 ("Amber") PMU. It is register 0x85, bit 1, taken from the iOS AppleD2045PMU::_setLDO table (the ADT's pmuL 0x20e, LDO 14). Binding in its own patch.
  • Input: apple_z2: apple,n51-touchscreen takes the N61 Gen1 variant (the iOS personality is C1F57,3, "AppleMultitouchSPI - C1,N51"), with a 1000 µs CS delay. Binding in its own patch.
  • arm64: dts: s5l8960x-5s: the touchscreen on SPI1 (IRQ GPIO 22, reset GPIO 23), with the analog supply on the Chestnut display PMU and the core supply on the D2045. The touchscreen0 alias lets m1n1 copy the calibration from the ADT.

Wi-Fi (4 commits)

  • usb: host: apple-a7-wlan: the PMU reset line, the boot ROM chip ID and the USB PID now come from the device tree (apple,pmu-reset, apple,rom-chip, apple,usb-pid). The A7 iPads keep their old values as defaults, so their DTs don't change. On the 5s the BCM43342 reset is GPIO 10 of the D2045 (register 0x40a, the same 0x400 | n layout iOS uses for the D2089), and its boot ROM is 0a5c:bd21, chip 0xa94e.
  • wifi: brcmfmac: usb: a table of the HSIC boot ROMs (chip, firmware name, RAM bound) instead of assuming the BCM43241, plus the BCM43342 (brcmfmac43342-<board>-usb).
  • arm64: dts: s5l8960x-5s: the radio on EHCI1 port 1. HOST_READY is GPIO 166 and DEVICE_READY is GPIO 167, both from the N51 ADT.

Testing

  • Built with orchard build hardware-check --device n51 --kernel <this branch>.
  • RAM boot: multi-touch across the whole panel in the right orientation. Firmware 6.46.79 starts, and a scan finds 2.4 and 5 GHz networks.
  • Installed Omarchy A 0.4.8 on N51: touch works on the desktop, and Wi-Fi connects through NetworkManager.
  • checkpatch is clean apart from two things. The attribution trailers get warnings. The touched hunks in apple-a7-wlan.c and the HSIC code in brcmfmac usb.c get space-indent warnings because they keep the files' existing indentation.
  • Not tested: N53 (iPhone 5s Global). It gets the same touch DT through the shared dtsi but has a different Wi-Fi module (cabernet), and this series leaves that out.

The iPhone 5s's Amber (D2045) PMIC switches the touchscreen's core
supply. Add its compatible.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
The iPhone 5s's ADT gives the multi-touch node function-power_ldo =
pmuL(0x20e), LDO index 14 on the D2045. In iOS 12.5.8 (16H88),
AppleD2045PMU::_setLDO indexes a table of 12-byte entries; entry 14 is
an enable-only switch at register 0x85 bit 1, set by read/modify/write.

Tested on an iPhone 5s (N51): the touchscreen powers up and boots.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
The iPhone 5s touchscreen takes the iPhone 6's properties: analog and
core supplies, the touch clock and the loader's calibration.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
The iPhone 5s (N51 and N53) runs the iPhone 6's generation-1 protocol.
Its iOS 12.5.8 personality "C1,N51" (C1F57,3) is AppleMultitouchN1SPI
with the N61's calibration download (0x10009000) and proximity
(0x10009600) addresses, fll-mval 6099, ref-clk-div 2, clk32 enable and
execute address 0x10003400. Reuse the N61 variant and its SPI timings.

Tested on an iPhone 5s (N51): multi-touch reports cover the panel in the
right orientation.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
Describe the N1 on SPI1 from the N51 ADT (/arm-io/spi1/multi-touch):
attention GPIO 22, reset GPIO 23, the PWM touch clock, the analog
supply on the Chestnut display PMU (dpLE(0x302)) and the core supply on
the D2045 (pmuL(0x20e)). N51 and N53 share their kernelcache, whose
only 5s touch personality matches multi-touch,n51, and identical
mtprops, so the node goes in the shared 5s dtsi.

Tested on an iPhone 5s (N51).

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
…dio identity

The iPhone 5s puts its HSIC radio's reset on another PMIC and line than
the A7 iPads, and its boot ROM is another chip with another USB product
ID. Add apple,pmu-reset, apple,rom-chip and apple,usb-pid; without them
the iPads' values apply.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
…device tree

The reset was GPIO 3 of the D2089 at I2C 0x3c and the boot ROM 0a5c:bd1c
reporting chip 0x4324, as on every A7 iPad. The iPhone 5s resets its
BCM43342 with GPIO 10 of the D2045 at 0x74, and its ROM is 0a5c:bd21,
chip 0xa94e. Read apple,pmu-reset, apple,rom-chip and apple,usb-pid,
keeping the iPads' values as defaults. iOS's D2045 and D2089 drivers both
configure PMU GPIO n at register 0x400 | n (n <= 15); the 5s reset reads
the same 0x09 baseline, so the measured 09/0b/09 sequence and its gates
are unchanged.

Tested on an iPhone 5s (N51): the radio enumerates and its ROM reports
a94e rev 1, 0x80000 bytes at 0x60000000.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
Look the HSIC radio up in a table of boot ROM chip IDs, firmware names
and RAM bounds instead of assuming the BCM43241, add the BCM43342
(0a5c:bd21, ROM chip 43342) and name its firmware
brcmfmac43342-<board>-usb.

Tested on an iPhone 5s (N51): firmware 6.46.79 starts and a scan finds
2.4 and 5 GHz networks.

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
The N51 ADT puts the BCM43342 (module chardonnay, wifi-chipset 43342) on
EHCI1 port 1 with its HSIC PHY at usb-complex +0x60, HOST_READY on GPIO
166, DEVICE_READY on GPIO 167 and the reset on the D2045's GPIO 10.

Tested on an iPhone 5s (N51).

Assisted-by: LLM
Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com>
Resolve the apple,z2-multitouch binding next to the D79 touchscreen.

Assisted-by: LLM
Signed-off-by: Henrik Klee <henrik@goat-code.com>
@henrikklee
henrikklee merged commit 974c8eb into OrchardLinux:main Dec 4, 2026
4 checks passed
@henrikklee

Copy link
Copy Markdown

Thank you, Ashton, this is a great first contribution: careful work straight from the iOS drivers and the ADT, in clean upstream-style commits.

Merged. What it brings:

  • iPhone 5s (N51): the touchscreen and Wi-Fi.
  • iPhone 5s Global (N53): the touchscreen too, through the shared 5s dtsi. Its Wi-Fi node is already shared as well: the N53 ADT has the same BCM43342 with the same pins and reset, only the module differs (cabernet instead of chardonnay). What it still needs is its firmware; we've added that recipe to iPhone 5s (N51): touchscreen and Wi-Fi orchard#544.

Changed on your branch: one merge of current main, to resolve the touchscreen binding next to the newly merged D79 entry. Your commits are unchanged. Nothing was left out.

Next: orchard takes this kernel and lands #544 with the device data (N51 touch, Wi-Fi and storage working; N53 touch and Wi-Fi untested).

One request: please use your real name in the sign-offs (Signed-off-by: Your Name <you@example.org>, see CONTRIBUTING, Sign-off). Upstream takes no change without it. Post the exact line as a comment here and that's enough.

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.

2 participants