patch_via.c 32 KB

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