@@ -48,6 +48,16 @@ static inline struct f_uac1 *func_to_uac1(struct usb_function *f)
/* Number of streaming interfaces */
#define F_AUDIO_NUM_INTERFACES 2
+static struct usb_interface_assoc_descriptor uac_iad = {
+ .bLength = sizeof(uac_iad),
+ .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
+ .bFirstInterface = 0,
+ .bInterfaceCount = 3,
+ .bFunctionClass = USB_CLASS_AUDIO,
+ .bFunctionSubClass = 0,
+ .bFunctionProtocol = UAC_VERSION_1,
+};
+
/* B.3.1 Standard AC Interface Descriptor */
static struct usb_interface_descriptor ac_interface_desc = {
.bLength = USB_DT_INTERFACE_SIZE,
@@ -247,6 +257,7 @@ static struct uac_iso_endpoint_descriptor as_iso_in_desc = {
};
static struct usb_descriptor_header *f_audio_desc[] = {
+ (struct usb_descriptor_header *)&uac_iad,
(struct usb_descriptor_header *)&ac_interface_desc,
(struct usb_descriptor_header *)&ac_header_desc,
@@ -523,6 +534,7 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
us = usb_gstrings_attach(cdev, uac1_strings, ARRAY_SIZE(strings_uac1));
if (IS_ERR(us))
return PTR_ERR(us);
+ uac_iad.iFunction = us[STR_AC_IF].id;
ac_interface_desc.iInterface = us[STR_AC_IF].id;
usb_out_it_desc.iTerminal = us[STR_USB_OUT_IT].id;
usb_out_it_desc.iChannelNames = us[STR_USB_OUT_IT_CH_NAMES].id;
@@ -559,6 +571,7 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
+ uac_iad.bFirstInterface = status;
ac_interface_desc.bInterfaceNumber = status;
uac1->ac_intf = status;
uac1->ac_alt = 0;
Add f_uac1 interface association descriptor, make f_uac1 link other function(like f_uvc) is possible. Signed-off-by: Liang Shengjun <liangshengjun@hisilicon.com> --- drivers/usb/gadget/function/f_uac1.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)