diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-01-13 11:50:46 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-13 11:50:46 -0500 |
commit | 14ed74fbe2b917f0ad3e30cf2644203c04a45e89 (patch) | |
tree | f1c9642a8c1f5c91399a9679faf32adfd213b508 /sound/pci/hda/hda_codec.c | |
parent | c107b41c485c43f15b24743e81eaab742b3c0b67 (diff) | |
parent | 58eec4235d63e07b98544527e031e7ae807e15df (diff) |
Merge branch 'topic/hda-gateway' into topic/hda
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index fdad6ae7aad4..b7bba7dc7cf1 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2724,6 +2724,67 @@ int snd_hda_check_board_config(struct hda_codec *codec, | |||
2724 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | 2724 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); |
2725 | 2725 | ||
2726 | /** | 2726 | /** |
2727 | * snd_hda_check_board_codec_sid_config - compare the current codec | ||
2728 | subsystem ID with the | ||
2729 | config table | ||
2730 | |||
2731 | This is important for Gateway notebooks with SB450 HDA Audio | ||
2732 | where the vendor ID of the PCI device is: | ||
2733 | ATI Technologies Inc SB450 HDA Audio [1002:437b] | ||
2734 | and the vendor/subvendor are found only at the codec. | ||
2735 | |||
2736 | * @codec: the HDA codec | ||
2737 | * @num_configs: number of config enums | ||
2738 | * @models: array of model name strings | ||
2739 | * @tbl: configuration table, terminated by null entries | ||
2740 | * | ||
2741 | * Compares the modelname or PCI subsystem id of the current codec with the | ||
2742 | * given configuration table. If a matching entry is found, returns its | ||
2743 | * config value (supposed to be 0 or positive). | ||
2744 | * | ||
2745 | * If no entries are matching, the function returns a negative value. | ||
2746 | */ | ||
2747 | int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | ||
2748 | int num_configs, const char **models, | ||
2749 | const struct snd_pci_quirk *tbl) | ||
2750 | { | ||
2751 | const struct snd_pci_quirk *q; | ||
2752 | |||
2753 | /* Search for codec ID */ | ||
2754 | for (q = tbl; q->subvendor; q++) { | ||
2755 | unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); | ||
2756 | |||
2757 | if (vendorid == codec->subsystem_id) | ||
2758 | break; | ||
2759 | } | ||
2760 | |||
2761 | if (!q->subvendor) | ||
2762 | return -1; | ||
2763 | |||
2764 | tbl = q; | ||
2765 | |||
2766 | if (tbl->value >= 0 && tbl->value < num_configs) { | ||
2767 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
2768 | char tmp[10]; | ||
2769 | const char *model = NULL; | ||
2770 | if (models) | ||
2771 | model = models[tbl->value]; | ||
2772 | if (!model) { | ||
2773 | sprintf(tmp, "#%d", tbl->value); | ||
2774 | model = tmp; | ||
2775 | } | ||
2776 | snd_printdd(KERN_INFO "hda_codec: model '%s' is selected " | ||
2777 | "for config %x:%x (%s)\n", | ||
2778 | model, tbl->subvendor, tbl->subdevice, | ||
2779 | (tbl->name ? tbl->name : "Unknown device")); | ||
2780 | #endif | ||
2781 | return tbl->value; | ||
2782 | } | ||
2783 | return -1; | ||
2784 | } | ||
2785 | EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config); | ||
2786 | |||
2787 | /** | ||
2727 | * snd_hda_add_new_ctls - create controls from the array | 2788 | * snd_hda_add_new_ctls - create controls from the array |
2728 | * @codec: the HDA codec | 2789 | * @codec: the HDA codec |
2729 | * @knew: the array of struct snd_kcontrol_new | 2790 | * @knew: the array of struct snd_kcontrol_new |