Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __USB_MIXER_US16X08_H
0003 #define __USB_MIXER_US16X08_H
0004 
0005 #define SND_US16X08_MAX_CHANNELS 16
0006 
0007 /* define some bias, cause some alsa-mixers wont work with
0008  * negative ranges or if mixer-min != 0
0009  */
0010 #define SND_US16X08_NO_BIAS 0
0011 #define SND_US16X08_FADER_BIAS 127
0012 #define SND_US16X08_EQ_HIGHFREQ_BIAS 0x20
0013 #define SND_US16X08_COMP_THRESHOLD_BIAS 0x20
0014 #define SND_US16X08_COMP_ATTACK_BIAS 2
0015 #define SND_US16X08_COMP_RELEASE_BIAS 1
0016 
0017 /* get macro for components of kcontrol private_value */
0018 #define SND_US16X08_KCBIAS(x) (((x)->private_value >> 24) & 0xff)
0019 #define SND_US16X08_KCSTEP(x) (((x)->private_value >> 16) & 0xff)
0020 #define SND_US16X08_KCMIN(x) (((x)->private_value >> 8) & 0xff)
0021 #define SND_US16X08_KCMAX(x) (((x)->private_value >> 0) & 0xff)
0022 /* set macro for kcontrol private_value */
0023 #define SND_US16X08_KCSET(bias, step, min, max)  \
0024     (((bias) << 24) | ((step) << 16) | ((min) << 8) | (max))
0025 
0026 /* the URB request/type to control Tascam mixers */
0027 #define SND_US16X08_URB_REQUEST 0x1D
0028 #define SND_US16X08_URB_REQUESTTYPE 0x40
0029 
0030 /* the URB params to retrieve meter ranges */
0031 #define SND_US16X08_URB_METER_REQUEST       0x1e
0032 #define SND_US16X08_URB_METER_REQUESTTYPE   0xc0
0033 
0034 #define MUA0(x, y) ((x)[(y) * 10 + 4])
0035 #define MUA1(x, y) ((x)[(y) * 10 + 5])
0036 #define MUA2(x, y) ((x)[(y) * 10 + 6])
0037 #define MUB0(x, y) ((x)[(y) * 10 + 7])
0038 #define MUB1(x, y) ((x)[(y) * 10 + 8])
0039 #define MUB2(x, y) ((x)[(y) * 10 + 9])
0040 #define MUC0(x, y) ((x)[(y) * 10 + 10])
0041 #define MUC1(x, y) ((x)[(y) * 10 + 11])
0042 #define MUC2(x, y) ((x)[(y) * 10 + 12])
0043 #define MUC3(x, y) ((x)[(y) * 10 + 13])
0044 
0045 /* Common Channel control IDs */
0046 #define SND_US16X08_ID_BYPASS 0x45
0047 #define SND_US16X08_ID_BUSS_OUT 0x44
0048 #define SND_US16X08_ID_PHASE 0x85
0049 #define SND_US16X08_ID_MUTE 0x83
0050 #define SND_US16X08_ID_FADER 0x81
0051 #define SND_US16X08_ID_PAN 0x82
0052 #define SND_US16X08_ID_METER 0xB1
0053 
0054 #define SND_US16X08_ID_EQ_BAND_COUNT 4
0055 #define SND_US16X08_ID_EQ_PARAM_COUNT 4
0056 
0057 /* EQ level IDs */
0058 #define SND_US16X08_ID_EQLOWLEVEL 0x01
0059 #define SND_US16X08_ID_EQLOWMIDLEVEL 0x02
0060 #define SND_US16X08_ID_EQHIGHMIDLEVEL 0x03
0061 #define SND_US16X08_ID_EQHIGHLEVEL 0x04
0062 
0063 /* EQ frequence IDs */
0064 #define SND_US16X08_ID_EQLOWFREQ 0x11
0065 #define SND_US16X08_ID_EQLOWMIDFREQ 0x12
0066 #define SND_US16X08_ID_EQHIGHMIDFREQ 0x13
0067 #define SND_US16X08_ID_EQHIGHFREQ 0x14
0068 
0069 /* EQ width IDs */
0070 #define SND_US16X08_ID_EQLOWMIDWIDTH 0x22
0071 #define SND_US16X08_ID_EQHIGHMIDWIDTH 0x23
0072 
0073 #define SND_US16X08_ID_EQENABLE 0x30
0074 
0075 #define EQ_STORE_BAND_IDX(x) ((x) & 0xf)
0076 #define EQ_STORE_PARAM_IDX(x) (((x) & 0xf0) >> 4)
0077 
0078 #define SND_US16X08_ID_ROUTE 0x00
0079 
0080 /* Compressor Ids */
0081 #define SND_US16X08_ID_COMP_BASE    0x32
0082 #define SND_US16X08_ID_COMP_THRESHOLD   SND_US16X08_ID_COMP_BASE
0083 #define SND_US16X08_ID_COMP_RATIO   (SND_US16X08_ID_COMP_BASE + 1)
0084 #define SND_US16X08_ID_COMP_ATTACK  (SND_US16X08_ID_COMP_BASE + 2)
0085 #define SND_US16X08_ID_COMP_RELEASE (SND_US16X08_ID_COMP_BASE + 3)
0086 #define SND_US16X08_ID_COMP_GAIN    (SND_US16X08_ID_COMP_BASE + 4)
0087 #define SND_US16X08_ID_COMP_SWITCH  (SND_US16X08_ID_COMP_BASE + 5)
0088 #define SND_US16X08_ID_COMP_COUNT   6
0089 
0090 #define COMP_STORE_IDX(x) ((x) - SND_US16X08_ID_COMP_BASE)
0091 
0092 struct snd_us16x08_eq_store {
0093     u8 val[SND_US16X08_ID_EQ_BAND_COUNT][SND_US16X08_ID_EQ_PARAM_COUNT]
0094         [SND_US16X08_MAX_CHANNELS];
0095 };
0096 
0097 struct snd_us16x08_comp_store {
0098     u8 val[SND_US16X08_ID_COMP_COUNT][SND_US16X08_MAX_CHANNELS];
0099 };
0100 
0101 struct snd_us16x08_meter_store {
0102     int meter_level[SND_US16X08_MAX_CHANNELS];
0103     int master_level[2]; /* level of meter for master output */
0104     int comp_index; /* round trip channel selector */
0105     int comp_active_index; /* channel select from user space mixer */
0106     int comp_level[16]; /* compressor reduction level */
0107     struct snd_us16x08_comp_store *comp_store;
0108 };
0109 
0110 struct snd_us16x08_control_params {
0111     const struct snd_kcontrol_new *kcontrol_new;
0112     int control_id;
0113     int type;
0114     int num_channels;
0115     const char *name;
0116     int default_val;
0117 };
0118 
0119 #define snd_us16x08_switch_info snd_ctl_boolean_mono_info
0120 
0121 int snd_us16x08_controls_create(struct usb_mixer_interface *mixer);
0122 #endif /* __USB_MIXER_US16X08_H */