#include <linux/bitops.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/log2.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/usb.h>
#include <linux/usb/audio.h>
#include <linux/usb/audio-v2.h>
#include <linux/usb/audio-v3.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/hwdep.h>
#include <sound/info.h>
#include <sound/tlv.h>
#include "usbaudio.h"
#include "mixer.h"
#include "helper.h"
#include "mixer_quirks.h"
#include "power.h"
#define MAX_ID_ELEMS …
struct usb_audio_term { … };
struct usbmix_name_map;
struct mixer_build { … };
enum { … };
enum { … };
#include "mixer_maps.c"
static const struct usbmix_name_map *
find_map(const struct usbmix_name_map *p, int unitid, int control)
{ … }
static int
check_mapped_name(const struct usbmix_name_map *p, char *buf, int buflen)
{ … }
#define filter_error(cval, err) …
static inline int
check_ignored_ctl(const struct usbmix_name_map *p)
{ … }
static inline void check_mapped_dB(const struct usbmix_name_map *p,
struct usb_mixer_elem_info *cval)
{ … }
static int check_mapped_selector_name(struct mixer_build *state, int unitid,
int index, char *buf, int buflen)
{ … }
static void *find_audio_control_unit(struct mixer_build *state,
unsigned char unit)
{ … }
static int snd_usb_copy_string_desc(struct snd_usb_audio *chip,
int index, char *buf, int maxlen)
{ … }
static int convert_signed_value(struct usb_mixer_elem_info *cval, int val)
{ … }
static int convert_bytes_value(struct usb_mixer_elem_info *cval, int val)
{ … }
static int get_relative_value(struct usb_mixer_elem_info *cval, int val)
{ … }
static int get_abs_value(struct usb_mixer_elem_info *cval, int val)
{ … }
static int uac2_ctl_value_size(int val_type)
{ … }
static inline int mixer_ctrl_intf(struct usb_mixer_interface *mixer)
{ … }
static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,
int validx, int *value_ret)
{ … }
static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
int validx, int *value_ret)
{ … }
static int get_ctl_value(struct usb_mixer_elem_info *cval, int request,
int validx, int *value_ret)
{ … }
static int get_cur_ctl_value(struct usb_mixer_elem_info *cval,
int validx, int *value)
{ … }
static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval,
int channel, int *value)
{ … }
int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval,
int channel, int index, int *value)
{ … }
int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
int request, int validx, int value_set)
{ … }
static int set_cur_ctl_value(struct usb_mixer_elem_info *cval,
int validx, int value)
{ … }
int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
int index, int value)
{ … }
int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
unsigned int size, unsigned int __user *_tlv)
{ … }
static int parse_audio_unit(struct mixer_build *state, int unitid);
static int check_matrix_bitmap(unsigned char *bmap,
int ich, int och, int num_outs)
{ … }
int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
struct snd_kcontrol *kctl,
bool is_std_info)
{ … }
static struct iterm_name_combo { … } iterm_names[] = …;
static int get_term_name(struct snd_usb_audio *chip, struct usb_audio_term *iterm,
unsigned char *name, int maxlen, int term_only)
{ … }
static int get_cluster_channels_v3(struct mixer_build *state, unsigned int cluster_id)
{ … }
static int uac_mixer_unit_get_channels(struct mixer_build *state,
struct uac_mixer_unit_descriptor *desc)
{ … }
static int __check_input_term(struct mixer_build *state, int id,
struct usb_audio_term *term);
static int parse_term_uac1_iterm_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_uac2_iterm_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_uac3_iterm_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_mixer_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_selector_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_proc_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id, int vtype)
{ … }
static int parse_term_effect_unit(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_uac2_clock_source(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
static int parse_term_uac3_clock_source(struct mixer_build *state,
struct usb_audio_term *term,
void *p1, int id)
{ … }
#define PTYPE(a, b) …
static int __check_input_term(struct mixer_build *state, int id,
struct usb_audio_term *term)
{ … }
static int check_input_term(struct mixer_build *state, int id,
struct usb_audio_term *term)
{ … }
struct usb_feature_control_info { … };
static const struct usb_feature_control_info audio_feature_info[] = …;
static void usb_mixer_elem_info_free(struct usb_mixer_elem_info *cval)
{ … }
void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl)
{ … }
static void volume_control_quirks(struct usb_mixer_elem_info *cval,
struct snd_kcontrol *kctl)
{ … }
static void init_cur_mix_raw(struct usb_mixer_elem_info *cval, int ch, int idx)
{ … }
static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
int default_min, struct snd_kcontrol *kctl)
{ … }
#define get_min_max(cval, def) …
static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mixer_ctl_master_bool_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int get_connector_value(struct usb_mixer_elem_info *cval,
char *name, int *val)
{ … }
static int mixer_ctl_connector_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new usb_feature_unit_ctl = …;
static const struct snd_kcontrol_new usb_feature_unit_ctl_ro = …;
static const struct snd_kcontrol_new usb_bool_master_control_ctl_ro = …;
static const struct snd_kcontrol_new usb_connector_ctl_ro = …;
const struct snd_kcontrol_new *snd_usb_feature_unit_ctl = …;
static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str)
{ … }
static void check_no_speaker_on_headset(struct snd_kcontrol *kctl,
struct snd_card *card)
{ … }
static const struct usb_feature_control_info *get_feature_control_info(int control)
{ … }
static void __build_feature_ctl(struct usb_mixer_interface *mixer,
const struct usbmix_name_map *imap,
unsigned int ctl_mask, int control,
struct usb_audio_term *iterm,
struct usb_audio_term *oterm,
int unitid, int nameid, int readonly_mask)
{ … }
static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
unsigned int ctl_mask, int control,
struct usb_audio_term *iterm, int unitid,
int readonly_mask)
{ … }
static void build_feature_ctl_badd(struct usb_mixer_interface *mixer,
unsigned int ctl_mask, int control, int unitid,
const struct usbmix_name_map *badd_map)
{ … }
static void get_connector_control_name(struct usb_mixer_interface *mixer,
struct usb_audio_term *term,
bool is_input, char *name, int name_size)
{ … }
static int connector_mixer_resume(struct usb_mixer_elem_list *list)
{ … }
static void build_connector_control(struct usb_mixer_interface *mixer,
const struct usbmix_name_map *imap,
struct usb_audio_term *term, bool is_input)
{ … }
static int parse_clock_source_unit(struct mixer_build *state, int unitid,
void *_ftr)
{ … }
static int parse_audio_feature_unit(struct mixer_build *state, int unitid,
void *_ftr)
{ … }
static bool mixer_bitmap_overflow(struct uac_mixer_unit_descriptor *desc,
int protocol, int num_ins, int num_outs)
{ … }
static void build_mixer_unit_ctl(struct mixer_build *state,
struct uac_mixer_unit_descriptor *desc,
int in_pin, int in_ch, int num_outs,
int unitid, struct usb_audio_term *iterm)
{ … }
static int parse_audio_input_terminal(struct mixer_build *state, int unitid,
void *raw_desc)
{ … }
static int parse_audio_mixer_unit(struct mixer_build *state, int unitid,
void *raw_desc)
{ … }
static int mixer_ctl_procunit_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mixer_ctl_procunit_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new mixer_procunit_ctl = …;
struct procunit_value_info { … };
struct procunit_info { … };
static const struct procunit_value_info undefined_proc_info[] = …;
static const struct procunit_value_info updown_proc_info[] = …;
static const struct procunit_value_info prologic_proc_info[] = …;
static const struct procunit_value_info threed_enh_proc_info[] = …;
static const struct procunit_value_info reverb_proc_info[] = …;
static const struct procunit_value_info chorus_proc_info[] = …;
static const struct procunit_value_info dcr_proc_info[] = …;
static const struct procunit_info procunits[] = …;
static const struct procunit_value_info uac3_updown_proc_info[] = …;
static const struct procunit_value_info uac3_stereo_ext_proc_info[] = …;
static const struct procunit_info uac3_procunits[] = …;
static const struct procunit_value_info clock_rate_xu_info[] = …;
static const struct procunit_value_info clock_source_xu_info[] = …;
static const struct procunit_value_info spdif_format_xu_info[] = …;
static const struct procunit_value_info soft_limit_xu_info[] = …;
static const struct procunit_info extunits[] = …;
static int build_audio_procunit(struct mixer_build *state, int unitid,
void *raw_desc, const struct procunit_info *list,
bool extension_unit)
{ … }
static int parse_audio_processing_unit(struct mixer_build *state, int unitid,
void *raw_desc)
{ … }
static int parse_audio_extension_unit(struct mixer_build *state, int unitid,
void *raw_desc)
{ … }
static int mixer_ctl_selector_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int mixer_ctl_selector_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mixer_ctl_selector_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new mixer_selectunit_ctl = …;
static void usb_mixer_selector_elem_free(struct snd_kcontrol *kctl)
{ … }
static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
void *raw_desc)
{ … }
static int parse_audio_unit(struct mixer_build *state, int unitid)
{ … }
static void snd_usb_mixer_free(struct usb_mixer_interface *mixer)
{ … }
static int snd_usb_mixer_dev_free(struct snd_device *device)
{ … }
struct uac3_badd_profile { … };
static const struct uac3_badd_profile uac3_badd_profiles[] = …;
static bool uac3_badd_func_has_valid_channels(struct usb_mixer_interface *mixer,
const struct uac3_badd_profile *f,
int c_chmask, int p_chmask)
{ … }
static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer,
int ctrlif)
{ … }
static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
{ … }
static int delegate_notify(struct usb_mixer_interface *mixer, int unitid,
u8 *control, u8 *channel)
{ … }
void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
{ … }
static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer,
struct usb_mixer_elem_list *list)
{ … }
static void snd_usb_mixer_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
int attribute, int value, int index)
{ … }
static void snd_usb_mixer_interrupt(struct urb *urb)
{ … }
static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
{ … }
int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
{ … }
void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)
{ … }
static void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer)
{ … }
static int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
{ … }
int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer)
{ … }
static int restore_mixer_value(struct usb_mixer_elem_list *list)
{ … }
int snd_usb_mixer_resume(struct usb_mixer_interface *mixer)
{ … }
void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
struct usb_mixer_interface *mixer,
int unitid)
{ … }