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