diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-07-27 13:15:54 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:12 -0400 |
commit | 82467611ffc41fba534c95f8b4ae3887a90f5a66 (patch) | |
tree | 9afc5d99795afaba2bb262a935538263649ab17c /sound/pci/hda/hda_codec.c | |
parent | 532d5381793f3c824f8ff68d7067fab8c76bb811 (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/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 31 |
1 files changed, 27 insertions, 4 deletions
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; |