mixer_maps.c 12 KB

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