Skip to content

TouchBar appletbdrm the module reload functionality is broken, not the initial loading!  #635

@xing0r

Description

@xing0r

TouchBar appletbdrm driver fails to bind on Linux 6.12.31+ - DRM API compatibility issue

Preliminary Note

I attempted to resolve this issue with assistance from Claude AI, including trying various workarounds and patches. When those attempts were unsuccessful (and in one case caused boot issues), Claude AI helped me compile and structure the following comprehensive bug report based on our debugging session and gathered system information.

System Information

Hardware:

  • MacBook Pro 16,2 (2020 Intel 13" - 4 Thunderbolt Ports)
  • Board: Mac-5F9802EFE386AA28 (Hardware revision 1.0)
  • TouchBar Hardware:
    • 05ac:8302 - "Touch Bar Display" (Primary issue) - bcdDevice 2.01
    • 05ac:8102 - "Touch Bar Backlight" (Working) - bcdDevice 2.01
    • USB Version: 2.00
    • Manufacturer: Apple Inc.
  • T2 Security Chip devices (all USB 2.00, bcdDevice 2.01):
    • 05ac:8233 - Apple T2 Controller
    • 05ac:8514 - FaceTime HD Camera (Built-in)
    • 05ac:8262 - Ambient Light Sensor
    • 05ac:8103 - Headset (Audio)
    • 05ac:027e - Apple Internal Keyboard/Trackpad
  • Architecture: Intel x86-64 (Late 2020 generation)

Software:

  • Distribution: Gentoo Linux
  • Working Kernel: 6.12.21-gentoo-t2
  • Broken Kernels:
    • 6.12.31-gentoo-t2
    • 6.15.3-vanilla-sources (same issue persists)
  • appletbdrm module: Loads successfully but fails to bind
  • tiny-dfr version: Latest

Problem Description

The appletbdrm kernel module loads successfully but fails to bind to the TouchBar USB device on Linux kernel 6.12.31, while it works perfectly on 6.12.21. This appears to be related to DRM subsystem API changes introduced between these kernel versions.

Symptoms

  1. Module loads successfully:

    $ modinfo appletbdrm
    filename:       /lib/modules/6.12.31-gentoo-t2/kernel/drivers/gpu/drm/tiny/appletbdrm.ko
    license:        GPL
    description:    Apple Touch Bar DRM Driver
    author:         Kerem Karabay <[email protected]>
    alias:          usb:v05ACp8302d*dc*dsc*dp*ic10isc*ip*in*
  2. TouchBar hardware detected but bound to generic USB driver:

    $ ls /sys/bus/usb/devices/*/idVendor | xargs grep -l 05ac
    Apple Device: /sys/bus/usb/devices/5-6
    Vendor: 05ac
    Product: 8302
    Driver: ../../../../../../../../../bus/usb/drivers/usb  # Should be appletbdrm
  3. No TouchBar DRM device created:

    $ ls -la /dev/dri/
    # Only shows Intel i915 card0, no TouchBar DRM device
    crw-rw----+  1 root video  226,   0 card0
    crw-rw-rw-   1 root render 226, 128 renderD128
  4. tiny-dfr fails to find TouchBar:

    $ tiny-dfr --help
    Searching for cards in /dev/dri/
    Found card: "/dev/dri/card0"
    Trying to open card: "/dev/dri/card0"
    Failed to open card: "/dev/dri/card0" - Error: unknown system error: EBUSY: Device or resource busy
    thread 'main' panicked at src/main.rs:381:43:
    called `Result::unwrap()` on an `Err` value: No touchbar device found

Reproduction Steps

  1. Boot Linux kernel 6.12.31-gentoo-t2
  2. Verify appletbdrm module is loaded: lsmod | grep appletbdrm
  3. Check TouchBar USB device: Find USB device 05ac:8302
  4. Attempt manual binding:
    echo "5-6" > /sys/bus/usb/drivers/usb/unbind
    echo "05ac 8302" > /sys/bus/usb/drivers/appletbdrm/new_id
    echo "5-6" > /sys/bus/usb/drivers/appletbdrm/bind
    Result: bash: echo: write error: No such device

Detailed Logs

Detailed Error Logs

appletbdrm module loading and probe failure (Linux 6.12.31+):

$ modprobe appletbdrm
$ echo $?
0  # Module loads successfully

$ dmesg | tail -5
[ 1512.718129] bce-vhci: Not implemented: wait for pending output requests
[ 1512.719742] appletbdrm 5-6:2.1: [drm] *ERROR* Failed to send message (-110)
[ 1512.719750] appletbdrm 5-6:2.1: [drm] *ERROR* Failed to get display information
[ 1512.719755] appletbdrm 5-6:2.1: probe with driver appletbdrm failed with error -110
[ 1512.719844] usbcore: registered new interface driver appletbdrm

Error Analysis:

  • Error -110: ETIMEDOUT - USB communication timeout with TouchBar device
  • Root cause: appletbdrm_get_information() function fails during initial TouchBar communication
  • Probe failure: Driver binding succeeds but device initialization fails at USB protocol level
  • bce-vhci warning: T2 controller shows "wait for pending output requests" - possible timing issue

Manual binding attempt:

$ echo "5-6" > /sys/bus/usb/drivers/usb/unbind          # Success
$ echo "05ac 8302" > /sys/bus/usb/drivers/appletbdrm/new_id  # Success  
$ echo "5-6" > /sys/bus/usb/drivers/appletbdrm/bind
bash: echo: Schreibfehler: Kein passendes Gerät gefunden.

tiny-dfr error output:

$ RUST_BACKTRACE=1 tiny-dfr --verbose
Searching for cards in /dev/dri/
Found card: "/dev/dri/by-path"
Found card: "/dev/dri/card0"
Trying to open card: "/dev/dri/card0"
Failed to open card: "/dev/dri/card0" - Error: unknown system error: EBUSY: Device or resource busy
Found card: "/dev/dri/renderD128"
thread 'main' panicked at src/main.rs:381:43:
called `Result::unwrap()` on an `Err` value: No touchbar device found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: tiny_dfr::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

dmesg output (no appletbdrm-specific errors shown):

  • No error messages from appletbdrm during binding attempt
  • No DRM device registration messages
  • Only standard Intel i915 DRM operations visible

USB device information:

$ cat /sys/bus/usb/devices/5-6/uevent
MAJOR=189
MINOR=518
DEVNAME=bus/usb/005/007
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=5ac/8302/201
TYPE=0/0/0
BUSNUM=005
DEVNUM=007

Root Cause Analysis

This issue appears to be identical to the known drm_open_helper crashes affecting multiple DRM drivers (NVIDIA, DisplayLink EVDI) on Linux 6.12, as documented in:

Suspected cause: DRM subsystem API changes in Linux 6.12 break out-of-tree DRM drivers, particularly around:

  • drm_open_helper() function changes
  • DRM file operations structure modifications
  • Device registration/initialization sequence changes

Workaround

Temporary solution: Downgrade to Linux 6.12.21-gentoo-t2 where TouchBar functionality works perfectly.

Additional Testing

Upstream Kernel Testing:

  • Linux 6.15.3 vanilla-sources: Tested independently - same issue occurs
  • This confirms the problem is not distribution-specific (Gentoo vs upstream)
  • Issue persists even in latest kernel versions that should include TouchBar improvements
  • Problem affects both gentoo-sources and vanilla-sources trees

Additional Context

  • TouchBar detection: ✅ Hardware properly detected via USB
  • Module loading: ✅ appletbdrm loads without errors
  • USB ID registration: ✅ new_id accepts the device ID
  • Device binding:Fails at probe function level
  • DRM registration:No TouchBar DRM device created

This suggests the issue occurs in the appletbdrm_probe() function, likely during DRM device initialization, due to API compatibility issues with the updated DRM subsystem in 6.12.31.

Expected Behavior

On Linux 6.12.21:

  • TouchBar automatically binds to appletbdrm driver
  • TouchBar DRM device appears in /dev/dri/
  • tiny-dfr successfully controls TouchBar display
  • Full TouchBar functionality available

Request

Please investigate DRM API compatibility for the appletbdrm driver with Linux 6.12.31+. This likely requires updating the driver to accommodate the new DRM subsystem API changes, similar to fixes already implemented for other DRM drivers.

Thank you for maintaining the excellent T2-Linux project! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions