patch_via.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  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);