patch_via.c 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. /*
  2. * Universal Interface for Intel High Definition Audio Codec
  3. *
  4. * HD audio interface patch for VIA VT17xx/VT18xx/VT20xx codec
  5. *
  6. * (C) 2006-2009 VIA Technology, Inc.
  7. * (C) 2006-2008 Takashi Iwai <tiwai@suse.de>
  8. *
  9. * This driver is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This driver is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. /* * * * * * * * * * * * * * Release History * * * * * * * * * * * * * * * * */
  24. /* */
  25. /* 2006-03-03 Lydia Wang Create the basic patch to support VT1708 codec */
  26. /* 2006-03-14 Lydia Wang Modify hard code for some pin widget nid */
  27. /* 2006-08-02 Lydia Wang Add support to VT1709 codec */
  28. /* 2006-09-08 Lydia Wang Fix internal loopback recording source select bug */
  29. /* 2007-09-12 Lydia Wang Add EAPD enable during driver initialization */
  30. /* 2007-09-17 Lydia Wang Add VT1708B codec support */
  31. /* 2007-11-14 Lydia Wang Add VT1708A codec HP and CD pin connect config */
  32. /* 2008-02-03 Lydia Wang Fix Rear channels and Back channels inverse issue */
  33. /* 2008-03-06 Lydia Wang Add VT1702 codec and VT1708S codec support */
  34. /* 2008-04-09 Lydia Wang Add mute front speaker when HP plugin */
  35. /* 2008-04-09 Lydia Wang Add Independent HP feature */
  36. /* 2008-05-28 Lydia Wang Add second S/PDIF Out support for VT1702 */
  37. /* 2008-09-15 Logan Li Add VT1708S Mic Boost workaround/backdoor */
  38. /* 2009-02-16 Logan Li Add support for VT1718S */
  39. /* 2009-03-13 Logan Li Add support for VT1716S */
  40. /* 2009-04-14 Lydai Wang Add support for VT1828S and VT2020 */
  41. /* 2009-07-08 Lydia Wang Add support for VT2002P */
  42. /* 2009-07-21 Lydia Wang Add support for VT1812 */
  43. /* 2009-09-19 Lydia Wang Add support for VT1818S */
  44. /* */
  45. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  46. #include <linux/init.h>
  47. #include <linux/delay.h>
  48. #include <linux/slab.h>
  49. #include <linux/module.h>
  50. #include <sound/core.h>
  51. #include <sound/asoundef.h>
  52. #include "hda_codec.h"
  53. #include "hda_local.h"
  54. #include "hda_auto_parser.h"
  55. #include "hda_jack.h"
  56. #include "hda_generic.h"
  57. /* Pin Widget NID */
  58. #define VT1708_HP_PIN_NID 0x20
  59. #define VT1708_CD_PIN_NID 0x24
  60. enum VIA_HDA_CODEC {
  61. UNKNOWN = -1,
  62. VT1708,
  63. VT1709_10CH,
  64. VT1709_6CH,
  65. VT1708B_8CH,
  66. VT1708B_4CH,
  67. VT1708S,
  68. VT1708BCE,
  69. VT1702,
  70. VT1718S,
  71. VT1716S,
  72. VT2002P,
  73. VT1812,
  74. VT1802,
  75. VT1705CF,
  76. VT1808,
  77. CODEC_TYPES,
  78. };
  79. #define VT2002P_COMPATIBLE(spec) \
  80. ((spec)->codec_type == VT2002P ||\
  81. (spec)->codec_type == VT1812 ||\
  82. (spec)->codec_type == VT1802)
  83. struct via_spec {
  84. struct hda_gen_spec gen;
  85. /* codec parameterization */
  86. const struct snd_kcontrol_new *mixers[6];
  87. unsigned int num_mixers;
  88. const struct hda_verb *init_verbs[5];
  89. unsigned int num_iverbs;
  90. /* HP mode source */
  91. unsigned int dmic_enabled;
  92. enum VIA_HDA_CODEC codec_type;
  93. /* analog low-power control */
  94. bool alc_mode;
  95. /* work to check hp jack state */
  96. int hp_work_active;
  97. int vt1708_jack_detect;
  98. unsigned int beep_amp;
  99. };
  100. static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec);
  101. static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo,
  102. struct hda_codec *codec,
  103. struct snd_pcm_substream *substream,
  104. int action);
  105. static struct via_spec *via_new_spec(struct hda_codec *codec)
  106. {
  107. struct via_spec *spec;
  108. spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  109. if (spec == NULL)
  110. return NULL;
  111. codec->spec = spec;
  112. snd_hda_gen_spec_init(&spec->gen);
  113. spec->codec_type = get_codec_type(codec);
  114. /* VT1708BCE & VT1708S are almost same */
  115. if (spec->codec_type == VT1708BCE)
  116. spec->codec_type = VT1708S;
  117. spec->gen.indep_hp = 1;
  118. spec->gen.keep_eapd_on = 1;
  119. spec->gen.pcm_playback_hook = via_playback_pcm_hook;
  120. spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
  121. codec->power_save_node = 1;
  122. spec->gen.power_down_unused = 1;
  123. return spec;
  124. }
  125. static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec)
  126. {
  127. u32 vendor_id = codec->core.vendor_id;
  128. u16 ven_id = vendor_id >> 16;
  129. u16 dev_id = vendor_id & 0xffff;
  130. enum VIA_HDA_CODEC codec_type;
  131. /* get codec type */
  132. if (ven_id != 0x1106)
  133. codec_type = UNKNOWN;
  134. else if (dev_id >= 0x1708 && dev_id <= 0x170b)
  135. codec_type = VT1708;
  136. else if (dev_id >= 0xe710 && dev_id <= 0xe713)
  137. codec_type = VT1709_10CH;
  138. else if (dev_id >= 0xe714 && dev_id <= 0xe717)
  139. codec_type = VT1709_6CH;
  140. else if (dev_id >= 0xe720 && dev_id <= 0xe723) {
  141. codec_type = VT1708B_8CH;
  142. if (snd_hda_param_read(codec, 0x16, AC_PAR_CONNLIST_LEN) == 0x7)
  143. codec_type = VT1708BCE;
  144. } else if (dev_id >= 0xe724 && dev_id <= 0xe727)
  145. codec_type = VT1708B_4CH;
  146. else if ((dev_id & 0xfff) == 0x397
  147. && (dev_id >> 12) < 8)
  148. codec_type = VT1708S;
  149. else if ((dev_id & 0xfff) == 0x398
  150. && (dev_id >> 12) < 8)
  151. codec_type = VT1702;
  152. else if ((dev_id & 0xfff) == 0x428
  153. && (dev_id >> 12) < 8)
  154. codec_type = VT1718S;
  155. else if (dev_id == 0x0433 || dev_id == 0xa721)
  156. codec_type = VT1716S;
  157. else if (dev_id == 0x0441 || dev_id == 0x4441)
  158. codec_type = VT1718S;
  159. else if (dev_id == 0x0438 || dev_id == 0x4438)
  160. codec_type = VT2002P;
  161. else if (dev_id == 0x0448)
  162. codec_type = VT1812;
  163. else if (dev_id == 0x0440)
  164. codec_type = VT1708S;
  165. else if ((dev_id & 0xfff) == 0x446)
  166. codec_type = VT1802;
  167. else if (dev_id == 0x4760)
  168. codec_type = VT1705CF;
  169. else if (dev_id == 0x4761 || dev_id == 0x4762)
  170. codec_type = VT1808;
  171. else
  172. codec_type = UNKNOWN;
  173. return codec_type;
  174. };
  175. static void analog_low_current_mode(struct hda_codec *codec);
  176. static bool is_aa_path_mute(struct hda_codec *codec);
  177. #define hp_detect_with_aa(codec) \
  178. (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1 && \
  179. !is_aa_path_mute(codec))
  180. static void vt1708_stop_hp_work(struct hda_codec *codec)
  181. {
  182. struct via_spec *spec = codec->spec;
  183. if (spec->codec_type != VT1708 || !spec->gen.autocfg.hp_outs)
  184. return;
  185. if (spec->hp_work_active) {
  186. snd_hda_codec_write(codec, 0x1, 0, 0xf81, 1);
  187. codec->jackpoll_interval = 0;
  188. cancel_delayed_work_sync(&codec->jackpoll_work);
  189. spec->hp_work_active = false;
  190. }
  191. }
  192. static void vt1708_update_hp_work(struct hda_codec *codec)
  193. {
  194. struct via_spec *spec = codec->spec;
  195. if (spec->codec_type != VT1708 || !spec->gen.autocfg.hp_outs)
  196. return;
  197. if (spec->vt1708_jack_detect) {
  198. if (!spec->hp_work_active) {
  199. codec->jackpoll_interval = msecs_to_jiffies(100);
  200. snd_hda_codec_write(codec, 0x1, 0, 0xf81, 0);
  201. schedule_delayed_work(&codec->jackpoll_work, 0);
  202. spec->hp_work_active = true;
  203. }
  204. } else if (!hp_detect_with_aa(codec))
  205. vt1708_stop_hp_work(codec);
  206. }
  207. static int via_pin_power_ctl_info(struct snd_kcontrol *kcontrol,
  208. struct snd_ctl_elem_info *uinfo)
  209. {
  210. return snd_hda_enum_bool_helper_info(kcontrol, uinfo);
  211. }
  212. static int via_pin_power_ctl_get(struct snd_kcontrol *kcontrol,
  213. struct snd_ctl_elem_value *ucontrol)
  214. {
  215. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  216. ucontrol->value.enumerated.item[0] = codec->power_save_node;
  217. return 0;
  218. }
  219. static int via_pin_power_ctl_put(struct snd_kcontrol *kcontrol,
  220. struct snd_ctl_elem_value *ucontrol)
  221. {
  222. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  223. struct via_spec *spec = codec->spec;
  224. bool val = !!ucontrol->value.enumerated.item[0];
  225. if (val == codec->power_save_node)
  226. return 0;
  227. codec->power_save_node = val;
  228. spec->gen.power_down_unused = val;
  229. analog_low_current_mode(codec);
  230. return 1;
  231. }
  232. static const struct snd_kcontrol_new via_pin_power_ctl_enum[] = {
  233. {
  234. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  235. .name = "Dynamic Power-Control",
  236. .info = via_pin_power_ctl_info,
  237. .get = via_pin_power_ctl_get,
  238. .put = via_pin_power_ctl_put,
  239. },
  240. {} /* terminator */
  241. };
  242. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  243. static inline void set_beep_amp(struct via_spec *spec, hda_nid_t nid,
  244. int idx, int dir)
  245. {
  246. spec->gen.beep_nid = nid;
  247. spec->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir);
  248. }
  249. /* additional beep mixers; the actual parameters are overwritten at build */
  250. static const struct snd_kcontrol_new cxt_beep_mixer[] = {
  251. HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
  252. HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT),
  253. { } /* end */
  254. };
  255. /* create beep controls if needed */
  256. static int add_beep_ctls(struct hda_codec *codec)
  257. {
  258. struct via_spec *spec = codec->spec;
  259. int err;
  260. if (spec->beep_amp) {
  261. const struct snd_kcontrol_new *knew;
  262. for (knew = cxt_beep_mixer; knew->name; knew++) {
  263. struct snd_kcontrol *kctl;
  264. kctl = snd_ctl_new1(knew, codec);
  265. if (!kctl)
  266. return -ENOMEM;
  267. kctl->private_value = spec->beep_amp;
  268. err = snd_hda_ctl_add(codec, 0, kctl);
  269. if (err < 0)
  270. return err;
  271. }
  272. }
  273. return 0;
  274. }
  275. static void auto_parse_beep(struct hda_codec *codec)
  276. {
  277. struct via_spec *spec = codec->spec;
  278. hda_nid_t nid;
  279. for_each_hda_codec_node(nid, codec)
  280. if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) {
  281. set_beep_amp(spec, nid, 0, HDA_OUTPUT);
  282. break;
  283. }
  284. }
  285. #else
  286. #define set_beep_amp(spec, nid, idx, dir) /* NOP */
  287. #define add_beep_ctls(codec) 0
  288. #define auto_parse_beep(codec)
  289. #endif
  290. /* check AA path's mute status */
  291. static bool is_aa_path_mute(struct hda_codec *codec)
  292. {
  293. struct via_spec *spec = codec->spec;
  294. const struct hda_amp_list *p;
  295. int ch, v;
  296. p = spec->gen.loopback.amplist;
  297. if (!p)
  298. return true;
  299. for (; p->nid; p++) {
  300. for (ch = 0; ch < 2; ch++) {
  301. v = snd_hda_codec_amp_read(codec, p->nid, ch, p->dir,
  302. p->idx);
  303. if (!(v & HDA_AMP_MUTE) && v > 0)
  304. return false;
  305. }
  306. }
  307. return true;
  308. }
  309. /* enter/exit analog low-current mode */
  310. static void __analog_low_current_mode(struct hda_codec *codec, bool force)
  311. {
  312. struct via_spec *spec = codec->spec;
  313. bool enable;
  314. unsigned int verb, parm;
  315. if (!codec->power_save_node)
  316. enable = false;
  317. else
  318. enable = is_aa_path_mute(codec) && !spec->gen.active_streams;
  319. if (enable == spec->alc_mode && !force)
  320. return;
  321. spec->alc_mode = enable;
  322. /* decide low current mode's verb & parameter */
  323. switch (spec->codec_type) {
  324. case VT1708B_8CH:
  325. case VT1708B_4CH:
  326. verb = 0xf70;
  327. parm = enable ? 0x02 : 0x00; /* 0x02: 2/3x, 0x00: 1x */
  328. break;
  329. case VT1708S:
  330. case VT1718S:
  331. case VT1716S:
  332. verb = 0xf73;
  333. parm = enable ? 0x51 : 0xe1; /* 0x51: 4/28x, 0xe1: 1x */
  334. break;
  335. case VT1702:
  336. verb = 0xf73;
  337. parm = enable ? 0x01 : 0x1d; /* 0x01: 4/40x, 0x1d: 1x */
  338. break;
  339. case VT2002P:
  340. case VT1812:
  341. case VT1802:
  342. verb = 0xf93;
  343. parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */
  344. break;
  345. case VT1705CF:
  346. case VT1808:
  347. verb = 0xf82;
  348. parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */
  349. break;
  350. default:
  351. return; /* other codecs are not supported */
  352. }
  353. /* send verb */
  354. snd_hda_codec_write(codec, codec->core.afg, 0, verb, parm);
  355. }
  356. static void analog_low_current_mode(struct hda_codec *codec)
  357. {
  358. return __analog_low_current_mode(codec, false);
  359. }
  360. static int via_build_controls(struct hda_codec *codec)
  361. {
  362. struct via_spec *spec = codec->spec;
  363. int err, i;
  364. err = snd_hda_gen_build_controls(codec);
  365. if (err < 0)
  366. return err;
  367. err = add_beep_ctls(codec);
  368. if (err < 0)
  369. return err;
  370. spec->mixers[spec->num_mixers++] = via_pin_power_ctl_enum;
  371. for (i = 0; i < spec->num_mixers; i++) {
  372. err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
  373. if (err < 0)
  374. return err;
  375. }
  376. return 0;
  377. }
  378. static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo,
  379. struct hda_codec *codec,
  380. struct snd_pcm_substream *substream,
  381. int action)
  382. {
  383. analog_low_current_mode(codec);
  384. vt1708_update_hp_work(codec);
  385. }
  386. static void via_free(struct hda_codec *codec)
  387. {
  388. vt1708_stop_hp_work(codec);
  389. snd_hda_gen_free(codec);
  390. }
  391. #ifdef CONFIG_PM
  392. static int via_suspend(struct hda_codec *codec)
  393. {
  394. struct via_spec *spec = codec->spec;
  395. vt1708_stop_hp_work(codec);
  396. /* Fix pop noise on headphones */
  397. if (spec->codec_type == VT1802)
  398. snd_hda_shutup_pins(codec);
  399. return 0;
  400. }
  401. static int via_resume(struct hda_codec *codec)
  402. {
  403. /* some delay here to make jack detection working (bko#98921) */
  404. msleep(10);
  405. codec->patch_ops.init(codec);
  406. regcache_sync(codec->core.regmap);
  407. return 0;
  408. }
  409. #endif
  410. #ifdef CONFIG_PM
  411. static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid)
  412. {
  413. struct via_spec *spec = codec->spec;
  414. analog_low_current_mode(codec);
  415. vt1708_update_hp_work(codec);
  416. return snd_hda_check_amp_list_power(codec, &spec->gen.loopback, nid);
  417. }
  418. #endif
  419. /*
  420. */
  421. static int via_init(struct hda_codec *codec);
  422. static const struct hda_codec_ops via_patch_ops = {
  423. .build_controls = via_build_controls,
  424. .build_pcms = snd_hda_gen_build_pcms,
  425. .init = via_init,
  426. .free = via_free,
  427. .unsol_event = snd_hda_jack_unsol_event,
  428. .stream_pm = snd_hda_gen_stream_pm,
  429. #ifdef CONFIG_PM
  430. .suspend = via_suspend,
  431. .resume = via_resume,
  432. .check_power_status = via_check_power_status,
  433. #endif
  434. };
  435. static const struct hda_verb vt1708_init_verbs[] = {
  436. /* power down jack detect function */
  437. {0x1, 0xf81, 0x1},
  438. { }
  439. };
  440. static void vt1708_set_pinconfig_connect(struct hda_codec *codec, hda_nid_t nid)
  441. {
  442. unsigned int def_conf;
  443. unsigned char seqassoc;
  444. def_conf = snd_hda_codec_get_pincfg(codec, nid);
  445. seqassoc = (unsigned char) get_defcfg_association(def_conf);
  446. seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf);
  447. if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE
  448. && (seqassoc == 0xf0 || seqassoc == 0xff)) {
  449. def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30));
  450. snd_hda_codec_set_pincfg(codec, nid, def_conf);
  451. }
  452. return;
  453. }
  454. static int vt1708_jack_detect_get(struct snd_kcontrol *kcontrol,
  455. struct snd_ctl_elem_value *ucontrol)
  456. {
  457. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  458. struct via_spec *spec = codec->spec;
  459. if (spec->codec_type != VT1708)
  460. return 0;
  461. ucontrol->value.integer.value[0] = spec->vt1708_jack_detect;
  462. return 0;
  463. }
  464. static int vt1708_jack_detect_put(struct snd_kcontrol *kcontrol,
  465. struct snd_ctl_elem_value *ucontrol)
  466. {
  467. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  468. struct via_spec *spec = codec->spec;
  469. int val;
  470. if (spec->codec_type != VT1708)
  471. return 0;
  472. val = !!ucontrol->value.integer.value[0];
  473. if (spec->vt1708_jack_detect == val)
  474. return 0;
  475. spec->vt1708_jack_detect = val;
  476. vt1708_update_hp_work(codec);
  477. return 1;
  478. }
  479. static const struct snd_kcontrol_new vt1708_jack_detect_ctl[] = {
  480. {
  481. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  482. .name = "Jack Detect",
  483. .count = 1,
  484. .info = snd_ctl_boolean_mono_info,
  485. .get = vt1708_jack_detect_get,
  486. .put = vt1708_jack_detect_put,
  487. },
  488. {} /* terminator */
  489. };
  490. static const struct badness_table via_main_out_badness = {
  491. .no_primary_dac = 0x10000,
  492. .no_dac = 0x4000,
  493. .shared_primary = 0x10000,
  494. .shared_surr = 0x20,
  495. .shared_clfe = 0x20,
  496. .shared_surr_main = 0x20,
  497. };
  498. static const struct badness_table via_extra_out_badness = {
  499. .no_primary_dac = 0x4000,
  500. .no_dac = 0x4000,
  501. .shared_primary = 0x12,
  502. .shared_surr = 0x20,
  503. .shared_clfe = 0x20,
  504. .shared_surr_main = 0x10,
  505. };
  506. static int via_parse_auto_config(struct hda_codec *codec)
  507. {
  508. struct via_spec *spec = codec->spec;
  509. int err;
  510. spec->gen.main_out_badness = &via_main_out_badness;
  511. spec->gen.extra_out_badness = &via_extra_out_badness;
  512. err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0);
  513. if (err < 0)
  514. return err;
  515. auto_parse_beep(codec);
  516. err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
  517. if (err < 0)
  518. return err;
  519. /* disable widget PM at start for compatibility */
  520. codec->power_save_node = 0;
  521. spec->gen.power_down_unused = 0;
  522. return 0;
  523. }
  524. static int via_init(struct hda_codec *codec)
  525. {
  526. struct via_spec *spec = codec->spec;
  527. int i;
  528. for (i = 0; i < spec->num_iverbs; i++)
  529. snd_hda_sequence_write(codec, spec->init_verbs[i]);
  530. /* init power states */
  531. __analog_low_current_mode(codec, true);
  532. snd_hda_gen_init(codec);
  533. vt1708_update_hp_work(codec);
  534. return 0;
  535. }
  536. static int vt1708_build_controls(struct hda_codec *codec)
  537. {
  538. /* In order not to create "Phantom Jack" controls,
  539. temporary enable jackpoll */
  540. int err;
  541. int old_interval = codec->jackpoll_interval;
  542. codec->jackpoll_interval = msecs_to_jiffies(100);
  543. err = via_build_controls(codec);
  544. codec->jackpoll_interval = old_interval;
  545. return err;
  546. }
  547. static int vt1708_build_pcms(struct hda_codec *codec)
  548. {
  549. struct via_spec *spec = codec->spec;
  550. int i, err;
  551. err = snd_hda_gen_build_pcms(codec);
  552. if (err < 0 || codec->core.vendor_id != 0x11061708)
  553. return err;
  554. /* We got noisy outputs on the right channel on VT1708 when
  555. * 24bit samples are used. Until any workaround is found,
  556. * disable the 24bit format, so far.
  557. */
  558. for (i = 0; i < ARRAY_SIZE(spec->gen.pcm_rec); i++) {
  559. struct hda_pcm *info = spec->gen.pcm_rec[i];
  560. if (!info)
  561. continue;
  562. if (!info->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams ||
  563. info->pcm_type != HDA_PCM_TYPE_AUDIO)
  564. continue;
  565. info->stream[SNDRV_PCM_STREAM_PLAYBACK].formats =
  566. SNDRV_PCM_FMTBIT_S16_LE;
  567. }
  568. return 0;
  569. }
  570. static int patch_vt1708(struct hda_codec *codec)
  571. {
  572. struct via_spec *spec;
  573. int err;
  574. /* create a codec specific record */
  575. spec = via_new_spec(codec);
  576. if (spec == NULL)
  577. return -ENOMEM;
  578. spec->gen.mixer_nid = 0x17;
  579. /* set jackpoll_interval while parsing the codec */
  580. codec->jackpoll_interval = msecs_to_jiffies(100);
  581. spec->vt1708_jack_detect = 1;
  582. /* don't support the input jack switching due to lack of unsol event */
  583. /* (it may work with polling, though, but it needs testing) */
  584. spec->gen.suppress_auto_mic = 1;
  585. /* Some machines show the broken speaker mute */
  586. spec->gen.auto_mute_via_amp = 1;
  587. /* Add HP and CD pin config connect bit re-config action */
  588. vt1708_set_pinconfig_connect(codec, VT1708_HP_PIN_NID);
  589. vt1708_set_pinconfig_connect(codec, VT1708_CD_PIN_NID);
  590. /* automatic parse from the BIOS config */
  591. err = via_parse_auto_config(codec);
  592. if (err < 0) {
  593. via_free(codec);
  594. return err;
  595. }
  596. /* add jack detect on/off control */
  597. spec->mixers[spec->num_mixers++] = vt1708_jack_detect_ctl;
  598. spec->init_verbs[spec->num_iverbs++] = vt1708_init_verbs;
  599. codec->patch_ops = via_patch_ops;
  600. codec->patch_ops.build_controls = vt1708_build_controls;
  601. codec->patch_ops.build_pcms = vt1708_build_pcms;
  602. /* clear jackpoll_interval again; it's set dynamically */
  603. codec->jackpoll_interval = 0;
  604. return 0;
  605. }
  606. static int patch_vt1709(struct hda_codec *codec)
  607. {
  608. struct via_spec *spec;
  609. int err;
  610. /* create a codec specific record */
  611. spec = via_new_spec(codec);
  612. if (spec == NULL)
  613. return -ENOMEM;
  614. spec->gen.mixer_nid = 0x18;
  615. err = via_parse_auto_config(codec);
  616. if (err < 0) {
  617. via_free(codec);
  618. return err;
  619. }
  620. codec->patch_ops = via_patch_ops;
  621. return 0;
  622. }
  623. static int patch_vt1708S(struct hda_codec *codec);
  624. static int patch_vt1708B(struct hda_codec *codec)
  625. {
  626. struct via_spec *spec;
  627. int err;
  628. if (get_codec_type(codec) == VT1708BCE)
  629. return patch_vt1708S(codec);
  630. /* create a codec specific record */
  631. spec = via_new_spec(codec);
  632. if (spec == NULL)
  633. return -ENOMEM;
  634. spec->gen.mixer_nid = 0x16;
  635. /* automatic parse from the BIOS config */
  636. err = via_parse_auto_config(codec);
  637. if (err < 0) {
  638. via_free(codec);
  639. return err;
  640. }
  641. codec->patch_ops = via_patch_ops;
  642. return 0;
  643. }
  644. /* Patch for VT1708S */
  645. static const struct hda_verb vt1708S_init_verbs[] = {
  646. /* Enable Mic Boost Volume backdoor */
  647. {0x1, 0xf98, 0x1},
  648. /* don't bybass mixer */
  649. {0x1, 0xf88, 0xc0},
  650. { }
  651. };
  652. static void override_mic_boost(struct hda_codec *codec, hda_nid_t pin,
  653. int offset, int num_steps, int step_size)
  654. {
  655. snd_hda_override_wcaps(codec, pin,
  656. get_wcaps(codec, pin) | AC_WCAP_IN_AMP);
  657. snd_hda_override_amp_caps(codec, pin, HDA_INPUT,
  658. (offset << AC_AMPCAP_OFFSET_SHIFT) |
  659. (num_steps << AC_AMPCAP_NUM_STEPS_SHIFT) |
  660. (step_size << AC_AMPCAP_STEP_SIZE_SHIFT) |
  661. (0 << AC_AMPCAP_MUTE_SHIFT));
  662. }
  663. static int patch_vt1708S(struct hda_codec *codec)
  664. {
  665. struct via_spec *spec;
  666. int err;
  667. /* create a codec specific record */
  668. spec = via_new_spec(codec);
  669. if (spec == NULL)
  670. return -ENOMEM;
  671. spec->gen.mixer_nid = 0x16;
  672. override_mic_boost(codec, 0x1a, 0, 3, 40);
  673. override_mic_boost(codec, 0x1e, 0, 3, 40);
  674. /* correct names for VT1708BCE */
  675. if (get_codec_type(codec) == VT1708BCE) {
  676. kfree(codec->core.chip_name);
  677. codec->core.chip_name = kstrdup("VT1708BCE", GFP_KERNEL);
  678. snprintf(codec->card->mixername,
  679. sizeof(codec->card->mixername),
  680. "%s %s", codec->core.vendor_name, codec->core.chip_name);
  681. }
  682. /* correct names for VT1705 */
  683. if (codec->core.vendor_id == 0x11064397) {
  684. kfree(codec->core.chip_name);
  685. codec->core.chip_name = kstrdup("VT1705", GFP_KERNEL);
  686. snprintf(codec->card->mixername,
  687. sizeof(codec->card->mixername),
  688. "%s %s", codec->core.vendor_name, codec->core.chip_name);
  689. }
  690. /* automatic parse from the BIOS config */
  691. err = via_parse_auto_config(codec);
  692. if (err < 0) {
  693. via_free(codec);
  694. return err;
  695. }
  696. spec->init_verbs[spec->num_iverbs++] = vt1708S_init_verbs;
  697. codec->patch_ops = via_patch_ops;
  698. return 0;
  699. }
  700. /* Patch for VT1702 */
  701. static const struct hda_verb vt1702_init_verbs[] = {
  702. /* mixer enable */
  703. {0x1, 0xF88, 0x3},
  704. /* GPIO 0~2 */
  705. {0x1, 0xF82, 0x3F},
  706. { }
  707. };
  708. static int patch_vt1702(struct hda_codec *codec)
  709. {
  710. struct via_spec *spec;
  711. int err;
  712. /* create a codec specific record */
  713. spec = via_new_spec(codec);
  714. if (spec == NULL)
  715. return -ENOMEM;
  716. spec->gen.mixer_nid = 0x1a;
  717. /* limit AA path volume to 0 dB */
  718. snd_hda_override_amp_caps(codec, 0x1A, HDA_INPUT,
  719. (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
  720. (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  721. (0x5 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  722. (1 << AC_AMPCAP_MUTE_SHIFT));
  723. /* automatic parse from the BIOS config */
  724. err = via_parse_auto_config(codec);
  725. if (err < 0) {
  726. via_free(codec);
  727. return err;
  728. }
  729. spec->init_verbs[spec->num_iverbs++] = vt1702_init_verbs;
  730. codec->patch_ops = via_patch_ops;
  731. return 0;
  732. }
  733. /* Patch for VT1718S */
  734. static const struct hda_verb vt1718S_init_verbs[] = {
  735. /* Enable MW0 adjust Gain 5 */
  736. {0x1, 0xfb2, 0x10},
  737. /* Enable Boost Volume backdoor */
  738. {0x1, 0xf88, 0x8},
  739. { }
  740. };
  741. /* Add a connection to the primary DAC from AA-mixer for some codecs
  742. * This isn't listed from the raw info, but the chip has a secret connection.
  743. */
  744. static int add_secret_dac_path(struct hda_codec *codec)
  745. {
  746. struct via_spec *spec = codec->spec;
  747. int i, nums;
  748. hda_nid_t conn[8];
  749. hda_nid_t nid;
  750. if (!spec->gen.mixer_nid)
  751. return 0;
  752. nums = snd_hda_get_connections(codec, spec->gen.mixer_nid, conn,
  753. ARRAY_SIZE(conn) - 1);
  754. for (i = 0; i < nums; i++) {
  755. if (get_wcaps_type(get_wcaps(codec, conn[i])) == AC_WID_AUD_OUT)
  756. return 0;
  757. }
  758. /* find the primary DAC and add to the connection list */
  759. for_each_hda_codec_node(nid, codec) {
  760. unsigned int caps = get_wcaps(codec, nid);
  761. if (get_wcaps_type(caps) == AC_WID_AUD_OUT &&
  762. !(caps & AC_WCAP_DIGITAL)) {
  763. conn[nums++] = nid;
  764. return snd_hda_override_conn_list(codec,
  765. spec->gen.mixer_nid,
  766. nums, conn);
  767. }
  768. }
  769. return 0;
  770. }
  771. static int patch_vt1718S(struct hda_codec *codec)
  772. {
  773. struct via_spec *spec;
  774. int err;
  775. /* create a codec specific record */
  776. spec = via_new_spec(codec);
  777. if (spec == NULL)
  778. return -ENOMEM;
  779. spec->gen.mixer_nid = 0x21;
  780. override_mic_boost(codec, 0x2b, 0, 3, 40);
  781. override_mic_boost(codec, 0x29, 0, 3, 40);
  782. add_secret_dac_path(codec);
  783. /* automatic parse from the BIOS config */
  784. err = via_parse_auto_config(codec);
  785. if (err < 0) {
  786. via_free(codec);
  787. return err;
  788. }
  789. spec->init_verbs[spec->num_iverbs++] = vt1718S_init_verbs;
  790. codec->patch_ops = via_patch_ops;
  791. return 0;
  792. }
  793. /* Patch for VT1716S */
  794. static int vt1716s_dmic_info(struct snd_kcontrol *kcontrol,
  795. struct snd_ctl_elem_info *uinfo)
  796. {
  797. uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
  798. uinfo->count = 1;
  799. uinfo->value.integer.min = 0;
  800. uinfo->value.integer.max = 1;
  801. return 0;
  802. }
  803. static int vt1716s_dmic_get(struct snd_kcontrol *kcontrol,
  804. struct snd_ctl_elem_value *ucontrol)
  805. {
  806. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  807. int index = 0;
  808. index = snd_hda_codec_read(codec, 0x26, 0,
  809. AC_VERB_GET_CONNECT_SEL, 0);
  810. if (index != -1)
  811. *ucontrol->value.integer.value = index;
  812. return 0;
  813. }
  814. static int vt1716s_dmic_put(struct snd_kcontrol *kcontrol,
  815. struct snd_ctl_elem_value *ucontrol)
  816. {
  817. struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  818. struct via_spec *spec = codec->spec;
  819. int index = *ucontrol->value.integer.value;
  820. snd_hda_codec_write(codec, 0x26, 0,
  821. AC_VERB_SET_CONNECT_SEL, index);
  822. spec->dmic_enabled = index;
  823. return 1;
  824. }
  825. static const struct snd_kcontrol_new vt1716s_dmic_mixer[] = {
  826. HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x22, 0x0, HDA_INPUT),
  827. {
  828. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  829. .name = "Digital Mic Capture Switch",
  830. .subdevice = HDA_SUBDEV_NID_FLAG | 0x26,
  831. .count = 1,
  832. .info = vt1716s_dmic_info,
  833. .get = vt1716s_dmic_get,
  834. .put = vt1716s_dmic_put,
  835. },
  836. {} /* end */
  837. };
  838. /* mono-out mixer elements */
  839. static const struct snd_kcontrol_new vt1716S_mono_out_mixer[] = {
  840. HDA_CODEC_MUTE("Mono Playback Switch", 0x2a, 0x0, HDA_OUTPUT),
  841. { } /* end */
  842. };
  843. static const struct hda_verb vt1716S_init_verbs[] = {
  844. /* Enable Boost Volume backdoor */
  845. {0x1, 0xf8a, 0x80},
  846. /* don't bybass mixer */
  847. {0x1, 0xf88, 0xc0},
  848. /* Enable mono output */
  849. {0x1, 0xf90, 0x08},
  850. { }
  851. };
  852. static int patch_vt1716S(struct hda_codec *codec)
  853. {
  854. struct via_spec *spec;
  855. int err;
  856. /* create a codec specific record */
  857. spec = via_new_spec(codec);
  858. if (spec == NULL)
  859. return -ENOMEM;
  860. spec->gen.mixer_nid = 0x16;
  861. override_mic_boost(codec, 0x1a, 0, 3, 40);
  862. override_mic_boost(codec, 0x1e, 0, 3, 40);
  863. /* automatic parse from the BIOS config */
  864. err = via_parse_auto_config(codec);
  865. if (err < 0) {
  866. via_free(codec);
  867. return err;
  868. }
  869. spec->init_verbs[spec->num_iverbs++] = vt1716S_init_verbs;
  870. spec->mixers[spec->num_mixers++] = vt1716s_dmic_mixer;
  871. spec->mixers[spec->num_mixers++] = vt1716S_mono_out_mixer;
  872. codec->patch_ops = via_patch_ops;
  873. return 0;
  874. }
  875. /* for vt2002P */
  876. static const struct hda_verb vt2002P_init_verbs[] = {
  877. /* Class-D speaker related verbs */
  878. {0x1, 0xfe0, 0x4},
  879. {0x1, 0xfe9, 0x80},
  880. {0x1, 0xfe2, 0x22},
  881. /* Enable Boost Volume backdoor */
  882. {0x1, 0xfb9, 0x24},
  883. /* Enable AOW0 to MW9 */
  884. {0x1, 0xfb8, 0x88},
  885. { }
  886. };
  887. static const struct hda_verb vt1802_init_verbs[] = {
  888. /* Enable Boost Volume backdoor */
  889. {0x1, 0xfb9, 0x24},
  890. /* Enable AOW0 to MW9 */
  891. {0x1, 0xfb8, 0x88},
  892. { }
  893. };
  894. /*
  895. * pin fix-up
  896. */
  897. enum {
  898. VIA_FIXUP_INTMIC_BOOST,
  899. VIA_FIXUP_ASUS_G75,
  900. };
  901. static void via_fixup_intmic_boost(struct hda_codec *codec,
  902. const struct hda_fixup *fix, int action)
  903. {
  904. if (action == HDA_FIXUP_ACT_PRE_PROBE)
  905. override_mic_boost(codec, 0x30, 0, 2, 40);
  906. }
  907. static const struct hda_fixup via_fixups[] = {
  908. [VIA_FIXUP_INTMIC_BOOST] = {
  909. .type = HDA_FIXUP_FUNC,
  910. .v.func = via_fixup_intmic_boost,
  911. },
  912. [VIA_FIXUP_ASUS_G75] = {
  913. .type = HDA_FIXUP_PINS,
  914. .v.pins = (const struct hda_pintbl[]) {
  915. /* set 0x24 and 0x33 as speakers */
  916. { 0x24, 0x991301f0 },
  917. { 0x33, 0x991301f1 }, /* subwoofer */
  918. { }
  919. }
  920. },
  921. };
  922. static const struct snd_pci_quirk vt2002p_fixups[] = {
  923. SND_PCI_QUIRK(0x1043, 0x1487, "Asus G75", VIA_FIXUP_ASUS_G75),
  924. SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
  925. {}
  926. };
  927. /* NIDs 0x24 and 0x33 on VT1802 have connections to non-existing NID 0x3e
  928. * Replace this with mixer NID 0x1c
  929. */
  930. static void fix_vt1802_connections(struct hda_codec *codec)
  931. {
  932. static hda_nid_t conn_24[] = { 0x14, 0x1c };
  933. static hda_nid_t conn_33[] = { 0x1c };
  934. snd_hda_override_conn_list(codec, 0x24, ARRAY_SIZE(conn_24), conn_24);
  935. snd_hda_override_conn_list(codec, 0x33, ARRAY_SIZE(conn_33), conn_33);
  936. }
  937. /* patch for vt2002P */
  938. static int patch_vt2002P(struct hda_codec *codec)
  939. {
  940. struct via_spec *spec;
  941. int err;
  942. /* create a codec specific record */
  943. spec = via_new_spec(codec);
  944. if (spec == NULL)
  945. return -ENOMEM;
  946. spec->gen.mixer_nid = 0x21;
  947. override_mic_boost(codec, 0x2b, 0, 3, 40);
  948. override_mic_boost(codec, 0x29, 0, 3, 40);
  949. if (spec->codec_type == VT1802)
  950. fix_vt1802_connections(codec);
  951. add_secret_dac_path(codec);
  952. snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups);
  953. snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  954. /* automatic parse from the BIOS config */
  955. err = via_parse_auto_config(codec);
  956. if (err < 0) {
  957. via_free(codec);
  958. return err;
  959. }
  960. if (spec->codec_type == VT1802)
  961. spec->init_verbs[spec->num_iverbs++] = vt1802_init_verbs;
  962. else
  963. spec->init_verbs[spec->num_iverbs++] = vt2002P_init_verbs;
  964. codec->patch_ops = via_patch_ops;
  965. return 0;
  966. }
  967. /* for vt1812 */
  968. static const struct hda_verb vt1812_init_verbs[] = {
  969. /* Enable Boost Volume backdoor */
  970. {0x1, 0xfb9, 0x24},
  971. /* Enable AOW0 to MW9 */
  972. {0x1, 0xfb8, 0xa8},
  973. { }
  974. };
  975. /* patch for vt1812 */
  976. static int patch_vt1812(struct hda_codec *codec)
  977. {
  978. struct via_spec *spec;
  979. int err;
  980. /* create a codec specific record */
  981. spec = via_new_spec(codec);
  982. if (spec == NULL)
  983. return -ENOMEM;
  984. spec->gen.mixer_nid = 0x21;
  985. override_mic_boost(codec, 0x2b, 0, 3, 40);
  986. override_mic_boost(codec, 0x29, 0, 3, 40);
  987. add_secret_dac_path(codec);
  988. /* automatic parse from the BIOS config */
  989. err = via_parse_auto_config(codec);
  990. if (err < 0) {
  991. via_free(codec);
  992. return err;
  993. }
  994. spec->init_verbs[spec->num_iverbs++] = vt1812_init_verbs;
  995. codec->patch_ops = via_patch_ops;
  996. return 0;
  997. }
  998. /* patch for vt3476 */
  999. static const struct hda_verb vt3476_init_verbs[] = {
  1000. /* Enable DMic 8/16/32K */
  1001. {0x1, 0xF7B, 0x30},
  1002. /* Enable Boost Volume backdoor */
  1003. {0x1, 0xFB9, 0x20},
  1004. /* Enable AOW-MW9 path */
  1005. {0x1, 0xFB8, 0x10},
  1006. { }
  1007. };
  1008. static int patch_vt3476(struct hda_codec *codec)
  1009. {
  1010. struct via_spec *spec;
  1011. int err;
  1012. /* create a codec specific record */
  1013. spec = via_new_spec(codec);
  1014. if (spec == NULL)
  1015. return -ENOMEM;
  1016. spec->gen.mixer_nid = 0x3f;
  1017. add_secret_dac_path(codec);
  1018. /* automatic parse from the BIOS config */
  1019. err = via_parse_auto_config(codec);
  1020. if (err < 0) {
  1021. via_free(codec);
  1022. return err;
  1023. }
  1024. spec->init_verbs[spec->num_iverbs++] = vt3476_init_verbs;
  1025. codec->patch_ops = via_patch_ops;
  1026. return 0;
  1027. }
  1028. /*
  1029. * patch entries
  1030. */
  1031. static const struct hda_codec_preset snd_hda_preset_via[] = {
  1032. { .id = 0x11061708, .name = "VT1708", .patch = patch_vt1708},
  1033. { .id = 0x11061709, .name = "VT1708", .patch = patch_vt1708},
  1034. { .id = 0x1106170a, .name = "VT1708", .patch = patch_vt1708},
  1035. { .id = 0x1106170b, .name = "VT1708", .patch = patch_vt1708},
  1036. { .id = 0x1106e710, .name = "VT1709 10-Ch",
  1037. .patch = patch_vt1709},
  1038. { .id = 0x1106e711, .name = "VT1709 10-Ch",
  1039. .patch = patch_vt1709},
  1040. { .id = 0x1106e712, .name = "VT1709 10-Ch",
  1041. .patch = patch_vt1709},
  1042. { .id = 0x1106e713, .name = "VT1709 10-Ch",
  1043. .patch = patch_vt1709},
  1044. { .id = 0x1106e714, .name = "VT1709 6-Ch",
  1045. .patch = patch_vt1709},
  1046. { .id = 0x1106e715, .name = "VT1709 6-Ch",
  1047. .patch = patch_vt1709},
  1048. { .id = 0x1106e716, .name = "VT1709 6-Ch",
  1049. .patch = patch_vt1709},
  1050. { .id = 0x1106e717, .name = "VT1709 6-Ch",
  1051. .patch = patch_vt1709},
  1052. { .id = 0x1106e720, .name = "VT1708B 8-Ch",
  1053. .patch = patch_vt1708B},
  1054. { .id = 0x1106e721, .name = "VT1708B 8-Ch",
  1055. .patch = patch_vt1708B},
  1056. { .id = 0x1106e722, .name = "VT1708B 8-Ch",
  1057. .patch = patch_vt1708B},
  1058. { .id = 0x1106e723, .name = "VT1708B 8-Ch",
  1059. .patch = patch_vt1708B},
  1060. { .id = 0x1106e724, .name = "VT1708B 4-Ch",
  1061. .patch = patch_vt1708B},
  1062. { .id = 0x1106e725, .name = "VT1708B 4-Ch",
  1063. .patch = patch_vt1708B},
  1064. { .id = 0x1106e726, .name = "VT1708B 4-Ch",
  1065. .patch = patch_vt1708B},
  1066. { .id = 0x1106e727, .name = "VT1708B 4-Ch",
  1067. .patch = patch_vt1708B},
  1068. { .id = 0x11060397, .name = "VT1708S",
  1069. .patch = patch_vt1708S},
  1070. { .id = 0x11061397, .name = "VT1708S",
  1071. .patch = patch_vt1708S},
  1072. { .id = 0x11062397, .name = "VT1708S",
  1073. .patch = patch_vt1708S},
  1074. { .id = 0x11063397, .name = "VT1708S",
  1075. .patch = patch_vt1708S},
  1076. { .id = 0x11064397, .name = "VT1705",
  1077. .patch = patch_vt1708S},
  1078. { .id = 0x11065397, .name = "VT1708S",
  1079. .patch = patch_vt1708S},
  1080. { .id = 0x11066397, .name = "VT1708S",
  1081. .patch = patch_vt1708S},
  1082. { .id = 0x11067397, .name = "VT1708S",
  1083. .patch = patch_vt1708S},
  1084. { .id = 0x11060398, .name = "VT1702",
  1085. .patch = patch_vt1702},
  1086. { .id = 0x11061398, .name = "VT1702",
  1087. .patch = patch_vt1702},
  1088. { .id = 0x11062398, .name = "VT1702",
  1089. .patch = patch_vt1702},
  1090. { .id = 0x11063398, .name = "VT1702",
  1091. .patch = patch_vt1702},
  1092. { .id = 0x11064398, .name = "VT1702",
  1093. .patch = patch_vt1702},
  1094. { .id = 0x11065398, .name = "VT1702",
  1095. .patch = patch_vt1702},
  1096. { .id = 0x11066398, .name = "VT1702",
  1097. .patch = patch_vt1702},
  1098. { .id = 0x11067398, .name = "VT1702",
  1099. .patch = patch_vt1702},
  1100. { .id = 0x11060428, .name = "VT1718S",
  1101. .patch = patch_vt1718S},
  1102. { .id = 0x11064428, .name = "VT1718S",
  1103. .patch = patch_vt1718S},
  1104. { .id = 0x11060441, .name = "VT2020",
  1105. .patch = patch_vt1718S},
  1106. { .id = 0x11064441, .name = "VT1828S",
  1107. .patch = patch_vt1718S},
  1108. { .id = 0x11060433, .name = "VT1716S",
  1109. .patch = patch_vt1716S},
  1110. { .id = 0x1106a721, .name = "VT1716S",
  1111. .patch = patch_vt1716S},
  1112. { .id = 0x11060438, .name = "VT2002P", .patch = patch_vt2002P},
  1113. { .id = 0x11064438, .name = "VT2002P", .patch = patch_vt2002P},
  1114. { .id = 0x11060448, .name = "VT1812", .patch = patch_vt1812},
  1115. { .id = 0x11060440, .name = "VT1818S",
  1116. .patch = patch_vt1708S},
  1117. { .id = 0x11060446, .name = "VT1802",
  1118. .patch = patch_vt2002P},
  1119. { .id = 0x11068446, .name = "VT1802",
  1120. .patch = patch_vt2002P},
  1121. { .id = 0x11064760, .name = "VT1705CF",
  1122. .patch = patch_vt3476},
  1123. { .id = 0x11064761, .name = "VT1708SCE",
  1124. .patch = patch_vt3476},
  1125. { .id = 0x11064762, .name = "VT1808",
  1126. .patch = patch_vt3476},
  1127. {} /* terminator */
  1128. };
  1129. MODULE_ALIAS("snd-hda-codec-id:1106*");
  1130. static struct hda_codec_driver via_driver = {
  1131. .preset = snd_hda_preset_via,
  1132. };
  1133. MODULE_LICENSE("GPL");
  1134. MODULE_DESCRIPTION("VIA HD-audio codec");
  1135. module_hda_codec_driver(via_driver);