usbmixer_maps.c 9.7 KB

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