Skip to content

xhci/ALSA/ASoC/SOF: Enable USB Audio Offload for LNL+ - #6049

Open
ujfalusi wants to merge 53 commits into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/uaol-01
Open

ujfalusi wants to merge 53 commits into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/uaol-01

Conversation

@ujfalusi

Copy link
Copy Markdown
Collaborator

kconfig patch: thesofproject/kconfig#111
sof-test patch for sof_remove.sh: thesofproject/sof-test#1366

USB Audio Offload Link (UAOL) support. The series lets an Intel audio DSP
source and sink isochronous USB audio directly through the xHCI Audio Sideband,
bypassing the host URB path, while snd-usb-audio keeps full ownership of the
device (descriptors, alternate settings, mixer, PM).

Base: topic/sof-dev. 54 patches (+1 test-only revert at the tip, see below),
53 files, +7248/-141.

Design in brief

  • xhci sideband (Mathias): Extended Property commands, xHC-controlled audio
    sideband registration, resource ID reservation, endpoint hand-over and
    property query. xhci_sideband_start_endpoint() restarts an endpoint stopped
    on the sideband.
  • usb-audio: the offload path claims the PCM substream and the endpoints it
    hands to the DSP; the host cannot open them meanwhile (-EBUSY).
    snd_usb_release_platform_ops() lets a platform let go of all devices when
    it unregisters.
  • USB audio offload library (sound/usb/offload): a host registers once
    with usb_offload_register(). The library:
    • filters candidate devices (FS/HS, class-compliant UAC AudioStreaming,
      explicit feedback only);
    • acquires a stream: claims the substream and endpoints, reserves the xHCI
      sideband resources and runs the device's format quirk;
    • refines and resolves hw params, with S24_3LE standing in for S24_LE;
    • quiesces and restarts the endpoints in the order the host dictates.
  • ASoC USB: per-stream route controls on the platform card,
    USB Offload <n> Playback/Capture Route, enumerating <card>,<pcm> pairs,
    and a USB Offload Jack.
  • SOF:
    • UAOL DAI type, link DMA, DAI copier gateway blob, and FIFO and device
      constraints on the frontends;
    • feedback link DMA for explicit feedback;
    • STOP quiesces and START restarts the USB endpoints around the DSP, so xrun
      recovery works;
    • the stream is reacquired on resume, and the gateway configuration is
      refreshed for the resources it gets;
    • hda-uaol.c holds the Intel glue.
  • Machine drivers: sof_sdw, sof_board_helpers and skl_hda_dsp_generic get
    the UAOL backend links. A missing sof-uaol function topology only leaves
    USB offload out.
  • Policy:
    • Userspace selects the route and opens the matching USB Offload <n>
      frontend; the kernel never migrates a stream.
    • Asynchronous playback stays on the host (snd_usb_offload.allow_feedback=1
      to test the explicit feedback path).
    • Implicit feedback is not offloaded: the playback and the capture it syncs
      to stay on the host. Devices with nothing to offload are not reported.

Layout

# Area
1–9 xhci sideband (Mathias ×9)
10 xhci sideband: restart a stopped endpoint
11–12 384 kHz HDA stream format
13 soc-usb non-DT backend match
14–16 usb-audio: substream and endpoint claim, platform ops release
17–24 USB audio offload library
25–26 soc-usb stub fix, route controls
27–42 SOF core / Intel UAOL DAI, gateway, constraints, feedback link DMA
43–46 Library: quiesce/restart, endpoint claim, format quirk
47–50 SOF: stop/start sequencing, route race, resume, enable
51–53 Machine drivers
54 Documentation (sof-uaol.rst, usb.rst)
55 Test-only: revert of "Don't support Intel audio sideband for devices behind a hub"

Testing

  • Build checks:
    • Every commit builds with W=1; allmodconfig W=1 is clean.
    • sparse: no new warnings.
    • gcc -fanalyzer: clean on the CI directories.
    • checkpatch.pl --strict: clean apart from MAINTAINERS notes on the new
      files (xhci patches as provided).
    • htmldocs: clean.
  • PTL, skl_hda_dsp_generic:
    • TTGK CM01 (UAC2 HS): playback S16_LE/S24_LE/S32_LE up to 384 kHz, and
      capture.
    • Sennheiser UAC1 FS headset (adaptive): playback and capture.
    • Yamaha MG-XU (UAC2 HS, asynchronous, behind a hub): capture, and
      explicit-feedback playback with allow_feedback=1.
    • Behringer UMC204HD (UAC2 HS, implicit feedback): stays on the host, and
      plays there while other devices are offloaded.
  • PTL, sof_sdw:
    • HUAWEI USB-C headset (UAC1 FS): playback S16_LE/S24_3LE up to 96 kHz, and
      capture.
    • CUBILUX CA7 (UAC2 HS, two PCMs): 2 to 8 channel playback, playback up to
      384 kHz on the second PCM, and capture on both.
  • Scenarios:
    • two playback and two capture streams concurrently, also with the
      deep-buffer frontends, and with host playback on another device;
    • xrun recovery (STOP/prepare/START), including S24_3LE devices;
    • unplug (deauthorize) during an active stream;
    • driver unbind/rebind and module reload;
    • s2idle with active playback and capture, including resume onto a
      different sideband resource.

Known limitations

  • A stream that is paused, or otherwise not running, across a system suspend
    is not reacquired: ALSA only sends TRIGGER_SUSPEND to running streams.
    This applies to all PCMs, not UAOL specific
  • One UAOL link and one registered host.
  • Devices behind a hub are rejected by the xhci sideband (patch 9); the
    test-only revert at the tip lifts that restriction.

Copilot AI balanced review requested due to automatic review settings November 19, 2026 14:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The FIFO prefilter can admit streams that exceed their allocated capacity and cause silent audio corruption, while rate-only refinement can accept unsupported sample rates.

2 open issues
What changed in this PR

Enables USB audio offload on Intel Lunar Lake and newer platforms, allowing the SOF DSP to stream through xHCI Audio Sideband while snd-usb-audio retains device ownership.

Changes:

  • Adds xHCI sideband resource management and USB audio offload ownership APIs.
  • Integrates SOF UAOL streams, feedback DMA, device constraints, suspend/resume handling, and per-stream route controls.
  • Adds machine-driver integration, build configuration, documentation, and 384-kHz stream-format support.
File Description
sound/​usb/​quirks.c Exports format quirks for offload use.
sound/​usb/​pcm.h Declares substream claim/release APIs.
sound/​usb/​pcm.c Adds exclusive substream claims and propagates endpoint errors.
sound/​usb/​offload/​offload.h Defines internal offload context and bridge interfaces.
sound/​usb/​offload/​Makefile Builds the offload library.
sound/​usb/​offload/​Kconfig Adds offload library configuration.
sound/​usb/​offload/​init.c Implements registration, notifications, and resource placement callbacks.
sound/​usb/​Makefile Includes the offload build directory.
sound/​usb/​Kconfig Includes offload configuration.
sound/​usb/​endpoint.h Declares endpoint ownership APIs.
sound/​usb/​endpoint.c Prevents host sharing of offloaded endpoints.
sound/​usb/​card.h Adds ownership state and platform-release declaration.
sound/​usb/​card.c Disconnects tracked devices before releasing platform operations.
sound/​soc/​sof/​topology.c Recognizes the UAOL DAI type.
sound/​soc/​sof/​sof-priv.h Adds machine-parameter finalization callback.
sound/​soc/​sof/​ipc4-topology.h Defines UAOL gateway configuration and stream mapping.
sound/​soc/​sof/​ipc4-topology.c Configures UAOL FIFOs and refreshes gateway data.
sound/​soc/​sof/​ipc4-priv.h Stores firmware UAOL support and capabilities.
sound/​soc/​sof/​ipc4-loader.c Parses firmware UAOL capabilities.
sound/​soc/​sof/​intel/​Makefile Builds Intel UAOL integration.
sound/​soc/​sof/​intel/​Kconfig Adds SOF USB offload configuration.
sound/​soc/​sof/​intel/​hda.h Defines UAOL state, limits, and shared interfaces.
sound/​soc/​sof/​intel/​hda.c Registers offload support and reports usable UAOL links.
sound/​soc/​sof/​intel/​hda-uaol.c Implements UAOL routing, constraints, and stream lifecycle.
sound/​soc/​sof/​intel/​hda-pcm.c Applies backend constraints and supports 384-kHz formats.
sound/​soc/​sof/​intel/​hda-mlink.c Adds UAOL link lookup.
sound/​soc/​sof/​intel/​hda-dai.c Adds UAOL DAIs and shares common callbacks.
sound/​soc/​sof/​intel/​hda-dai-ops.c Adds UAOL DMA operations and feedback DMA allocation.
sound/​soc/​sof/​intel/​hda-common-ops.c Wires UAOL-aware machine registration callbacks.
sound/​soc/​sof/​core.c Finalizes copied machine parameters before registration.
sound/​soc/​soc-usb.c Adds non-DT matching and per-stream route controls.
sound/​soc/​intel/​common/​sof-function-topology-lib.c Recognizes optional UAOL topology fragments.
sound/​soc/​intel/​boards/​sof_uaol_common.h Shares UAOL backend naming and counting helpers.
sound/​soc/​intel/​boards/​sof_sdw.c Creates UAOL backend links for SoundWire cards.
sound/​soc/​intel/​boards/​sof_board_helpers.h Adds UAOL link type and board parameters.
sound/​soc/​intel/​boards/​sof_board_helpers.c Creates UAOL links through shared board helpers.
sound/​soc/​intel/​boards/​skl_hda_dsp_generic.c Includes UAOL links in generic HDA cards.
sound/​hda/​core/​device.c Adds 384-kHz HDA stream-format encoding.
include/​sound/​usb-offload.h Defines the public USB audio offload interface.
include/​sound/​sof/​ipc4/​header.h Defines firmware UAOL capability messages.
include/​sound/​soc-usb.h Exposes route state, controls, and selection APIs.
include/​sound/​soc-acpi.h Adds UAOL machine parameters.
include/​sound/​hda-mlink.h Declares UAOL link lookup and its stub.
include/​linux/​usb/​xhci-sideband.h Exposes resource, endpoint-property, and restart APIs.
drivers/​usb/​host/​xhci.h Defines extended-property commands and resource tracking.
drivers/​usb/​host/​xhci.c Implements extended-property command execution.
drivers/​usb/​host/​xhci-sideband.c Implements audio endpoint handover and resource management.
drivers/​usb/​host/​xhci-ring.c Queues and handles extended-property commands.
drivers/​usb/​host/​xhci-mem.c Initializes and destroys sideband resource tracking.
Documentation/​sound/​soc/​usb.rst Documents routing APIs and platform-card controls.
Documentation/​sound/​soc/​index.rst Adds the UAOL documentation entry.

Review effort: Balanced

Comment thread sound/soc/sof/intel/hda-uaol.c Resolved
Comment thread sound/soc/sof/intel/hda-uaol.c Resolved
@ujfalusi
ujfalusi force-pushed the peter/sof/pr/uaol-01 branch from 5465b53 to 60134a0 Compare November 20, 2026 10:14
Copilot AI balanced review requested due to automatic review settings November 20, 2026 10:14
@ujfalusi

Copy link
Copy Markdown
Collaborator Author

Changes since v1

Folded into the existing UAOL patches in hda-uaol.c; patch count unchanged.

  • Check the FIFO fit with the real service interval. The frontend rules assume
    125 us, so a 1 ms device could pass negotiation and overrun its FIFO share
    (e.g. stereo 96 kHz packed 24-bit: 1152 bytes against 1024). After the
    acquire, two intervals in whole frames are checked against the share and the
    stream is refused with -EINVAL if larger. An exact fit is allowed (384 kHz
    stereo, 500 us endpoint). (Review comment)
  • Device rules now depend on the parameter they refine, so a RATE-only
    HW_REFINE is checked too. (Review comment)
  • Deep buffer and playback PCM share one backend, endpoint and mixer. The
    backend now remembers what the first frontend opened it with and refuses a
    different second frontend with -EBUSY. Frontend rules clone those parameters
    for the second one. A mismatch used to crash in the SOF core.
  • Docs updated.

Tested on PTL (SoundWire and HDA): 384 kHz S16 on a high-speed adapter, two
slots with different formats (12 runs), deep-buffer mismatch rejected while
the first stream keeps playing. The full UAOL suite last passed 32/32, before
the deep-buffer change.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical shutdown-ordering and sample-width accounting errors can stop USB endpoint service while the DSP remains active and underestimate FIFO requirements, risking stalled streams and corrupted audio.

3 open issues
2 resolved since last review

Review effort: Balanced

Comment thread sound/soc/sof/intel/hda-uaol.c Resolved
Comment thread sound/soc/sof/intel/hda-uaol.c Resolved
Comment thread drivers/usb/host/xhci-sideband.c Resolved
@ujfalusi
ujfalusi force-pushed the peter/sof/pr/uaol-01 branch from 60134a0 to 43ee753 Compare November 23, 2026 11:01
Copilot AI balanced review requested due to automatic review settings November 23, 2026 11:01
@ujfalusi

Copy link
Copy Markdown
Collaborator Author

Changes since v2:

Changelog since the "UAOL diet" marker (12 commits, all fixup! or amend! on top of a239254, so squashing them folds each change into its target patch)

Library

  • Descriptor filter dropped (d7da581, amend! of "Add USB audio offload library"). A device is a candidate if it is full or high speed, with an audio-class control interface and at least one PCM that snd-usb-audio set up. The streams are the ones usb-audio parsed, so a device with one bad interface can still offload its good PCMs.
  • Implicit feedback always stays on the host (10bf78f). Before, allow_feedback=1 or a host without async_playback_on_host offloaded it. The hardware can't follow an implicit-feedback clock.
  • 24-bit handling (c376c78, 8e05182, 64e9b19).
    usb_offload_acquire_stream() now finds the device's container itself (S24_LE first, S24_3LE as the fallback) and reports it in usb_offload_stream_hw.format.
    SOF sets the BE params to that format after the acquire and reapplies it in prepare.
    usb_offload_resolve_format() is removed.

ASoC and SOF

  • Routes in soc-usb (79dd2a5, 33034a5 for a comment). The default selection is no longer stored. Route N resolves to the Nth available pair, and a write pins it. This removed auto-select, take-over of duplicate routes and their helpers.
  • hda-uaol.c rules (428568e, 0078ef1). The per-parameter rule functions are merged into single rules that use rule->var: the device rules, the deep-buffer shared-parameter rules, and the FIFO bound for rate and channels. No behaviour change.

Docs (c2d0a93, 2d7ea53, bd7019f): updated for all of the above.

Behaviour changes to be aware of

  • Partial offload of a device with a malformed interface (see the first library bullet).
  • The default route can differ from the old "first pair no other route has" in some multi-device orderings.
  • Implicit-feedback formats are never offloaded.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Ignored Stop Endpoint failures can allow unsafe link teardown and controller stalls, while endpoint validation outside the lock can race with device removal and crash the kernel.

5 open issues

Review effort: Balanced

Comment thread drivers/usb/host/xhci-sideband.c Resolved
Comment thread sound/usb/offload/usb-audio.c Resolved
@ujfalusi
ujfalusi force-pushed the peter/sof/pr/uaol-01 branch from 43ee753 to d97558a Compare November 24, 2026 14:10
Copilot AI balanced review requested due to automatic review settings November 24, 2026 14:10
@ujfalusi

Copy link
Copy Markdown
Collaborator Author

Changes since v3:
The series is now 53 patches (was 70), on the same topic/sof-dev base.

  • Series
    All fixups are folded into their patches, and the HACK and marker commits are gone.
    The 4 patches that only patched earlier code from this series are merged into the ones they fix.
    The route controls patch is split into three: track devices and routes, add the controls, notify on hotplug.
    Mathias's xhci patches are replaced with his new set. The hub patch and its revert stay as they were.

  • Behaviour
    Playback with implicit feedback, and the capture it syncs to, always stays on the host. async_playback_on_host now only gates asynchronous playback with explicit feedback.
    Route model: writing a control pins the route to that pair, and an unwritten route follows a default. A busy route refuses changes with -EBUSY. Hotplug notifies INFO|VALUE on every route control. snd_soc_usb_connect() returns -ENODEV or -EEXIST.
    On unplug the host is notified first, so it ends its streams and stops the DSP before the library releases the streams and resources.

  • Fixes from review
    hda-uaol: no dangling jack, locked disconnect report, READ_ONCE/WRITE_ONCE on stream state, a joining frontend gets the backend's format, and the feedback stream is unwound if a start fails.
    IPC4 stream counts are validated, so a link the gateway can't be built for isn't offered.
    xhci_sideband_start_endpoint() is now properly locked.
    Commit messages and docs no longer describe removed behaviour.

  • Testing
    Every changed commit builds with no warnings.
    Booted on both DUTs: unplug during streaming, s2idle and unplug during suspend on PTL-HDA, and both slots at once on PTL-SDW. A lockdep run on an earlier build showed no splats.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Format filtering checks only rate bounds rather than discrete entries, allowing ALSA to select an incompatible format and fail rate refinement despite a valid configuration being available.

4 open issues
2 resolved since last review

Review effort: Balanced

Comment thread sound/usb/offload/usb-audio.c Resolved
@plbossart

Copy link
Copy Markdown
Member

@ujfalusi there's already support for USB offload on QCOM platforms, I reviewed their patches a very long time ago, see https://lore.kernel.org/linux-sound/20250409194804.3773260-1-quic_wcheng@quicinc.com/

The main difference with your solution is that the USB card exposes a control that tells the sound server if there's a matching offloaded card/device, see below excerpt from the introduction

tinymix -D 2 contents
Number of controls: 10
ctl     type    num     name                                    value
0       INT     2       Capture Channel Map                     0, 0 (range 0->36)
1       INT     2       Playback Channel Map                    0, 0 (range 0->36)
2       BOOL    1       Headset Capture Switch                  On
3       INT     1       Headset Capture Volume                  10 (range 0->13)
4       BOOL    1       Sidetone Playback Switch                On
5       INT     1       Sidetone Playback Volume                4096 (range 0->8192)
6       BOOL    1       Headset Playback Switch                 On
7       INT     2       Headset Playback Volume                 20, 20 (range 0->24)
8       INT     1       USB Offload Playback Card Route PCM#0   0 (range -1->32)
9       INT     1       USB Offload Playback PCM Route PCM#0    1 (range -1->255)

The example highlights that the userspace/application can utilize the offload path
for the USB device on card#0 PCM device#1.

@ujfalusi

ujfalusi commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

@ujfalusi there's already support for USB offload on QCOM platforms, I reviewed their patches a very long time ago, see https://lore.kernel.org/linux-sound/20250409194804.3773260-1-quic_wcheng@quicinc.com/

Yes, I'm aware of that and the SOF implementation is following as much as possible from that design.

The main difference with your solution is that the USB card exposes a control that tells the sound server if there's a matching offloaded card/device, see below excerpt from the introduction

tinymix -D 2 contents
Number of controls: 10
ctl     type    num     name                                    value
0       INT     2       Capture Channel Map                     0, 0 (range 0->36)
1       INT     2       Playback Channel Map                    0, 0 (range 0->36)
2       BOOL    1       Headset Capture Switch                  On
3       INT     1       Headset Capture Volume                  10 (range 0->13)
4       BOOL    1       Sidetone Playback Switch                On
5       INT     1       Sidetone Playback Volume                4096 (range 0->8192)
6       BOOL    1       Headset Playback Switch                 On
7       INT     2       Headset Playback Volume                 20, 20 (range 0->24)
8       INT     1       USB Offload Playback Card Route PCM#0   0 (range -1->32)
9       INT     1       USB Offload Playback PCM Route PCM#0    1 (range -1->255)

The example highlights that the userspace/application can utilize the offload path
for the USB device on card#0 PCM device#1.

Yes, and this is deliberate. QC is locking the offload to the last appearing USB audio device, so if you insert a USB device, the offload can go there, then if you insert another, the offload moves there, so on.
This is fine for mobile devices, with a single USB you are not going to insert multiple USB audio devices.

On Intel hardware we have 2x playback stream and 4 rx streams: 2 capture and 2 for playback feedback) support and laptops tends to have multiple USB ports and users can insert multiple devices. There are also devices with multiple PCMs...

What I wanted to have is to be able to select the destination for the two possible playback and capture for the offload, so we give this to user space with the 4x route selection enums, for example for the playback 0 stream:

amixer -csofsoundwire cget iface=CARD,name='USB Offload 0 Playback Route'
numid=37,iface=CARD,name='USB Offload 0 Playback Route'
  ; type=ENUMERATED,access=rw------,values=1,items=3
  ; Item #0 '0,0 | HUAWEI USB-C HEADSET - USB Audio'
  ; Item #1 '1,0 | CUBILUX CA7 - USB Audio'
  ; Item #2 '1,1 | CUBILUX CA7 - USB Audio #1'
  : values=0

and you select where to direct the offload.

If QC wants, they can adapt this fro flexibility, but using the last (or first) endpoint was too limiting for my liking.
Take CUBILUX for example: it has two PCMs (one 384K/stereo, the other 48K/5.1). with static offload you could only target one of the endpoints.
The USB offload jack will tell user space on the SOF card our jack is on when at least one offload-capable device is connected, which is the same as QCOM. "Single" reads as "exactly one" (re-suing the existing code).

We also support capture, hence the 2x 2x route selection

The documentation patch have some use case diagram on how I think this can be handled in a user friendly way.

@ujfalusi
ujfalusi force-pushed the peter/sof/pr/uaol-01 branch from d97558a to 9ca2c3e Compare November 25, 2026 07:02
Copilot AI balanced review requested due to automatic review settings November 25, 2026 07:02
Add writable enumerated controls that let userspace select the USB
device and PCM each offloaded stream of a direction goes to. Every
(device, pcm) pair of a direction is one item, and with no device
connected the only item is "None", so the control stays valid. Each
route gets a control of its own, "USB Offload 0 Playback Route", "USB
Offload 1 Playback Route" and so on; the number is the route and is
always there, so the names do not depend on the stream count. Swapping
two devices between two routes is two plain writes.

A route is pointed at a pair by writing its control, which pins it to
that pair until the device is disconnected, when it falls back to its
default.

The backend can veto a write which would change what a route points at:
the optional is_route_busy() callback is asked about the route, and the
write fails with -EBUSY while a stream is set up on it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…sconnects

Connecting or disconnecting a device changes the items of every route
control, and the pair of the routes which follow the default. Notify
SNDRV_CTL_EVENT_MASK_INFO and SNDRV_CTL_EVENT_MASK_VALUE on all of them,
so that userspace re-reads both.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The USB Audio Offload Link (UAOL) is enumerated as an alternate HDaudio
multi-link by hda_bus_ml_init(), but nothing keeps track of it
afterwards, so a machine driver has no way to learn how many UAOL
backends it should create.

Read the link count once the controller is initialized and pass it to
the machine driver in mach_params as a link mask, next to the BT offload
link mask, with a module parameter to override it for testing.

The count comes from the SLCOUNT field of the link's AZX_REG_ML_LCAP,
which can encode up to eight sublinks. Only sublink 0 can be reached:
hda-mlink has no instance offset for UAOL, so every sublink resolves to
the registers of sublink 0. Clamp the count to one. A single link is not
a practical restriction, the firmware reports the number of streams it
can carry and one link serves more than one endpoint.

The mask describes what the controller exposes. Whether the firmware can
serve those links is not known this early in the probe and is handled
separately.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Whether a booted firmware can do USB Audio Offload, and to what extent,
is described by two parts of the firmware configuration, both ignored so
far.

Firmware configuration tuple 21, which the kernel names RESERVED, tells
whether the firmware has been built with UAOL support. The hardware
configuration carries the IPC4_UAOL_CAPS_HW_CFG tuple: the number of
UAOL links and, for each, the supported input, output and bidirectional
stream counts and the maximum TX and RX FIFO sizes, i.e. how many streams
can be offloaded before the resources run out.

Parse both, store them and print the capabilities for debugging. The link
count comes from the firmware and is used as the length of a flexible
array member, so validate it against the tuple size before copying.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The machine params are filled in when the machine is selected, before
the firmware has booted, and the selected machine is not touched
afterwards. The UAOL link mask is the first parameter that also depends
on the booted firmware: the controller enumerates the links regardless
of what the firmware can do with them, and a machine driver creating
backends for them with a firmware that cannot serve them fails to load
the topology.

sof_machine_register() already hands the machine driver a copy of the
selected machine. Add an optional finalize_mach_params() platform op and
run it on that copy right before it is registered, so the platform can
fold in what it only learned from the firmware while the selected
machine stays as it was.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The USB audio offload library tracks offload capable USB audio devices
and needs a host that owns the DSP. On Intel platforms that host is SOF,
which reaches the xHCI controller over a USB Audio Offload Link (UAOL).

Add the registration with the library, to run once the firmware has
booted, and the unregistration on remove. One offload context in the
library is one UAOL link, over which the DSP reaches an xHCI controller.

The offload capabilities are part of the firmware configuration, which is
only parsed after post_fw_run, so the registration is done from
machine_register, the first hook that runs late enough. The hook is not
installed yet: the library reports the devices it tracks to the driver,
which needs the rest of the offload support in place to act on them.

Implement finalize_mach_params() to tell the machine driver what the
booted firmware can serve: a link with T output and I input streams
carries T playback and I - T capture streams, the remaining T input
streams being the clock feedback of the playback streams. Report the
two counts in two new mach_params fields, with the static DAI count as
the ceiling, and withdraw the link mask when the firmware does not
support UAOL or the link has no usable stream.

The firmware lays the UAOL link FIFOs out by stream, and the xHCI
resource an endpoint gets is what selects the stream (stream = resource -
1), so a capture endpoint has to stay on the streams the firmware reads
audio from and a clock feedback endpoint on the ones it reads feedback
from. Implement the library's get_resource_range() op from the link's
stream capabilities: playback on the output streams, capture on the
input streams before the feedback ones, feedback on the last T input
streams. With two output and four input streams this is resources 1-2,
3-4 and 5-6.

SOF's pipeline only has S24_LE as 24-bit representation, while a USB
device commonly packs 24-bit audio into 3 bytes. Set s24_3le_as_s24_le
so the library treats the two as interchangeable during negotiation.

The firmware applies the clock feedback of an asynchronous playback
stream by spreading the samples linearly over the service interval,
which is audible on the gear that uses asynchronous playback in the
first place. Set async_playback_on_host so the library leaves such
streams to the host.

A failing registration only means that offload is unavailable, it does not
fail the probe of the audio card.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The UAOL alternate link is already enumerated and its link type is
reported as HDA_BUS_ML_LINK_UAOL, but there is no way for a client to
retrieve the hdac_ext_link for it.

Add hdac_bus_eml_uaol_get_hlink() following the existing SSP, DMIC and
SoundWire helpers. It is needed by the UAOL DAI to assign a link DMA
channel.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
SOF_DAI_INTEL_UAOL is defined in the IPC ABI but it is not reachable
from topology: find_dai() has no matching name, so a topology using it
resolves to SOF_DAI_INTEL_NONE, and the IPC4 dai_config op rejects the
type as unsupported.

Add the "UAOL" name to the DAI type table and accept the type in
sof_ipc4_dai_config(). Unlike HDA, the node index of the copier gateway
is not the link DMA stream tag but the UAOL link stream the endpoint is
routed to, which is only known once the USB endpoint has been claimed;
the DAI sets it from its own hw_params path.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Provide the CPU DAIs and the widget DMA ops needed to run a stream over a
UAOL link.

The UAOL link is an ACE2+ alternate link using a link DMA, so the
generic HDA link DMA handling applies unchanged and the ops are
identical to the SSP and DMIC ones, only the hlink lookup and the
stream format calculation differ. The UAOL DAI code gets a file of its
own, hda-uaol.c, built into the HDA common module when
SND_SOC_SOF_INTEL_USB_OFFLOAD is enabled; the DAI callbacks and helpers
of hda-dai.c it builds on are made visible within the module for that.

A UAOL link runs several streams at a time, two in each direction on the
current hardware, and each stream the link can carry concurrently needs
a backend of its own, in the way a SoundWire link gets a backend per
PDI. Give the component a playback and a capture DAI for each stream,
"UAOL0 Playback Pin0", "UAOL0 Playback Pin1", "UAOL0 Capture Pin0" and
"UAOL0 Capture Pin1". The DAIs are unidirectional: the link's streams
are, and the backend hw_params fixup is not told the direction, so a
duplex DAI would gain nothing. The pin number only tells the DAIs of a
direction apart, it is not the UAOL stream the DAI runs on: that is
decided by the xHCI sideband resource the endpoint gets when the USB
device is acquired.

The DAIs are kept last in skl_dai[], as the number of DAIs the component
registers is a prefix of the array.

The link DMA stream allocator already knows about HDA_BUS_ML_LINK_UAOL
and applies the ACE2+ allocation constraints to it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The offload library reports offload capable USB audio devices to the
driver, but they still have to be presented to the ASoC USB framework so
that a card can route to them.

Allocate the ASoC USB port when the first UAOL DAI is bound into a card
and release it when the DAI goes away. It cannot be done when the offload
library is started: the firmware boots before the audio component is
registered, so there is no component to hand over at that point. Devices
which enumerated before the card existed are rediscovered by the ASoC USB
core when the port is added.

The connected devices are kept on a list owned by the controller, which
is where the DAI looks up the device to offload. The record has its own
list node, struct snd_soc_usb_device's list_head belongs to the ASoC USB
core.

A device can expose several PCMs (e.g. separate speaker and line-out
streams) and the link runs several streams per direction, each on a
backend of its own. Which device and PCM a backend plays to is decided
by the ASoC USB route controls: give the port as many routes per
direction as the link has streams, create the controls with the port and
report each PCM's name for the controls to show. The selected PCM's
sideband resources are acquired only once a stream on it is actually
started.

The UAOL PCMs exist whether or not a device is connected, so report the
availability on a SND_JACK_USB jack named "USB Offload Jack", the name the
Qualcomm offload path uses. The jack follows the device list, so removing
one of several connected devices leaves it reported. It is created before
the port is added, as that is what reports the already connected devices.

The UAOL PCMs also exist if the driver could not register with the
offload library, so the jack is created in that case too and reported
off.

The port can go away with the card while a device is being reported, so
the port check and the record are handled under the device list lock and
a device the port refused is dropped again rather than kept as known.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The UAOL backend DAI only sets up the link DMA, the DSP side of the link.
Nothing claims the USB side, so the endpoint the DSP is supposed to read
from is still owned by the host and its transfer ring does not even
exist: a ring is only allocated once the streaming altsetting is
selected.

Acquire the stream from the offload library in hw_params and release it
in hw_free. This starts the device on the USB side, hands its endpoint
ring to the DSP and takes the device away from user space for as long
as the DAI holds it.

Every UAOL CPU DAI claims a struct hda_uaol_stream of its own when it
probes, found from the DAI on every callback: that is where the acquired
device and its USB PCM, the backend substream and the suspended flag of
the backend live, so the backends of a direction do not step on each
other. The ASoC USB route a backend plays to is the pin number of its DAI
name, "UAOL0 Playback Pin1" playing to playback route 1.

DPCM runs a backend's hw_params once for every frontend that reaches its
own hw_params while the backend is still in the OPEN, HW_PARAMS or
HW_FREE state, so with a playback PCM and its deep buffer opened at once
the backend sees two calls. The stream is acquired by the first one only,
and released from hw_free, which DPCM runs once the last frontend is
gone.

A system suspend resets the pipeline and frees the DAI copier while the
stream stays open, taking the device's streaming altsetting with it. DPCM
brings such a stream back through the backend's prepare, not hw_params,
so acquire the stream again from prepare when the backend saw a suspend
trigger. The trigger runs under the PCM stream lock and only records the
fact.

Which device and which of its PCMs a backend offloads is the ASoC USB
route control's decision: the DAI resolves the selection of its route
when acquiring the stream and reports the route as busy while it holds
one, so the selection cannot change under a running stream.

Unplugging the device a stream plays to would otherwise leave that
stream running: the library gives the USB side back and the host drops
the device from the port, but nothing reaches the frontend, so the link
keeps running into a dead endpoint and the application keeps feeding it.
The USB audio card ends its users' streams when it goes away, by
stopping them into the DISCONNECTED state; do the same for the frontends
routed to the backends whose stream belongs to the unplugged device, so
that the application sees the device disappear the way it does when
playing to the card directly. The backend substream is remembered along
with the device for that, and the frontends are walked under the card's
DPCM mutex, which the backend's hw_params and hw_free also hold. The
backend then forgets the device: the library has given the USB side back
already and the usb_device goes away with the disconnect, so the hw_free
of the frontends' teardown must not hand it to the library again.

SOF only hands this DAI S24_LE, while a USB device commonly packs 24-bit
audio into 3 bytes. The library reports the container the acquired stream
runs in, so set the link DMA up from that, so that it runs the same 24-bit
container and the DSP packs the samples on their way to the link. DPCM
hands hw_params a copy of the params, while prepare programs the link DMA
again after a stop from the backend's own copy, so prepare applies the
container to that one as well.

A second frontend, the deep buffer, can share the backend with the one
which has it open. They share the one endpoint and the one mixer, so the
second one can only run what the first one opened the backend with: the
rate, the channel count and the format. Remember those when the stream is
acquired and refuse a joining frontend which asks for anything else, before
the core prepares anything for it.

The route control refuses to change a route while its backend holds a
stream, but the selection is read before the device is acquired and the
route is marked busy once it is held. Read the selection back once the
stream is set: the control decides whether the route is busy under the
lock the selection is read with, so a change made during the acquisition
is seen there and a later one is refused. Release the stream and fail
with -EBUSY when the selection moved, the stream has not started yet.

Keep a stream suspended by the SUSPEND trigger marked until it is acquired
again: a prepare retried after a failed one, after a route change in
between or after the device went away, must not run the common prepare
and start the DSP on a gateway whose xHCI sideband resources were
released and may belong to another stream by then. Clear the flag only
once the stream is acquired again, or the stream is closed, and fail
prepare when the backend has no device.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The UAOL gateway needs a configuration blob the topology cannot provide:
it describes the link and the USB endpoint behind it, neither of which is
known before the stream is opened. The firmware reads it as a sequence of
TLVs: the xHCI bus address, the link configuration, the FIFO start
address offsets, the data and feedback endpoint information, the ART
divider and the endpoint's service interval.

Define the blob and build it when the DAI widget is set up, since its
size is part of the copier IPC. The link index, the ART divider and the
FIFO layout are known at that point: the link FIFO is divided evenly
between the streams of a direction, with the T output streams carrying
playback and the I input streams carrying the capture and the clock
feedback. The fields which describe the USB endpoint are left for the
platform code to fill in once the stream has been acquired.

The number of streams per direction the link is advertised with comes
from sof_ipc4_uaol_get_stream_counts(), which the FIFO layout uses as
well: a link the gateway configuration cannot be built for, because the
firmware reports more streams than it has room for or none to play to,
is not offered with UAOL PCMs which would fail to set up.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The UAOL gateway configuration blob describes the USB endpoint behind
the link, which is only known once the stream has been acquired.

Complete the blob in hw_params with the xHCI address, the endpoint
information, the sideband resource the endpoint was given and the
endpoint's service interval. The resource number is also the UAOL
stream, which selects the gateway node index. The service interval lets
the firmware size the FIFO time slot to the endpoint's real cadence
(1000 us for a standard isochronous endpoint, 125-500 us for high
bandwidth ones) instead of assuming one.

The feedback fields of the configuration are cleared when the acquired
stream has no feedback endpoint, as they can be left over from a
previously offloaded device.

A widget freed on system suspend stays prepared, so on resume its IPC
payload is not rebuilt and sof_ipc4_widget_setup() refreshes only the
copier data and the DMA config TLVs; the gateway configuration in between
would be sent as it was copied at prepare time. The stream is acquired
again on resume, and the sideband resource, with it the UAOL stream index
the blob carries, and the slot of the device need not come back the same.
Refresh the gateway configuration from copier_config at setup as well. For
the other DAI types it has not changed since prepare and the copy is the
same.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…FIFO

The share of the link FIFO a UAOL stream is given is decided when the
gateway is configured, and the rate, the channel count and the format
together decide whether the stream fits in it. An overrun is not reported
anywhere, the audio just comes out corrupted.

The limit is a single byte rate, so it cuts across all three parameters
at once: 192kHz stereo S32_LE needs exactly as much room as 48kHz 8
channel S32_LE. Add hardware rules for the three parameters to the
frontend so that only the combinations which fit are offered.

The real service interval is not known before a device's altsetting is
resolved, so the rule assumes the shortest possible one (125 us) as a
coarse pre-filter rather than capping high-bandwidth devices needlessly.
Once the USB stream is acquired, the actual service interval is known:
check the payload of two such intervals, rounded to whole sample frames,
against the FIFO share and refuse the stream if it is larger. A payload
which is exactly as large as the share fits.

The frontend's backends are resolved before it is opened, and everything
the core does to runtime->hw afterwards only narrows it, so the rules are
added from the platform PCM open. The hook looks at the backends the
frontend routes to and acts on the UAOL ones only; others whose
capabilities are only known at runtime could be added to it.

The limit is the FIFO share the layout computed for the gateway
configuration gives a stream. Add sof_ipc4_uaol_get_fifo_size(), returning
the bytes a stream of a direction can use on a link, so that the platform
code and the gateway agree on the number.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The capabilities of the connected device cannot be coded into the
topology file, the user can connect a wide range of devices. The topology
provides a broad set of formats, rates and channels for the UAOL PCM,
which is then narrowed down to what the actual USB device supports.

For example:
tplg: S16_LE/S24_LE/S32_LE, 48K/96K, stereo,
headset: S16_LE only, 8-192K, stereo/2ch

result on PCM:
S16_LE (S24_LE/S32_LE dropped), 48K/96K, stereo

The device is brought in as hardware rules and not as plain ranges,
because what one parameter can be depends on the other two: a device can
have a multichannel stream at one rate and a stereo one at another, and
the ranges alone would offer the combination of the two that it does not
have. The rules resolve the selected device on every call, so a device
connected, removed or selected while a PCM sits open is picked up on the
next negotiation. Each rule also depends on the parameter it refines, so
that a request which changes only that parameter is checked against the
device as well.

A frontend which shares the backend with one that has it open, the deep
buffer, can only run what the first one opened the backend with. Add rules
which clone those parameters as the only ones allowed to the second
frontend, so that userspace negotiates against the running stream. They
read what the first frontend opened the backend with when they are
evaluated, so they allow everything while the backend is idle.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The firmware reads a USB device's clock feedback endpoint through a link
DMA of its own, which it expects as a second DMA config TLV in the UAOL
gateway configuration (host_dma_config[1]). The driver only ever
supplied the audio link DMA, so the firmware ran every playback stream
without rate feedback.

When the acquired USB stream has a feedback endpoint, allocate a second
link DMA stream on the UAOL link, in the capture direction, and
describe it in dma_config_tlv[1] the same way the audio one is
described in dma_config_tlv[0]. It belongs to the playback substream
but is neither the DAI's DMA data nor a stream of its own, so it is
kept with the backend's stream state, is not registered as the
link_substream, and is run and stopped from the UAOL trigger alongside
the audio stream. It is released, and its TLV cleared, together with the
USB stream, so that a following device without feedback does not inherit
it.

hda_link_stream_assign() gets the stream direction as a parameter for
that, and the release of a link stream is factored out so that it can
be undone without a DAI DMA data pointer.

Co-developed-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The offloaded stream is released from the host's hw_free, which runs
only after the DSP has stopped and freed its side of the link. Until
then the xHCI keeps servicing the offloaded endpoints. An isochronous
IN endpoint, the feedback endpoint of a playback stream in particular,
then has nowhere to deliver its packets, which can stall the
controller's periodic schedule and lock it up.

Add usb_offload_quiesce_stream() so that the host can stop the
endpoints on the controller once its own side of the link has stopped,
before it is torn down.
The feedback endpoint is stopped first, then the data endpoint. The
sideband resources stay claimed and usb_offload_release_stream() still
has to follow. The stream is named the way release_stream() names it,
by its direction and USB PCM device number.

Co-developed-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
usb_offload_quiesce_stream() stops the endpoints of an offloaded stream
when the host stops it. A stream can be started again without being
released in between, which is how an xrun is recovered from, and its
endpoints then stay stopped: the stream stalls.

Add usb_offload_restart_stream() for the host to run before it starts its
own side of the link again. The data endpoint is restarted first, the
feedback endpoint, which the quiesce stops first, last. The stream lookup
is shared with the quiesce.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The library claims the USB substream it offloads, but the endpoints the
DSP drives can still be shared with a host stream: with implicit feedback
the capture data endpoint is also the sync source of the device's
playback. An offloaded capture stream and the host's playback then both
run that endpoint, the host submitting URBs on a ring the sideband owns,
and both stall.

Claim the data endpoint, and an explicit feedback endpoint, with
snd_usb_endpoint_claim_offload() right after their hw_params, before
anything is set up on them, and release them before the stream's
hw_free. An endpoint which another stream has open already fails the
acquisition with -EBUSY, and the host cannot open one while the stream is
held. The test whether a stream has an explicit feedback endpoint is
shared with the feedback reservation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
snd_usb_pcm_prepare() runs snd_usb_set_format_quirk() whenever it sets
up the data endpoint afresh. The library prepares the endpoints itself and
skipped it, leaving a device which takes its sample rate through vendor
requests at whatever rate it ran last. Export the quirk and run it the
same way.

Some quirks only set up the host's URB path: the MacroSilicon MS2100 and
MS2109 capture cards need the first two bytes of the stream dropped, or
the channels come out swapped and out of phase, and the E-Mu devices
need the start of each packet skipped at 176.4 and 192kHz. The DSP gets
the data as the device sends it, so refuse a stream that is left with
such an offset with -EOPNOTSUPP. The E-Mu devices are vendor class and
never pass the candidate filter, the MacroSilicon cards do.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…s UAOL

The USB stream is released from hw_free, after the DAI copier has been
freed and the UAOL link powered off. Until then the xHCI keeps
servicing the offloaded endpoints, and the feedback IN endpoint has
nowhere to deliver its packets, which can lock up the controller.

On TRIGGER_STOP and TRIGGER_SUSPEND, stop the xHCI endpoints with
usb_offload_quiesce_stream() right after hda_dai_trigger() has stopped
the DAI pipeline. They cannot be stopped any earlier: a UAOL stream
cannot go idle once the xHCI no longer services an endpoint still bound
to it, so the DSP would time out stopping both the audio and the
feedback stream and fall back to resetting them.

A stopped endpoint stays stopped until it is restarted, and only a
hw_free followed by hw_params, or the reacquire after a system suspend,
brings up fresh ones. A stream started again right after a stop, which
is how an xrun is recovered from (STOP, prepare, START), would run the
DSP against stopped endpoints: the link makes no progress and the
application's next write fails with -EIO. Remember that the endpoints
were stopped and restart them with usb_offload_restart_stream() on
TRIGGER_START, before the DSP starts its side of the link, so that they
run then as they do on the first start. Releasing the stream, at hw_free
or before a reacquire, forgets it.

Co-developed-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The pieces of the USB audio offload are in place: the device
notifications reach the ASoC USB port, the UAOL DAIs acquire, configure,
quiesce and restart the USB stream, and the frontends are constrained to
what the link and the device can carry.

Install hda_machine_register() as the machine_register op, so that the
driver registers with the USB audio offload library once the firmware
has booted and the library starts reporting the offloadable devices.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Create the UAOL backend DAI links from the link mask and the stream
counts reported in mach_params, following the BT offload link, with
their own function topology so that the PCMs they add do not collide
with the other functions of the card.

Each stream of each direction gets a link of its own: the backend
hw_params fixup is called without the stream direction, so a duplex link
could not tell which of the two DAI copiers describes the stream being
configured and would have to constrain both directions to the same
format. With two streams per direction the backends are "UAOL0-Play0",
"UAOL0-Play1", "UAOL0-Cap0" and "UAOL0-Cap1", on the CPU DAIs "UAOL0
Playback Pin0" and so on. The link and CPU DAI names are kept in
sof_uaol_common.h for the other boards to share.

The backends are created ordinal first, playback before capture within
an ordinal, so the first playback and capture backend keep two
consecutive IDs whatever the stream count, and a topology describing one
stream per direction stays valid. The ordinal only tells the backends of
a direction apart: it is not the UAOL stream the backend runs on, which
is decided by the xHCI sideband resource the endpoint gets when the USB
device is acquired.

The backend names are abbreviated on purpose: the topology names its DAI
copier widget "dai-copier.UAOL.<backend>.<direction>", and alsa-lib keeps
element ids in SNDRV_CTL_ELEM_ID_NAME_MAXLEN bytes, so from 38 characters
on the ids of the widget's "dai.word" and "dai.string" tuple sections
collide and one set is silently dropped from the topology.

The topology is named sof-uaol-id<BE id>.tplg after the id of the first
playback link. The function name carries no link index, like dmic and
hdmi, as the host driver reports a single link.

A missing UAOL function topology file is not fatal for the card: like
with best_effort the link is skipped when the topology files are
collected, and the card comes up without USB offload.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add a link type creating the UAOL backend DAI links from a link mask and
the stream counts per direction, so that boards using the helpers can
place them in their link order like any other backend.

Each stream of each direction gets a link of its own, named like sof_sdw
does it, see sof_uaol_common.h. The backends are created ordinal first,
playback before capture within an ordinal, so the IDs of the first
playback and capture backend do not depend on how many streams the link
has.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Create the UAOL backend DAI links from the link mask and the stream
counts reported in mach_params, following the BT offload link.

The board assigns fixed backend ids, so the UAOL links can take the ids
after the BT offload one regardless of which other functions are
present. A topology describing the UAOL therefore does not need a
variant per board configuration.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add Documentation/sound/soc/sof-uaol.rst, describing the USB audio
offload on Intel platforms with SOF: how the xHCI Audio Sideband, the
USB audio offload library, the ASoC USB framework, the SOF HDA driver
and the machine drivers fit together, what the user visible interface
is (the route controls and the jack), how a stream is acquired and
released, how the UAOL gateway is configured and how the firmware's
FIFO layout decides where an endpoint may be placed, the asynchronous
playback policy, and the current limits.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…s behind a hub"

This reverts commit 0e544eef569fbdb90db410b3457e37224788a6e2.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi

Copy link
Copy Markdown
Collaborator Author

Changes since v5:

  • xhci: sideband: reserve and track sideband endpoint use with resource IDs
    • comment typo fix
  • xhci: sideband: support handing over endpoints to hardware controlled audio sideband
    • ep->sideband and sb->eps[] are only updated after Set Resource completes
      successfully; a failed removal keeps the endpoint assigned
    • removing an endpoint that is not part of the sideband returns -ENODEV
    • xhci_sideband_unregister() clears endpoints left over from failed removals
  • ALSA: usb: offload: Reserve the isochronous feedback endpoint
    • keep the resource id reserved if the endpoint could not be detached
    • free only the reservation when adding the endpoint fails

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

One or more reviewer sessions failed, leaving the review evidence incomplete.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

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.

4 participants