Skip to content

appletbdrm: wake the T1 display at probe and rearm - #47

Open
pnshad wants to merge 1 commit into
standardagents:mainfrom
pnshad:t1-wake-display
Open

pnshad wants to merge 1 commit into
standardagents:mainfrom
pnshad:t1-wake-display

Conversation

@pnshad

@pnshad pnshad commented Oct 6, 2026

Copy link
Copy Markdown

Refs #34, #18.

T1 display power is HID feature report 3 on the iBridge HID interface, byte 1 = 0x01 parked / 0x02 awake. The driver only ever wrote 0x01 (on suspend) and the firmware keeps the value across a reprobe, so a parked panel stays dark through every later probe while accepting every frame: DRM registered, renderer frames held, no error anywhere.

This shares the report write between park and a new wake, and writes the awake value after the probe-time clear and at the end of the resume rearm. A failed awake write warns and continues; it never fails probe or rearm.

Tested. Attended control on a MacBookPro14,2 (Arch/Omarchy, kernel 7.2.5, t1bridge 0.1.12), lid open, t1-touchbar-hw stopped:

  1. park the panel from userspace (same report 3, byte 1 = 0x01) → dark
  2. rmmod + insmod the unmodified v0.1.12 driver → stays dark
  3. rmmod + insmod this driver → relights from probe alone, no "Failed to wake" warning in dmesg

make -C kernel/appletbdrm-t1 test sanitize passes with the new WAKE step. Suspend/resume was not exercised on that unit (sleep masked), so whether this also repairs the #18 path, where the stock rearm never wrote the awake value either, is left as "to be observed" in docs/display-failures.md.

Not touched: kernel/appletbdrm-t1/upstream/*.patch (the mainline series); happy to refresh it if you want this carried there.

🤖 Generated with Claude Code

T1 display power is HID feature report 3 on the iBridge HID interface,
byte 1 = 0x01 parked or 0x02 awake. The driver only ever wrote 0x01, on
suspend, and the firmware keeps the value across a reprobe, so a parked
panel stayed dark through every later probe while accepting every frame:
DRM registered, renderer frames held, no error anywhere.

Share the report write between park and a new wake, and write the awake
value after the probe-time clear and at the end of the resume rearm. A
failed awake write is a warning, not a probe or rearm failure.

Attended control on a MacBookPro14,2 running 0.1.12, hardware service
stopped: park from userspace, unload and load the unmodified driver, panel
stays dark; unload and load this driver, panel relights from probe alone
with no "Failed to wake" warning. Suspend/resume was not exercised on that
unit, so the standardagents#18 path (stock rearm never wrote the awake value either)
remains to be observed.

The resume fault test gains the WAKE step and checks that its failure is
reported without failing the rearm. docs/display-failures.md records the
control and what remains unobserved.
@makoni

makoni commented Oct 8, 2026

Copy link
Copy Markdown

Tested the idea behind this on the #18 path, on a MacBookPro14,3 with s2idle (deep S3 doesn't come back on this machine at all). I didn't build this branch; I did the same write from userspace.

Setup: Omarchy 4.0.4-1, kernel 7.2.5-3-omarchy, official t1bridge 0.1.12 packages, diagnostics on.

After one s2idle cycle (rtcwake + systemctl suspend, ~30 s) the strip was dark. t1bridge status was all ready, card0-USB-1 connected / On, and with the dynamic-debug call sites enabled a renderer restart gave t1bridge-display v=1 phase=reply kind=update result=ok code=0 attempts=2. None of these relit it:

Then I read feature report 3 on interface 6 (hidraw, page 0xff12) with HIDIOCGFEATURE:

03 01 00 00 00 00 01 df 88 df 00 00 00 00 00

So it was parked, and it had stayed parked through all of the above. Writing the 15-byte report from this PR (03 02 f4 01 + zeros) with HIDIOCSFEATURE lit the strip; reading it back gave 03 02 00 00 00 00 01 df 88 df ….

I've since put the same write in a system-sleep post hook (3 s after resume, skipped if byte 1 is already 0x02). On a later s2idle cycle the hook found the panel not awake, wrote awake, the strip came back, and fprintd-verify returned verify-match. The keybag relay dropped during that sleep (sep-lease -107) and recovered on its own after restart.

So on 14,3 + s2idle the awake write at rearm looks like exactly what #18 is missing. I can run a build of this branch through a few suspend cycles here if that helps.

@niconistal

Copy link
Copy Markdown
Contributor

This answers the open question in the description: on a unit that sleeps, writing the awake value at the end of the rearm does fix the #18 path. I found the same root cause independently and opened #49 the next day without having seen this PR. The code change is the same: report 3, byte 1 = 0x02, written after the rearm-time clear.

Machine. MacBookPro14,3 (Radeon Pro 555 on the panel), T1Bridge 0.1.12 DKMS rebuilt with the awake write at the end of appletbdrm_t1_rearm(), kernel 7.2.5 (linux-omarchy plus the s2idle patches from omacom/omarchy-pkgs#596 and #544), Omarchy 4.0.4, mem_sleep_default=s2idle.

  • Stock 0.1.12: report 3 read 03 01 … (parked) after every resume, and the panel stayed dark until a reboot. Restarting t1-touchbar-hw or the renderer, or t1bridge validate usb-cycle, didn't relight it.
  • With the awake write: report 3 read 03 02 … after each of 10 RTC-woken s2idle cycles, with no manual step. A stock-module control in the same harness came back at 03 01. I saw the panel lit after one of those cycles, and after a real 3-minute lid close.
  • The patched module has been in daily use since 2026-10-09, about 20 more resumes. The bar came back each time.

Not covered. This is s2idle only. For S3 on a 14,3, the comment from @darrellgum on #18 found that the awake write alone isn't enough: \_SB.PCI0.XHC1.RHUB.ASOC.SOCW(1) is needed first. On s2idle I tried SOCW(1) on a dark panel, and it made no difference. The awake write alone relit the bar.

One difference from #49. There, a failed awake write at resume takes the reprobe path from #27. Here it warns and continues. Either is fine for the case I tested, because the write never failed. Warn-and-continue leaves the bar dark if the write does fail, and a reprobe would retry it.

Since this PR came first and also covers probe, I'm happy to close #49 in its favor, or to move its fault-test step here if that's useful. @andrew-boyd, your call.

@aldervale

Copy link
Copy Markdown

Adding an actual build-and-hardware report from MacBookPro13,3 (2016 15-inch T1).

I tested this PR at d43d2c52d965ce0ee495e311a6cf982ab6cc9b4f, then packaged that source locally as t1bridge-dkms 0.1.12.r47.d43d2c5-1. Omarchy is 4.0.4-1, with t1bridge 0.1.12-1 and t1bridge-omarchy 0.2.2-1. Loaded/on-disk module identity and package persistence after reboot were checked. My separate userspace HID unpark hook was disabled throughout the successful #47 trials.

Observed results: seven attended sleep/resume cycles restored visible Touch Bar icons and Fn switching without a manual unpark. Four were on 7.2.5-3-omarchy (two before packaging, two after installing the package and rebooting). Three were on a separately built 7.2.5-3-omarchy-acpi-trial kernel across two boots; the last two included 15 minutes asleep on battery. Startup display/Fn also worked after the packaged reboot.

These were confirmed s2idle cycles, not screen blanking alone. The machine still uses a model-specific EC lid-wake helper and guarded Thunderbolt unload/reload, with external devices disconnected. I did not add a SOCW(1) call. Earlier live-swap attempts aborted with internal xHCI EBUSY; a stock-driver comparison also aborted in that boot. Those attempts are not counted as passes, and their cause remains unresolved.

The separate ACPICA correction carried by omacom/omarchy-pkgs#544 reduced visible wake from 17–18 seconds to about one second / nearly immediate in the first two attended patched-kernel tests. That timing improvement is separate from this display fix.

This favors using the driver fix instead of shipping my additional userspace recovery hook. It does not validate S3, multi-hour display recovery, external ports or Touch ID. Severe closed-lid battery depletion also remains unresolved. Test chronology and limitations.

@hanscnelson

Copy link
Copy Markdown

MacBookPro14,2, stock t1bridge 0.1.12-1, Omarchy 4.5.0-3, kernel 7.2.15-1-omarchy. This is the userspace form of this write after S3, not a build of the branch.

After two deep suspends the strip was dark and report 3 byte 1 was 0x01. Writing 03 02 f4 01 plus zeros to 05ac:8600 interface 6 (/dev/hidraw1) read back 03 02 00 00 00 00 01 …. Byte 1 stayed 0x02. Restarting t1-touchbar-hw then returned display-open ok, and the renderer was restarted, so a fresh frame followed the awake value. The strip stayed dark.

Details are on #18. No SOCW call.

@hanscnelson

Copy link
Copy Markdown

Follow-up to the 14,2 note above. With report 3 already 0x02 and the strip still dark, \_SB.PCI0.XHC1.RHUB.ASOC.SOCW 0x1 returned 0x0 and the strip relit. The awake write alone was not enough after S3 on this machine. Details are on #18. FRST was not called, and this branch is still not installed.

This branch has not been deployed

No deployments
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.

5 participants