alc260_quirks.c 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. /*
  2. * ALC260 quirk models
  3. * included by patch_realtek.c
  4. */
  5. /* ALC260 models */
  6. enum {
  7. ALC260_AUTO,
  8. ALC260_BASIC,
  9. ALC260_FUJITSU_S702X,
  10. ALC260_ACER,
  11. ALC260_WILL,
  12. ALC260_REPLACER_672V,
  13. ALC260_FAVORIT100,
  14. #ifdef CONFIG_SND_DEBUG
  15. ALC260_TEST,
  16. #endif
  17. ALC260_MODEL_LAST /* last tag */
  18. };
  19. static const hda_nid_t alc260_dac_nids[1] = {
  20. /* front */
  21. 0x02,
  22. };
  23. static const hda_nid_t alc260_adc_nids[1] = {
  24. /* ADC0 */
  25. 0x04,
  26. };
  27. static const hda_nid_t alc260_adc_nids_alt[1] = {
  28. /* ADC1 */
  29. 0x05,
  30. };
  31. /* NIDs used when simultaneous access to both ADCs makes sense. Note that
  32. * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
  33. */
  34. static const hda_nid_t alc260_dual_adc_nids[2] = {
  35. /* ADC0, ADC1 */
  36. 0x04, 0x05
  37. };
  38. #define ALC260_DIGOUT_NID 0x03
  39. #define ALC260_DIGIN_NID 0x06
  40. static const struct hda_input_mux alc260_capture_source = {
  41. .num_items = 4,
  42. .items = {
  43. { "Mic", 0x0 },
  44. { "Front Mic", 0x1 },
  45. { "Line", 0x2 },
  46. { "CD", 0x4 },
  47. },
  48. };
  49. /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
  50. * headphone jack and the internal CD lines since these are the only pins at
  51. * which audio can appear. For flexibility, also allow the option of
  52. * recording the mixer output on the second ADC (ADC0 doesn't have a
  53. * connection to the mixer output).
  54. */
  55. static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
  56. {
  57. .num_items = 3,
  58. .items = {
  59. { "Mic/Line", 0x0 },
  60. { "CD", 0x4 },
  61. { "Headphone", 0x2 },
  62. },
  63. },
  64. {
  65. .num_items = 4,
  66. .items = {
  67. { "Mic/Line", 0x0 },
  68. { "CD", 0x4 },
  69. { "Headphone", 0x2 },
  70. { "Mixer", 0x5 },
  71. },
  72. },
  73. };
  74. /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
  75. * the Fujitsu S702x, but jacks are marked differently.
  76. */
  77. static const struct hda_input_mux alc260_acer_capture_sources[2] = {
  78. {
  79. .num_items = 4,
  80. .items = {
  81. { "Mic", 0x0 },
  82. { "Line", 0x2 },
  83. { "CD", 0x4 },
  84. { "Headphone", 0x5 },
  85. },
  86. },
  87. {
  88. .num_items = 5,
  89. .items = {
  90. { "Mic", 0x0 },
  91. { "Line", 0x2 },
  92. { "CD", 0x4 },
  93. { "Headphone", 0x6 },
  94. { "Mixer", 0x5 },
  95. },
  96. },
  97. };
  98. /* Maxdata Favorit 100XS */
  99. static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
  100. {
  101. .num_items = 2,
  102. .items = {
  103. { "Line/Mic", 0x0 },
  104. { "CD", 0x4 },
  105. },
  106. },
  107. {
  108. .num_items = 3,
  109. .items = {
  110. { "Line/Mic", 0x0 },
  111. { "CD", 0x4 },
  112. { "Mixer", 0x5 },
  113. },
  114. },
  115. };
  116. /*
  117. * This is just place-holder, so there's something for alc_build_pcms to look
  118. * at when it calculates the maximum number of channels. ALC260 has no mixer
  119. * element which allows changing the channel mode, so the verb list is
  120. * never used.
  121. */
  122. static const struct hda_channel_mode alc260_modes[1] = {
  123. { 2, NULL },
  124. };
  125. /* Mixer combinations
  126. *
  127. * basic: base_output + input + pc_beep + capture
  128. * fujitsu: fujitsu + capture
  129. * acer: acer + capture
  130. */
  131. static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
  132. HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  133. HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
  134. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
  135. HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
  136. HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
  137. HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
  138. { } /* end */
  139. };
  140. static const struct snd_kcontrol_new alc260_input_mixer[] = {
  141. HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
  142. HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
  143. HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
  144. HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
  145. HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
  146. HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
  147. HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
  148. HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
  149. { } /* end */
  150. };
  151. /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
  152. * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
  153. */
  154. static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
  155. HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  156. HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
  157. ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
  158. HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
  159. HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
  160. HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
  161. HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
  162. ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
  163. HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
  164. HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
  165. { } /* end */
  166. };
  167. /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
  168. * versions of the ALC260 don't act on requests to enable mic bias from NID
  169. * 0x0f (used to drive the headphone jack in these laptops). The ALC260
  170. * datasheet doesn't mention this restriction. At this stage it's not clear
  171. * whether this behaviour is intentional or is a hardware bug in chip
  172. * revisions available in early 2006. Therefore for now allow the
  173. * "Headphone Jack Mode" control to span all choices, but if it turns out
  174. * that the lack of mic bias for this NID is intentional we could change the
  175. * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
  176. *
  177. * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
  178. * don't appear to make the mic bias available from the "line" jack, even
  179. * though the NID used for this jack (0x14) can supply it. The theory is
  180. * that perhaps Acer have included blocking capacitors between the ALC260
  181. * and the output jack. If this turns out to be the case for all such
  182. * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
  183. * to ALC_PIN_DIR_INOUT_NOMICBIAS.
  184. *
  185. * The C20x Tablet series have a mono internal speaker which is controlled
  186. * via the chip's Mono sum widget and pin complex, so include the necessary
  187. * controls for such models. On models without a "mono speaker" the control
  188. * won't do anything.
  189. */
  190. static const struct snd_kcontrol_new alc260_acer_mixer[] = {
  191. HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  192. HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
  193. ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
  194. HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
  195. HDA_OUTPUT),
  196. HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
  197. HDA_INPUT),
  198. HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
  199. HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
  200. HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
  201. HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
  202. ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
  203. HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
  204. HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
  205. ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
  206. { } /* end */
  207. };
  208. /* Maxdata Favorit 100XS: one output and one input (0x12) jack
  209. */
  210. static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
  211. HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  212. HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
  213. ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
  214. HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
  215. HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
  216. ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
  217. { } /* end */
  218. };
  219. /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
  220. * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
  221. */
  222. static const struct snd_kcontrol_new alc260_will_mixer[] = {
  223. HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  224. HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
  225. HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
  226. HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
  227. ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
  228. HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
  229. HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
  230. ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
  231. HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
  232. HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
  233. { } /* end */
  234. };
  235. /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
  236. * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
  237. */
  238. static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
  239. HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  240. HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
  241. HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
  242. HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
  243. ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
  244. HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
  245. HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
  246. HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
  247. HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
  248. ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
  249. { } /* end */
  250. };
  251. /*
  252. * initialization verbs
  253. */
  254. static const struct hda_verb alc260_init_verbs[] = {
  255. /* Line In pin widget for input */
  256. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  257. /* CD pin widget for input */
  258. {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  259. /* Mic1 (rear panel) pin widget for input and vref at 80% */
  260. {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  261. /* Mic2 (front panel) pin widget for input and vref at 80% */
  262. {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  263. /* LINE-2 is used for line-out in rear */
  264. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  265. /* select line-out */
  266. {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
  267. /* LINE-OUT pin */
  268. {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  269. /* enable HP */
  270. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  271. /* enable Mono */
  272. {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  273. /* mute capture amp left and right */
  274. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  275. /* set connection select to line in (default select for this ADC) */
  276. {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
  277. /* mute capture amp left and right */
  278. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  279. /* set connection select to line in (default select for this ADC) */
  280. {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
  281. /* set vol=0 Line-Out mixer amp left and right */
  282. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  283. /* unmute pin widget amp left and right (no gain on this amp) */
  284. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  285. /* set vol=0 HP mixer amp left and right */
  286. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  287. /* unmute pin widget amp left and right (no gain on this amp) */
  288. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  289. /* set vol=0 Mono mixer amp left and right */
  290. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  291. /* unmute pin widget amp left and right (no gain on this amp) */
  292. {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  293. /* unmute LINE-2 out pin */
  294. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  295. /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
  296. * Line In 2 = 0x03
  297. */
  298. /* mute analog inputs */
  299. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  300. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  301. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
  302. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
  303. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
  304. /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
  305. /* mute Front out path */
  306. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  307. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  308. /* mute Headphone out path */
  309. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  310. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  311. /* mute Mono out path */
  312. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  313. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  314. { }
  315. };
  316. /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
  317. * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
  318. * audio = 0x16, internal speaker = 0x10.
  319. */
  320. static const struct hda_verb alc260_fujitsu_init_verbs[] = {
  321. /* Disable all GPIOs */
  322. {0x01, AC_VERB_SET_GPIO_MASK, 0},
  323. /* Internal speaker is connected to headphone pin */
  324. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  325. /* Headphone/Line-out jack connects to Line1 pin; make it an output */
  326. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  327. /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
  328. {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  329. /* Ensure all other unused pins are disabled and muted. */
  330. {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  331. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  332. {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  333. {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  334. {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  335. {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  336. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  337. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  338. /* Disable digital (SPDIF) pins */
  339. {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
  340. {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
  341. /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
  342. * when acting as an output.
  343. */
  344. {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
  345. /* Start with output sum widgets muted and their output gains at min */
  346. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  347. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  348. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  349. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  350. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  351. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  352. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  353. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  354. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  355. /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
  356. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  357. /* Unmute Line1 pin widget output buffer since it starts as an output.
  358. * If the pin mode is changed by the user the pin mode control will
  359. * take care of enabling the pin's input/output buffers as needed.
  360. * Therefore there's no need to enable the input buffer at this
  361. * stage.
  362. */
  363. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  364. /* Unmute input buffer of pin widget used for Line-in (no equiv
  365. * mixer ctrl)
  366. */
  367. {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  368. /* Mute capture amp left and right */
  369. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  370. /* Set ADC connection select to match default mixer setting - line
  371. * in (on mic1 pin)
  372. */
  373. {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
  374. /* Do the same for the second ADC: mute capture input amp and
  375. * set ADC connection to line in (on mic1 pin)
  376. */
  377. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  378. {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
  379. /* Mute all inputs to mixer widget (even unconnected ones) */
  380. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
  381. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
  382. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
  383. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
  384. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
  385. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
  386. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
  387. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
  388. { }
  389. };
  390. /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
  391. * similar laptops (adapted from Fujitsu init verbs).
  392. */
  393. static const struct hda_verb alc260_acer_init_verbs[] = {
  394. /* On TravelMate laptops, GPIO 0 enables the internal speaker and
  395. * the headphone jack. Turn this on and rely on the standard mute
  396. * methods whenever the user wants to turn these outputs off.
  397. */
  398. {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
  399. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
  400. {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
  401. /* Internal speaker/Headphone jack is connected to Line-out pin */
  402. {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  403. /* Internal microphone/Mic jack is connected to Mic1 pin */
  404. {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
  405. /* Line In jack is connected to Line1 pin */
  406. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
  407. /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
  408. {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  409. /* Ensure all other unused pins are disabled and muted. */
  410. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  411. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  412. {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  413. {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  414. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  415. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  416. /* Disable digital (SPDIF) pins */
  417. {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
  418. {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
  419. /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
  420. * bus when acting as outputs.
  421. */
  422. {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
  423. {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
  424. /* Start with output sum widgets muted and their output gains at min */
  425. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  426. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  427. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  428. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  429. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  430. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  431. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  432. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  433. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  434. /* Unmute Line-out pin widget amp left and right
  435. * (no equiv mixer ctrl)
  436. */
  437. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  438. /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
  439. {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  440. /* Unmute Mic1 and Line1 pin widget input buffers since they start as
  441. * inputs. If the pin mode is changed by the user the pin mode control
  442. * will take care of enabling the pin's input/output buffers as needed.
  443. * Therefore there's no need to enable the input buffer at this
  444. * stage.
  445. */
  446. {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  447. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  448. /* Mute capture amp left and right */
  449. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  450. /* Set ADC connection select to match default mixer setting - mic
  451. * (on mic1 pin)
  452. */
  453. {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
  454. /* Do similar with the second ADC: mute capture input amp and
  455. * set ADC connection to mic to match ALSA's default state.
  456. */
  457. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  458. {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
  459. /* Mute all inputs to mixer widget (even unconnected ones) */
  460. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
  461. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
  462. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
  463. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
  464. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
  465. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
  466. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
  467. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
  468. { }
  469. };
  470. /* Initialisation sequence for Maxdata Favorit 100XS
  471. * (adapted from Acer init verbs).
  472. */
  473. static const struct hda_verb alc260_favorit100_init_verbs[] = {
  474. /* GPIO 0 enables the output jack.
  475. * Turn this on and rely on the standard mute
  476. * methods whenever the user wants to turn these outputs off.
  477. */
  478. {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
  479. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
  480. {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
  481. /* Line/Mic input jack is connected to Mic1 pin */
  482. {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
  483. /* Ensure all other unused pins are disabled and muted. */
  484. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  485. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  486. {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  487. {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  488. {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  489. {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  490. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  491. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  492. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
  493. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  494. /* Disable digital (SPDIF) pins */
  495. {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
  496. {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
  497. /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
  498. * bus when acting as outputs.
  499. */
  500. {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
  501. {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
  502. /* Start with output sum widgets muted and their output gains at min */
  503. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  504. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  505. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  506. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  507. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  508. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  509. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  510. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  511. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  512. /* Unmute Line-out pin widget amp left and right
  513. * (no equiv mixer ctrl)
  514. */
  515. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  516. /* Unmute Mic1 and Line1 pin widget input buffers since they start as
  517. * inputs. If the pin mode is changed by the user the pin mode control
  518. * will take care of enabling the pin's input/output buffers as needed.
  519. * Therefore there's no need to enable the input buffer at this
  520. * stage.
  521. */
  522. {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  523. /* Mute capture amp left and right */
  524. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  525. /* Set ADC connection select to match default mixer setting - mic
  526. * (on mic1 pin)
  527. */
  528. {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
  529. /* Do similar with the second ADC: mute capture input amp and
  530. * set ADC connection to mic to match ALSA's default state.
  531. */
  532. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  533. {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
  534. /* Mute all inputs to mixer widget (even unconnected ones) */
  535. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
  536. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
  537. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
  538. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
  539. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
  540. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
  541. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
  542. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
  543. { }
  544. };
  545. static const struct hda_verb alc260_will_verbs[] = {
  546. {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  547. {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
  548. {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
  549. {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
  550. {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
  551. {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
  552. {}
  553. };
  554. static const struct hda_verb alc260_replacer_672v_verbs[] = {
  555. {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
  556. {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
  557. {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
  558. {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
  559. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
  560. {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
  561. {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
  562. {}
  563. };
  564. /* toggle speaker-output according to the hp-jack state */
  565. static void alc260_replacer_672v_automute(struct hda_codec *codec)
  566. {
  567. unsigned int present;
  568. /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
  569. present = snd_hda_jack_detect(codec, 0x0f);
  570. if (present) {
  571. snd_hda_codec_write_cache(codec, 0x01, 0,
  572. AC_VERB_SET_GPIO_DATA, 1);
  573. snd_hda_codec_write_cache(codec, 0x0f, 0,
  574. AC_VERB_SET_PIN_WIDGET_CONTROL,
  575. PIN_HP);
  576. } else {
  577. snd_hda_codec_write_cache(codec, 0x01, 0,
  578. AC_VERB_SET_GPIO_DATA, 0);
  579. snd_hda_codec_write_cache(codec, 0x0f, 0,
  580. AC_VERB_SET_PIN_WIDGET_CONTROL,
  581. PIN_OUT);
  582. }
  583. }
  584. static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
  585. unsigned int res)
  586. {
  587. if ((res >> 26) == ALC_HP_EVENT)
  588. alc260_replacer_672v_automute(codec);
  589. }
  590. static const struct hda_verb alc260_hp_dc7600_verbs[] = {
  591. {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
  592. {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
  593. {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  594. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
  595. {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  596. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  597. {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
  598. {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
  599. {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
  600. {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
  601. {}
  602. };
  603. /* Test configuration for debugging, modelled after the ALC880 test
  604. * configuration.
  605. */
  606. #ifdef CONFIG_SND_DEBUG
  607. static const hda_nid_t alc260_test_dac_nids[1] = {
  608. 0x02,
  609. };
  610. static const hda_nid_t alc260_test_adc_nids[2] = {
  611. 0x04, 0x05,
  612. };
  613. /* For testing the ALC260, each input MUX needs its own definition since
  614. * the signal assignments are different. This assumes that the first ADC
  615. * is NID 0x04.
  616. */
  617. static const struct hda_input_mux alc260_test_capture_sources[2] = {
  618. {
  619. .num_items = 7,
  620. .items = {
  621. { "MIC1 pin", 0x0 },
  622. { "MIC2 pin", 0x1 },
  623. { "LINE1 pin", 0x2 },
  624. { "LINE2 pin", 0x3 },
  625. { "CD pin", 0x4 },
  626. { "LINE-OUT pin", 0x5 },
  627. { "HP-OUT pin", 0x6 },
  628. },
  629. },
  630. {
  631. .num_items = 8,
  632. .items = {
  633. { "MIC1 pin", 0x0 },
  634. { "MIC2 pin", 0x1 },
  635. { "LINE1 pin", 0x2 },
  636. { "LINE2 pin", 0x3 },
  637. { "CD pin", 0x4 },
  638. { "Mixer", 0x5 },
  639. { "LINE-OUT pin", 0x6 },
  640. { "HP-OUT pin", 0x7 },
  641. },
  642. },
  643. };
  644. static const struct snd_kcontrol_new alc260_test_mixer[] = {
  645. /* Output driver widgets */
  646. HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
  647. HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
  648. HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
  649. HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
  650. HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
  651. HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
  652. /* Modes for retasking pin widgets
  653. * Note: the ALC260 doesn't seem to act on requests to enable mic
  654. * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
  655. * mention this restriction. At this stage it's not clear whether
  656. * this behaviour is intentional or is a hardware bug in chip
  657. * revisions available at least up until early 2006. Therefore for
  658. * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
  659. * choices, but if it turns out that the lack of mic bias for these
  660. * NIDs is intentional we could change their modes from
  661. * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
  662. */
  663. ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
  664. ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
  665. ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
  666. ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
  667. ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
  668. ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
  669. /* Loopback mixer controls */
  670. HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
  671. HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
  672. HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
  673. HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
  674. HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
  675. HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
  676. HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
  677. HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
  678. HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
  679. HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
  680. HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
  681. HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
  682. HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
  683. HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
  684. /* Controls for GPIO pins, assuming they are configured as outputs */
  685. ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
  686. ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
  687. ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
  688. ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
  689. /* Switches to allow the digital IO pins to be enabled. The datasheet
  690. * is ambigious as to which NID is which; testing on laptops which
  691. * make this output available should provide clarification.
  692. */
  693. ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
  694. ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
  695. /* A switch allowing EAPD to be enabled. Some laptops seem to use
  696. * this output to turn on an external amplifier.
  697. */
  698. ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
  699. ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
  700. { } /* end */
  701. };
  702. static const struct hda_verb alc260_test_init_verbs[] = {
  703. /* Enable all GPIOs as outputs with an initial value of 0 */
  704. {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
  705. {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
  706. {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
  707. /* Enable retasking pins as output, initially without power amp */
  708. {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  709. {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  710. {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  711. {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  712. {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  713. {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
  714. /* Disable digital (SPDIF) pins initially, but users can enable
  715. * them via a mixer switch. In the case of SPDIF-out, this initverb
  716. * payload also sets the generation to 0, output to be in "consumer"
  717. * PCM format, copyright asserted, no pre-emphasis and no validity
  718. * control.
  719. */
  720. {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
  721. {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
  722. /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
  723. * OUT1 sum bus when acting as an output.
  724. */
  725. {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
  726. {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
  727. {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
  728. {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
  729. /* Start with output sum widgets muted and their output gains at min */
  730. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  731. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  732. {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  733. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  734. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  735. {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  736. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  737. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
  738. {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
  739. /* Unmute retasking pin widget output buffers since the default
  740. * state appears to be output. As the pin mode is changed by the
  741. * user the pin mode control will take care of enabling the pin's
  742. * input/output buffers as needed.
  743. */
  744. {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  745. {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  746. {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  747. {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  748. {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  749. {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  750. /* Also unmute the mono-out pin widget */
  751. {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
  752. /* Mute capture amp left and right */
  753. {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  754. /* Set ADC connection select to match default mixer setting (mic1
  755. * pin)
  756. */
  757. {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
  758. /* Do the same for the second ADC: mute capture input amp and
  759. * set ADC connection to mic1 pin
  760. */
  761. {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
  762. {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
  763. /* Mute all inputs to mixer widget (even unconnected ones) */
  764. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
  765. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
  766. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
  767. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
  768. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
  769. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
  770. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
  771. {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
  772. { }
  773. };
  774. #endif
  775. /*
  776. * ALC260 configurations
  777. */
  778. static const char * const alc260_models[ALC260_MODEL_LAST] = {
  779. [ALC260_BASIC] = "basic",
  780. [ALC260_FUJITSU_S702X] = "fujitsu",
  781. [ALC260_ACER] = "acer",
  782. [ALC260_WILL] = "will",
  783. [ALC260_REPLACER_672V] = "replacer",
  784. [ALC260_FAVORIT100] = "favorit100",
  785. #ifdef CONFIG_SND_DEBUG
  786. [ALC260_TEST] = "test",
  787. #endif
  788. [ALC260_AUTO] = "auto",
  789. };
  790. static const struct snd_pci_quirk alc260_cfg_tbl[] = {
  791. SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
  792. SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
  793. SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
  794. SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
  795. SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
  796. SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
  797. SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
  798. SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
  799. SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
  800. SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
  801. SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
  802. {}
  803. };
  804. static const struct alc_config_preset alc260_presets[] = {
  805. [ALC260_BASIC] = {
  806. .mixers = { alc260_base_output_mixer,
  807. alc260_input_mixer },
  808. .init_verbs = { alc260_init_verbs },
  809. .num_dacs = ARRAY_SIZE(alc260_dac_nids),
  810. .dac_nids = alc260_dac_nids,
  811. .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
  812. .adc_nids = alc260_dual_adc_nids,
  813. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  814. .channel_mode = alc260_modes,
  815. .input_mux = &alc260_capture_source,
  816. },
  817. [ALC260_FUJITSU_S702X] = {
  818. .mixers = { alc260_fujitsu_mixer },
  819. .init_verbs = { alc260_fujitsu_init_verbs },
  820. .num_dacs = ARRAY_SIZE(alc260_dac_nids),
  821. .dac_nids = alc260_dac_nids,
  822. .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
  823. .adc_nids = alc260_dual_adc_nids,
  824. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  825. .channel_mode = alc260_modes,
  826. .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
  827. .input_mux = alc260_fujitsu_capture_sources,
  828. },
  829. [ALC260_ACER] = {
  830. .mixers = { alc260_acer_mixer },
  831. .init_verbs = { alc260_acer_init_verbs },
  832. .num_dacs = ARRAY_SIZE(alc260_dac_nids),
  833. .dac_nids = alc260_dac_nids,
  834. .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
  835. .adc_nids = alc260_dual_adc_nids,
  836. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  837. .channel_mode = alc260_modes,
  838. .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
  839. .input_mux = alc260_acer_capture_sources,
  840. },
  841. [ALC260_FAVORIT100] = {
  842. .mixers = { alc260_favorit100_mixer },
  843. .init_verbs = { alc260_favorit100_init_verbs },
  844. .num_dacs = ARRAY_SIZE(alc260_dac_nids),
  845. .dac_nids = alc260_dac_nids,
  846. .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
  847. .adc_nids = alc260_dual_adc_nids,
  848. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  849. .channel_mode = alc260_modes,
  850. .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
  851. .input_mux = alc260_favorit100_capture_sources,
  852. },
  853. [ALC260_WILL] = {
  854. .mixers = { alc260_will_mixer },
  855. .init_verbs = { alc260_init_verbs, alc260_will_verbs },
  856. .num_dacs = ARRAY_SIZE(alc260_dac_nids),
  857. .dac_nids = alc260_dac_nids,
  858. .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
  859. .adc_nids = alc260_adc_nids,
  860. .dig_out_nid = ALC260_DIGOUT_NID,
  861. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  862. .channel_mode = alc260_modes,
  863. .input_mux = &alc260_capture_source,
  864. },
  865. [ALC260_REPLACER_672V] = {
  866. .mixers = { alc260_replacer_672v_mixer },
  867. .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
  868. .num_dacs = ARRAY_SIZE(alc260_dac_nids),
  869. .dac_nids = alc260_dac_nids,
  870. .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
  871. .adc_nids = alc260_adc_nids,
  872. .dig_out_nid = ALC260_DIGOUT_NID,
  873. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  874. .channel_mode = alc260_modes,
  875. .input_mux = &alc260_capture_source,
  876. .unsol_event = alc260_replacer_672v_unsol_event,
  877. .init_hook = alc260_replacer_672v_automute,
  878. },
  879. #ifdef CONFIG_SND_DEBUG
  880. [ALC260_TEST] = {
  881. .mixers = { alc260_test_mixer },
  882. .init_verbs = { alc260_test_init_verbs },
  883. .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
  884. .dac_nids = alc260_test_dac_nids,
  885. .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
  886. .adc_nids = alc260_test_adc_nids,
  887. .num_channel_mode = ARRAY_SIZE(alc260_modes),
  888. .channel_mode = alc260_modes,
  889. .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
  890. .input_mux = alc260_test_capture_sources,
  891. },
  892. #endif
  893. };