]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/hda/patch_via.c
Merge branch 'topic/snd-hrtimer' into to-push
[linux-2.6-omap-h63xx.git] / sound / pci / hda / patch_via.c
index 43fb96538b806bd4aceaaac60c0eb459c7bb3afa..c761394cbe84baabf9433c0bdd3c1d928f79f08c 100644 (file)
@@ -35,6 +35,7 @@
 /* 2008-04-09  Lydia Wang  Add mute front speaker when HP plugin             */
 /* 2008-04-09  Lydia Wang  Add Independent HP feature                        */
 /* 2008-05-28  Lydia Wang  Add second S/PDIF Out support for VT1702         */
+/* 2008-09-15  Logan Li    Add VT1708S Mic Boost workaround/backdoor        */
 /*                                                                           */
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 #include <sound/asoundef.h>
 #include "hda_codec.h"
 #include "hda_local.h"
-#include "hda_patch.h"
 
 /* amp values */
 #define AMP_VAL_IDX_SHIFT      19
 #define AMP_VAL_IDX_MASK       (0x0f<<19)
 
-#define NUM_CONTROL_ALLOC      32
-#define NUM_VERB_ALLOC         32
-
 /* Pin Widget NID */
 #define VT1708_HP_NID          0x13
 #define VT1708_DIGOUT_NID      0x14
 #define IS_VT1708S_VENDORID(x)         ((x) >= 0x11060397 && (x) <= 0x11067397)
 #define IS_VT1702_VENDORID(x)          ((x) >= 0x11060398 && (x) <= 0x11067398)
 
+enum VIA_HDA_CODEC {
+       UNKNOWN = -1,
+       VT1708,
+       VT1709_10CH,
+       VT1709_6CH,
+       VT1708B_8CH,
+       VT1708B_4CH,
+       VT1708S,
+       VT1702,
+       CODEC_TYPES,
+};
+
+static enum VIA_HDA_CODEC get_codec_type(u32 vendor_id)
+{
+       u16 ven_id = vendor_id >> 16;
+       u16 dev_id = vendor_id & 0xffff;
+       enum VIA_HDA_CODEC codec_type;
+
+       /* get codec type */
+       if (ven_id != 0x1106)
+               codec_type = UNKNOWN;
+       else if (dev_id >= 0x1708 && dev_id <= 0x170b)
+               codec_type = VT1708;
+       else if (dev_id >= 0xe710 && dev_id <= 0xe713)
+               codec_type = VT1709_10CH;
+       else if (dev_id >= 0xe714 && dev_id <= 0xe717)
+               codec_type = VT1709_6CH;
+       else if (dev_id >= 0xe720 && dev_id <= 0xe723)
+               codec_type = VT1708B_8CH;
+       else if (dev_id >= 0xe724 && dev_id <= 0xe727)
+               codec_type = VT1708B_4CH;
+       else if ((dev_id & 0xfff) == 0x397
+                && (dev_id >> 12) < 8)
+               codec_type = VT1708S;
+       else if ((dev_id & 0xfff) == 0x398
+                && (dev_id >> 12) < 8)
+               codec_type = VT1702;
+       else
+               codec_type = UNKNOWN;
+       return codec_type;
+};
+
 #define VIA_HP_EVENT           0x01
 #define VIA_GPIO_EVENT         0x02
 
@@ -102,6 +141,46 @@ enum {
        AUTO_SEQ_SIDE
 };
 
+/* Some VT1708S based boards gets the micboost setting wrong, so we have
+ * to apply some brute-force and re-write the TLV's by software. */
+static int mic_boost_tlv(struct snd_kcontrol *kcontrol, int op_flag,
+                        unsigned int size, unsigned int __user *_tlv)
+{
+       struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+       hda_nid_t nid = get_amp_nid(kcontrol);
+
+       if (get_codec_type(codec->vendor_id) == VT1708S
+           && (nid == 0x1a || nid == 0x1e)) {
+               if (size < 4 * sizeof(unsigned int))
+                       return -ENOMEM;
+               if (put_user(1, _tlv))  /* SNDRV_CTL_TLVT_DB_SCALE */
+                       return -EFAULT;
+               if (put_user(2 * sizeof(unsigned int), _tlv + 1))
+                       return -EFAULT;
+               if (put_user(0, _tlv + 2)) /* offset = 0 */
+                       return -EFAULT;
+               if (put_user(1000, _tlv + 3)) /* step size = 10 dB */
+                       return -EFAULT;
+       }
+       return 0;
+}
+
+static int mic_boost_volume_info(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_info *uinfo)
+{
+       struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+       hda_nid_t nid = get_amp_nid(kcontrol);
+
+       if (get_codec_type(codec->vendor_id) == VT1708S
+           && (nid == 0x1a || nid == 0x1e)) {
+               uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+               uinfo->count = 2;
+               uinfo->value.integer.min = 0;
+               uinfo->value.integer.max = 3;
+       }
+       return 0;
+}
+
 static struct snd_kcontrol_new vt1708_control_templates[] = {
        HDA_CODEC_VOLUME(NULL, 0, 0, 0),
        HDA_CODEC_MUTE(NULL, 0, 0, 0),
@@ -123,7 +202,6 @@ struct via_spec {
        char *stream_name_digital;
        struct hda_pcm_stream *stream_digital_playback;
        struct hda_pcm_stream *stream_digital_capture;
-       struct hda_pcm_stream *stream_extra_digital_playback;
 
        /* playback */
        struct hda_multi_out multiout;
@@ -143,8 +221,7 @@ struct via_spec {
 
        /* dynamic controls, init_verbs and input_mux */
        struct auto_pin_cfg autocfg;
-       unsigned int num_kctl_alloc, num_kctl_used;
-       struct snd_kcontrol_new *kctl_alloc;
+       struct snd_array kctls;
        struct hda_input_mux private_imux[2];
        hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
 
@@ -188,33 +265,31 @@ static int via_add_control(struct via_spec *spec, int type, const char *name,
 {
        struct snd_kcontrol_new *knew;
 
-       if (spec->num_kctl_used >= spec->num_kctl_alloc) {
-               int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
-
-               /* array + terminator */
-               knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
-               if (!knew)
-                       return -ENOMEM;
-               if (spec->kctl_alloc) {
-                       memcpy(knew, spec->kctl_alloc,
-                              sizeof(*knew) * spec->num_kctl_alloc);
-                       kfree(spec->kctl_alloc);
-               }
-               spec->kctl_alloc = knew;
-               spec->num_kctl_alloc = num;
-       }
-
-       knew = &spec->kctl_alloc[spec->num_kctl_used];
+       snd_array_init(&spec->kctls, sizeof(*knew), 32);
+       knew = snd_array_new(&spec->kctls);
+       if (!knew)
+               return -ENOMEM;
        *knew = vt1708_control_templates[type];
        knew->name = kstrdup(name, GFP_KERNEL);
-
        if (!knew->name)
                return -ENOMEM;
        knew->private_value = val;
-       spec->num_kctl_used++;
        return 0;
 }
 
+static void via_free_kctls(struct hda_codec *codec)
+{
+       struct via_spec *spec = codec->spec;
+
+       if (spec->kctls.list) {
+               struct snd_kcontrol_new *kctl = spec->kctls.list;
+               int i;
+               for (i = 0; i < spec->kctls.used; i++)
+                       kfree(kctl[i].name);
+       }
+       snd_array_free(&spec->kctls);
+}
+
 /* create input playback/capture controls for the given pin */
 static int via_new_analog_input(struct via_spec *spec, hda_nid_t pin,
                                const char *ctlname, int idx, int mix_nid)
@@ -656,17 +731,6 @@ static int via_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
        return snd_hda_multi_out_dig_close(codec, &spec->multiout);
 }
 
-static int via_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
-                                       struct hda_codec *codec,
-                                       unsigned int stream_tag,
-                                       unsigned int format,
-                                       struct snd_pcm_substream *substream)
-{
-       struct via_spec *spec = codec->spec;
-       return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
-                                            stream_tag, format, substream);
-}
-
 /* setup SPDIF output stream */
 static void setup_dig_playback_stream(struct hda_codec *codec, hda_nid_t nid,
                                 unsigned int stream_tag, unsigned int format)
@@ -682,17 +746,25 @@ static void setup_dig_playback_stream(struct hda_codec *codec, hda_nid_t nid,
                                    codec->spdif_ctls & 0xff);
 }
 
-static int via_extra_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
+static int via_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
                                        struct hda_codec *codec,
                                        unsigned int stream_tag,
                                        unsigned int format,
                                        struct snd_pcm_substream *substream)
 {
        struct via_spec *spec = codec->spec;
+       hda_nid_t nid;
+
+       /* 1st or 2nd S/PDIF */
+       if (substream->number == 0)
+               nid = spec->multiout.dig_out_nid;
+       else if (substream->number == 1)
+               nid = spec->extra_dig_out_nid;
+       else
+               return -1;
 
        mutex_lock(&codec->spdif_mutex);
-       setup_dig_playback_stream(codec, spec->extra_dig_out_nid, stream_tag,
-                                 format);
+       setup_dig_playback_stream(codec, nid, stream_tag, format);
        mutex_unlock(&codec->spdif_mutex);
        return 0;
 }
@@ -815,6 +887,7 @@ static int via_build_controls(struct hda_codec *codec)
                if (err < 0)
                        return err;
        }
+       via_free_kctls(codec); /* no longer needed */
        return 0;
 }
 
@@ -854,34 +927,17 @@ static int via_build_pcms(struct hda_codec *codec)
                }
        }
 
-       if (spec->extra_dig_out_nid) {
-               codec->num_pcms++;
-               info++;
-               info->name = spec->stream_name_digital;
-               info->pcm_type = HDA_PCM_TYPE_HDMI;
-               info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
-                               *(spec->stream_extra_digital_playback);
-               info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
-                               spec->extra_dig_out_nid;
-       }
-
        return 0;
 }
 
 static void via_free(struct hda_codec *codec)
 {
        struct via_spec *spec = codec->spec;
-       unsigned int i;
 
        if (!spec)
                return;
 
-       if (spec->kctl_alloc) {
-               for (i = 0; i < spec->num_kctl_used; i++)
-                       kfree(spec->kctl_alloc[i].name);
-               kfree(spec->kctl_alloc);
-       }
-
+       via_free_kctls(codec);
        kfree(codec->spec);
 }
 
@@ -957,6 +1013,10 @@ static void via_unsol_event(struct hda_codec *codec,
                via_gpio_control(codec);
 }
 
+static hda_nid_t slave_dig_outs[] = {
+       0,
+};
+
 static int via_init(struct hda_codec *codec)
 {
        struct via_spec *spec = codec->spec;
@@ -991,6 +1051,9 @@ static int via_init(struct hda_codec *codec)
                snd_hda_codec_write(codec, spec->autocfg.dig_in_pin, 0,
                                    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN);
 
+       /* no slave outs */
+       codec->slave_dig_outs = slave_dig_outs;
+
        return 0;
 }
 
@@ -1296,8 +1359,8 @@ static int vt1708_parse_auto_config(struct hda_codec *codec)
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = VT1708_DIGIN_NID;
 
-       if (spec->kctl_alloc)
-               spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
+       if (spec->kctls.list)
+               spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
        spec->init_verbs[spec->num_iverbs++] = vt1708_volume_init_verbs;
 
@@ -1769,8 +1832,8 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = VT1709_DIGIN_NID;
 
-       if (spec->kctl_alloc)
-               spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
+       if (spec->kctls.list)
+               spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
        spec->input_mux = &spec->private_imux[0];
 
@@ -2313,8 +2376,8 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = VT1708B_DIGIN_NID;
 
-       if (spec->kctl_alloc)
-               spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
+       if (spec->kctls.list)
+               spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
        spec->input_mux = &spec->private_imux[0];
 
@@ -2438,14 +2501,29 @@ static int patch_vt1708B_4ch(struct hda_codec *codec)
 
 /* Patch for VT1708S */
 
+/* VT1708S software backdoor based override for buggy hardware micboost
+ * setting */
+#define MIC_BOOST_VOLUME(xname, nid) {                         \
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,            \
+       .name = xname,                                  \
+       .index = 0,                                     \
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |     \
+       SNDRV_CTL_ELEM_ACCESS_TLV_READ |                \
+       SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,             \
+       .info = mic_boost_volume_info,                  \
+       .get = snd_hda_mixer_amp_volume_get,            \
+       .put = snd_hda_mixer_amp_volume_put,            \
+       .tlv = { .c = mic_boost_tlv },                  \
+       .private_value = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT) }
+
 /* capture mixer elements */
 static struct snd_kcontrol_new vt1708S_capture_mixer[] = {
        HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
        HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
        HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x14, 0x0, HDA_INPUT),
-       HDA_CODEC_VOLUME("Mic Boost", 0x1A, 0x0, HDA_INPUT),
-       HDA_CODEC_VOLUME("Front Mic Boost", 0x1E, 0x0, HDA_INPUT),
+       MIC_BOOST_VOLUME("Mic Boost Capture Volume", 0x1A),
+       MIC_BOOST_VOLUME("Front Mic Boost Capture Volume", 0x1E),
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                /* The multiple "Capture Source" controls confuse alsamixer
@@ -2477,8 +2555,11 @@ static struct hda_verb vt1708S_volume_init_verbs[] = {
 
        /* Setup default input of PW4 to MW0 */
        {0x1d, AC_VERB_SET_CONNECT_SEL, 0x0},
-       /* PW9 Output enable */
+       /* PW9, PW10  Output enable */
        {0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
+       {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
+       /* Enable Mic Boost Volume backdoor */
+       {0x1, 0xf98, 0x1},
        { }
 };
 
@@ -2511,7 +2592,7 @@ static struct hda_pcm_stream vt1708S_pcm_analog_capture = {
 };
 
 static struct hda_pcm_stream vt1708S_pcm_digital_playback = {
-       .substreams = 1,
+       .substreams = 2,
        .channels_min = 2,
        .channels_max = 2,
        /* NID is set in via_build_pcms */
@@ -2522,16 +2603,6 @@ static struct hda_pcm_stream vt1708S_pcm_digital_playback = {
        },
 };
 
-static struct hda_pcm_stream vt1708S_pcm_extra_digital_playback = {
-       .substreams = 1,
-       .channels_min = 2,
-       .channels_max = 2,
-       /* NID is set in via_build_pcms */
-       .ops = {
-               .prepare = via_extra_dig_playback_pcm_prepare
-       },
-};
-
 /* fill in the dac_nids table from the parsed pin configuration */
 static int vt1708S_auto_fill_dac_nids(struct via_spec *spec,
                                     const struct auto_pin_cfg *cfg)
@@ -2770,8 +2841,8 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)
 
        spec->extra_dig_out_nid = 0x15;
 
-       if (spec->kctl_alloc)
-               spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
+       if (spec->kctls.list)
+               spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
        spec->input_mux = &spec->private_imux[0];
 
@@ -2822,8 +2893,6 @@ static int patch_vt1708S(struct hda_codec *codec)
 
        spec->stream_name_digital = "VT1708S Digital";
        spec->stream_digital_playback = &vt1708S_pcm_digital_playback;
-       spec->stream_extra_digital_playback =
-                                       &vt1708S_pcm_extra_digital_playback;
 
        if (!spec->adc_nids && spec->input_mux) {
                spec->adc_nids = vt1708S_adc_nids;
@@ -2927,7 +2996,7 @@ static struct hda_pcm_stream vt1702_pcm_analog_capture = {
 };
 
 static struct hda_pcm_stream vt1702_pcm_digital_playback = {
-       .substreams = 1,
+       .substreams = 2,
        .channels_min = 2,
        .channels_max = 2,
        /* NID is set in via_build_pcms */
@@ -2938,16 +3007,6 @@ static struct hda_pcm_stream vt1702_pcm_digital_playback = {
        },
 };
 
-static struct hda_pcm_stream vt1702_pcm_extra_digital_playback = {
-       .substreams = 1,
-       .channels_min = 2,
-       .channels_max = 2,
-       /* NID is set in via_build_pcms */
-       .ops = {
-               .prepare = via_extra_dig_playback_pcm_prepare
-       },
-};
-
 /* fill in the dac_nids table from the parsed pin configuration */
 static int vt1702_auto_fill_dac_nids(struct via_spec *spec,
                                     const struct auto_pin_cfg *cfg)
@@ -3101,8 +3160,8 @@ static int vt1702_parse_auto_config(struct hda_codec *codec)
 
        spec->extra_dig_out_nid = 0x1B;
 
-       if (spec->kctl_alloc)
-               spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
+       if (spec->kctls.list)
+               spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
        spec->input_mux = &spec->private_imux[0];
 
@@ -3155,8 +3214,6 @@ static int patch_vt1702(struct hda_codec *codec)
 
        spec->stream_name_digital = "VT1702 Digital";
        spec->stream_digital_playback = &vt1702_pcm_digital_playback;
-       spec->stream_extra_digital_playback =
-                                       &vt1702_pcm_extra_digital_playback;
 
        if (!spec->adc_nids && spec->input_mux) {
                spec->adc_nids = vt1702_adc_nids;
@@ -3191,74 +3248,97 @@ static int patch_vt1702(struct hda_codec *codec)
 /*
  * patch entries
  */
-struct hda_codec_preset snd_hda_preset_via[] = {
-       { .id = 0x11061708, .name = "VIA VT1708", .patch = patch_vt1708},
-       { .id = 0x11061709, .name = "VIA VT1708", .patch = patch_vt1708},
-       { .id = 0x1106170A, .name = "VIA VT1708", .patch = patch_vt1708},
-       { .id = 0x1106170B, .name = "VIA VT1708", .patch = patch_vt1708},
-       { .id = 0x1106E710, .name = "VIA VT1709 10-Ch",
+static struct hda_codec_preset snd_hda_preset_via[] = {
+       { .id = 0x11061708, .name = "VT1708", .patch = patch_vt1708},
+       { .id = 0x11061709, .name = "VT1708", .patch = patch_vt1708},
+       { .id = 0x1106170a, .name = "VT1708", .patch = patch_vt1708},
+       { .id = 0x1106170b, .name = "VT1708", .patch = patch_vt1708},
+       { .id = 0x1106e710, .name = "VT1709 10-Ch",
          .patch = patch_vt1709_10ch},
-       { .id = 0x1106E711, .name = "VIA VT1709 10-Ch",
+       { .id = 0x1106e711, .name = "VT1709 10-Ch",
          .patch = patch_vt1709_10ch},
-       { .id = 0x1106E712, .name = "VIA VT1709 10-Ch",
+       { .id = 0x1106e712, .name = "VT1709 10-Ch",
          .patch = patch_vt1709_10ch},
-       { .id = 0x1106E713, .name = "VIA VT1709 10-Ch",
+       { .id = 0x1106e713, .name = "VT1709 10-Ch",
          .patch = patch_vt1709_10ch},
-       { .id = 0x1106E714, .name = "VIA VT1709 6-Ch",
+       { .id = 0x1106e714, .name = "VT1709 6-Ch",
          .patch = patch_vt1709_6ch},
-       { .id = 0x1106E715, .name = "VIA VT1709 6-Ch",
+       { .id = 0x1106e715, .name = "VT1709 6-Ch",
          .patch = patch_vt1709_6ch},
-       { .id = 0x1106E716, .name = "VIA VT1709 6-Ch",
+       { .id = 0x1106e716, .name = "VT1709 6-Ch",
          .patch = patch_vt1709_6ch},
-       { .id = 0x1106E717, .name = "VIA VT1709 6-Ch",
+       { .id = 0x1106e717, .name = "VT1709 6-Ch",
          .patch = patch_vt1709_6ch},
-       { .id = 0x1106E720, .name = "VIA VT1708B 8-Ch",
+       { .id = 0x1106e720, .name = "VT1708B 8-Ch",
          .patch = patch_vt1708B_8ch},
-       { .id = 0x1106E721, .name = "VIA VT1708B 8-Ch",
+       { .id = 0x1106e721, .name = "VT1708B 8-Ch",
          .patch = patch_vt1708B_8ch},
-       { .id = 0x1106E722, .name = "VIA VT1708B 8-Ch",
+       { .id = 0x1106e722, .name = "VT1708B 8-Ch",
          .patch = patch_vt1708B_8ch},
-       { .id = 0x1106E723, .name = "VIA VT1708B 8-Ch",
+       { .id = 0x1106e723, .name = "VT1708B 8-Ch",
          .patch = patch_vt1708B_8ch},
-       { .id = 0x1106E724, .name = "VIA VT1708B 4-Ch",
+       { .id = 0x1106e724, .name = "VT1708B 4-Ch",
          .patch = patch_vt1708B_4ch},
-       { .id = 0x1106E725, .name = "VIA VT1708B 4-Ch",
+       { .id = 0x1106e725, .name = "VT1708B 4-Ch",
          .patch = patch_vt1708B_4ch},
-       { .id = 0x1106E726, .name = "VIA VT1708B 4-Ch",
+       { .id = 0x1106e726, .name = "VT1708B 4-Ch",
          .patch = patch_vt1708B_4ch},
-       { .id = 0x1106E727, .name = "VIA VT1708B 4-Ch",
+       { .id = 0x1106e727, .name = "VT1708B 4-Ch",
          .patch = patch_vt1708B_4ch},
-       { .id = 0x11060397, .name = "VIA VT1708S",
+       { .id = 0x11060397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11061397, .name = "VIA VT1708S",
+       { .id = 0x11061397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11062397, .name = "VIA VT1708S",
+       { .id = 0x11062397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11063397, .name = "VIA VT1708S",
+       { .id = 0x11063397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11064397, .name = "VIA VT1708S",
+       { .id = 0x11064397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11065397, .name = "VIA VT1708S",
+       { .id = 0x11065397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11066397, .name = "VIA VT1708S",
+       { .id = 0x11066397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11067397, .name = "VIA VT1708S",
+       { .id = 0x11067397, .name = "VT1708S",
          .patch = patch_vt1708S},
-       { .id = 0x11060398, .name = "VIA VT1702",
+       { .id = 0x11060398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11061398, .name = "VIA VT1702",
+       { .id = 0x11061398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11062398, .name = "VIA VT1702",
+       { .id = 0x11062398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11063398, .name = "VIA VT1702",
+       { .id = 0x11063398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11064398, .name = "VIA VT1702",
+       { .id = 0x11064398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11065398, .name = "VIA VT1702",
+       { .id = 0x11065398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11066398, .name = "VIA VT1702",
+       { .id = 0x11066398, .name = "VT1702",
          .patch = patch_vt1702},
-       { .id = 0x11067398, .name = "VIA VT1702",
+       { .id = 0x11067398, .name = "VT1702",
          .patch = patch_vt1702},
        {} /* terminator */
 };
+
+MODULE_ALIAS("snd-hda-codec-id:1106*");
+
+static struct hda_codec_preset_list via_list = {
+       .preset = snd_hda_preset_via,
+       .owner = THIS_MODULE,
+};
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("VIA HD-audio codec");
+
+static int __init patch_via_init(void)
+{
+       return snd_hda_add_codec_preset(&via_list);
+}
+
+static void __exit patch_via_exit(void)
+{
+       snd_hda_delete_codec_preset(&via_list);
+}
+
+module_init(patch_via_init)
+module_exit(patch_via_exit)