ALSA: hda - Disable static quirks for C-Media codecs
authorTakashi Iwai <tiwai@suse.de>
Mon, 10 Feb 2014 17:18:17 +0000 (18:18 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 10 Feb 2014 17:18:17 +0000 (18:18 +0100)
According to alsa-info.sh outputs, all three entries with static
quirks have the correct pin configs, so it's safe to remove static
quirks.  For now, turn the static quirks off via ifdef.  The dead
codes will be removed in later release.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_cmedia.c

index 9c6ce73b03c5585994ee4099106a70dbe7cca51c..139ef301c914567232bd4d4b41080161d18ff940 100644 (file)
@@ -32,6 +32,9 @@
 #include "hda_jack.h"
 #include "hda_generic.h"
 
+#undef ENABLE_CMI_STATIC_QUIRKS
+
+#ifdef ENABLE_CMI_STATIC_QUIRKS
 #define NUM_PINS       11
 
 
@@ -45,10 +48,12 @@ enum {
        CMI_AUTO,       /* let driver guess it */
        CMI_MODELS
 };
+#endif /* ENABLE_CMI_STATIC_QUIRKS */
 
 struct cmi_spec {
        struct hda_gen_spec gen;
 
+#ifdef ENABLE_CMI_STATIC_QUIRKS
        /* below are only for static models */
 
        int board_config;
@@ -81,8 +86,10 @@ struct cmi_spec {
 
        /* multichannel pins */
        struct hda_verb multi_init[9];  /* 2 verbs for each pin + terminator */
+#endif /* ENABLE_CMI_STATIC_QUIRKS */
 };
 
+#ifdef ENABLE_CMI_STATIC_QUIRKS
 /*
  * input MUX
  */
@@ -566,6 +573,7 @@ static const struct hda_codec_ops cmi9880_patch_ops = {
        .init = cmi9880_init,
        .free = cmi9880_free,
 };
+#endif /* ENABLE_CMI_STATIC_QUIRKS */
 
 /*
  * stuff for auto-parser
@@ -588,15 +596,20 @@ static int cmi_parse_auto_config(struct hda_codec *codec)
 
        err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
        if (err < 0)
-               return err;
+               goto error;
        err = snd_hda_gen_parse_auto_config(codec, cfg);
        if (err < 0)
-               return err;
+               goto error;
 
        codec->patch_ops = cmi_auto_patch_ops;
        return 0;
+
+ error:
+       snd_hda_gen_free(codec);
+       return err;
 }
 
+
 static int patch_cmi9880(struct hda_codec *codec)
 {
        struct cmi_spec *spec;
@@ -606,6 +619,7 @@ static int patch_cmi9880(struct hda_codec *codec)
                return -ENOMEM;
 
        codec->spec = spec;
+#ifdef ENABLE_CMI_STATIC_QUIRKS
        spec->board_config = snd_hda_check_board_config(codec, CMI_MODELS,
                                                        cmi9880_models,
                                                        cmi9880_cfg_tbl);
@@ -615,14 +629,8 @@ static int patch_cmi9880(struct hda_codec *codec)
                spec->board_config = CMI_AUTO; /* try everything */
        }
 
-       if (spec->board_config == CMI_AUTO) {
-               int err = cmi_parse_auto_config(codec);
-               if (err < 0) {
-                       snd_hda_gen_free(codec);
-                       return err;
-               }
-               return 0;
-       }
+       if (spec->board_config == CMI_AUTO)
+               return cmi_parse_auto_config(codec);
 
        /* copy default DAC NIDs */
        memcpy(spec->dac_nids, cmi9880_dac_nids, sizeof(spec->dac_nids));
@@ -669,6 +677,9 @@ static int patch_cmi9880(struct hda_codec *codec)
        codec->patch_ops = cmi9880_patch_ops;
 
        return 0;
+#else
+       return cmi_parse_auto_config(codec);
+#endif
 }
 
 /*