patch_via.c 32 KB

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