Commit d355339e authored by Ruslan Bilovol's avatar Ruslan Bilovol Committed by Felipe Balbi

usb: gadget: function: make current f_uac1 implementation legacy

Before introducing new f_uac1 function (with virtual
ALSA card) make current implementation legacy.

This includes renaming of existing files, some
variables, config options and documentation
Signed-off-by: default avatarRuslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent eb9fecb9
What: /config/usb-gadget/gadget/functions/uac1.name What: /config/usb-gadget/gadget/functions/uac1_legacy.name
Date: Sep 2014 Date: Sep 2014
KernelVersion: 3.18 KernelVersion: 3.18
Description: Description:
......
...@@ -16,7 +16,7 @@ provided by gadgets. ...@@ -16,7 +16,7 @@ provided by gadgets.
13. RNDIS function 13. RNDIS function
14. SERIAL function 14. SERIAL function
15. SOURCESINK function 15. SOURCESINK function
16. UAC1 function 16. UAC1 function (legacy implementation)
17. UAC2 function 17. UAC2 function
18. UVC function 18. UVC function
19. PRINTER function 19. PRINTER function
...@@ -589,15 +589,16 @@ device: run the gadget ...@@ -589,15 +589,16 @@ device: run the gadget
host: test-usb (tools/usb/testusb.c) host: test-usb (tools/usb/testusb.c)
16. UAC1 function 16. UAC1 function (legacy implementation)
================= =================
The function is provided by usb_f_uac1.ko module. The function is provided by usb_f_uac1_legacy.ko module.
Function-specific configfs interface Function-specific configfs interface
------------------------------------ ------------------------------------
The function name to use when creating the function directory is "uac1". The function name to use when creating the function directory
is "uac1_legacy".
The uac1 function provides these attributes in its function directory: The uac1 function provides these attributes in its function directory:
audio_buf_size - audio buffer size audio_buf_size - audio buffer size
......
...@@ -191,7 +191,7 @@ config USB_F_MASS_STORAGE ...@@ -191,7 +191,7 @@ config USB_F_MASS_STORAGE
config USB_F_FS config USB_F_FS
tristate tristate
config USB_F_UAC1 config USB_F_UAC1_LEGACY
tristate tristate
config USB_F_UAC2 config USB_F_UAC2
...@@ -365,13 +365,13 @@ config USB_CONFIGFS_F_FS ...@@ -365,13 +365,13 @@ config USB_CONFIGFS_F_FS
implemented in kernel space (for instance Ethernet, serial or implemented in kernel space (for instance Ethernet, serial or
mass storage) and other are implemented in user space. mass storage) and other are implemented in user space.
config USB_CONFIGFS_F_UAC1 config USB_CONFIGFS_F_UAC1_LEGACY
bool "Audio Class 1.0" bool "Audio Class 1.0 (legacy implementation)"
depends on USB_CONFIGFS depends on USB_CONFIGFS
depends on SND depends on SND
select USB_LIBCOMPOSITE select USB_LIBCOMPOSITE
select SND_PCM select SND_PCM
select USB_F_UAC1 select USB_F_UAC1_LEGACY
help help
This Audio function implements 1 AudioControl interface, This Audio function implements 1 AudioControl interface,
1 AudioStreaming Interface each for USB-OUT and USB-IN. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
......
...@@ -33,8 +33,8 @@ obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o ...@@ -33,8 +33,8 @@ obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o
usb_f_fs-y := f_fs.o usb_f_fs-y := f_fs.o
obj-$(CONFIG_USB_F_FS) += usb_f_fs.o obj-$(CONFIG_USB_F_FS) += usb_f_fs.o
obj-$(CONFIG_USB_U_AUDIO) += u_audio.o obj-$(CONFIG_USB_U_AUDIO) += u_audio.o
usb_f_uac1-y := f_uac1.o u_uac1.o usb_f_uac1_legacy-y := f_uac1_legacy.o u_uac1_legacy.o
obj-$(CONFIG_USB_F_UAC1) += usb_f_uac1.o obj-$(CONFIG_USB_F_UAC1_LEGACY) += usb_f_uac1_legacy.o
usb_f_uac2-y := f_uac2.o usb_f_uac2-y := f_uac2.o
obj-$(CONFIG_USB_F_UAC2) += usb_f_uac2.o obj-$(CONFIG_USB_F_UAC2) += usb_f_uac2.o
usb_f_uvc-y := f_uvc.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_configfs.o usb_f_uvc-y := f_uvc.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_configfs.o
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include "u_uac1.h" #include "u_uac1_legacy.h"
static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value); static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value);
static int generic_get_cmd(struct usb_audio_control *con, u8 cmd); static int generic_get_cmd(struct usb_audio_control *con, u8 cmd);
...@@ -326,11 +326,11 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req) ...@@ -326,11 +326,11 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
struct f_audio *audio = req->context; struct f_audio *audio = req->context;
struct usb_composite_dev *cdev = audio->card.func.config->cdev; struct usb_composite_dev *cdev = audio->card.func.config->cdev;
struct f_audio_buf *copy_buf = audio->copy_buf; struct f_audio_buf *copy_buf = audio->copy_buf;
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
int audio_buf_size; int audio_buf_size;
int err; int err;
opts = container_of(audio->card.func.fi, struct f_uac1_opts, opts = container_of(audio->card.func.fi, struct f_uac1_legacy_opts,
func_inst); func_inst);
audio_buf_size = opts->audio_buf_size; audio_buf_size = opts->audio_buf_size;
...@@ -578,13 +578,13 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt) ...@@ -578,13 +578,13 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
struct usb_composite_dev *cdev = f->config->cdev; struct usb_composite_dev *cdev = f->config->cdev;
struct usb_ep *out_ep = audio->out_ep; struct usb_ep *out_ep = audio->out_ep;
struct usb_request *req; struct usb_request *req;
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
int req_buf_size, req_count, audio_buf_size; int req_buf_size, req_count, audio_buf_size;
int i = 0, err = 0; int i = 0, err = 0;
DBG(cdev, "intf %d, alt %d\n", intf, alt); DBG(cdev, "intf %d, alt %d\n", intf, alt);
opts = container_of(f->fi, struct f_uac1_opts, func_inst); opts = container_of(f->fi, struct f_uac1_legacy_opts, func_inst);
req_buf_size = opts->req_buf_size; req_buf_size = opts->req_buf_size;
req_count = opts->req_count; req_count = opts->req_count;
audio_buf_size = opts->audio_buf_size; audio_buf_size = opts->audio_buf_size;
...@@ -705,9 +705,9 @@ f_audio_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -705,9 +705,9 @@ f_audio_bind(struct usb_configuration *c, struct usb_function *f)
struct usb_string *us; struct usb_string *us;
int status; int status;
struct usb_ep *ep = NULL; struct usb_ep *ep = NULL;
struct f_uac1_opts *audio_opts; struct f_uac1_legacy_opts *audio_opts;
audio_opts = container_of(f->fi, struct f_uac1_opts, func_inst); audio_opts = container_of(f->fi, struct f_uac1_legacy_opts, func_inst);
audio->card.gadget = c->cdev->gadget; audio->card.gadget = c->cdev->gadget;
/* set up ASLA audio devices */ /* set up ASLA audio devices */
if (!audio_opts->bound) { if (!audio_opts->bound) {
...@@ -801,15 +801,16 @@ static int control_selector_init(struct f_audio *audio) ...@@ -801,15 +801,16 @@ static int control_selector_init(struct f_audio *audio)
return 0; return 0;
} }
static inline struct f_uac1_opts *to_f_uac1_opts(struct config_item *item) static inline
struct f_uac1_legacy_opts *to_f_uac1_opts(struct config_item *item)
{ {
return container_of(to_config_group(item), struct f_uac1_opts, return container_of(to_config_group(item), struct f_uac1_legacy_opts,
func_inst.group); func_inst.group);
} }
static void f_uac1_attr_release(struct config_item *item) static void f_uac1_attr_release(struct config_item *item)
{ {
struct f_uac1_opts *opts = to_f_uac1_opts(item); struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item);
usb_put_function_instance(&opts->func_inst); usb_put_function_instance(&opts->func_inst);
} }
...@@ -822,7 +823,7 @@ static struct configfs_item_operations f_uac1_item_ops = { ...@@ -822,7 +823,7 @@ static struct configfs_item_operations f_uac1_item_ops = {
static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \ static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \
char *page) \ char *page) \
{ \ { \
struct f_uac1_opts *opts = to_f_uac1_opts(item); \ struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item); \
int result; \ int result; \
\ \
mutex_lock(&opts->lock); \ mutex_lock(&opts->lock); \
...@@ -835,7 +836,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \ ...@@ -835,7 +836,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \
static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
const char *page, size_t len) \ const char *page, size_t len) \
{ \ { \
struct f_uac1_opts *opts = to_f_uac1_opts(item); \ struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item); \
int ret; \ int ret; \
u32 num; \ u32 num; \
\ \
...@@ -867,7 +868,7 @@ UAC1_INT_ATTRIBUTE(audio_buf_size); ...@@ -867,7 +868,7 @@ UAC1_INT_ATTRIBUTE(audio_buf_size);
static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \ static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \
char *page) \ char *page) \
{ \ { \
struct f_uac1_opts *opts = to_f_uac1_opts(item); \ struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item); \
int result; \ int result; \
\ \
mutex_lock(&opts->lock); \ mutex_lock(&opts->lock); \
...@@ -880,7 +881,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \ ...@@ -880,7 +881,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item, \
static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
const char *page, size_t len) \ const char *page, size_t len) \
{ \ { \
struct f_uac1_opts *opts = to_f_uac1_opts(item); \ struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item); \
int ret = -EBUSY; \ int ret = -EBUSY; \
char *tmp; \ char *tmp; \
\ \
...@@ -928,9 +929,9 @@ static struct config_item_type f_uac1_func_type = { ...@@ -928,9 +929,9 @@ static struct config_item_type f_uac1_func_type = {
static void f_audio_free_inst(struct usb_function_instance *f) static void f_audio_free_inst(struct usb_function_instance *f)
{ {
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
opts = container_of(f, struct f_uac1_opts, func_inst); opts = container_of(f, struct f_uac1_legacy_opts, func_inst);
if (opts->fn_play_alloc) if (opts->fn_play_alloc)
kfree(opts->fn_play); kfree(opts->fn_play);
if (opts->fn_cap_alloc) if (opts->fn_cap_alloc)
...@@ -942,7 +943,7 @@ static void f_audio_free_inst(struct usb_function_instance *f) ...@@ -942,7 +943,7 @@ static void f_audio_free_inst(struct usb_function_instance *f)
static struct usb_function_instance *f_audio_alloc_inst(void) static struct usb_function_instance *f_audio_alloc_inst(void)
{ {
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
opts = kzalloc(sizeof(*opts), GFP_KERNEL); opts = kzalloc(sizeof(*opts), GFP_KERNEL);
if (!opts) if (!opts)
...@@ -966,10 +967,10 @@ static struct usb_function_instance *f_audio_alloc_inst(void) ...@@ -966,10 +967,10 @@ static struct usb_function_instance *f_audio_alloc_inst(void)
static void f_audio_free(struct usb_function *f) static void f_audio_free(struct usb_function *f)
{ {
struct f_audio *audio = func_to_audio(f); struct f_audio *audio = func_to_audio(f);
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
gaudio_cleanup(&audio->card); gaudio_cleanup(&audio->card);
opts = container_of(f->fi, struct f_uac1_opts, func_inst); opts = container_of(f->fi, struct f_uac1_legacy_opts, func_inst);
kfree(audio); kfree(audio);
mutex_lock(&opts->lock); mutex_lock(&opts->lock);
--opts->refcnt; --opts->refcnt;
...@@ -984,7 +985,7 @@ static void f_audio_unbind(struct usb_configuration *c, struct usb_function *f) ...@@ -984,7 +985,7 @@ static void f_audio_unbind(struct usb_configuration *c, struct usb_function *f)
static struct usb_function *f_audio_alloc(struct usb_function_instance *fi) static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
{ {
struct f_audio *audio; struct f_audio *audio;
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
/* allocate and initialize one new instance */ /* allocate and initialize one new instance */
audio = kzalloc(sizeof(*audio), GFP_KERNEL); audio = kzalloc(sizeof(*audio), GFP_KERNEL);
...@@ -993,7 +994,7 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi) ...@@ -993,7 +994,7 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
audio->card.func.name = "g_audio"; audio->card.func.name = "g_audio";
opts = container_of(fi, struct f_uac1_opts, func_inst); opts = container_of(fi, struct f_uac1_legacy_opts, func_inst);
mutex_lock(&opts->lock); mutex_lock(&opts->lock);
++opts->refcnt; ++opts->refcnt;
mutex_unlock(&opts->lock); mutex_unlock(&opts->lock);
...@@ -1015,6 +1016,6 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi) ...@@ -1015,6 +1016,6 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
return &audio->card.func; return &audio->card.func;
} }
DECLARE_USB_FUNCTION_INIT(uac1, f_audio_alloc_inst, f_audio_alloc); DECLARE_USB_FUNCTION_INIT(uac1_legacy, f_audio_alloc_inst, f_audio_alloc);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bryan Wu"); MODULE_AUTHOR("Bryan Wu");
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/random.h> #include <linux/random.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include "u_uac1.h" #include "u_uac1_legacy.h"
/* /*
* This component encapsulates the ALSA devices for USB audio gadget * This component encapsulates the ALSA devices for USB audio gadget
...@@ -205,10 +205,11 @@ static int gaudio_open_snd_dev(struct gaudio *card) ...@@ -205,10 +205,11 @@ static int gaudio_open_snd_dev(struct gaudio *card)
{ {
struct snd_pcm_file *pcm_file; struct snd_pcm_file *pcm_file;
struct gaudio_snd_dev *snd; struct gaudio_snd_dev *snd;
struct f_uac1_opts *opts; struct f_uac1_legacy_opts *opts;
char *fn_play, *fn_cap, *fn_cntl; char *fn_play, *fn_cap, *fn_cntl;
opts = container_of(card->func.fi, struct f_uac1_opts, func_inst); opts = container_of(card->func.fi, struct f_uac1_legacy_opts,
func_inst);
fn_play = opts->fn_play; fn_play = opts->fn_play;
fn_cap = opts->fn_cap; fn_cap = opts->fn_cap;
fn_cntl = opts->fn_cntl; fn_cntl = opts->fn_cntl;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Licensed under the GPL-2 or later. * Licensed under the GPL-2 or later.
*/ */
#ifndef __U_AUDIO_H #ifndef __U_UAC1_LEGACY_H
#define __U_AUDIO_H #define __U_UAC1_LEGACY_H
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -56,7 +56,7 @@ struct gaudio { ...@@ -56,7 +56,7 @@ struct gaudio {
/* TODO */ /* TODO */
}; };
struct f_uac1_opts { struct f_uac1_legacy_opts {
struct usb_function_instance func_inst; struct usb_function_instance func_inst;
int req_buf_size; int req_buf_size;
int req_count; int req_count;
...@@ -79,4 +79,4 @@ size_t u_audio_playback(struct gaudio *card, void *buf, size_t count); ...@@ -79,4 +79,4 @@ size_t u_audio_playback(struct gaudio *card, void *buf, size_t count);
int u_audio_get_playback_channels(struct gaudio *card); int u_audio_get_playback_channels(struct gaudio *card);
int u_audio_get_playback_rate(struct gaudio *card); int u_audio_get_playback_rate(struct gaudio *card);
#endif /* __U_AUDIO_H */ #endif /* __U_UAC1_LEGACY_H */
...@@ -54,8 +54,8 @@ config USB_AUDIO ...@@ -54,8 +54,8 @@ config USB_AUDIO
depends on SND depends on SND
select USB_LIBCOMPOSITE select USB_LIBCOMPOSITE
select SND_PCM select SND_PCM
select USB_F_UAC1 if GADGET_UAC1 select USB_F_UAC1_LEGACY if GADGET_UAC1_LEGACY
select USB_F_UAC2 if !GADGET_UAC1 select USB_F_UAC2 if !GADGET_UAC1_LEGACY
select USB_U_AUDIO if USB_F_UAC2 select USB_U_AUDIO if USB_F_UAC2
help help
This Gadget Audio driver is compatible with USB Audio Class This Gadget Audio driver is compatible with USB Audio Class
...@@ -73,7 +73,7 @@ config USB_AUDIO ...@@ -73,7 +73,7 @@ config USB_AUDIO
Say "y" to link the driver statically, or "m" to build a Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_audio". dynamically linked module called "g_audio".
config GADGET_UAC1 config GADGET_UAC1_LEGACY
bool "UAC 1.0 (Legacy)" bool "UAC 1.0 (Legacy)"
depends on USB_AUDIO depends on USB_AUDIO
help help
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
USB_GADGET_COMPOSITE_OPTIONS(); USB_GADGET_COMPOSITE_OPTIONS();
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1_LEGACY
#include "u_uac2.h" #include "u_uac2.h"
/* Playback(USB-IN) Default Stereo - Fl/Fr */ /* Playback(USB-IN) Default Stereo - Fl/Fr */
...@@ -53,7 +53,7 @@ static int c_ssize = UAC2_DEF_CSSIZE; ...@@ -53,7 +53,7 @@ static int c_ssize = UAC2_DEF_CSSIZE;
module_param(c_ssize, uint, S_IRUGO); module_param(c_ssize, uint, S_IRUGO);
MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)"); MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
#else #else
#include "u_uac1.h" #include "u_uac1_legacy.h"
static char *fn_play = FILE_PCM_PLAYBACK; static char *fn_play = FILE_PCM_PLAYBACK;
module_param(fn_play, charp, S_IRUGO); module_param(fn_play, charp, S_IRUGO);
...@@ -99,7 +99,7 @@ static struct usb_gadget_strings *audio_strings[] = { ...@@ -99,7 +99,7 @@ static struct usb_gadget_strings *audio_strings[] = {
NULL, NULL,
}; };
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1_LEGACY
static struct usb_function_instance *fi_uac2; static struct usb_function_instance *fi_uac2;
static struct usb_function *f_uac2; static struct usb_function *f_uac2;
#else #else
...@@ -125,7 +125,7 @@ static struct usb_device_descriptor device_desc = { ...@@ -125,7 +125,7 @@ static struct usb_device_descriptor device_desc = {
/* .bcdUSB = DYNAMIC */ /* .bcdUSB = DYNAMIC */
#ifdef CONFIG_GADGET_UAC1 #ifdef CONFIG_GADGET_UAC1_LEGACY
.bDeviceClass = USB_CLASS_PER_INTERFACE, .bDeviceClass = USB_CLASS_PER_INTERFACE,
.bDeviceSubClass = 0, .bDeviceSubClass = 0,
.bDeviceProtocol = 0, .bDeviceProtocol = 0,
...@@ -164,7 +164,7 @@ static int audio_do_config(struct usb_configuration *c) ...@@ -164,7 +164,7 @@ static int audio_do_config(struct usb_configuration *c)
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
} }
#ifdef CONFIG_GADGET_UAC1 #ifdef CONFIG_GADGET_UAC1_LEGACY
f_uac1 = usb_get_function(fi_uac1); f_uac1 = usb_get_function(fi_uac1);
if (IS_ERR(f_uac1)) { if (IS_ERR(f_uac1)) {
status = PTR_ERR(f_uac1); status = PTR_ERR(f_uac1);
...@@ -204,24 +204,24 @@ static struct usb_configuration audio_config_driver = { ...@@ -204,24 +204,24 @@ static struct usb_configuration audio_config_driver = {
static int audio_bind(struct usb_composite_dev *cdev) static int audio_bind(struct usb_composite_dev *cdev)
{ {
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1_LEGACY
struct f_uac2_opts *uac2_opts; struct f_uac2_opts *uac2_opts;
#else #else
struct f_uac1_opts *uac1_opts; struct f_uac1_legacy_opts *uac1_opts;
#endif #endif
int status; int status;
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1_LEGACY
fi_uac2 = usb_get_function_instance("uac2"); fi_uac2 = usb_get_function_instance("uac2");
if (IS_ERR(fi_uac2)) if (IS_ERR(fi_uac2))
return PTR_ERR(fi_uac2); return PTR_ERR(fi_uac2);
#else #else
fi_uac1 = usb_get_function_instance("uac1"); fi_uac1 = usb_get_function_instance("uac1_legacy");
if (IS_ERR(fi_uac1)) if (IS_ERR(fi_uac1))
return PTR_ERR(fi_uac1); return PTR_ERR(fi_uac1);
#endif #endif
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1_LEGACY
uac2_opts = container_of(fi_uac2, struct f_uac2_opts, func_inst); uac2_opts = container_of(fi_uac2, struct f_uac2_opts, func_inst);
uac2_opts->p_chmask = p_chmask; uac2_opts->p_chmask = p_chmask;
uac2_opts->p_srate = p_srate; uac2_opts->p_srate = p_srate;
...@@ -231,7 +231,7 @@ static int audio_bind(struct usb_composite_dev *cdev) ...@@ -231,7 +231,7 @@ static int audio_bind(struct usb_composite_dev *cdev)
uac2_opts->c_ssize = c_ssize; uac2_opts->c_ssize = c_ssize;
uac2_opts->req_number = UAC2_DEF_REQ_NUM; uac2_opts->req_number = UAC2_DEF_REQ_NUM;
#else #else
uac1_opts = container_of(fi_uac1, struct f_uac1_opts, func_inst); uac1_opts = container_of(fi_uac1, struct f_uac1_legacy_opts, func_inst);
uac1_opts->fn_play = fn_play; uac1_opts->fn_play = fn_play;
uac1_opts->fn_cap = fn_cap; uac1_opts->fn_cap = fn_cap;
uac1_opts->fn_cntl = fn_cntl; uac1_opts->fn_cntl = fn_cntl;
...@@ -269,7 +269,7 @@ static int audio_bind(struct usb_composite_dev *cdev) ...@@ -269,7 +269,7 @@ static int audio_bind(struct usb_composite_dev *cdev)
kfree(otg_desc[0]); kfree(otg_desc[0]);
otg_desc[0] = NULL; otg_desc[0] = NULL;
fail: fail:
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1_LEGACY
usb_put_function_instance(fi_uac2); usb_put_function_instance(fi_uac2);
#else #else
usb_put_function_instance(fi_uac1); usb_put_function_instance(fi_uac1);
...@@ -279,7 +279,7 @@ static int audio_bind(struct usb_composite_dev *cdev) ...@@ -279,7 +279,7 @@ static int audio_bind(struct usb_composite_dev *cdev)
static int audio_unbind(struct usb_composite_dev *cdev) static int audio_unbind(struct usb_composite_dev *cdev)
{ {
#ifdef CONFIG_GADGET_UAC1 #ifdef CONFIG_GADGET_UAC1_LEGACY
if (!IS_ERR_OR_NULL(f_uac1)) if (!IS_ERR_OR_NULL(f_uac1))
usb_put_function(f_uac1); usb_put_function(f_uac1);
if (!IS_ERR_OR_NULL(fi_uac1)) if (!IS_ERR_OR_NULL(fi_uac1))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment