linux/sound/usb/mixer_us16x08.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   Tascam US-16x08 ALSA driver
 *
 *   Copyright (c) 2016 by Detlef Urban ([email protected])
 */

#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/usb/audio-v2.h>

#include <sound/core.h>
#include <sound/control.h>

#include "usbaudio.h"
#include "mixer.h"
#include "helper.h"

#include "mixer_us16x08.h"

/* USB control message templates */
static const char route_msg[] =;

static const char mix_init_msg1[] =;

static const char mix_init_msg2[] =;

static const char mix_msg_in[] =;

static const char mix_msg_out[] =;

static const char bypass_msg_out[] =;

static const char bus_msg_out[] =;

static const char comp_msg[] =;

static const char eqs_msq[] =;

/* compressor ratio map */
static const char ratio_map[] =;

/* route enumeration names */
static const char *const route_names[] =;

static int snd_us16x08_recv_urb(struct snd_usb_audio *chip,
	unsigned char *buf, int size)
{}

/* wrapper function to send prepared URB buffer to usb device. Return an error
 * code if something went wrong
 */
static int snd_us16x08_send_urb(struct snd_usb_audio *chip, char *buf, int size)
{}

static int snd_us16x08_route_info(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_info *uinfo)
{}

static int snd_us16x08_route_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_route_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_master_info(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_info *uinfo)
{}

static int snd_us16x08_master_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_master_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_bus_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_bus_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

/* gets a current mixer value from common store */
static int snd_us16x08_channel_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_channel_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_mix_info(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_info *uinfo)
{}

static int snd_us16x08_comp_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_comp_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_eqswitch_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_eqswitch_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_eq_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_eq_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_meter_info(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_info *uinfo)
{}

/* calculate compressor index for reduction level request */
static int snd_get_meter_comp_index(struct snd_us16x08_meter_store *store)
{}

/* retrieve the meter level values from URB message */
static void get_meter_levels_from_urb(int s,
	struct snd_us16x08_meter_store *store,
	u8 *meter_urb)
{}

/* Function to retrieve current meter values from the device.
 *
 * The device needs to be polled for meter values with an initial
 * requests. It will return with a sequence of different meter value
 * packages. The first request (case 0:) initiate this meter response sequence.
 * After the third response, an additional request can be placed,
 * to retrieve compressor reduction level value for given channel. This round
 * trip channel selector will skip all inactive compressors.
 * A mixer can interrupt this round-trip by selecting one ore two (stereo-link)
 * specific channels.
 */
static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static int snd_us16x08_meter_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static const struct snd_kcontrol_new snd_us16x08_ch_boolean_ctl =;

static const struct snd_kcontrol_new snd_us16x08_ch_int_ctl =;

static const struct snd_kcontrol_new snd_us16x08_pan_int_ctl =;

static const struct snd_kcontrol_new snd_us16x08_master_ctl =;

static const struct snd_kcontrol_new snd_us16x08_route_ctl =;

static const struct snd_kcontrol_new snd_us16x08_bus_ctl =;

static const struct snd_kcontrol_new snd_us16x08_compswitch_ctl =;

static const struct snd_kcontrol_new snd_us16x08_comp_threshold_ctl =;

static const struct snd_kcontrol_new snd_us16x08_comp_ratio_ctl =;

static const struct snd_kcontrol_new snd_us16x08_comp_gain_ctl =;

static const struct snd_kcontrol_new snd_us16x08_comp_attack_ctl =;

static const struct snd_kcontrol_new snd_us16x08_comp_release_ctl =;

static const struct snd_kcontrol_new snd_us16x08_eq_gain_ctl =;

static const struct snd_kcontrol_new snd_us16x08_eq_low_freq_ctl =;

static const struct snd_kcontrol_new snd_us16x08_eq_mid_freq_ctl =;

static const struct snd_kcontrol_new snd_us16x08_eq_mid_width_ctl =;

static const struct snd_kcontrol_new snd_us16x08_eq_high_freq_ctl =;

static const struct snd_kcontrol_new snd_us16x08_eq_switch_ctl =;

static const struct snd_kcontrol_new snd_us16x08_meter_ctl =;

/* control store preparation */

/* setup compressor store and assign default value */
static struct snd_us16x08_comp_store *snd_us16x08_create_comp_store(void)
{}

/* setup EQ store and assign default values */
static struct snd_us16x08_eq_store *snd_us16x08_create_eq_store(void)
{}

static struct snd_us16x08_meter_store *snd_us16x08_create_meter_store(void)
{}

/* release elem->private_free as well; called only once for each *_store */
static void elem_private_free(struct snd_kcontrol *kctl)
{}

static int add_new_ctl(struct usb_mixer_interface *mixer,
	const struct snd_kcontrol_new *ncontrol,
	int index, int val_type, int channels,
	const char *name, void *opt,
	bool do_private_free,
	struct usb_mixer_elem_info **elem_ret)
{}

/* table of EQ controls */
static const struct snd_us16x08_control_params eq_controls[] =;

/* table of compressor controls */
static const struct snd_us16x08_control_params comp_controls[] =;

/* table of channel controls */
static const struct snd_us16x08_control_params channel_controls[] =;

/* table of master controls */
static const struct snd_us16x08_control_params master_controls[] =;

int snd_us16x08_controls_create(struct usb_mixer_interface *mixer)
{}