]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - sound/usb/mixer_us16x08.h
Merge tag 'char-misc-4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
[mirror_ubuntu-artful-kernel.git] / sound / usb / mixer_us16x08.h
CommitLineData
d2bb390a
DU
1#ifndef __USB_MIXER_US16X08_H
2#define __USB_MIXER_US16X08_H
3
4#define SND_US16X08_MAX_CHANNELS 16
5
6/* define some bias, cause some alsa-mixers wont work with
7 * negative ranges or if mixer-min != 0
8 */
9#define SND_US16X08_NO_BIAS 0
10#define SND_US16X08_FADER_BIAS 127
11#define SND_US16X08_EQ_HIGHFREQ_BIAS 0x20
12#define SND_US16X08_COMP_THRESHOLD_BIAS 0x20
13#define SND_US16X08_COMP_ATTACK_BIAS 2
14#define SND_US16X08_COMP_RELEASE_BIAS 1
15
16/* get macro for components of kcontrol private_value */
17#define SND_US16X08_KCBIAS(x) (((x)->private_value >> 24) & 0xff)
18#define SND_US16X08_KCSTEP(x) (((x)->private_value >> 16) & 0xff)
19#define SND_US16X08_KCMIN(x) (((x)->private_value >> 8) & 0xff)
20#define SND_US16X08_KCMAX(x) (((x)->private_value >> 0) & 0xff)
21/* set macro for kcontrol private_value */
22#define SND_US16X08_KCSET(bias, step, min, max) \
23 (((bias) << 24) | ((step) << 16) | ((min) << 8) | (max))
24
25/* the URB request/type to control Tascam mixers */
26#define SND_US16X08_URB_REQUEST 0x1D
27#define SND_US16X08_URB_REQUESTTYPE 0x40
28
29/* the URB params to retrieve meter ranges */
30#define SND_US16X08_URB_METER_REQUEST 0x1e
31#define SND_US16X08_URB_METER_REQUESTTYPE 0xc0
32
33#define MUA0(x, y) ((x)[(y) * 10 + 4])
34#define MUA1(x, y) ((x)[(y) * 10 + 5])
35#define MUA2(x, y) ((x)[(y) * 10 + 6])
36#define MUB0(x, y) ((x)[(y) * 10 + 7])
37#define MUB1(x, y) ((x)[(y) * 10 + 8])
38#define MUB2(x, y) ((x)[(y) * 10 + 9])
39#define MUC0(x, y) ((x)[(y) * 10 + 10])
40#define MUC1(x, y) ((x)[(y) * 10 + 11])
41#define MUC2(x, y) ((x)[(y) * 10 + 12])
42#define MUC3(x, y) ((x)[(y) * 10 + 13])
43
44/* Common Channel control IDs */
45#define SND_US16X08_ID_BYPASS 0x45
46#define SND_US16X08_ID_BUSS_OUT 0x44
47#define SND_US16X08_ID_PHASE 0x85
48#define SND_US16X08_ID_MUTE 0x83
49#define SND_US16X08_ID_FADER 0x81
50#define SND_US16X08_ID_PAN 0x82
51#define SND_US16X08_ID_METER 0xB1
52
53#define SND_US16X08_ID_EQ_BAND_COUNT 4
54#define SND_US16X08_ID_EQ_PARAM_COUNT 4
55
56/* EQ level IDs */
57#define SND_US16X08_ID_EQLOWLEVEL 0x01
58#define SND_US16X08_ID_EQLOWMIDLEVEL 0x02
59#define SND_US16X08_ID_EQHIGHMIDLEVEL 0x03
60#define SND_US16X08_ID_EQHIGHLEVEL 0x04
61
62/* EQ frequence IDs */
63#define SND_US16X08_ID_EQLOWFREQ 0x11
64#define SND_US16X08_ID_EQLOWMIDFREQ 0x12
65#define SND_US16X08_ID_EQHIGHMIDFREQ 0x13
66#define SND_US16X08_ID_EQHIGHFREQ 0x14
67
68/* EQ width IDs */
69#define SND_US16X08_ID_EQLOWMIDWIDTH 0x22
70#define SND_US16X08_ID_EQHIGHMIDWIDTH 0x23
71
72#define SND_US16X08_ID_EQENABLE 0x30
73
74#define EQ_STORE_BAND_IDX(x) ((x) & 0xf)
75#define EQ_STORE_PARAM_IDX(x) (((x) & 0xf0) >> 4)
76
77#define SND_US16X08_ID_ROUTE 0x00
78
79/* Compressor Ids */
80#define SND_US16X08_ID_COMP_BASE 0x32
81#define SND_US16X08_ID_COMP_THRESHOLD SND_US16X08_ID_COMP_BASE
82#define SND_US16X08_ID_COMP_RATIO (SND_US16X08_ID_COMP_BASE + 1)
83#define SND_US16X08_ID_COMP_ATTACK (SND_US16X08_ID_COMP_BASE + 2)
84#define SND_US16X08_ID_COMP_RELEASE (SND_US16X08_ID_COMP_BASE + 3)
85#define SND_US16X08_ID_COMP_GAIN (SND_US16X08_ID_COMP_BASE + 4)
86#define SND_US16X08_ID_COMP_SWITCH (SND_US16X08_ID_COMP_BASE + 5)
87#define SND_US16X08_ID_COMP_COUNT 6
88
89#define COMP_STORE_IDX(x) ((x) - SND_US16X08_ID_COMP_BASE)
90
91struct snd_us16x08_eq_store {
92 u8 val[SND_US16X08_ID_EQ_BAND_COUNT][SND_US16X08_ID_EQ_PARAM_COUNT]
93 [SND_US16X08_MAX_CHANNELS];
94};
95
96struct snd_us16x08_comp_store {
97 u8 val[SND_US16X08_ID_COMP_COUNT][SND_US16X08_MAX_CHANNELS];
98};
99
100struct snd_us16x08_meter_store {
101 int meter_level[SND_US16X08_MAX_CHANNELS];
102 int master_level[2]; /* level of meter for master output */
103 int comp_index; /* round trip channel selector */
104 int comp_active_index; /* channel select from user space mixer */
105 int comp_level[16]; /* compressor reduction level */
106 struct snd_us16x08_comp_store *comp_store;
107};
108
109struct snd_us16x08_control_params {
110 struct snd_kcontrol_new *kcontrol_new;
111 int control_id;
112 int type;
113 int num_channels;
114 const char *name;
d2bb390a
DU
115 int default_val;
116};
117
118#define snd_us16x08_switch_info snd_ctl_boolean_mono_info
119
120int snd_us16x08_controls_create(struct usb_mixer_interface *mixer);
121#endif /* __USB_MIXER_US16X08_H */