Repository navigation
usb: misc: add a USB Billboard Device Class driver - #2263
Conversation
USB-C docks, adapters and displays that offer Alternate Modes expose a USB 2.0 Billboard device (class 0x11). Its BOS carries a Billboard Capability descriptor listing every mode the device container supports (SVID, mode index, optional string) and a two-bit bmConfigured result per mode telling the host whether the mode was entered, plus optional Billboard AUM Capability descriptors with each mode's VDO. Linux has no driver for the class, so these devices sit unbound in every dock (lsusb -t shows Driver=[none]) and a dock whose DisplayPort path failed says nothing. Bind to the Billboard interface and: - expose the descriptor in sysfs under <interface>/billboard/ (num_modes, preferred_mode, vconn_power, version, additional_failure_info, additional_info_url, and altmode<N>/ with svid, mode, vdo, state, description), readable without root; - log one line per mode at bind time, at warning level for modes the device reports as attempted-but-not-entered or as an unspecified error. The descriptor layouts go into the uapi ch9.h so user space can share them. The capability is copied at probe, since a device reset replaces udev->bos. Nothing is sent to the device beyond the string descriptors the core already reads. This follows the 2024 debugfs posting by Niklas Neronin; review asked for the data outside debugfs and for the structs in uapi, which this does. It also fixes that posting's bmConfigured decode, which shifted by the mode index instead of twice the index. Tested on a Realtek RTS5411 dock billboard (0bda:5418, Billboard 1.21, one DisplayPort mode, configured). Link: https://lore.kernel.org/linux-usb/[email protected]/ Suggested-by: Niklas Neronin <[email protected]> Signed-off-by: Ryan Murray <[email protected]>
Sysfs attribute groups cannot nest, so the per-mode "altmode<N>" groups
landed next to "billboard" on the interface instead of inside it. Build
one "billboard" group holding the device-wide attributes and
altmode<N>_{svid,mode,vdo,state,description} for each mode, and update
the ABI document to match.
Signed-off-by: Ryan Murray <[email protected]>
|
Blockers: 1.
Everything else I checked is sound. BOS walking is bounded by HW row: a full kernel from this head with Assisted-by: LLM (Claude:Opus 5.5) |
…leared The device-wide attributes (version, num_modes, vconn_power, ...) look up their state with usb_get_intfdata(). The billboard group was added with devm_device_add_group(), so devres removed it only in device_unbind_cleanup(), after usb_unbind_interface() had already called usb_set_intfdata(intf, NULL). A read of billboard/version racing an unbind or an unplug could therefore dereference a NULL struct usb_billboard. Add the group with device_add_group() and remove it in billboard_disconnect(), which runs while the interface data is still set. Sysfs removal waits for show() calls already running, so once disconnect returns no reader can see the cleared pointer, and the devres-managed state (the struct, the attribute array, the names and the strings) is freed only after the files are gone. The driver core's dev_groups do not fit here because the group is built per device: its file names depend on the number of modes the device reports. Signed-off-by: Ryan Murray <[email protected]>
|
Added 5cdb7b2: remove the billboard sysfs group in disconnect, while intfdata is still set (devres removed it only after usb_unbind_interface() cleared intfdata, so a racing read of billboard/version could dereference NULL). arm64 object build clean. Still owed: unplug-while-reading row on a Billboard device. |
Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Verdict: MERGE at 8465e83 once the required checks and remaining validation clear.
Checked: Billboard 1.2.2 table 3-5 and Appendix A specify the 0x11/0/0 interface tuple, and the VCONN and two-bit mode-state tables agree with the decoder. The match is class-wide. The driver removes the sysfs group during disconnect, while interface data is live, and group removal drains active readers before devres cleanup. Reviewed the descriptor layouts, optional per-mode files and ABI docs. No DT change. The forward merge does not touch the driver or its integration files. The J473 receipt covers active sysfs readers across 20 rebinds, with shared USB smoke on J316s and J473. Keep hosted checks and the physical disconnect row visible.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: A small
usb-billboardclass driver: binds the USB Billboard interface that every Alt Mode dock and adapter exposes (unbound today), shows its capability descriptor in sysfs, and warns when a mode was attempted but not entered. The latest commit removes the sysfs group in disconnect while intfdata is still set (review finding: NULL dereference on unbind during a read).Tested: J473 (M2 mini) at 5cdb7b2 (dsw2): a real Billboard device behind the USB-C monitor binds (
3-1.4:1.0, Billboard 1.21, one alt modeconfigured, vconn 1W). 20 unbind/bind cycles while a loop keeps readingbillboard/version: still bound, 0 oops/WARN. J473 at f7205f4 (dsw1): bind + all sysfs values read. Shared USB regression (include/uapi/linux/usb/ch9.h): J615 (dsw1), M1 Pro and J473 (dsw2) boot with USB devices enumerated, 0 failed units, 0 WARN/BUG. (DRVGAP's earlier Neo row: dock Billboard 0bda:5418 bind/unbind/rebind, sysfs =lsusb -v.)Risk: two-way · all Macs (new module, binds USB class 0x11 only; uapi ch9.h gains descriptor structs)
Not yet: physically unplugging the device during a read (the sysfs unbind loop is the stand-in)
Evidence
CONFIG_USB_BILLBOARD=m), LLVM 22.1.6 / rustc 1.97.1; build warnings = main's.grub2-reboot, no Stage 2 or DTB change. Each Mac went back to its saved fleet kernel, the test kernel was removed, and production state was verified: saved entry, empty next_entry, Enforcing, 0 failed units.genpd_prepare -11, brcmfmac LPAS fallback), and the fleet kernel's own s2idle shows them too.Merge main into drvgap/usb-billboard-v2. This PR's files are byte-identical to the dsw2 tree.Original description
Problem
Every USB-C dock, adapter or display that offers an Alternate Mode exposes a USB Billboard device (class 0x11), and Linux has no driver for the class. These devices sit unbound in every dock (
lsusb -tshowsDriver=[none]). When a dock's DisplayPort path fails, nothing says so, although the Billboard reports exactly that. Example: the Realtek 0bda:5418 Billboard behind the RTS5411 hub of a Plugable UD-ULTC4K dock.Change
A small class driver,
usb-billboard. It binds to the Billboard interface and reads the Billboard Capability descriptor (and any Billboard AUM Capability descriptors) from the BOS the core already holds. Then it:<interface>/billboard/(one flat group), readable without root (ABI doc included)The descriptor structs go into uapi
ch9.h. The driver sends nothing to the device beyond string descriptors. It does not depend on the SoC or board: it binds to any Billboard on any machine.CONFIG_USB_BILLBOARD=mis added toasahi.config.This follows Niklas Neronin's 2024 debugfs-only posting, which was never merged. Review there asked for the data outside debugfs and for the structs in uapi; this version does both. It also fixes that posting's bmConfigured decode, which shifted by the mode index instead of twice the index.
Testing
Module built out of tree against the 7.3.0-40 config (clang 22, W=1): 0 warnings. checkpatch --strict: 0 errors.
uapi block:
gcc -std=c99 -pedantic -Werrorclean, plus static asserts on the layout (capability 44 bytes + 4 per mode, AUM capability 8 bytes, bcdVersion at offset 40).Hardware, MacBook Neo (T8140, 7.3.0-40), dock Billboard 0bda:5418 behind an RTS5411 hub (Billboard 1.21, one DisplayPort mode): the module built from this branch binds it (
lsusb -tshowsDriver=usb-billboard), and every sysfs value matcheslsusb -v: vconn_power 1W, version 1.21, num_modes 1, preferred_mode 0, additional_failure_info 0x00, altmode0 svid ff01, mode 1, vdo 0x000c0045, state configured. dmesg: one info line,alternate mode 0: SVID ff01 DisplayPort mode 1: configured. sysfs unbind removesbillboard/, bind restores it, rmmod is clean, 0 failed units, 0 SELinux denials. The first run found the per-mode groups landing besidebillboard/(sysfs groups cannot nest); the second commit fixes that and the rerun shows everything underbillboard/with no stray directories.Still to run
CONFIG_USB_BILLBOARD=m(next unified test kernel).sysfs layout