diff options
-rw-r--r-- | sound/pci/hda/hda_codec.c | 61 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 3 |
2 files changed, 64 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 004344825e9e..9c1af0101dde 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2705,6 +2705,67 @@ int snd_hda_check_board_config(struct hda_codec *codec, | |||
2705 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | 2705 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); |
2706 | 2706 | ||
2707 | /** | 2707 | /** |
2708 | * snd_hda_check_board_codec_sid_config - compare the current codec | ||
2709 | subsystem ID with the | ||
2710 | config table | ||
2711 | |||
2712 | This is important for Gateway notebooks with SB450 HDA Audio | ||
2713 | where the vendor ID of the PCI device is: | ||
2714 | ATI Technologies Inc SB450 HDA Audio [1002:437b] | ||
2715 | and the vendor/subvendor are found only at the codec. | ||
2716 | |||
2717 | * @codec: the HDA codec | ||
2718 | * @num_configs: number of config enums | ||
2719 | * @models: array of model name strings | ||
2720 | * @tbl: configuration table, terminated by null entries | ||
2721 | * | ||
2722 | * Compares the modelname or PCI subsystem id of the current codec with the | ||
2723 | * given configuration table. If a matching entry is found, returns its | ||
2724 | * config value (supposed to be 0 or positive). | ||
2725 | * | ||
2726 | * If no entries are matching, the function returns a negative value. | ||
2727 | */ | ||
2728 | int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | ||
2729 | int num_configs, const char **models, | ||
2730 | const struct snd_pci_quirk *tbl) | ||
2731 | { | ||
2732 | const struct snd_pci_quirk *q; | ||
2733 | |||
2734 | /* Search for codec ID */ | ||
2735 | for (q = tbl; q->subvendor; q++) { | ||
2736 | unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); | ||
2737 | |||
2738 | if (vendorid == codec->subsystem_id) | ||
2739 | break; | ||
2740 | } | ||
2741 | |||
2742 | if (!q->subvendor) | ||
2743 | return -1; | ||
2744 | |||
2745 | tbl = q; | ||
2746 | |||
2747 | if (tbl->value >= 0 && tbl->value < num_configs) { | ||
2748 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
2749 | char tmp[10]; | ||
2750 | const char *model = NULL; | ||
2751 | if (models) | ||
2752 | model = models[tbl->value]; | ||
2753 | if (!model) { | ||
2754 | sprintf(tmp, "#%d", tbl->value); | ||
2755 | model = tmp; | ||
2756 | } | ||
2757 | snd_printdd(KERN_INFO "hda_codec: model '%s' is selected " | ||
2758 | "for config %x:%x (%s)\n", | ||
2759 | model, tbl->subvendor, tbl->subdevice, | ||
2760 | (tbl->name ? tbl->name : "Unknown device")); | ||
2761 | #endif | ||
2762 | return tbl->value; | ||
2763 | } | ||
2764 | return -1; | ||
2765 | } | ||
2766 | EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config); | ||
2767 | |||
2768 | /** | ||
2708 | * snd_hda_add_new_ctls - create controls from the array | 2769 | * snd_hda_add_new_ctls - create controls from the array |
2709 | * @codec: the HDA codec | 2770 | * @codec: the HDA codec |
2710 | * @knew: the array of struct snd_kcontrol_new | 2771 | * @knew: the array of struct snd_kcontrol_new |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 6f2fe0f9fdd8..1dd8716c387f 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -296,6 +296,9 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen); | |||
296 | int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, | 296 | int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, |
297 | const char **modelnames, | 297 | const char **modelnames, |
298 | const struct snd_pci_quirk *pci_list); | 298 | const struct snd_pci_quirk *pci_list); |
299 | int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | ||
300 | int num_configs, const char **models, | ||
301 | const struct snd_pci_quirk *tbl); | ||
299 | int snd_hda_add_new_ctls(struct hda_codec *codec, | 302 | int snd_hda_add_new_ctls(struct hda_codec *codec, |
300 | struct snd_kcontrol_new *knew); | 303 | struct snd_kcontrol_new *knew); |
301 | 304 | ||