From f5fcc13c2fc62da6f75d80189a51c2492afb39c0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 24 Nov 2006 17:07:44 +0100 Subject: [ALSA] hda-codec - Use snd_pci_quirk_lookup() for board config lookup Use snd_pci_quirk_lookup() for looking up a board config table. The config table is sorted in numerical order of PCI SSIDs. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/pci/hda/patch_cmedia.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'sound/pci/hda/patch_cmedia.c') diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index d38ce22507a..5b9d3a31a1a 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c @@ -40,6 +40,7 @@ enum { CMI_FULL_DIG, /* back 6-jack + front-panel 2-jack + digital I/O */ CMI_ALLOUT, /* back 5-jack + front-panel 2-jack + digital out */ CMI_AUTO, /* let driver guess it */ + CMI_MODELS }; struct cmi_spec { @@ -603,14 +604,17 @@ static void cmi9880_free(struct hda_codec *codec) /* */ -static struct hda_board_config cmi9880_cfg_tbl[] = { - { .modelname = "minimal", .config = CMI_MINIMAL }, - { .modelname = "min_fp", .config = CMI_MIN_FP }, - { .modelname = "full", .config = CMI_FULL }, - { .modelname = "full_dig", .config = CMI_FULL_DIG }, - { .pci_subvendor = 0x1043, .pci_subdevice = 0x813d, .config = CMI_FULL_DIG }, /* ASUS P5AD2 */ - { .modelname = "allout", .config = CMI_ALLOUT }, - { .modelname = "auto", .config = CMI_AUTO }, +static const char *cmi9880_models[CMI_MODELS] = { + [CMI_MINIMAL] = "minimal", + [CMI_MIN_FP] = "min_fp", + [CMI_FULL] = "full", + [CMI_FULL_DIG] = "full_dig", + [CMI_ALLOUT] = "allout", + [CMI_AUTO] = "auto", +}; + +static struct snd_pci_quirk cmi9880_cfg_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), {} /* terminator */ }; @@ -633,7 +637,9 @@ static int patch_cmi9880(struct hda_codec *codec) return -ENOMEM; codec->spec = spec; - spec->board_config = snd_hda_check_board_config(codec, cmi9880_cfg_tbl); + spec->board_config = snd_hda_check_board_config(codec, CMI_MODELS, + cmi9880_models, + cmi9880_cfg_tbl); if (spec->board_config < 0) { snd_printdd(KERN_INFO "hda_codec: Unknown model for CMI9880\n"); spec->board_config = CMI_AUTO; /* try everything */ -- cgit v1.2.3