usbmixer_maps.c 8.6 KB

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