mixer_maps.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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_name_map mbox1_map[] = {
  170. { 1, "Clock" },
  171. { 0 } /* terminator */
  172. };
  173. static struct usbmix_selector_map c400_selectors[] = {
  174. {
  175. .id = 0x80,
  176. .count = 2,
  177. .names = (const char*[]) {"Internal", "SPDIF"}
  178. },
  179. { 0 } /* terminator */
  180. };
  181. static 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. };
  199. /* Creative SoundBlaster Live! 24-bit External */
  200. static struct usbmix_name_map live24ext_map[] = {
  201. /* 2: PCM Playback Volume */
  202. { 5, "Mic Capture" }, /* FU, default PCM Capture Volume */
  203. { 0 } /* terminator */
  204. };
  205. /* LineX FM Transmitter entry - needed to bypass controls bug */
  206. static struct usbmix_name_map linex_map[] = {
  207. /* 1: IT pcm */
  208. /* 2: OT Speaker */
  209. { 3, "Master" }, /* FU: master volume - left / right / mute */
  210. { 0 } /* terminator */
  211. };
  212. static struct usbmix_name_map maya44_map[] = {
  213. /* 1: IT line */
  214. { 2, "Line Playback" }, /* FU */
  215. /* 3: IT line */
  216. { 4, "Line Playback" }, /* FU */
  217. /* 5: IT pcm playback */
  218. /* 6: MU */
  219. { 7, "Master Playback" }, /* FU */
  220. /* 8: OT speaker */
  221. /* 9: IT line */
  222. { 10, "Line Capture" }, /* FU */
  223. /* 11: MU */
  224. /* 12: OT pcm capture */
  225. { }
  226. };
  227. /* Section "justlink_map" below added by James Courtier-Dutton <James@superbug.demon.co.uk>
  228. * sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK
  229. * Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.)
  230. * The USB Mixer publishes a Microphone and extra Volume controls for it, but none exist on the device,
  231. * so this map removes all unwanted sliders from alsamixer
  232. */
  233. static struct usbmix_name_map justlink_map[] = {
  234. /* 1: IT pcm playback */
  235. /* 2: Not present */
  236. { 3, NULL}, /* IT mic (No mic input on device) */
  237. /* 4: Not present */
  238. /* 5: OT speacker */
  239. /* 6: OT pcm capture */
  240. { 7, "Master Playback" }, /* Mute/volume for speaker */
  241. { 8, NULL }, /* Capture Switch (No capture inputs on device) */
  242. { 9, NULL }, /* Capture Mute/volume (No capture inputs on device */
  243. /* 0xa: Not present */
  244. /* 0xb: MU (w/o controls) */
  245. { 0xc, NULL }, /* Mic feedback Mute/volume (No capture inputs on device) */
  246. { 0 } /* terminator */
  247. };
  248. /* TerraTec Aureon 5.1 MkII USB */
  249. static struct usbmix_name_map aureon_51_2_map[] = {
  250. /* 1: IT USB */
  251. /* 2: IT Mic */
  252. /* 3: IT Line */
  253. /* 4: IT SPDIF */
  254. /* 5: OT SPDIF */
  255. /* 6: OT Speaker */
  256. /* 7: OT USB */
  257. { 8, "Capture Source" }, /* SU */
  258. { 9, "Master Playback" }, /* FU */
  259. { 10, "Mic Capture" }, /* FU */
  260. { 11, "Line Capture" }, /* FU */
  261. { 12, "IEC958 In Capture" }, /* FU */
  262. { 13, "Mic Playback" }, /* FU */
  263. { 14, "Line Playback" }, /* FU */
  264. /* 15: MU */
  265. {} /* terminator */
  266. };
  267. static struct usbmix_name_map scratch_live_map[] = {
  268. /* 1: IT Line 1 (USB streaming) */
  269. /* 2: OT Line 1 (Speaker) */
  270. /* 3: IT Line 1 (Line connector) */
  271. { 4, "Line 1 In" }, /* FU */
  272. /* 5: OT Line 1 (USB streaming) */
  273. /* 6: IT Line 2 (USB streaming) */
  274. /* 7: OT Line 2 (Speaker) */
  275. /* 8: IT Line 2 (Line connector) */
  276. { 9, "Line 2 In" }, /* FU */
  277. /* 10: OT Line 2 (USB streaming) */
  278. /* 11: IT Mic (Line connector) */
  279. /* 12: OT Mic (USB streaming) */
  280. { 0 } /* terminator */
  281. };
  282. static struct usbmix_name_map ebox44_map[] = {
  283. { 4, NULL }, /* FU */
  284. { 6, NULL }, /* MU */
  285. { 7, NULL }, /* FU */
  286. { 10, NULL }, /* FU */
  287. { 11, NULL }, /* MU */
  288. { 0 }
  289. };
  290. /* "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 merget
  295. */
  296. static 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. };
  305. /* Plantronics Gamecom 780 has a broken volume control, better to disable it */
  306. static struct usbmix_name_map gamecom780_map[] = {
  307. { 9, NULL }, /* FU, speaker out */
  308. {}
  309. };
  310. /* some (all?) SCMS USB3318 devices are affected by a firmware lock up
  311. * when anything attempts to access FU 10 (control)
  312. */
  313. static const struct usbmix_name_map scms_usb3318_map[] = {
  314. { 10, NULL },
  315. { 0 }
  316. };
  317. /*
  318. * Control map entries
  319. */
  320. static struct usbmix_ctl_map usbmix_ctl_maps[] = {
  321. {
  322. .id = USB_ID(0x041e, 0x3000),
  323. .map = extigy_map,
  324. .ignore_ctl_error = 1,
  325. },
  326. {
  327. .id = USB_ID(0x041e, 0x3010),
  328. .map = mp3plus_map,
  329. },
  330. {
  331. .id = USB_ID(0x041e, 0x3020),
  332. .map = audigy2nx_map,
  333. .selector_map = audigy2nx_selectors,
  334. },
  335. {
  336. .id = USB_ID(0x041e, 0x3040),
  337. .map = live24ext_map,
  338. },
  339. {
  340. .id = USB_ID(0x041e, 0x3048),
  341. .map = audigy2nx_map,
  342. .selector_map = audigy2nx_selectors,
  343. },
  344. { /* Logitech, Inc. QuickCam Pro for Notebooks */
  345. .id = USB_ID(0x046d, 0x0991),
  346. .ignore_ctl_error = 1,
  347. },
  348. { /* Logitech, Inc. QuickCam E 3500 */
  349. .id = USB_ID(0x046d, 0x09a4),
  350. .ignore_ctl_error = 1,
  351. },
  352. { /* Plantronics GameCom 780 */
  353. .id = USB_ID(0x047f, 0xc010),
  354. .map = gamecom780_map,
  355. },
  356. {
  357. /* Hercules DJ Console (Windows Edition) */
  358. .id = USB_ID(0x06f8, 0xb000),
  359. .ignore_ctl_error = 1,
  360. },
  361. {
  362. /* Hercules DJ Console (Macintosh Edition) */
  363. .id = USB_ID(0x06f8, 0xd002),
  364. .ignore_ctl_error = 1,
  365. },
  366. {
  367. /* Hercules Gamesurround Muse Pocket LT
  368. * (USB 5.1 Channel Audio Adapter)
  369. */
  370. .id = USB_ID(0x06f8, 0xc000),
  371. .map = hercules_usb51_map,
  372. },
  373. {
  374. .id = USB_ID(0x0763, 0x2030),
  375. .selector_map = c400_selectors,
  376. },
  377. {
  378. .id = USB_ID(0x0763, 0x2031),
  379. .selector_map = c400_selectors,
  380. },
  381. {
  382. .id = USB_ID(0x08bb, 0x2702),
  383. .map = linex_map,
  384. .ignore_ctl_error = 1,
  385. },
  386. {
  387. .id = USB_ID(0x0a92, 0x0091),
  388. .map = maya44_map,
  389. },
  390. {
  391. .id = USB_ID(0x0c45, 0x1158),
  392. .map = justlink_map,
  393. },
  394. {
  395. .id = USB_ID(0x0ccd, 0x0028),
  396. .map = aureon_51_2_map,
  397. },
  398. {
  399. .id = USB_ID(0x0dba, 0x1000),
  400. .map = mbox1_map,
  401. },
  402. {
  403. .id = USB_ID(0x13e5, 0x0001),
  404. .map = scratch_live_map,
  405. .ignore_ctl_error = 1,
  406. },
  407. {
  408. .id = USB_ID(0x200c, 0x1018),
  409. .map = ebox44_map,
  410. },
  411. {
  412. /* MAYA44 USB+ */
  413. .id = USB_ID(0x2573, 0x0008),
  414. .map = maya44_map,
  415. },
  416. {
  417. /* KEF X300A */
  418. .id = USB_ID(0x27ac, 0x1000),
  419. .map = scms_usb3318_map,
  420. },
  421. {
  422. /* Arcam rPAC */
  423. .id = USB_ID(0x25c4, 0x0003),
  424. .map = scms_usb3318_map,
  425. },
  426. { 0 } /* terminator */
  427. };