Skip to content

appletbdrm: unpark the T1 panel on resume - #49

Open
niconistal wants to merge 1 commit into
standardagents:mainfrom
niconistal:t1-unpark-on-resume
Open

niconistal wants to merge 1 commit into
standardagents:mainfrom
niconistal:t1-unpark-on-resume

Conversation

@niconistal

Copy link
Copy Markdown
Contributor

On a MacBookPro14,3, the Touch Bar stays dark after every system resume until a reboot. appletbdrm_t1_park() sets HID feature report 3 to mode 1 at suspend, and nothing sets it back. The rearm handshake succeeds and frames are accepted, but the T1 keeps the panel parked.

This change ends appletbdrm_t1_rearm() with a report-3 write of mode 2 (appletbdrm_t1_unpark()). It runs before drm_mode_config_helper_resume(), so the panel gets fresh frames after the unpark. A failed write takes the existing display-interface reprobe path from #27. The resume fault tests now include the new step.

Testing

MacBookPro14,3 (Radeon Pro 555 on the panel), T1Bridge 0.1.12 DKMS rebuilt with this patch, 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 mode 1 (03 01 …) after every resume, and the panel stayed dark. Restarting t1-touchbar-hw or the renderer, or running t1bridge validate usb-cycle, did not relight it.
  • Live, on a panel left dark by a resume, writing report 3 = 03 02 and then restarting the renderer relit it.
  • With this patch, report 3 read mode 2 after each of 10 RTC-woken s2idle cycles, with no manual step. The panel was seen lit after one of those cycles and after a 3-minute lid close. A stock-module control in the same harness came back at mode 1.
  • Wi-Fi, Thunderbolt, Touch ID and the camera also came back after each resume. That depends on the host-side s2idle patches above, not on this change.
  • make quality passes.

Scope

  • Only s2idle was tested. The 14,2 S3 reports in Restore all T1 functions automatically after suspend and resume #18 saw the same unpark write fail to relight after S3, so this does not settle S3. docs/display-failures.md now records the s2idle result separately.
  • After a resume, the desktop leaves the display powered off until input. With a display-power provider, the bar follows the display, so it lights on the first key press. That is desktop behavior, not this driver.

Refs #18

🤖 Generated with Claude Code

appletbdrm_t1_park() sets HID feature report 3 to mode 1 at suspend, but
resume never set it back. The rearm handshake succeeds and frames are
accepted, yet the T1 keeps the panel parked, so the Touch Bar stays dark
until a reboot.

End the T1 rearm with a report-3 write of mode 2. It runs before the DRM
state is restored, so the panel receives fresh frames after the unpark. A
failed write takes the existing display-interface reprobe path. The resume
fault tests cover the new step.

Tested on a MacBookPro14,3 with s2idle. Before this change, report 3 read
mode 1 and the panel was dark after every resume. With the change, report
3 read mode 2 after each of 10 timer wakes, and the panel was seen lit after
one of them and after a lid close. S3 on the 14,2 is not covered.

Refs standardagents#18

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@niconistal

Copy link
Copy Markdown
Contributor Author

The failed quality check isn't from this change. CI installs Arch's current rust package, which is now 1.99.0 (rust-1:1.99.0-1 in the job log). Two new diagnostics fail make lint under -D warnings:

  1. AtomicUsize::fetch_update is deprecated in favour of try_update, at crates/t1-platform/src/diagnostics.rs:171. That's where this run stopped.
  2. The new clippy::assert_is_empty lint flags assert!(x.is_empty()) in tests: 58 sites across t1-bridge, t1-daemons, t1-import, t1-touchbar, t1-touchbar-hw and tools/release. A run with --keep-going lists them all.

On Rust 1.98.1, make quality passes on this branch, including clippy, the resume fault tests with sanitizers, and the DKMS build. main would fail the same way on its next run.

Options: pin the toolchain in CI, allow clippy::assert_is_empty at the workspace level, or rewrite the asserts. If fetch_update is replaced with a compare_exchange_weak loop, that one builds on both 1.98 and 1.99, since try_update doesn't exist before 1.99. I can open a separate PR with whichever you prefer, so this one stays focused.

@mheineck

mheineck commented Oct 20, 2026 •

Copy link
Copy Markdown

Suggestion:

Edit 2026-10-21

Read this first

https://github.com/mythopoeic/macbookpro14-3-linux/pull/2/changes#diff-c654c4fe2b6666d1c0a4870d90ced19feafa4627a545cc99edc0071c3180e35a

How to install t1-touchbar.service

Fix: Touch Bar dark after S3 suspend/resume on T1 MacBook Pros (2016–2017, MacBookPro13,x/14,x)

After every S3 resume the Touch Bar stays dark, and no HID-level revival works — the T1
acknowledges USB writes (SET_FEATURE ok) but discards them internally, so mode and
display reports go nowhere. Only a reboot brings the bar back.

The root cause: the T1's rendering subsystem needs a firmware-level wake call after
resume — ASOC.SOCW — which HID userspace cannot reach. I've been running this fix on
a MacBookPro14,2 (elementary OS, kernel 7.0) and the bar now survives suspend/resume
reliably across repeated cycles:

1. Wake call via acpi_call (requires the acpi_call DKMS module):

echo '\_SB.PCI0.XHC1.RHUB.ASOC.SOCW 0x1' | sudo tee /proc/acpi/call

2. Call it from a systemd resume unit (After=suspend.target, WantedBy=suspend.target):

[Unit]
Description=Wake Apple T1 (iBridge) and restart touchbar daemon after suspend
After=suspend.target

[Service]
Type=oneshot
ExecStartPre=/sbin/modprobe acpi_call
ExecStart=/bin/sh -c "echo '\_SB.PCI0.XHC1.RHUB.ASOC.SOCW 0x1' > /proc/acpi/call; sleep 1; systemctl restart t1-touchbar.service"

[Install]
WantedBy=suspend.target

3. Disable USB runtime suspend for the iBridge via udev (otherwise the T1 falls
asleep between writes and the same state loss occurs):

SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="8600", \
    ATTR{power/control}="on", ATTR{autosuspend_delay_ms}="-1"

This matches the failure signature reported in several threads since 2017 (HID writes
succeed, bar stays dark) and complements the kernel-driver workarounds —
AJ-dev-i60/t1-touchbar#4 documents the same root cause from the driver side
(skip_acpi_power skips SOCW, bar stays dark after S3).

⚠️ Caveat: an unconditional ASOC.SOCW(1) at driver probe time is reported to
hard-freeze some T1 machines (that's why skip_acpi_power=1 exists). Calling it once at
resume time from userspace works stable on my 14,2 — but test carefully on your model,
and check your DSDT for the exact path if it differs (grep SOCW dsdt.dsl).

Full write-up: mythopoeic/macbookpro14-3-linux#2

@vpacher

vpacher commented Oct 20, 2026

Copy link
Copy Markdown

One more data point for this change, from a second MacBookPro14,3. It uses the stock Omarchy kernel, without the s2idle patches from omacom/omarchy-pkgs#596 and #544.

Setup

  • MacBookPro14,3, Intel GPU active (Radeon off), Omarchy 4.0.6
  • Suspend mode s2idle (MemorySleepMode=s2idle), started with systemctl suspend and an RTC wake alarm
  • Test 1: kernel 7.2.5-3-omarchy, T1Bridge 0.1.11
  • Test 2: kernel 7.2.8-9-omarchy, T1Bridge 0.1.12

Result without a fix (both tests)

Before suspend After resume
Report 3 03 02 03 01
ALS in_illuminance_raw 55 0
Touch Bar lit dark

The update from 0.1.11 to 0.1.12 and from 7.2.5 to 7.2.8 did not change the result.

Result with the awake write

When I write report 3 = 03 02 f4 01 on interface 6 after resume, report 3 reads 02 again and the Touch Bar comes back after the next input. The ALS also comes back without other steps. It reads 0 immediately after the write and a normal value (33 to 37) a few seconds later. Earlier, I thought that the ALS had stopped. That was also the parked panel.

Until this PR is in a release, I use a systemd sleep hook in /usr/lib/systemd/system-sleep/. The hook writes the awake value at post if byte 1 is not 02. In one RTC-woken s2idle cycle, the hook logged 01 -> 02, and 3 s later the probe read 02 with ALS 35. I did not need SOCW(1) in s2idle.

About the S3 suggestion above

Two items in the udev rule and the unit need a correction before other users copy them:

  1. ATTR{idProduct}="8600" uses =. In udev, = assigns a value. It does not compare. Thus the rule matches every 05ac device and tries to write idProduct. Use ATTR{idProduct}=="8600".
  2. The unit runs as a system service and restarts t1-touchbar.service. In T1Bridge 0.1.12, t1-touchbar.service is only a user unit. The system units are t1-touchbar-hw.service and t1-touchbar-hw.socket. Thus the restart fails with "unit not found".

@mheineck

Copy link
Copy Markdown

edited my comment. Added missing instructions for t1-touchbar.service and missing '='

@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.

@patattzel

Copy link
Copy Markdown

Additional s2idle hardware confirmation for this patch on MacBookPro14,3 (2017 15-inch, i7-7820HQ, Radeon Pro 560, T1 05ac:8600).

The earlier local diagnosis reproduced the parked-panel failure: report 3 remained in mode 1 after a PM transition, and an explicit mode-2 request plus fresh renderer frames relit the strip. I then rebuilt T1Bridge 0.1.12 DKMS with this PR's change at 26f6ef618811296e4e19ca210ef08ff4b4283f00 (local package 0.1.12-1.1). Resume/protocol tests and sanitizers passed, with successful module builds.

On November 6, the patched driver was present for an attended real lid-close/open s2idle cycle on a separately built 7.2.15-2-macbook143 kernel:

  • 26.563 s actual sleep, independently measured and confirmed by kernel timekeeping; not just screen blanking or pm_test.
  • EC/LID wake accepted before device resume, before the fallback RTC alarm.
  • Passive report-3 readings were mode 2 before and after; the observer did not send an awake report or restart the renderer as a repair.
  • The owner reported automatic screen return in approximately one second and then confirmed normal keyboard, trackpad and Touch Bar function.

The host also needed separate Thunderbolt/BCM43602 fixes from omacom/omarchy-pkgs#596, omacom/omarchy-pkgs#544 (ACPICA), an EC wake-capability workaround, and T1 USB remote wake disabled. Those host requirements are not fixed by this display patch. This was one short real lid cycle with the final successful combination, not a repeated-cycle, official-package, or long-term qualification. Camera, ALS and Touch ID were not separately acceptance-tested after this cycle.

No SOCW/FRST call or T1 firmware recovery was used for this resume. This evidence supports the existing s2idle scope and does not contradict the separate S3 cases where mode 2 alone leaves the strip dark. It also does not close all of #18.

Prepared with AI assistance from local build/test records and the machine owner's separate visual confirmation. No new hardware test was run for this comment.

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