usb: gadget: f_uac1: set baInterfaceNr of ac_header_desc dynamically

As per UAC1.0 spec Table 4-2: Class-Specific AC Interface
Header Descriptor, the baInterfaceNr(n) are indicated the
interface number of each AudioStreaming. So it needs to
set the baInterfaceNr dynamically according to the interface
IDs allocated by the usb gadget core.

Change-Id: I57cc7b0070fb166aac4360262b2a7e6f2f5df6e1
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2021-03-31 12:05:44 +08:00
committed by Tao Huang
parent 45bfb674cd
commit 3fb1f42ff0

View File

@@ -68,14 +68,8 @@ static struct uac1_ac_header_descriptor_2 ac_header_desc = {
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_HEADER,
.bcdADC = cpu_to_le16(0x0100),
.baInterfaceNr = {
/*
* Assume the maximum interfaces number of the UAC AudioStream
* interfaces
*/
[0] = 1,
[1] = 2,
}
/* .baInterfaceNr[0] = DYNAMIC */
/* .baInterfaceNr[1] = DYNAMIC */
};
static struct uac_input_terminal_descriptor usb_out_it_desc = {
@@ -888,6 +882,8 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
ac_interface_desc.bInterfaceNumber = status;
uac1->ac_intf = status;
uac1->ac_alt = 0;
ac_header_desc.baInterfaceNr[0] = ++status;
ac_header_desc.baInterfaceNr[1] = ++status;
if (EPOUT_EN(audio_opts)) {
status = usb_interface_id(c, f);