patch_via.c 32 KB

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