Skip to content

Commit 342f482

Browse files
authored
Merge pull request #40 from MultiTracksDotCom/develop
Merge develop into main (0.1.1) Alpha
2 parents 138a096 + 2e3a4fe commit 342f482

2 files changed

Lines changed: 26 additions & 10 deletions

File tree

Documentation/ABI/testing/configfs-usb-gadget-uac2

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ Description:
55
The attributes:
66

77
===================== =======================================
8-
c_chmask capture channel mask
8+
c_chmask capture channel mask; bits 0-26 correspond
9+
to the UAC2 spatial channel positions (UAC2
10+
spec 4.1 Table 4-1). Masks that stay within
11+
bits 0-26 are used directly as bmChannelConfig
12+
in the USB descriptor. Any bit set outside
13+
0-26 triggers non-predefined spatial location
14+
mode (bmChannelConfig=0), which allows more
15+
than 27 channels; the channel count equals
16+
popcount(c_chmask) in both cases.
917
c_srate list of capture sampling rates (comma-separated)
1018
c_ssize capture sample size (bytes)
1119
c_hs_bint capture bInterval for HS/SS (1-4: fixed, 0: auto)
@@ -20,7 +28,8 @@ Description:
2028
c_volume_res capture volume control resolution
2129
(in 1/256 dB)
2230
fb_max maximum extra bandwidth in async mode
23-
p_chmask playback channel mask
31+
p_chmask playback channel mask; same semantics as
32+
c_chmask above
2433
p_srate list of playback sampling rates (comma-separated)
2534
p_ssize playback sample size (bytes)
2635
p_hs_bint playback bInterval for HS/SS (1-4: fixed, 0: auto)

drivers/usb/gadget/function/f_uac2.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -989,10 +989,6 @@ static int afunc_validate_opts(struct g_audio *agdev, struct device *dev)
989989

990990
if (!opts->p_chmask && !opts->c_chmask)
991991
msg = "no playback and capture channels";
992-
else if (opts->p_chmask & ~UAC2_CHANNEL_MASK)
993-
msg = "unsupported playback channels mask";
994-
else if (opts->c_chmask & ~UAC2_CHANNEL_MASK)
995-
msg = "unsupported capture channels mask";
996992
else if ((opts->p_ssize < 1) || (opts->p_ssize > 4))
997993
msg = "incorrect playback sample size";
998994
else if ((opts->c_ssize < 1) || (opts->c_ssize > 4))
@@ -1090,14 +1086,25 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
10901086

10911087

10921088
/* Initialize the configurable parameters */
1089+
/*
1090+
* UAC2 spec §4.1: bmChannelConfig bits 27-30 are reserved and must be
1091+
* zero. For channel masks that exceed the 27 defined spatial positions
1092+
* (bits 0-26), use bmChannelConfig=0 (non-predefined spatial locations)
1093+
* with bNrChannels set from the popcount of the full mask. This is the
1094+
* standard-compliant way to declare more than 27 channels.
1095+
*/
1096+
u32 c_chanconfig = (uac2_opts->c_chmask & ~UAC2_CHANNEL_MASK) ?
1097+
0 : uac2_opts->c_chmask;
1098+
u32 p_chanconfig = (uac2_opts->p_chmask & ~UAC2_CHANNEL_MASK) ?
1099+
0 : uac2_opts->p_chmask;
10931100
usb_out_it_desc.bNrChannels = num_channels(uac2_opts->c_chmask);
1094-
usb_out_it_desc.bmChannelConfig = cpu_to_le32(uac2_opts->c_chmask);
1101+
usb_out_it_desc.bmChannelConfig = cpu_to_le32(c_chanconfig);
10951102
io_in_it_desc.bNrChannels = num_channels(uac2_opts->p_chmask);
1096-
io_in_it_desc.bmChannelConfig = cpu_to_le32(uac2_opts->p_chmask);
1103+
io_in_it_desc.bmChannelConfig = cpu_to_le32(p_chanconfig);
10971104
as_out_hdr_desc.bNrChannels = num_channels(uac2_opts->c_chmask);
1098-
as_out_hdr_desc.bmChannelConfig = cpu_to_le32(uac2_opts->c_chmask);
1105+
as_out_hdr_desc.bmChannelConfig = cpu_to_le32(c_chanconfig);
10991106
as_in_hdr_desc.bNrChannels = num_channels(uac2_opts->p_chmask);
1100-
as_in_hdr_desc.bmChannelConfig = cpu_to_le32(uac2_opts->p_chmask);
1107+
as_in_hdr_desc.bmChannelConfig = cpu_to_le32(p_chanconfig);
11011108
as_out_fmt1_desc.bSubslotSize = uac2_opts->c_ssize;
11021109
as_out_fmt1_desc.bBitResolution = uac2_opts->c_ssize * 8;
11031110
as_in_fmt1_desc.bSubslotSize = uac2_opts->p_ssize;

0 commit comments

Comments
 (0)