aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-07-27 13:15:54 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:58:12 -0400
commit82467611ffc41fba534c95f8b4ae3887a90f5a66 (patch)
tree9afc5d99795afaba2bb262a935538263649ab17c /sound/pci/hda
parent532d5381793f3c824f8ff68d7067fab8c76bb811 (diff)
[ALSA] hda-codec - kernel config for each codec
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>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/Makefile20
-rw-r--r--sound/pci/hda/hda_codec.c31
-rw-r--r--sound/pci/hda/hda_patch.h16
3 files changed, 53 insertions, 14 deletions
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index f85c34551ac8..6d43e39b9d0b 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -2,17 +2,17 @@ snd-hda-intel-y := hda_intel.o
2# since snd-hda-intel is the only driver using hda-codec, 2# since snd-hda-intel is the only driver using hda-codec,
3# merge it into a single module although it was originally 3# merge it into a single module although it was originally
4# designed to be individual modules 4# designed to be individual modules
5snd-hda-intel-y += hda_codec.o \ 5snd-hda-intel-y += hda_codec.o
6 hda_generic.o \
7 patch_realtek.o \
8 patch_cmedia.o \
9 patch_analog.o \
10 patch_sigmatel.o \
11 patch_si3054.o \
12 patch_atihdmi.o \
13 patch_conexant.o \
14 patch_via.o
15snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o 6snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o
16snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o 7snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
8snd-hda-intel-$(CONFIG_SND_HDA_CODEC_GENERIC) += hda_generic.o
9snd-hda-intel-$(CONFIG_SND_HDA_CODEC_REALTEK) += patch_realtek.o
10snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CMEDIA) += patch_cmedia.o
11snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ANALOG) += patch_analog.o
12snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SIGMATEL) += patch_sigmatel.o
13snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3054) += patch_si3054.o
14snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
15snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CONEXANT) += patch_conexant.o
16snd-hda-intel-$(CONFIG_SND_HDA_CODEC_VIA) += patch_via.o
17 17
18obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o 18obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 36879a93eac4..c4cf2c7230ef 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -388,6 +388,13 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
388 return 0; 388 return 0;
389} 389}
390 390
391#ifdef CONFIG_SND_HDA_GENERIC
392#define is_generic_config(codec) \
393 (codec->bus->modelname && !strcmp(codec->bus->modelname, "generic"))
394#else
395#define is_generic_config(codec) 0
396#endif
397
391/* 398/*
392 * find a matching codec preset 399 * find a matching codec preset
393 */ 400 */
@@ -396,7 +403,7 @@ find_codec_preset(struct hda_codec *codec)
396{ 403{
397 const struct hda_codec_preset **tbl, *preset; 404 const struct hda_codec_preset **tbl, *preset;
398 405
399 if (codec->bus->modelname && !strcmp(codec->bus->modelname, "generic")) 406 if (is_generic_config(codec))
400 return NULL; /* use the generic parser */ 407 return NULL; /* use the generic parser */
401 408
402 for (tbl = hda_preset_tables; *tbl; tbl++) { 409 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,
582 snd_hda_get_codec_name(codec, bus->card->mixername, 589 snd_hda_get_codec_name(codec, bus->card->mixername,
583 sizeof(bus->card->mixername)); 590 sizeof(bus->card->mixername));
584 591
585 if (codec->preset && codec->preset->patch) 592#ifdef CONFIG_SND_HDA_GENERIC
586 err = codec->preset->patch(codec); 593 if (is_generic_config(codec)) {
587 else
588 err = snd_hda_parse_generic_codec(codec); 594 err = snd_hda_parse_generic_codec(codec);
595 goto patched;
596 }
597#endif
598 if (codec->preset && codec->preset->patch) {
599 err = codec->preset->patch(codec);
600 goto patched;
601 }
602
603 /* call the default parser */
604#ifdef CONFIG_SND_HDA_GENERIC
605 err = snd_hda_parse_generic_codec(codec);
606#else
607 printk(KERN_ERR "hda-codec: No codec parser is available\n");
608 err = -ENODEV;
609#endif
610
611 patched:
589 if (err < 0) { 612 if (err < 0) {
590 snd_hda_codec_free(codec); 613 snd_hda_codec_free(codec);
591 return err; 614 return err;
diff --git a/sound/pci/hda/hda_patch.h b/sound/pci/hda/hda_patch.h
index 9f9e9ae44a9d..f5c23bb16d7e 100644
--- a/sound/pci/hda/hda_patch.h
+++ b/sound/pci/hda/hda_patch.h
@@ -20,13 +20,29 @@ extern struct hda_codec_preset snd_hda_preset_conexant[];
20extern struct hda_codec_preset snd_hda_preset_via[]; 20extern struct hda_codec_preset snd_hda_preset_via[];
21 21
22static const struct hda_codec_preset *hda_preset_tables[] = { 22static const struct hda_codec_preset *hda_preset_tables[] = {
23#ifdef CONFIG_SND_HDA_CODEC_REALTEK
23 snd_hda_preset_realtek, 24 snd_hda_preset_realtek,
25#endif
26#ifdef CONFIG_SND_HDA_CODEC_CMEDIA
24 snd_hda_preset_cmedia, 27 snd_hda_preset_cmedia,
28#endif
29#ifdef CONFIG_SND_HDA_CODEC_ANALOG
25 snd_hda_preset_analog, 30 snd_hda_preset_analog,
31#endif
32#ifdef CONFIG_SND_HDA_CODEC_SIGMATEL
26 snd_hda_preset_sigmatel, 33 snd_hda_preset_sigmatel,
34#endif
35#ifdef CONFIG_SND_HDA_CODEC_SI3054
27 snd_hda_preset_si3054, 36 snd_hda_preset_si3054,
37#endif
38#ifdef CONFIG_SND_HDA_CODEC_ATIHDMI
28 snd_hda_preset_atihdmi, 39 snd_hda_preset_atihdmi,
40#endif
41#ifdef CONFIG_SND_HDA_CODEC_CONEXANT
29 snd_hda_preset_conexant, 42 snd_hda_preset_conexant,
43#endif
44#ifdef CONFIG_SND_HDA_CODEC_VIA
30 snd_hda_preset_via, 45 snd_hda_preset_via,
46#endif
31 NULL 47 NULL
32}; 48};