patch_via.c 32 KB

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