patch_via.c 33 KB

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