linux/drivers/usb/gadget/function/f_uac1_legacy.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * f_audio.c -- USB Audio class function driver
  *
 * Copyright (C) 2008 Bryan Wu <[email protected]>
 * Copyright (C) 2008 Analog Devices, Inc
 */

#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/atomic.h>

#include "u_uac1_legacy.h"

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);

/*
 * DESCRIPTORS ... most are static, but strings and full
 * configuration descriptors are built on demand.
 */

/*
 * We have two interfaces- AudioControl and AudioStreaming
 * TODO: only supcard playback currently
 */
#define F_AUDIO_AC_INTERFACE
#define F_AUDIO_AS_INTERFACE
#define F_AUDIO_NUM_INTERFACES

/* B.3.1  Standard AC Interface Descriptor */
static struct usb_interface_descriptor ac_interface_desc =;

/*
 * The number of AudioStreaming and MIDIStreaming interfaces
 * in the Audio Interface Collection
 */
DECLARE_UAC_AC_HEADER_DESCRIPTOR} ;

#define UAC_DT_AC_HEADER_LENGTH
/* 1 input terminal, 1 output terminal and 1 feature unit */
#define UAC_DT_TOTAL_LENGTH
/* B.3.2  Class-Specific AC Interface Descriptor */
static struct uac1_ac_header_descriptor_1 ac_header_desc =;

#define INPUT_TERMINAL_ID
static struct uac_input_terminal_descriptor input_terminal_desc =;

DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR();

#define FEATURE_UNIT_ID
static struct uac_feature_unit_descriptor_0 feature_unit_desc =;

static struct usb_audio_control mute_control =;

static struct usb_audio_control volume_control =;

static struct usb_audio_control_selector feature_unit =;

#define OUTPUT_TERMINAL_ID
static struct uac1_output_terminal_descriptor output_terminal_desc =;

/* B.4.1  Standard AS Interface Descriptor */
static struct usb_interface_descriptor as_interface_alt_0_desc =;

static struct usb_interface_descriptor as_interface_alt_1_desc =;

/* B.4.2  Class-Specific AS Interface Descriptor */
static struct uac1_as_header_descriptor as_header_desc =;

DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(} ;

static struct uac_format_type_i_discrete_descriptor_1 as_type_i_desc =;

/* Standard ISO OUT Endpoint Descriptor */
static struct usb_endpoint_descriptor as_out_ep_desc  =;

/* Class-specific AS ISO OUT Endpoint Descriptor */
static struct uac_iso_endpoint_descriptor as_iso_out_desc =;

static struct usb_descriptor_header *f_audio_desc[] =;

enum {};

static struct usb_string strings_uac1[] =;

static struct usb_gadget_strings str_uac1 =;

static struct usb_gadget_strings *uac1_strings[] =;

/*
 * This function is an ALSA sound card following USB Audio Class Spec 1.0.
 */

/*-------------------------------------------------------------------------*/
struct f_audio_buf {};

static struct f_audio_buf *f_audio_buffer_alloc(int buf_size)
{}

static void f_audio_buffer_free(struct f_audio_buf *audio_buf)
{}
/*-------------------------------------------------------------------------*/

struct f_audio {};

static inline struct f_audio *func_to_audio(struct usb_function *f)
{}

/*-------------------------------------------------------------------------*/

static void f_audio_playback_work(struct work_struct *data)
{}

static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
{}

static void f_audio_complete(struct usb_ep *ep, struct usb_request *req)
{}

static int audio_set_intf_req(struct usb_function *f,
		const struct usb_ctrlrequest *ctrl)
{}

static int audio_get_intf_req(struct usb_function *f,
		const struct usb_ctrlrequest *ctrl)
{}

static int audio_set_endpoint_req(struct usb_function *f,
		const struct usb_ctrlrequest *ctrl)
{}

static int audio_get_endpoint_req(struct usb_function *f,
		const struct usb_ctrlrequest *ctrl)
{}

static int
f_audio_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
{}

static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
{}

static int f_audio_get_alt(struct usb_function *f, unsigned intf)
{}

static void f_audio_disable(struct usb_function *f)
{}

/*-------------------------------------------------------------------------*/

static void f_audio_build_desc(struct f_audio *audio)
{}

/* audio function driver setup/binding */
static int
f_audio_bind(struct usb_configuration *c, struct usb_function *f)
{}

/*-------------------------------------------------------------------------*/

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)
{}

/* Todo: add more control selecotor dynamically */
static int control_selector_init(struct f_audio *audio)
{}

static inline
struct f_uac1_legacy_opts *to_f_uac1_opts(struct config_item *item)
{}

static void f_uac1_attr_release(struct config_item *item)
{}

static struct configfs_item_operations f_uac1_item_ops =;

#define UAC1_INT_ATTRIBUTE(name)

UAC1_INT_ATTRIBUTE();
UAC1_INT_ATTRIBUTE();
UAC1_INT_ATTRIBUTE();

#define UAC1_STR_ATTRIBUTE(name)

UAC1_STR_ATTRIBUTE();
UAC1_STR_ATTRIBUTE();
UAC1_STR_ATTRIBUTE();

static struct configfs_attribute *f_uac1_attrs[] =;

static const struct config_item_type f_uac1_func_type =;

static void f_audio_free_inst(struct usb_function_instance *f)
{}

static struct usb_function_instance *f_audio_alloc_inst(void)
{}

static void f_audio_free(struct usb_function *f)
{}

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)
{}

DECLARE_USB_FUNCTION_INIT(uac1_legacy, f_audio_alloc_inst, f_audio_alloc);
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_AUTHOR();