aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/audio.c')
-rw-r--r--drivers/usb/gadget/audio.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 9d89ae4765a9..98899244860e 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -14,10 +14,8 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/utsname.h> 15#include <linux/utsname.h>
16 16
17#include "u_audio.h"
18
19#define DRIVER_DESC "Linux USB Audio Gadget" 17#define DRIVER_DESC "Linux USB Audio Gadget"
20#define DRIVER_VERSION "Dec 18, 2008" 18#define DRIVER_VERSION "Feb 2, 2012"
21 19
22/*-------------------------------------------------------------------------*/ 20/*-------------------------------------------------------------------------*/
23 21
@@ -33,8 +31,36 @@
33#include "config.c" 31#include "config.c"
34#include "epautoconf.c" 32#include "epautoconf.c"
35 33
36#include "u_audio.c" 34/* string IDs are assigned dynamically */
37#include "f_audio.c" 35
36#define STRING_MANUFACTURER_IDX 0
37#define STRING_PRODUCT_IDX 1
38
39static char manufacturer[50];
40
41static struct usb_string strings_dev[] = {
42 [STRING_MANUFACTURER_IDX].s = manufacturer,
43 [STRING_PRODUCT_IDX].s = DRIVER_DESC,
44 { } /* end of list */
45};
46
47static struct usb_gadget_strings stringtab_dev = {
48 .language = 0x0409, /* en-us */
49 .strings = strings_dev,
50};
51
52static struct usb_gadget_strings *audio_strings[] = {
53 &stringtab_dev,
54 NULL,
55};
56
57#ifdef CONFIG_GADGET_UAC1
58#include "u_uac1.h"
59#include "u_uac1.c"
60#include "f_uac1.c"
61#else
62#include "f_uac2.c"
63#endif
38 64
39/*-------------------------------------------------------------------------*/ 65/*-------------------------------------------------------------------------*/
40 66
@@ -54,9 +80,15 @@ static struct usb_device_descriptor device_desc = {
54 80
55 .bcdUSB = __constant_cpu_to_le16(0x200), 81 .bcdUSB = __constant_cpu_to_le16(0x200),
56 82
83#ifdef CONFIG_GADGET_UAC1
57 .bDeviceClass = USB_CLASS_PER_INTERFACE, 84 .bDeviceClass = USB_CLASS_PER_INTERFACE,
58 .bDeviceSubClass = 0, 85 .bDeviceSubClass = 0,
59 .bDeviceProtocol = 0, 86 .bDeviceProtocol = 0,
87#else
88 .bDeviceClass = USB_CLASS_MISC,
89 .bDeviceSubClass = 0x02,
90 .bDeviceProtocol = 0x01,
91#endif
60 /* .bMaxPacketSize0 = f(hardware) */ 92 /* .bMaxPacketSize0 = f(hardware) */
61 93
62 /* Vendor and product id defaults change according to what configs 94 /* Vendor and product id defaults change according to what configs
@@ -108,6 +140,9 @@ static struct usb_configuration audio_config_driver = {
108 .bConfigurationValue = 1, 140 .bConfigurationValue = 1,
109 /* .iConfiguration = DYNAMIC */ 141 /* .iConfiguration = DYNAMIC */
110 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 142 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
143#ifndef CONFIG_GADGET_UAC1
144 .unbind = uac2_unbind_config,
145#endif
111}; 146};
112 147
113/*-------------------------------------------------------------------------*/ 148/*-------------------------------------------------------------------------*/
@@ -157,7 +192,9 @@ fail:
157 192
158static int __exit audio_unbind(struct usb_composite_dev *cdev) 193static int __exit audio_unbind(struct usb_composite_dev *cdev)
159{ 194{
195#ifdef CONFIG_GADGET_UAC1
160 gaudio_cleanup(); 196 gaudio_cleanup();
197#endif
161 return 0; 198 return 0;
162} 199}
163 200