via.c 31 KB

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