mixer_maps.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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 = {.min = -4781, .max = 0};
  102. /* just guess */
  103. static struct usbmix_dB_map mp3plus_dB_2 = {.min = -1781, .max = 618};
  104. /* just guess */
  105. static 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 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", */ NULL, 2, .dB = &mp3plus_dB_2 },
  118. /* FU, Mic Capture */
  119. { 10, "Mic Boost", 7 }, /* FU, default Auto Gain Input */
  120. { 11, "Line Capture", .dB = &mp3plus_dB_2 },
  121. /* FU, default PCM Capture */
  122. { 12, "Digital In Playback" }, /* FU, default PCM 1 */
  123. { 13, /* "Mic Playback", */ .dB = &mp3plus_dB_1 },
  124. /* FU, default Mic Playback */
  125. { 14, "Line Playback", .dB = &mp3plus_dB_1 }, /* FU, default Speaker */
  126. /* 15: MU */
  127. { 0 } /* terminator */
  128. };
  129. /* Topology of SB Audigy 2 NX
  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. static struct usbmix_name_map mbox1_map[] = {
  172. { 1, "Clock" },
  173. { 0 } /* terminator */
  174. };
  175. static struct usbmix_selector_map c400_selectors[] = {
  176. {
  177. .id = 0x80,
  178. .count = 2,
  179. .names = (const char*[]) {"Internal", "SPDIF"}
  180. },
  181. { 0 } /* terminator */
  182. };
  183. static struct usbmix_selector_map audigy2nx_selectors[] = {
  184. {
  185. .id = 14, /* Capture Source */
  186. .count = 3,
  187. .names = (const char*[]) {"Line", "Digital In", "What-U-Hear"}
  188. },
  189. {
  190. .id = 29, /* Digital Out Source */
  191. .count = 3,
  192. .names = (const char*[]) {"Front", "PCM", "Digital In"}
  193. },
  194. {
  195. .id = 31, /* Headphone Source */
  196. .count = 2,
  197. .names = (const char*[]) {"Front", "Side"}
  198. },
  199. { 0 } /* terminator */
  200. };
  201. /* Creative SoundBlaster Live! 24-bit External */
  202. static struct usbmix_name_map live24ext_map[] = {
  203. /* 2: PCM Playback Volume */
  204. { 5, "Mic Capture" }, /* FU, default PCM Capture Volume */
  205. { 0 } /* terminator */
  206. };
  207. /* LineX FM Transmitter entry - needed to bypass controls bug */
  208. static 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. };
  214. static struct usbmix_name_map maya44_map[] = {
  215. /* 1: IT line */
  216. { 2, "Line Playback" }, /* FU */
  217. /* 3: IT line */
  218. { 4, "Line Playback" }, /* FU */
  219. /* 5: IT pcm playback */
  220. /* 6: MU */
  221. { 7, "Master Playback" }, /* FU */
  222. /* 8: OT speaker */
  223. /* 9: IT line */
  224. { 10, "Line Capture" }, /* FU */
  225. /* 11: MU */
  226. /* 12: OT pcm capture */
  227. { }
  228. };
  229. /* Section "justlink_map" below added by James Courtier-Dutton <James@superbug.demon.co.uk>
  230. * sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK
  231. * Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.)
  232. * The USB Mixer publishes a Microphone and extra Volume controls for it, but none exist on the device,
  233. * so this map removes all unwanted sliders from alsamixer
  234. */
  235. static struct usbmix_name_map justlink_map[] = {
  236. /* 1: IT pcm playback */
  237. /* 2: Not present */
  238. { 3, NULL}, /* IT mic (No mic input on device) */
  239. /* 4: Not present */
  240. /* 5: OT speacker */
  241. /* 6: OT pcm capture */
  242. { 7, "Master Playback" }, /* Mute/volume for speaker */
  243. { 8, NULL }, /* Capture Switch (No capture inputs on device) */
  244. { 9, NULL }, /* Capture Mute/volume (No capture inputs on device */
  245. /* 0xa: Not present */
  246. /* 0xb: MU (w/o controls) */
  247. { 0xc, NULL }, /* Mic feedback Mute/volume (No capture inputs on device) */
  248. { 0 } /* terminator */
  249. };
  250. /* TerraTec Aureon 5.1 MkII USB */
  251. static struct usbmix_name_map aureon_51_2_map[] = {
  252. /* 1: IT USB */
  253. /* 2: IT Mic */
  254. /* 3: IT Line */
  255. /* 4: IT SPDIF */
  256. /* 5: OT SPDIF */
  257. /* 6: OT Speaker */
  258. /* 7: OT USB */
  259. { 8, "Capture Source" }, /* SU */
  260. { 9, "Master Playback" }, /* FU */
  261. { 10, "Mic Capture" }, /* FU */
  262. { 11, "Line Capture" }, /* FU */
  263. { 12, "IEC958 In Capture" }, /* FU */
  264. { 13, "Mic Playback" }, /* FU */
  265. { 14, "Line Playback" }, /* FU */
  266. /* 15: MU */
  267. {} /* terminator */
  268. };
  269. static struct usbmix_name_map scratch_live_map[] = {
  270. /* 1: IT Line 1 (USB streaming) */
  271. /* 2: OT Line 1 (Speaker) */
  272. /* 3: IT Line 1 (Line connector) */
  273. { 4, "Line 1 In" }, /* FU */
  274. /* 5: OT Line 1 (USB streaming) */
  275. /* 6: IT Line 2 (USB streaming) */
  276. /* 7: OT Line 2 (Speaker) */
  277. /* 8: IT Line 2 (Line connector) */
  278. { 9, "Line 2 In" }, /* FU */
  279. /* 10: OT Line 2 (USB streaming) */
  280. /* 11: IT Mic (Line connector) */
  281. /* 12: OT Mic (USB streaming) */
  282. { 0 } /* terminator */
  283. };
  284. static struct usbmix_name_map ebox44_map[] = {
  285. { 4, NULL }, /* FU */
  286. { 6, NULL }, /* MU */
  287. { 7, NULL }, /* FU */
  288. { 10, NULL }, /* FU */
  289. { 11, NULL }, /* MU */
  290. { 0 }
  291. };
  292. /* "Gamesurround Muse Pocket LT" looks same like "Sound Blaster MP3+"
  293. * most importand difference is SU[8], it should be set to "Capture Source"
  294. * to make alsamixer and PA working properly.
  295. * FIXME: or mp3plus_map should use "Capture Source" too,
  296. * so this maps can be merget
  297. */
  298. static struct usbmix_name_map hercules_usb51_map[] = {
  299. { 8, "Capture Source" }, /* SU, default "PCM Capture Source" */
  300. { 9, "Master Playback" }, /* FU, default "Speaker Playback" */
  301. { 10, "Mic Boost", 7 }, /* FU, default "Auto Gain Input" */
  302. { 11, "Line Capture" }, /* FU, default "PCM Capture" */
  303. { 13, "Mic Bypass Playback" }, /* FU, default "Mic Playback" */
  304. { 14, "Line Bypass Playback" }, /* FU, default "Line Playback" */
  305. { 0 } /* terminator */
  306. };
  307. /* Plantronics Gamecom 780 has a broken volume control, better to disable it */
  308. static struct usbmix_name_map gamecom780_map[] = {
  309. { 9, NULL }, /* FU, speaker out */
  310. {}
  311. };
  312. /* some (all?) SCMS USB3318 devices are affected by a firmware lock up
  313. * when anything attempts to access FU 10 (control)
  314. */
  315. static const struct usbmix_name_map scms_usb3318_map[] = {
  316. { 10, NULL },
  317. { 0 }
  318. };
  319. /* Bose companion 5, the dB conversion factor is 16 instead of 256 */
  320. static struct usbmix_dB_map bose_companion5_dB = {-5006, -6};
  321. static struct usbmix_name_map bose_companion5_map[] = {
  322. { 3, NULL, .dB = &bose_companion5_dB },
  323. { 0 } /* terminator */
  324. };
  325. /*
  326. * Dell usb dock with ALC4020 codec had a firmware problem where it got
  327. * screwed up when zero volume is passed; just skip it as a workaround
  328. *
  329. * Also the extension unit gives an access error, so skip it as well.
  330. */
  331. static const struct usbmix_name_map dell_alc4020_map[] = {
  332. { 4, NULL }, /* extension unit */
  333. { 16, NULL },
  334. { 19, NULL },
  335. { 0 }
  336. };
  337. /*
  338. * Control map entries
  339. */
  340. static struct usbmix_ctl_map usbmix_ctl_maps[] = {
  341. {
  342. .id = USB_ID(0x041e, 0x3000),
  343. .map = extigy_map,
  344. .ignore_ctl_error = 1,
  345. },
  346. {
  347. .id = USB_ID(0x041e, 0x3010),
  348. .map = mp3plus_map,
  349. },
  350. {
  351. .id = USB_ID(0x041e, 0x3020),
  352. .map = audigy2nx_map,
  353. .selector_map = audigy2nx_selectors,
  354. },
  355. {
  356. .id = USB_ID(0x041e, 0x3040),
  357. .map = live24ext_map,
  358. },
  359. {
  360. .id = USB_ID(0x041e, 0x3048),
  361. .map = audigy2nx_map,
  362. .selector_map = audigy2nx_selectors,
  363. },
  364. { /* Logitech, Inc. QuickCam Pro for Notebooks */
  365. .id = USB_ID(0x046d, 0x0991),
  366. .ignore_ctl_error = 1,
  367. },
  368. { /* Logitech, Inc. QuickCam E 3500 */
  369. .id = USB_ID(0x046d, 0x09a4),
  370. .ignore_ctl_error = 1,
  371. },
  372. { /* Plantronics GameCom 780 */
  373. .id = USB_ID(0x047f, 0xc010),
  374. .map = gamecom780_map,
  375. },
  376. {
  377. /* Hercules DJ Console (Windows Edition) */
  378. .id = USB_ID(0x06f8, 0xb000),
  379. .ignore_ctl_error = 1,
  380. },
  381. {
  382. /* Hercules DJ Console (Macintosh Edition) */
  383. .id = USB_ID(0x06f8, 0xd002),
  384. .ignore_ctl_error = 1,
  385. },
  386. {
  387. /* Hercules Gamesurround Muse Pocket LT
  388. * (USB 5.1 Channel Audio Adapter)
  389. */
  390. .id = USB_ID(0x06f8, 0xc000),
  391. .map = hercules_usb51_map,
  392. },
  393. {
  394. .id = USB_ID(0x0763, 0x2030),
  395. .selector_map = c400_selectors,
  396. },
  397. {
  398. .id = USB_ID(0x0763, 0x2031),
  399. .selector_map = c400_selectors,
  400. },
  401. {
  402. .id = USB_ID(0x08bb, 0x2702),
  403. .map = linex_map,
  404. .ignore_ctl_error = 1,
  405. },
  406. {
  407. .id = USB_ID(0x0a92, 0x0091),
  408. .map = maya44_map,
  409. },
  410. {
  411. .id = USB_ID(0x0c45, 0x1158),
  412. .map = justlink_map,
  413. },
  414. {
  415. .id = USB_ID(0x0ccd, 0x0028),
  416. .map = aureon_51_2_map,
  417. },
  418. {
  419. .id = USB_ID(0x0bda, 0x4014),
  420. .map = dell_alc4020_map,
  421. },
  422. {
  423. .id = USB_ID(0x0dba, 0x1000),
  424. .map = mbox1_map,
  425. },
  426. {
  427. .id = USB_ID(0x13e5, 0x0001),
  428. .map = scratch_live_map,
  429. .ignore_ctl_error = 1,
  430. },
  431. {
  432. .id = USB_ID(0x200c, 0x1018),
  433. .map = ebox44_map,
  434. },
  435. {
  436. /* MAYA44 USB+ */
  437. .id = USB_ID(0x2573, 0x0008),
  438. .map = maya44_map,
  439. },
  440. {
  441. /* KEF X300A */
  442. .id = USB_ID(0x27ac, 0x1000),
  443. .map = scms_usb3318_map,
  444. },
  445. {
  446. /* Arcam rPAC */
  447. .id = USB_ID(0x25c4, 0x0003),
  448. .map = scms_usb3318_map,
  449. },
  450. {
  451. /* Bose Companion 5 */
  452. .id = USB_ID(0x05a7, 0x1020),
  453. .map = bose_companion5_map,
  454. },
  455. { 0 } /* terminator */
  456. };