summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/audio.c
diff options
context:
space:
mode:
authorJassi Brar <jaswinder.singh@linaro.org>2012-02-02 22:01:34 +0530
committerFelipe Balbi <balbi@ti.com>2012-02-15 10:10:31 +0200
commit132fcb460839a876f5bc8b71bede60f8d0875757 (patch)
treef05d2018a2cfecdd6b4b280f4c6925bb9f37a197 /drivers/usb/gadget/audio.c
parentd747a916872241daef68c864ef09f8bef0c35bf8 (diff)
downloadop-kernel-dev-132fcb460839a876f5bc8b71bede60f8d0875757.zip
op-kernel-dev-132fcb460839a876f5bc8b71bede60f8d0875757.tar.gz
usb: gadget: Add Audio Class 2.0 Driver
This is a flexible USB Audio Class 2.0 compliant gadget driver that implements a simple topology with a virtual sound card exposed at the function side. The driver doesn't expect any real audio codec to be present on the function - the audio streams are simply sinked to and sourced from a virtual ALSA sound card created. The user-space application may choose to do whatever it wants with the data received from the USB Host and choose to provide whatever it wants as audio data to the USB Host. Capture(USB-Out) and Playback(USB-In) can be run at independent configurations specified via module parameters while loading the driver. Make this new version as the default selection by a new Kconfig choice. Signed-off-by: Yadi Brar <yadi.brar01@gmail.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/audio.c')
-rw-r--r--drivers/usb/gadget/audio.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 33e9327..9889924 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -14,10 +14,8 @@
#include <linux/kernel.h>
#include <linux/utsname.h>
-#include "u_uac1.h"
-
#define DRIVER_DESC "Linux USB Audio Gadget"
-#define DRIVER_VERSION "Dec 18, 2008"
+#define DRIVER_VERSION "Feb 2, 2012"
/*-------------------------------------------------------------------------*/
@@ -56,8 +54,13 @@ static struct usb_gadget_strings *audio_strings[] = {
NULL,
};
+#ifdef CONFIG_GADGET_UAC1
+#include "u_uac1.h"
#include "u_uac1.c"
#include "f_uac1.c"
+#else
+#include "f_uac2.c"
+#endif
/*-------------------------------------------------------------------------*/
@@ -77,9 +80,15 @@ static struct usb_device_descriptor device_desc = {
.bcdUSB = __constant_cpu_to_le16(0x200),
+#ifdef CONFIG_GADGET_UAC1
.bDeviceClass = USB_CLASS_PER_INTERFACE,
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
+#else
+ .bDeviceClass = USB_CLASS_MISC,
+ .bDeviceSubClass = 0x02,
+ .bDeviceProtocol = 0x01,
+#endif
/* .bMaxPacketSize0 = f(hardware) */
/* Vendor and product id defaults change according to what configs
@@ -131,6 +140,9 @@ static struct usb_configuration audio_config_driver = {
.bConfigurationValue = 1,
/* .iConfiguration = DYNAMIC */
.bmAttributes = USB_CONFIG_ATT_SELFPOWER,
+#ifndef CONFIG_GADGET_UAC1
+ .unbind = uac2_unbind_config,
+#endif
};
/*-------------------------------------------------------------------------*/
@@ -180,7 +192,9 @@ fail:
static int __exit audio_unbind(struct usb_composite_dev *cdev)
{
+#ifdef CONFIG_GADGET_UAC1
gaudio_cleanup();
+#endif
return 0;
}
OpenPOWER on IntegriCloud