#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb/composite.h>
#define DRIVER_DESC …
#define DRIVER_VERSION …
USB_GADGET_COMPOSITE_OPTIONS(…);
#ifndef CONFIG_GADGET_UAC1
#include "u_uac2.h"
static int p_chmask = UAC2_DEF_PCHMASK;
module_param(p_chmask, uint, 0444);
MODULE_PARM_DESC(p_chmask, "Playback Channel Mask");
static int p_srates[UAC_MAX_RATES] = {UAC2_DEF_PSRATE};
static int p_srates_cnt = 1;
module_param_array_named(p_srate, p_srates, uint, &p_srates_cnt, 0444);
MODULE_PARM_DESC(p_srate, "Playback Sampling Rates (array)");
static int p_ssize = UAC2_DEF_PSSIZE;
module_param(p_ssize, uint, 0444);
MODULE_PARM_DESC(p_ssize, "Playback Sample Size(bytes)");
static u8 p_hs_bint = UAC2_DEF_PHSBINT;
module_param(p_hs_bint, byte, 0444);
MODULE_PARM_DESC(p_hs_bint,
"Playback bInterval for HS/SS (1-4: fixed, 0: auto)");
static int c_chmask = UAC2_DEF_CCHMASK;
module_param(c_chmask, uint, 0444);
MODULE_PARM_DESC(c_chmask, "Capture Channel Mask");
static int c_srates[UAC_MAX_RATES] = {UAC2_DEF_CSRATE};
static int c_srates_cnt = 1;
module_param_array_named(c_srate, c_srates, uint, &c_srates_cnt, 0444);
MODULE_PARM_DESC(c_srate, "Capture Sampling Rates (array)");
static int c_ssize = UAC2_DEF_CSSIZE;
module_param(c_ssize, uint, 0444);
MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
static u8 c_hs_bint = UAC2_DEF_CHSBINT;
module_param(c_hs_bint, byte, 0444);
MODULE_PARM_DESC(c_hs_bint,
"Capture bInterval for HS/SS (1-4: fixed, 0: auto)");
#else
#ifndef CONFIG_GADGET_UAC1_LEGACY
#include "u_uac1.h"
static int p_chmask = UAC1_DEF_PCHMASK;
module_param(p_chmask, uint, 0444);
MODULE_PARM_DESC(p_chmask, "Playback Channel Mask");
static int p_srates[UAC_MAX_RATES] = {UAC1_DEF_PSRATE};
static int p_srates_cnt = 1;
module_param_array_named(p_srate, p_srates, uint, &p_srates_cnt, 0444);
MODULE_PARM_DESC(p_srate, "Playback Sampling Rates (array)");
static int p_ssize = UAC1_DEF_PSSIZE;
module_param(p_ssize, uint, 0444);
MODULE_PARM_DESC(p_ssize, "Playback Sample Size(bytes)");
static int c_chmask = UAC1_DEF_CCHMASK;
module_param(c_chmask, uint, 0444);
MODULE_PARM_DESC(c_chmask, "Capture Channel Mask");
static int c_srates[UAC_MAX_RATES] = {UAC1_DEF_CSRATE};
static int c_srates_cnt = 1;
module_param_array_named(c_srate, c_srates, uint, &c_srates_cnt, 0444);
MODULE_PARM_DESC(c_srate, "Capture Sampling Rates (array)");
static int c_ssize = UAC1_DEF_CSSIZE;
module_param(c_ssize, uint, 0444);
MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
#else
#include "u_uac1_legacy.h"
static char *fn_play = …;
module_param(fn_play, charp, 0444);
MODULE_PARM_DESC(…) …;
static char *fn_cap = …;
module_param(fn_cap, charp, 0444);
MODULE_PARM_DESC(…) …;
static char *fn_cntl = …;
module_param(fn_cntl, charp, 0444);
MODULE_PARM_DESC(…) …;
static int req_buf_size = …;
module_param(req_buf_size, int, 0444);
MODULE_PARM_DESC(…) …;
static int req_count = …;
module_param(req_count, int, 0444);
MODULE_PARM_DESC(…) …;
static int audio_buf_size = …;
module_param(audio_buf_size, int, 0444);
MODULE_PARM_DESC(…) …;
#endif
#endif
static struct usb_string strings_dev[] = …;
static struct usb_gadget_strings stringtab_dev = …;
static struct usb_gadget_strings *audio_strings[] = …;
#ifndef CONFIG_GADGET_UAC1
static struct usb_function_instance *fi_uac2;
static struct usb_function *f_uac2;
#else
static struct usb_function_instance *fi_uac1;
static struct usb_function *f_uac1;
#endif
#define AUDIO_VENDOR_NUM …
#define AUDIO_PRODUCT_NUM …
static struct usb_device_descriptor device_desc = …;
static const struct usb_descriptor_header *otg_desc[2];
static int audio_do_config(struct usb_configuration *c)
{ … }
static struct usb_configuration audio_config_driver = …;
static int audio_bind(struct usb_composite_dev *cdev)
{ … }
static int audio_unbind(struct usb_composite_dev *cdev)
{ … }
static struct usb_composite_driver audio_driver = …;
module_usb_composite_driver(…);
MODULE_DESCRIPTION(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;