linux/sound/usb/usbmixer_maps.c
<<
>>
Prefs
   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
  23struct usbmix_name_map {
  24        int id;
  25        const char *name;
  26        int control;
  27};
  28
  29struct usbmix_selector_map {
  30        int id;
  31        int count;
  32        const char **names;
  33};
  34
  35struct usbmix_ctl_map {
  36        u32 id;
  37        const struct usbmix_name_map *map;
  38        const struct usbmix_selector_map *selector_map;
  39        int ignore_ctl_error;
  40};
  41
  42/*
  43 * USB control mappers for SB Exitigy
  44 */
  45
  46/*
  47 * Topology of SB Extigy (see on the wide screen :)
  48
  49USB_IN[1] --->FU[2]------------------------------+->MU[16]-->PU[17]-+->FU[18]--+->EU[27]--+->EU[21]-->FU[22]--+->FU[23] > Dig_OUT[24]
  50                                                 ^                  |          |          |                   |
  51USB_IN[3] -+->SU[5]-->FU[6]--+->MU[14] ->PU[15]->+                  |          |          |                   +->FU[25] > Dig_OUT[26]
  52           ^                 ^                   |                  |          |          |
  53Dig_IN[4] -+                 |                   |                  |          |          +->FU[28]---------------------> Spk_OUT[19]
  54                             |                   |                  |          |
  55Lin-IN[7] -+-->FU[8]---------+                   |                  |          +----------------------------------------> Hph_OUT[20]
  56           |                                     |                  |
  57Mic-IN[9] --+->FU[10]----------------------------+                  |
  58           ||                                                       |
  59           ||  +----------------------------------------------------+
  60           VV  V
  61           ++--+->SU[11]-->FU[12] --------------------------------------------------------------------------------------> USB_OUT[13]
  62*/
  63
  64static struct usbmix_name_map extigy_map[] = {
  65        /* 1: IT pcm */
  66        { 2, "PCM Playback" }, /* FU */
  67        /* 3: IT pcm */
  68        /* 4: IT digital in */
  69        { 5, NULL }, /* DISABLED: this seems to be bogus on some firmware */
  70        { 6, "Digital In" }, /* FU */
  71        /* 7: IT line */
  72        { 8, "Line Playback" }, /* FU */
  73        /* 9: IT mic */
  74        { 10, "Mic Playback" }, /* FU */
  75        { 11, "Capture Input Source" }, /* SU */
  76        { 12, "Capture" }, /* FU */
  77        /* 13: OT pcm capture */
  78        /* 14: MU (w/o controls) */
  79        /* 15: PU (3D enh) */
  80        /* 16: MU (w/o controls) */
  81        { 17, NULL, 1 }, /* DISABLED: PU-switch (any effect?) */
  82        { 17, "Channel Routing", 2 },   /* PU: mode select */
  83        { 18, "Tone Control - Bass", USB_FEATURE_BASS }, /* FU */
  84        { 18, "Tone Control - Treble", USB_FEATURE_TREBLE }, /* FU */
  85        { 18, "Master Playback" }, /* FU; others */
  86        /* 19: OT speaker */
  87        /* 20: OT headphone */
  88        { 21, NULL }, /* DISABLED: EU (for what?) */
  89        { 22, "Digital Out Playback" }, /* FU */
  90        { 23, "Digital Out1 Playback" }, /* FU */  /* FIXME: corresponds to 24 */
  91        /* 24: OT digital out */
  92        { 25, "IEC958 Optical Playback" }, /* FU */
  93        { 26, "IEC958 Optical Playback" }, /* OT */
  94        { 27, NULL }, /* DISABLED: EU (for what?) */
  95        /* 28: FU speaker (mute) */
  96        { 29, NULL }, /* Digital Input Playback Source? */
  97        { 0 } /* terminator */
  98};
  99
 100/* Sound Blaster MP3+ controls mapping
 101 * The default mixer channels have totally misleading names,
 102 * e.g. no Master and fake PCM volume
 103 *                      Pavel Mihaylov <bin@bash.info>
 104 */
 105static struct usbmix_name_map mp3plus_map[] = {
 106        /* 1: IT pcm */
 107        /* 2: IT mic */
 108        /* 3: IT line */
 109        /* 4: IT digital in */
 110        /* 5: OT digital out */
 111        /* 6: OT speaker */
 112        /* 7: OT pcm capture */
 113        { 8, "Capture Input Source" }, /* FU, default PCM Capture Source */
 114                /* (Mic, Input 1 = Line input, Input 2 = Optical input) */
 115        { 9, "Master Playback" }, /* FU, default Speaker 1 */
 116        /* { 10, "Mic Capture", 1 }, */ /* FU, Mic Capture */
 117        /* { 10, "Mic Capture", 2 }, */ /* FU, Mic Capture */
 118        { 10, "Mic Boost", 7 }, /* FU, default Auto Gain Input */
 119        { 11, "Line Capture" }, /* FU, default PCM Capture */
 120        { 12, "Digital In Playback" }, /* FU, default PCM 1 */
 121        /* { 13, "Mic Playback" }, */ /* FU, default Mic Playback */
 122        { 14, "Line Playback" }, /* FU, default Speaker */
 123        /* 15: MU */
 124        { 0 } /* terminator */
 125};
 126
 127/* Topology of SB Audigy 2 NX
 128
 129          +----------------------------->EU[27]--+
 130          |                                      v
 131          | +----------------------------------->SU[29]---->FU[22]-->Dig_OUT[24]
 132          | |                                    ^
 133USB_IN[1]-+------------+              +->EU[17]->+->FU[11]-+
 134            |          v              |          v         |
 135Dig_IN[4]---+->FU[6]-->MU[16]->FU[18]-+->EU[21]->SU[31]----->FU[30]->Hph_OUT[20]
 136            |          ^              |                    |
 137Lin_IN[7]-+--->FU[8]---+              +->EU[23]->FU[28]------------->Spk_OUT[19]
 138          | |                                              v
 139          +--->FU[12]------------------------------------->SU[14]--->USB_OUT[15]
 140            |                                              ^
 141            +->FU[13]--------------------------------------+
 142*/
 143static struct usbmix_name_map audigy2nx_map[] = {
 144        /* 1: IT pcm playback */
 145        /* 4: IT digital in */
 146        { 6, "Digital In Playback" }, /* FU */
 147        /* 7: IT line in */
 148        { 8, "Line Playback" }, /* FU */
 149        { 11, "What-U-Hear Capture" }, /* FU */
 150        { 12, "Line Capture" }, /* FU */
 151        { 13, "Digital In Capture" }, /* FU */
 152        { 14, "Capture Source" }, /* SU */
 153        /* 15: OT pcm capture */
 154        /* 16: MU w/o controls */
 155        { 17, NULL }, /* DISABLED: EU (for what?) */
 156        { 18, "Master Playback" }, /* FU */
 157        /* 19: OT speaker */
 158        /* 20: OT headphone */
 159        { 21, NULL }, /* DISABLED: EU (for what?) */
 160        { 22, "Digital Out Playback" }, /* FU */
 161        { 23, NULL }, /* DISABLED: EU (for what?) */
 162        /* 24: OT digital out */
 163        { 27, NULL }, /* DISABLED: EU (for what?) */
 164        { 28, "Speaker Playback" }, /* FU */
 165        { 29, "Digital Out Source" }, /* SU */
 166        { 30, "Headphone Playback" }, /* FU */
 167        { 31, "Headphone Source" }, /* SU */
 168        { 0 } /* terminator */
 169};
 170
 171static struct usbmix_selector_map audigy2nx_selectors[] = {
 172        {
 173                .id = 14, /* Capture Source */
 174                .count = 3,
 175                .names = (const char*[]) {"Line", "Digital In", "What-U-Hear"}
 176        },
 177        {
 178                .id = 29, /* Digital Out Source */
 179                .count = 3,
 180                .names = (const char*[]) {"Front", "PCM", "Digital In"}
 181        },
 182        {
 183                .id = 31, /* Headphone Source */
 184                .count = 2,
 185                .names = (const char*[]) {"Front", "Side"}
 186        },
 187        { 0 } /* terminator */
 188};
 189
 190/* Creative SoundBlaster Live! 24-bit External */
 191static struct usbmix_name_map live24ext_map[] = {
 192        /* 2: PCM Playback Volume */
 193        { 5, "Mic Capture" }, /* FU, default PCM Capture Volume */
 194        { 0 } /* terminator */
 195};
 196
 197/* LineX FM Transmitter entry - needed to bypass controls bug */
 198static struct usbmix_name_map linex_map[] = {
 199        /* 1: IT pcm */
 200        /* 2: OT Speaker */ 
 201        { 3, "Master" }, /* FU: master volume - left / right / mute */
 202        { 0 } /* terminator */
 203};
 204
 205static struct usbmix_name_map maya44_map[] = {
 206        /* 1: IT line */
 207        { 2, "Line Playback" }, /* FU */
 208        /* 3: IT line */
 209        { 4, "Line Playback" }, /* FU */
 210        /* 5: IT pcm playback */
 211        /* 6: MU */
 212        { 7, "Master Playback" }, /* FU */
 213        /* 8: OT speaker */
 214        /* 9: IT line */
 215        { 10, "Line Capture" }, /* FU */
 216        /* 11: MU */
 217        /* 12: OT pcm capture */
 218        { }
 219};
 220
 221/* Section "justlink_map" below added by James Courtier-Dutton <James@superbug.demon.co.uk>
 222 * sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK
 223 * Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.)
 224 * The USB Mixer publishes a Microphone and extra Volume controls for it, but none exist on the device,
 225 * so this map removes all unwanted sliders from alsamixer
 226 */
 227
 228static struct usbmix_name_map justlink_map[] = {
 229        /* 1: IT pcm playback */
 230        /* 2: Not present */
 231        { 3, NULL}, /* IT mic (No mic input on device) */
 232        /* 4: Not present */
 233        /* 5: OT speacker */
 234        /* 6: OT pcm capture */
 235        { 7, "Master Playback" }, /* Mute/volume for speaker */
 236        { 8, NULL }, /* Capture Switch (No capture inputs on device) */
 237        { 9, NULL }, /* Capture Mute/volume (No capture inputs on device */
 238        /* 0xa: Not present */
 239        /* 0xb: MU (w/o controls) */
 240        { 0xc, NULL }, /* Mic feedback Mute/volume (No capture inputs on device) */
 241        { 0 } /* terminator */
 242};
 243
 244/* TerraTec Aureon 5.1 MkII USB */
 245static struct usbmix_name_map aureon_51_2_map[] = {
 246        /* 1: IT USB */
 247        /* 2: IT Mic */
 248        /* 3: IT Line */
 249        /* 4: IT SPDIF */
 250        /* 5: OT SPDIF */
 251        /* 6: OT Speaker */
 252        /* 7: OT USB */
 253        { 8, "Capture Source" }, /* SU */
 254        { 9, "Master Playback" }, /* FU */
 255        { 10, "Mic Capture" }, /* FU */
 256        { 11, "Line Capture" }, /* FU */
 257        { 12, "IEC958 In Capture" }, /* FU */
 258        { 13, "Mic Playback" }, /* FU */
 259        { 14, "Line Playback" }, /* FU */
 260        /* 15: MU */
 261        {} /* terminator */
 262};
 263
 264static struct usbmix_name_map scratch_live_map[] = {
 265        /* 1: IT Line 1 (USB streaming) */
 266        /* 2: OT Line 1 (Speaker) */
 267        /* 3: IT Line 1 (Line connector) */
 268        { 4, "Line 1 In" }, /* FU */
 269        /* 5: OT Line 1 (USB streaming) */
 270        /* 6: IT Line 2 (USB streaming) */
 271        /* 7: OT Line 2 (Speaker) */
 272        /* 8: IT Line 2 (Line connector) */
 273        { 9, "Line 2 In" }, /* FU */
 274        /* 10: OT Line 2 (USB streaming) */
 275        /* 11: IT Mic (Line connector) */
 276        /* 12: OT Mic (USB streaming) */
 277        { 0 } /* terminator */
 278};
 279
 280/*
 281 * Control map entries
 282 */
 283
 284static struct usbmix_ctl_map usbmix_ctl_maps[] = {
 285        {
 286                .id = USB_ID(0x041e, 0x3000),
 287                .map = extigy_map,
 288                .ignore_ctl_error = 1,
 289        },
 290        {
 291                .id = USB_ID(0x041e, 0x3010),
 292                .map = mp3plus_map,
 293        },
 294        {
 295                .id = USB_ID(0x041e, 0x3020),
 296                .map = audigy2nx_map,
 297                .selector_map = audigy2nx_selectors,
 298        },
 299        {
 300                .id = USB_ID(0x041e, 0x3040),
 301                .map = live24ext_map,
 302        },
 303        {
 304                .id = USB_ID(0x041e, 0x3048),
 305                .map = audigy2nx_map,
 306                .selector_map = audigy2nx_selectors,
 307        },
 308        {
 309                /* Hercules DJ Console (Windows Edition) */
 310                .id = USB_ID(0x06f8, 0xb000),
 311                .ignore_ctl_error = 1,
 312        },
 313        {
 314                /* Hercules DJ Console (Macintosh Edition) */
 315                .id = USB_ID(0x06f8, 0xd002),
 316                .ignore_ctl_error = 1,
 317        },
 318        {
 319                .id = USB_ID(0x08bb, 0x2702),
 320                .map = linex_map,
 321                .ignore_ctl_error = 1,
 322        },
 323        {
 324                .id = USB_ID(0x0a92, 0x0091),
 325                .map = maya44_map,
 326        },
 327        {
 328                .id = USB_ID(0x0c45, 0x1158),
 329                .map = justlink_map,
 330        },
 331        {
 332                .id = USB_ID(0x0ccd, 0x0028),
 333                .map = aureon_51_2_map,
 334        },
 335        {
 336                .id = USB_ID(0x13e5, 0x0001),
 337                .map = scratch_live_map,
 338                .ignore_ctl_error = 1,
 339        },
 340        { 0 } /* terminator */
 341};
 342
 343