Skip to content

usb: Full charging current from a Mac on every board - #108

Merged
henrikklee merged 2 commits into
OrchardLinux:mainfrom
brkosebay:j71t/mac-current
Nov 12, 2026
Merged

henrikklee merged 2 commits into
OrchardLinux:mainfrom
brkosebay:j71t/mac-current

Conversation

@brkosebay

@brkosebay brkosebay commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Part 6 of 23 of the iPad 5 (J71t) series in this repository; merge after #106.

Problem

A Mac grants an iPad more than the standard USB current, but the charger took the gadget's reported budget unchecked and the composite gadget could draw the extra current while the bus was suspended.

Change

Cap and log the USB host budget in the TriStar charger, draw no extra Apple current while suspended, and let the initramfs and orchard USB helpers opt J71t into the Mac current profile. Documented in docs/bring-up/charging/j71t-mac-current.md, with tests.

Testing

  • Hardware: iPad 5 Wi-Fi (J71t). Hands-on testing on 2026-11-11 with an integrated build of this series, made before the final failure-path fixes, covered charging from a Mac.
  • 2026-11-12: after a USB host session, reconnecting the Mac brought back the 2400 mA Apple current grant (CDP 1.5 A).
  • Host: the Linux test suite passes at this branch's head, and the kernel and m1n1 patch series apply on apple-16k and apple-4k. At the top of the series the applied kernel tree is identical to the one in the built release image.
  • Other boards that share these drivers or compatibles have not been tested.

Dependencies

Depends on #106.

This branch is stacked on the PRs it depends on and carries their commits; the change of this PR is its last commit, "j71t: Guarded Mac current profile".

This update keeps the branch's earlier history: it merges the current base into the branch and adds the reworked change as a new commit on top.

🤖 Generated with Claude Code

@brkosebay
brkosebay marked this pull request as ready for review November 8, 2026 15:51
@brkosebay brkosebay changed the title J71t guarded Mac current profile j71t: Guarded Mac current profile Nov 12, 2026
brkosebay and others added 2 commits November 13, 2026 07:01
The Lightning charger took the current a USB host grants as reported;
it now caps it at the board's maximum. The gadget no longer draws an
Apple host's extra current while the bus is suspended. Both apply to
every board with this charger and gadget.

From orchard PR OrchardLinux#108 (commit 0674e1d), the two kernel patches.
macOS grants 2400 mA only to USB product IDs on its own list. Installed
Orchard systems now present Apple's vendor ID with product ID 0x1014
from that list, as an interface-association composite so macOS binds
its generic composite driver (which delivers the grant) beside the CDC
network and serial drivers. A Mac then charges the tablet at full
speed; the charger caps the grant at the board maximum. The host CLI
recognises 0x1014 as an installed system only with an Orchard serial,
and the Linux access rules include it. RAM payloads keep their ID.

From orchard PR OrchardLinux#108 (commit 0674e1d): the identity there was opt-in
and J71t-only; it is now the default for every board.
@henrikklee henrikklee changed the title j71t: Guarded Mac current profile usb: Full charging current from a Mac on every board Nov 12, 2026
@henrikklee

Copy link
Copy Markdown
Contributor

Landing this with your two kernel patches as your commit (grant capped at the board maximum, no extra current while suspended; the budget log is a debug message). The Mac current identity (0x1014, IAD class) is now the default for every installed system rather than a J71t opt-in, and hosts recognise 0x1014 as an installed system only with an Orchard serial. Your previous head is kept as tag contrib/brkosebay-j71t-mac-current. Please check the 2400 mA grant from a Mac on the next nightly.

@henrikklee
henrikklee merged commit 83867fe into OrchardLinux:main Nov 12, 2026
11 checks passed
henrikklee pushed a commit that referenced this pull request Nov 12, 2026
How macOS decides to grant 2400 mA (its power table, the 40/40 vendor
request, why the device class must be the IAD composite), what the
tablet does with a grant, the device acceptance check, and the NCM stall
findings from the J71t bring-up.

From orchard PR #108 (commit 0674e1d, docs/bring-up/charging/
j71t-mac-current.md), updated to what landed: the identity is the
default for every installed system, macOS approves it once thanks to the
stable USB serial, and the opt-in file and host test sections are gone.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in drivers/usb are renumbered to follow
main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base and drivers/usb
are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base and drivers/usb
are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base,
drivers/pmdomain and drivers/usb are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base,
drivers/pmdomain and drivers/usb are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/t8010, drivers/base,
drivers/media, drivers/pmdomain, drivers/power and drivers/usb are
renumbered to follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power and drivers/usb are renumbered to follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power and drivers/usb are renumbered to follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power, drivers/soc-apple and drivers/usb are renumbered to
follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power, drivers/soc-apple and drivers/usb are renumbered to
follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
@brkosebay

Copy link
Copy Markdown
Contributor Author

Checked on an iPad 5 (J71t) on 2026-11-13 with a user install image built from main 8ea3182 plus the open 0.4 PRs (top j71t/gpu-handover), installed with orchard install from DFU, then a cold boot from DFU and a warm restart (kexec) from the desktop.

Confirmed: plugged into a Mac, the kernel logs Apple host current grant: extra 1900 mA, suspend 2400 mA, which is 2400 mA with the 500 mA base.

@brkosebay

Copy link
Copy Markdown
Contributor Author

Correction to my comment above: the Mac grant reaches the gadget (Apple host current grant: extra 1900 mA), but the charger never applies it. After boot the Lightning supply shows current_max=0 and input_current_limit=500000, while the board maximum in the DT is 2400000 µA. The iPad discharges at ~1.1 A while plugged into the Mac. So the 2400 mA check fails on this build.

My guess is that the gadget's one-time report goes stale against the charger's source epoch: the budget log is a debug message now, so I couldn't see the "stale" line. The 1 s hold that #127 applies on every attachment could advance the epoch after the report. I'm looking into it and will follow up with the root cause, and a fix PR if the fix is on our side.

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