patch_via.c 33 KB

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