[ALSA] hda-codec - kernel config for each codec
authorTakashi Iwai <tiwai@suse.de>
Fri, 27 Jul 2007 17:15:54 +0000 (19:15 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:58:12 +0000 (15:58 +0200)
Create kernel configs to choose the codec support codes to build.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/Kconfig
sound/pci/hda/Makefile
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_patch.h

index 57426f6fa423a294b35b89371cc0f2d01d922600..b80b97f7a49ab641593c854c4000784e03fafadf 100644 (file)
@@ -509,6 +509,78 @@ config SND_HDA_HWDEP
          This interface can be used for out-of-bound communication
          with codesc for debugging purposes.
 
+config SND_HDA_CODEC_REALTEK
+       bool "Build Realtek HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include Realtek HD-audio codec support in
+         snd-hda-intel driver, such as ALC880.
+
+config SND_HDA_CODEC_ANALOG
+       bool "Build Analog Device HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include Analog Device HD-audio codec support in
+         snd-hda-intel driver, such as AD1986A.
+
+config SND_HDA_CODEC_SIGMATEL
+       bool "Build IDT/Sigmatel HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include IDT (Sigmatel) HD-audio codec support in
+         snd-hda-intel driver, such as STAC9200.
+
+config SND_HDA_CODEC_VIA
+       bool "Build VIA HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include VIA HD-audio codec support in
+         snd-hda-intel driver, such as VT1708.
+
+config SND_HDA_CODEC_ATIHDMI
+       bool "Build ATI HDMI HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include ATI HDMI HD-audio codec support in
+         snd-hda-intel driver, such as ATI RS600 HDMI.
+
+config SND_HDA_CODEC_CONEXANT
+       bool "Build Conexant HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include Conexant HD-audio codec support in
+         snd-hda-intel driver, such as CX20549.
+
+config SND_HDA_CODEC_CMEDIA
+       bool "Build C-Media HD-audio codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include C-Media HD-audio codec support in
+         snd-hda-intel driver, such as CMI9880.
+
+config SND_HDA_CODEC_SI3054
+       bool "Build Silicon Labs 3054 HD-modem codec support"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to include Silicon Labs 3054 HD-modem codec
+         (and compatibles) support in snd-hda-intel driver.
+
+config SND_HDA_GENERIC
+       bool "Enable generic HD-audio codec parser"
+       depends on SND_HDA_INTEL
+       default y
+       help
+         Say Y here to enable the generic HD-audio codec parser
+         in snd-hda-intel driver.
+
 config SND_HDSP
        tristate "RME Hammerfall DSP Audio"
        depends on SND
index f85c34551ac8bfd13ef62490703b6d9bf5b77016..6d43e39b9d0b9acc6b24e3af5c7e04e5036f00e4 100644 (file)
@@ -2,17 +2,17 @@ snd-hda-intel-y := hda_intel.o
 # since snd-hda-intel is the only driver using hda-codec,
 # merge it into a single module although it was originally
 # designed to be individual modules
-snd-hda-intel-y += hda_codec.o \
-       hda_generic.o \
-       patch_realtek.o \
-       patch_cmedia.o \
-       patch_analog.o \
-       patch_sigmatel.o \
-       patch_si3054.o \
-       patch_atihdmi.o \
-       patch_conexant.o \
-       patch_via.o
+snd-hda-intel-y += hda_codec.o
 snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o
 snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_GENERIC) += hda_generic.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_REALTEK) += patch_realtek.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CMEDIA) += patch_cmedia.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ANALOG) += patch_analog.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SIGMATEL) += patch_sigmatel.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3054) += patch_si3054.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CONEXANT) += patch_conexant.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_VIA) += patch_via.o
 
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
index 36879a93eac477091ec2beb5991b84b75cf9a71d..c4cf2c7230ef5e0de15a5d7f55e11cbbdc28dbac 100644 (file)
@@ -388,6 +388,13 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
        return 0;
 }
 
+#ifdef CONFIG_SND_HDA_GENERIC
+#define is_generic_config(codec) \
+       (codec->bus->modelname && !strcmp(codec->bus->modelname, "generic"))
+#else
+#define is_generic_config(codec)       0
+#endif
+
 /*
  * find a matching codec preset
  */
@@ -396,7 +403,7 @@ find_codec_preset(struct hda_codec *codec)
 {
        const struct hda_codec_preset **tbl, *preset;
 
-       if (codec->bus->modelname && !strcmp(codec->bus->modelname, "generic"))
+       if (is_generic_config(codec))
                return NULL; /* use the generic parser */
 
        for (tbl = hda_preset_tables; *tbl; tbl++) {
@@ -582,10 +589,26 @@ int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
                snd_hda_get_codec_name(codec, bus->card->mixername,
                                       sizeof(bus->card->mixername));
 
-       if (codec->preset && codec->preset->patch)
-               err = codec->preset->patch(codec);
-       else
+#ifdef CONFIG_SND_HDA_GENERIC
+       if (is_generic_config(codec)) {
                err = snd_hda_parse_generic_codec(codec);
+               goto patched;
+       }
+#endif
+       if (codec->preset && codec->preset->patch) {
+               err = codec->preset->patch(codec);
+               goto patched;
+       }
+
+       /* call the default parser */
+#ifdef CONFIG_SND_HDA_GENERIC
+       err = snd_hda_parse_generic_codec(codec);
+#else
+       printk(KERN_ERR "hda-codec: No codec parser is available\n");
+       err = -ENODEV;
+#endif
+
+ patched:
        if (err < 0) {
                snd_hda_codec_free(codec);
                return err;
index 9f9e9ae44a9d89bb62b76410781972fcff53d11c..f5c23bb16d7eb79f1137053a047e986c15c0a762 100644 (file)
@@ -20,13 +20,29 @@ extern struct hda_codec_preset snd_hda_preset_conexant[];
 extern struct hda_codec_preset snd_hda_preset_via[];
 
 static const struct hda_codec_preset *hda_preset_tables[] = {
+#ifdef CONFIG_SND_HDA_CODEC_REALTEK
        snd_hda_preset_realtek,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_CMEDIA
        snd_hda_preset_cmedia,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_ANALOG
        snd_hda_preset_analog,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_SIGMATEL
        snd_hda_preset_sigmatel,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_SI3054
        snd_hda_preset_si3054,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_ATIHDMI
        snd_hda_preset_atihdmi,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_CONEXANT
        snd_hda_preset_conexant,
+#endif
+#ifdef CONFIG_SND_HDA_CODEC_VIA
        snd_hda_preset_via,
+#endif
        NULL
 };