]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - sound/usb/usbmixer_maps.c
[ALSA] usb-audio - add selector unit names override for Audigy 2 NX
[linux-2.6-omap-h63xx.git] / sound / usb / usbmixer_maps.c
1 /*
2  *   Additional mixer mapping
3  *
4  *   Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
5  *
6  *   This program is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation; either version 2 of the License, or
9  *   (at your option) any later version.
10  *
11  *   This program is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU General Public License for more details.
15  *
16  *   You should have received a copy of the GNU General Public License
17  *   along with this program; if not, write to the Free Software
18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19  *
20  */
21
22
23 struct usbmix_name_map {
24         int id;
25         const char *name;
26         int control;
27 };
28
29 struct usbmix_selector_map {
30         int id;
31         int count;
32         const char **names;
33 };
34
35 struct usbmix_ctl_map {
36         int vendor;
37         int product;
38         const struct usbmix_name_map *map;
39         const struct usbmix_selector_map *selector_map;
40         int ignore_ctl_error;
41 };
42
43 /*
44  * USB control mappers for SB Exitigy
45  */
46
47 /*
48  * Topology of SB Extigy (see on the wide screen :)
49
50 USB_IN[1] --->FU[2]------------------------------+->MU[16]-->PU[17]-+->FU[18]--+->EU[27]--+->EU[21]-->FU[22]--+->FU[23] > Dig_OUT[24]
51                                                  ^                  |          |          |                   |
52 USB_IN[3] -+->SU[5]-->FU[6]--+->MU[14] ->PU[15]->+                  |          |          |                   +->FU[25] > Dig_OUT[26]
53            ^                 ^                   |                  |          |          |
54 Dig_IN[4] -+                 |                   |                  |          |          +->FU[28]---------------------> Spk_OUT[19]
55                              |                   |                  |          |
56 Lin-IN[7] -+-->FU[8]---------+                   |                  |          +----------------------------------------> Hph_OUT[20]
57            |                                     |                  |
58 Mic-IN[9] --+->FU[10]----------------------------+                  |
59            ||                                                       |
60            ||  +----------------------------------------------------+
61            VV  V
62            ++--+->SU[11]-->FU[12] --------------------------------------------------------------------------------------> USB_OUT[13]
63 */
64
65 static struct usbmix_name_map extigy_map[] = {
66         /* 1: IT pcm */
67         { 2, "PCM Playback" }, /* FU */
68         /* 3: IT pcm */
69         /* 4: IT digital in */
70         { 5, NULL }, /* DISABLED: this seems to be bogus on some firmware */
71         { 6, "Digital In" }, /* FU */
72         /* 7: IT line */
73         { 8, "Line Playback" }, /* FU */
74         /* 9: IT mic */
75         { 10, "Mic Playback" }, /* FU */
76         { 11, "Capture Input Source" }, /* SU */
77         { 12, "Capture" }, /* FU */
78         /* 13: OT pcm capture */
79         /* 14: MU (w/o controls) */
80         /* 15: PU (3D enh) */
81         /* 16: MU (w/o controls) */
82         { 17, NULL, 1 }, /* DISABLED: PU-switch (any effect?) */
83         { 17, "Channel Routing", 2 },   /* PU: mode select */
84         { 18, "Tone Control - Bass", USB_FEATURE_BASS }, /* FU */
85         { 18, "Tone Control - Treble", USB_FEATURE_TREBLE }, /* FU */
86         { 18, "Master Playback" }, /* FU; others */
87         /* 19: OT speaker */
88         /* 20: OT headphone */
89         { 21, NULL }, /* DISABLED: EU (for what?) */
90         { 22, "Digital Out Playback" }, /* FU */
91         { 23, "Digital Out1 Playback" }, /* FU */  /* FIXME: corresponds to 24 */
92         /* 24: OT digital out */
93         { 25, "IEC958 Optical Playback" }, /* FU */
94         { 26, "IEC958 Optical Playback" }, /* OT */
95         { 27, NULL }, /* DISABLED: EU (for what?) */
96         /* 28: FU speaker (mute) */
97         { 29, NULL }, /* Digital Input Playback Source? */
98         { 0 } /* terminator */
99 };
100
101 /* Sound Blaster MP3+ controls mapping
102  * The default mixer channels have totally misleading names,
103  * e.g. no Master and fake PCM volume
104  *                      Pavel Mihaylov <bin@bash.info>
105  */
106 static struct usbmix_name_map mp3plus_map[] = {
107         /* 1: IT pcm */
108         /* 2: IT mic */
109         /* 3: IT line */
110         /* 4: IT digital in */
111         /* 5: OT digital out */
112         /* 6: OT speaker */
113         /* 7: OT pcm capture */
114         { 8, "Capture Input Source" }, /* FU, default PCM Capture Source */
115                 /* (Mic, Input 1 = Line input, Input 2 = Optical input) */
116         { 9, "Master Playback" }, /* FU, default Speaker 1 */
117         /* { 10, "Mic Capture", 1 }, */ /* FU, Mic Capture */
118         /* { 10, "Mic Capture", 2 }, */ /* FU, Mic Capture */
119         { 10, "Mic Boost", 7 }, /* FU, default Auto Gain Input */
120         { 11, "Line Capture" }, /* FU, default PCM Capture */
121         { 12, "Digital In Playback" }, /* FU, default PCM 1 */
122         /* { 13, "Mic Playback" }, */ /* FU, default Mic Playback */
123         { 14, "Line Playback" }, /* FU, default Speaker */
124         /* 15: MU */
125         { 0 } /* terminator */
126 };
127
128 /* Topology of SB Audigy 2 NX
129
130           +----------------------------->EU[27]--+
131           |                                      v
132           | +----------------------------------->SU[29]---->FU[22]-->Dig_OUT[24]
133           | |                                    ^
134 USB_IN[1]-+------------+              +->EU[17]->+->FU[11]-+
135             |          v              |          v         |
136 Dig_IN[4]---+->FU[6]-->MU[16]->FU[18]-+->EU[21]->SU[31]----->FU[30]->Hph_OUT[20]
137             |          ^              |                    |
138 Lin_IN[7]-+--->FU[8]---+              +->EU[23]->FU[28]------------->Spk_OUT[19]
139           | |                                              v
140           +--->FU[12]------------------------------------->SU[14]--->USB_OUT[15]
141             |                                              ^
142             +->FU[13]--------------------------------------+
143 */
144 static struct usbmix_name_map audigy2nx_map[] = {
145         /* 1: IT pcm playback */
146         /* 4: IT digital in */
147         { 6, "Digital In Playback" }, /* FU */
148         /* 7: IT line in */
149         { 8, "Line Playback" }, /* FU */
150         { 11, "What-U-Hear Capture" }, /* FU */
151         { 12, "Line Capture" }, /* FU */
152         { 13, "Digital In Capture" }, /* FU */
153         { 14, "Capture Source" }, /* SU */
154         /* 15: OT pcm capture */
155         /* 16: MU w/o controls */
156         { 17, NULL }, /* DISABLED: EU (for what?) */
157         { 18, "Master Playback" }, /* FU */
158         /* 19: OT speaker */
159         /* 20: OT headphone */
160         { 21, NULL }, /* DISABLED: EU (for what?) */
161         { 22, "Digital Out Playback" }, /* FU */
162         { 23, NULL }, /* DISABLED: EU (for what?) */
163         /* 24: OT digital out */
164         { 27, NULL }, /* DISABLED: EU (for what?) */
165         { 28, "Speaker Playback" }, /* FU */
166         { 29, "Digital Out Source" }, /* SU */
167         { 30, "Headphone Playback" }, /* FU */
168         { 31, "Headphone Source" }, /* SU */
169         { 0 } /* terminator */
170 };
171
172 static struct usbmix_selector_map audigy2nx_selectors[] = {
173         {
174                 .id = 14, /* Capture Source */
175                 .count = 3,
176                 .names = (const char*[]) {"Line", "Digital In", "What-U-Hear"}
177         },
178         {
179                 .id = 29, /* Digital Out Source */
180                 .count = 3,
181                 .names = (const char*[]) {"Front", "PCM", "Digital In"}
182         },
183         {
184                 .id = 31, /* Headphone Source */
185                 .count = 2,
186                 .names = (const char*[]) {"Front", "Side"}
187         },
188         { 0 } /* terminator */
189 };
190
191 /* LineX FM Transmitter entry - needed to bypass controls bug */
192 static struct usbmix_name_map linex_map[] = {
193         /* 1: IT pcm */
194         /* 2: OT Speaker */ 
195         { 3, "Master" }, /* FU: master volume - left / right / mute */
196         { 0 } /* terminator */
197 };
198
199 /* Section "justlink_map" below added by James Courtier-Dutton <James@superbug.demon.co.uk>
200  * sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK
201  * Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.)
202  * The USB Mixer publishes a Microphone and extra Volume controls for it, but none exist on the device,
203  * so this map removes all unwanted sliders from alsamixer
204  */
205
206 static struct usbmix_name_map justlink_map[] = {
207         /* 1: IT pcm playback */
208         /* 2: Not present */
209         { 3, NULL}, /* IT mic (No mic input on device) */
210         /* 4: Not present */
211         /* 5: OT speacker */
212         /* 6: OT pcm capture */
213         { 7, "Master Playback" }, /* Mute/volume for speaker */
214         { 8, NULL }, /* Capture Switch (No capture inputs on device) */
215         { 9, NULL }, /* Capture Mute/volume (No capture inputs on device */
216         /* 0xa: Not present */
217         /* 0xb: MU (w/o controls) */
218         { 0xc, NULL }, /* Mic feedback Mute/volume (No capture inputs on device) */
219         { 0 } /* terminator */
220 };
221
222 /*
223  * Control map entries
224  */
225
226 static struct usbmix_ctl_map usbmix_ctl_maps[] = {
227         {
228                 .vendor = 0x41e, .product = 0x3000,
229                 .map = extigy_map,
230                 .ignore_ctl_error = 1,
231         },
232         {
233                 .vendor = 0x41e, .product = 0x3010,
234                 .map = mp3plus_map,
235         },
236         {
237                 .vendor = 0x41e, .product = 0x3020,
238                 .map = audigy2nx_map,
239                 .selector_map = audigy2nx_selectors,
240         },
241         {
242                 .vendor = 0x8bb, .product = 0x2702,
243                 .map = linex_map,
244                 .ignore_ctl_error = 1,
245         },
246         {
247                 .vendor = 0xc45, .product = 0x1158,
248                 .map = justlink_map,
249         },
250         { 0 } /* terminator */
251 };
252