From: Kyle Farrell <kaf@nwlink.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
Kyle Farrell <kaf@nwlink.com>
Subject: [PATCH 0/2] usb: gadget: uac2: support explicit channel counts
Date: Tue, 28 Jul 2026 22:41:13 -0700 [thread overview]
Message-ID: <20260729054115.889174-1-kaf@nwlink.com> (raw)
USB Audio Class 2.0 permits up to 255 channels in an audio channel cluster,
with bNrChannels specified independently of the channel-location bitmap
(bmChannelConfig). A zero channel-location bitmap indicates that the
channels have no predefined spatial positions.
The UAC2 gadget driver currently derives bNrChannels from the number of set
bits in bmChannelConfig. Since the descriptor defines only 27
channel-location bits, this limits playback and capture streams to 27
channels.
This series removes that limitation while preserving existing userspace
behavior. Existing ConfigFS channel-mask configuration continues to work
unchanged, while optional playback and capture channel-count attributes
allow non-spatial channel clusters to be described.
The series is split so that the shared u_audio infrastructure is updated
first without changing behavior, followed by the UAC2 functional change.
Patch 1:
Pass resolved playback and capture channel counts explicitly into
the shared u_audio implementation instead of deriving them from
channel masks.
Patch 2:
Add ConfigFS playback/capture channel-count attributes to the UAC2
function driver and use them when generating descriptors and stream
configuration, allowing counts beyond the 27 predefined channel
locations.
Testing
Testing was performed using a Raspberry Pi Zero 2 W configured as a USB
UAC2 gadget. Streaming and descriptor validation were performed against
both Linux and macOS hosts. Windows hosts were not tested.
UAC1
- Verified playback/capture operation via alsaloop.
- No descriptor or behavioral changes observed.
UAC2
- Verified legacy channel-mask configuration (1-27 channels).
- Verified explicit channel-count mode with 2, 28, 61, 62, 96 channels.
- Verified invalid channel-count/channel-mask combinations are rejected.
- Verified Feature Unit descriptor size limits are enforced.
- Verified descriptors including:
* bNrChannels
* bmChannelConfig
* Feature Unit presence and bLength
* AudioControl wTotalLength
* endpoint wMaxPacketSize
- Verified ALSA-reported playback and capture channel counts.
- Verified streaming using alsaloop.
Kyle Farrell (2):
usb: gadget: u_audio: pass channel counts explicitly
usb: gadget: f_uac2: allow explicit channel counts
.../ABI/testing/configfs-usb-gadget-uac2 | 18 ++++-
Documentation/usb/gadget-testing.rst | 18 ++++-
drivers/usb/gadget/function/f_uac1.c | 2 +
drivers/usb/gadget/function/f_uac2.c | 69 ++++++++++++++-----
drivers/usb/gadget/function/u_audio.c | 32 ++++-----
drivers/usb/gadget/function/u_audio.h | 2 +
drivers/usb/gadget/function/u_uac2.h | 4 ++
7 files changed, 105 insertions(+), 40 deletions(-)
base-commit: 1590cf0329716306e948a8fc29f1d3ee87d3989f
--
2.34.1
next reply other threads:[~2026-07-29 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 5:41 Kyle Farrell [this message]
2026-07-29 5:41 ` [PATCH 1/2] usb: gadget: u_audio: pass channel counts explicitly Kyle Farrell
2026-07-29 5:41 ` [PATCH 2/2] usb: gadget: f_uac2: allow explicit channel counts Kyle Farrell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260729054115.889174-1-kaf@nwlink.com \
--to=kaf@nwlink.com \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox