/*1* Additional mixer mapping2*3* Copyright (c) 2002 by Takashi Iwai <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*19*/2021struct usbmix_dB_map {22u32 min;23u32 max;24};2526struct usbmix_name_map {27int id;28const char *name;29int control;30struct usbmix_dB_map *dB;31};3233struct usbmix_selector_map {34int id;35int count;36const char **names;37};3839struct usbmix_ctl_map {40u32 id;41const struct usbmix_name_map *map;42const struct usbmix_selector_map *selector_map;43int ignore_ctl_error;44};4546/*47* USB control mappers for SB Exitigy48*/4950/*51* Topology of SB Extigy (see on the wide screen :)5253USB_IN[1] --->FU[2]------------------------------+->MU[16]-->PU[17]-+->FU[18]--+->EU[27]--+->EU[21]-->FU[22]--+->FU[23] > Dig_OUT[24]54^ | | | |55USB_IN[3] -+->SU[5]-->FU[6]--+->MU[14] ->PU[15]->+ | | | +->FU[25] > Dig_OUT[26]56^ ^ | | | |57Dig_IN[4] -+ | | | | +->FU[28]---------------------> Spk_OUT[19]58| | | |59Lin-IN[7] -+-->FU[8]---------+ | | +----------------------------------------> Hph_OUT[20]60| | |61Mic-IN[9] --+->FU[10]----------------------------+ |62|| |63|| +----------------------------------------------------+64VV V65++--+->SU[11]-->FU[12] --------------------------------------------------------------------------------------> USB_OUT[13]66*/6768static struct usbmix_name_map extigy_map[] = {69/* 1: IT pcm */70{ 2, "PCM Playback" }, /* FU */71/* 3: IT pcm */72/* 4: IT digital in */73{ 5, NULL }, /* DISABLED: this seems to be bogus on some firmware */74{ 6, "Digital In" }, /* FU */75/* 7: IT line */76{ 8, "Line Playback" }, /* FU */77/* 9: IT mic */78{ 10, "Mic Playback" }, /* FU */79{ 11, "Capture Source" }, /* SU */80{ 12, "Capture" }, /* FU */81/* 13: OT pcm capture */82/* 14: MU (w/o controls) */83/* 15: PU (3D enh) */84/* 16: MU (w/o controls) */85{ 17, NULL, 1 }, /* DISABLED: PU-switch (any effect?) */86{ 17, "Channel Routing", 2 }, /* PU: mode select */87{ 18, "Tone Control - Bass", UAC_FU_BASS }, /* FU */88{ 18, "Tone Control - Treble", UAC_FU_TREBLE }, /* FU */89{ 18, "Master Playback" }, /* FU; others */90/* 19: OT speaker */91/* 20: OT headphone */92{ 21, NULL }, /* DISABLED: EU (for what?) */93{ 22, "Digital Out Playback" }, /* FU */94{ 23, "Digital Out1 Playback" }, /* FU */ /* FIXME: corresponds to 24 */95/* 24: OT digital out */96{ 25, "IEC958 Optical Playback" }, /* FU */97{ 26, "IEC958 Optical Playback" }, /* OT */98{ 27, NULL }, /* DISABLED: EU (for what?) */99/* 28: FU speaker (mute) */100{ 29, NULL }, /* Digital Input Playback Source? */101{ 0 } /* terminator */102};103104/* Sound Blaster MP3+ controls mapping105* The default mixer channels have totally misleading names,106* e.g. no Master and fake PCM volume107* Pavel Mihaylov <[email protected]>108*/109static struct usbmix_dB_map mp3plus_dB_1 = {-4781, 0}; /* just guess */110static struct usbmix_dB_map mp3plus_dB_2 = {-1781, 618}; /* just guess */111112static struct usbmix_name_map mp3plus_map[] = {113/* 1: IT pcm */114/* 2: IT mic */115/* 3: IT line */116/* 4: IT digital in */117/* 5: OT digital out */118/* 6: OT speaker */119/* 7: OT pcm capture */120{ 8, "Capture Source" }, /* FU, default PCM Capture Source */121/* (Mic, Input 1 = Line input, Input 2 = Optical input) */122{ 9, "Master Playback" }, /* FU, default Speaker 1 */123/* { 10, "Mic Capture", 1 }, */ /* FU, Mic Capture */124{ 10, /* "Mic Capture", */ NULL, 2, .dB = &mp3plus_dB_2 },125/* FU, Mic Capture */126{ 10, "Mic Boost", 7 }, /* FU, default Auto Gain Input */127{ 11, "Line Capture", .dB = &mp3plus_dB_2 },128/* FU, default PCM Capture */129{ 12, "Digital In Playback" }, /* FU, default PCM 1 */130{ 13, /* "Mic Playback", */ .dB = &mp3plus_dB_1 },131/* FU, default Mic Playback */132{ 14, "Line Playback", .dB = &mp3plus_dB_1 }, /* FU, default Speaker */133/* 15: MU */134{ 0 } /* terminator */135};136137/* Topology of SB Audigy 2 NX138139+----------------------------->EU[27]--+140| v141| +----------------------------------->SU[29]---->FU[22]-->Dig_OUT[24]142| | ^143USB_IN[1]-+------------+ +->EU[17]->+->FU[11]-+144| v | v |145Dig_IN[4]---+->FU[6]-->MU[16]->FU[18]-+->EU[21]->SU[31]----->FU[30]->Hph_OUT[20]146| ^ | |147Lin_IN[7]-+--->FU[8]---+ +->EU[23]->FU[28]------------->Spk_OUT[19]148| | v149+--->FU[12]------------------------------------->SU[14]--->USB_OUT[15]150| ^151+->FU[13]--------------------------------------+152*/153static struct usbmix_name_map audigy2nx_map[] = {154/* 1: IT pcm playback */155/* 4: IT digital in */156{ 6, "Digital In Playback" }, /* FU */157/* 7: IT line in */158{ 8, "Line Playback" }, /* FU */159{ 11, "What-U-Hear Capture" }, /* FU */160{ 12, "Line Capture" }, /* FU */161{ 13, "Digital In Capture" }, /* FU */162{ 14, "Capture Source" }, /* SU */163/* 15: OT pcm capture */164/* 16: MU w/o controls */165{ 17, NULL }, /* DISABLED: EU (for what?) */166{ 18, "Master Playback" }, /* FU */167/* 19: OT speaker */168/* 20: OT headphone */169{ 21, NULL }, /* DISABLED: EU (for what?) */170{ 22, "Digital Out Playback" }, /* FU */171{ 23, NULL }, /* DISABLED: EU (for what?) */172/* 24: OT digital out */173{ 27, NULL }, /* DISABLED: EU (for what?) */174{ 28, "Speaker Playback" }, /* FU */175{ 29, "Digital Out Source" }, /* SU */176{ 30, "Headphone Playback" }, /* FU */177{ 31, "Headphone Source" }, /* SU */178{ 0 } /* terminator */179};180181static struct usbmix_selector_map audigy2nx_selectors[] = {182{183.id = 14, /* Capture Source */184.count = 3,185.names = (const char*[]) {"Line", "Digital In", "What-U-Hear"}186},187{188.id = 29, /* Digital Out Source */189.count = 3,190.names = (const char*[]) {"Front", "PCM", "Digital In"}191},192{193.id = 31, /* Headphone Source */194.count = 2,195.names = (const char*[]) {"Front", "Side"}196},197{ 0 } /* terminator */198};199200/* Creative SoundBlaster Live! 24-bit External */201static struct usbmix_name_map live24ext_map[] = {202/* 2: PCM Playback Volume */203{ 5, "Mic Capture" }, /* FU, default PCM Capture Volume */204{ 0 } /* terminator */205};206207/* LineX FM Transmitter entry - needed to bypass controls bug */208static struct usbmix_name_map linex_map[] = {209/* 1: IT pcm */210/* 2: OT Speaker */211{ 3, "Master" }, /* FU: master volume - left / right / mute */212{ 0 } /* terminator */213};214215static struct usbmix_name_map maya44_map[] = {216/* 1: IT line */217{ 2, "Line Playback" }, /* FU */218/* 3: IT line */219{ 4, "Line Playback" }, /* FU */220/* 5: IT pcm playback */221/* 6: MU */222{ 7, "Master Playback" }, /* FU */223/* 8: OT speaker */224/* 9: IT line */225{ 10, "Line Capture" }, /* FU */226/* 11: MU */227/* 12: OT pcm capture */228{ }229};230231/* Section "justlink_map" below added by James Courtier-Dutton <[email protected]>232* sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK233* Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.)234* The USB Mixer publishes a Microphone and extra Volume controls for it, but none exist on the device,235* so this map removes all unwanted sliders from alsamixer236*/237238static struct usbmix_name_map justlink_map[] = {239/* 1: IT pcm playback */240/* 2: Not present */241{ 3, NULL}, /* IT mic (No mic input on device) */242/* 4: Not present */243/* 5: OT speacker */244/* 6: OT pcm capture */245{ 7, "Master Playback" }, /* Mute/volume for speaker */246{ 8, NULL }, /* Capture Switch (No capture inputs on device) */247{ 9, NULL }, /* Capture Mute/volume (No capture inputs on device */248/* 0xa: Not present */249/* 0xb: MU (w/o controls) */250{ 0xc, NULL }, /* Mic feedback Mute/volume (No capture inputs on device) */251{ 0 } /* terminator */252};253254/* TerraTec Aureon 5.1 MkII USB */255static struct usbmix_name_map aureon_51_2_map[] = {256/* 1: IT USB */257/* 2: IT Mic */258/* 3: IT Line */259/* 4: IT SPDIF */260/* 5: OT SPDIF */261/* 6: OT Speaker */262/* 7: OT USB */263{ 8, "Capture Source" }, /* SU */264{ 9, "Master Playback" }, /* FU */265{ 10, "Mic Capture" }, /* FU */266{ 11, "Line Capture" }, /* FU */267{ 12, "IEC958 In Capture" }, /* FU */268{ 13, "Mic Playback" }, /* FU */269{ 14, "Line Playback" }, /* FU */270/* 15: MU */271{} /* terminator */272};273274static struct usbmix_name_map scratch_live_map[] = {275/* 1: IT Line 1 (USB streaming) */276/* 2: OT Line 1 (Speaker) */277/* 3: IT Line 1 (Line connector) */278{ 4, "Line 1 In" }, /* FU */279/* 5: OT Line 1 (USB streaming) */280/* 6: IT Line 2 (USB streaming) */281/* 7: OT Line 2 (Speaker) */282/* 8: IT Line 2 (Line connector) */283{ 9, "Line 2 In" }, /* FU */284/* 10: OT Line 2 (USB streaming) */285/* 11: IT Mic (Line connector) */286/* 12: OT Mic (USB streaming) */287{ 0 } /* terminator */288};289290/* "Gamesurround Muse Pocket LT" looks same like "Sound Blaster MP3+"291* most importand difference is SU[8], it should be set to "Capture Source"292* to make alsamixer and PA working properly.293* FIXME: or mp3plus_map should use "Capture Source" too,294* so this maps can be merget295*/296static struct usbmix_name_map hercules_usb51_map[] = {297{ 8, "Capture Source" }, /* SU, default "PCM Capture Source" */298{ 9, "Master Playback" }, /* FU, default "Speaker Playback" */299{ 10, "Mic Boost", 7 }, /* FU, default "Auto Gain Input" */300{ 11, "Line Capture" }, /* FU, default "PCM Capture" */301{ 13, "Mic Bypass Playback" }, /* FU, default "Mic Playback" */302{ 14, "Line Bypass Playback" }, /* FU, default "Line Playback" */303{ 0 } /* terminator */304};305306/*307* Control map entries308*/309310static struct usbmix_ctl_map usbmix_ctl_maps[] = {311{312.id = USB_ID(0x041e, 0x3000),313.map = extigy_map,314.ignore_ctl_error = 1,315},316{317.id = USB_ID(0x041e, 0x3010),318.map = mp3plus_map,319},320{321.id = USB_ID(0x041e, 0x3020),322.map = audigy2nx_map,323.selector_map = audigy2nx_selectors,324},325{326.id = USB_ID(0x041e, 0x3040),327.map = live24ext_map,328},329{330.id = USB_ID(0x041e, 0x3048),331.map = audigy2nx_map,332.selector_map = audigy2nx_selectors,333},334{335/* Hercules DJ Console (Windows Edition) */336.id = USB_ID(0x06f8, 0xb000),337.ignore_ctl_error = 1,338},339{340/* Hercules DJ Console (Macintosh Edition) */341.id = USB_ID(0x06f8, 0xd002),342.ignore_ctl_error = 1,343},344{345/* Hercules Gamesurround Muse Pocket LT346* (USB 5.1 Channel Audio Adapter)347*/348.id = USB_ID(0x06f8, 0xc000),349.map = hercules_usb51_map,350},351{352.id = USB_ID(0x08bb, 0x2702),353.map = linex_map,354.ignore_ctl_error = 1,355},356{357.id = USB_ID(0x0a92, 0x0091),358.map = maya44_map,359},360{361.id = USB_ID(0x0c45, 0x1158),362.map = justlink_map,363},364{365.id = USB_ID(0x0ccd, 0x0028),366.map = aureon_51_2_map,367},368{369.id = USB_ID(0x13e5, 0x0001),370.map = scratch_live_map,371.ignore_ctl_error = 1,372},373{ 0 } /* terminator */374};375376377378