* [PATCH] usb: gadget: function: f_uac1 add interface assoc desc
@ 2018-12-24 2:35 liangshengjun
2019-02-06 6:51 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: liangshengjun @ 2018-12-24 2:35 UTC (permalink / raw)
To: Felipe Balbi, Greg Kroah-Hartman, Paul Elder, linux-usb, linux-kernel
Cc: Jiangheng, Caizhiyong
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(+)
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 2746a92..28c1a78 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: function: f_uac1 add interface assoc desc
2018-12-24 2:35 [PATCH] usb: gadget: function: f_uac1 add interface assoc desc liangshengjun
@ 2019-02-06 6:51 ` Felipe Balbi
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2019-02-06 6:51 UTC (permalink / raw)
To: liangshengjun, Greg Kroah-Hartman, Paul Elder, linux-usb, linux-kernel
Cc: Jiangheng, Caizhiyong
[-- Attachment #1: Type: text/plain, Size: 313 bytes --]
liangshengjun <liangshengjun@hisilicon.com> writes:
> 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>
doesn't apply. Also, remember to break commit log lines at 72 columns
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] usb: gadget: function: f_uac1 add interface assoc desc
@ 2018-12-19 11:02 liangshengjun
0 siblings, 0 replies; 3+ messages in thread
From: liangshengjun @ 2018-12-19 11:02 UTC (permalink / raw)
To: balbi; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
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(+)
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 2746a92..28c1a78 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-06 6:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24 2:35 [PATCH] usb: gadget: function: f_uac1 add interface assoc desc liangshengjun
2019-02-06 6:51 ` Felipe Balbi
-- strict thread matches above, loose matches on Subject: below --
2018-12-19 11:02 liangshengjun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).