diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-11-24 11:07:44 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 03:02:04 -0500 |
commit | f5fcc13c2fc62da6f75d80189a51c2492afb39c0 (patch) | |
tree | a08340173113cd5f64653b81b656f58ecb27a091 /sound/pci/hda/patch_analog.c | |
parent | 0b830bac35dd6e3996bee675c3893857da8a4d0a (diff) |
[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 <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r-- | sound/pci/hda/patch_analog.c | 145 |
1 files changed, 72 insertions, 73 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 9ce4c9f869b2..2e18a716a095 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -787,55 +787,43 @@ static struct hda_verb ad1986a_eapd_init_verbs[] = { | |||
787 | }; | 787 | }; |
788 | 788 | ||
789 | /* models */ | 789 | /* models */ |
790 | enum { AD1986A_6STACK, AD1986A_3STACK, AD1986A_LAPTOP, AD1986A_LAPTOP_EAPD }; | 790 | enum { |
791 | 791 | AD1986A_6STACK, | |
792 | static struct hda_board_config ad1986a_cfg_tbl[] = { | 792 | AD1986A_3STACK, |
793 | { .modelname = "6stack", .config = AD1986A_6STACK }, | 793 | AD1986A_LAPTOP, |
794 | { .modelname = "3stack", .config = AD1986A_3STACK }, | 794 | AD1986A_LAPTOP_EAPD, |
795 | { .pci_subvendor = 0x10de, .pci_subdevice = 0xcb84, | 795 | AD1986A_MODELS |
796 | .config = AD1986A_3STACK }, /* ASUS A8N-VM CSM */ | 796 | }; |
797 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x817f, | 797 | |
798 | .config = AD1986A_3STACK }, /* ASUS P5P-L2 */ | 798 | static const char *ad1986a_models[AD1986A_MODELS] = { |
799 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b3, | 799 | [AD1986A_6STACK] = "6stack", |
800 | .config = AD1986A_3STACK }, /* ASUS P5RD2-VM / P5GPL-X SE */ | 800 | [AD1986A_3STACK] = "3stack", |
801 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x81cb, | 801 | [AD1986A_LAPTOP] = "laptop", |
802 | .config = AD1986A_3STACK }, /* ASUS M2NPV-VM */ | 802 | [AD1986A_LAPTOP_EAPD] = "laptop-eapd", |
803 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x8234, | 803 | }; |
804 | .config = AD1986A_3STACK }, /* ASUS M2N-MX */ | 804 | |
805 | { .pci_subvendor = 0x17aa, .pci_subdevice = 0x1017, | 805 | static struct snd_pci_quirk ad1986a_cfg_tbl[] = { |
806 | .config = AD1986A_3STACK }, /* Lenovo A60 desktop */ | 806 | SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_LAPTOP_EAPD), |
807 | { .modelname = "laptop", .config = AD1986A_LAPTOP }, | 807 | SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_3STACK), |
808 | { .pci_subvendor = 0x144d, .pci_subdevice = 0xc01e, | 808 | SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9", AD1986A_LAPTOP_EAPD), |
809 | .config = AD1986A_LAPTOP }, /* FSC V2060 */ | 809 | SND_PCI_QUIRK(0x1043, 0x1213, "ASUS A6J", AD1986A_LAPTOP_EAPD), |
810 | { .pci_subvendor = 0x17c0, .pci_subdevice = 0x2017, | 810 | SND_PCI_QUIRK(0x1043, 0x11f7, "ASUS U5A", AD1986A_LAPTOP_EAPD), |
811 | .config = AD1986A_LAPTOP }, /* Samsung M50 */ | 811 | SND_PCI_QUIRK(0x1043, 0x1263, "ASUS U5F", AD1986A_LAPTOP_EAPD), |
812 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x818f, | 812 | SND_PCI_QUIRK(0x1043, 0x1297, "ASUS Z62F", AD1986A_LAPTOP_EAPD), |
813 | .config = AD1986A_LAPTOP }, /* ASUS P5GV-MX */ | 813 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS V1j", AD1986A_LAPTOP_EAPD), |
814 | { .modelname = "laptop-eapd", .config = AD1986A_LAPTOP_EAPD }, | 814 | SND_PCI_QUIRK(0x1043, 0x1302, "ASUS W3j", AD1986A_LAPTOP_EAPD), |
815 | { .pci_subvendor = 0x144d, .pci_subdevice = 0xc023, | 815 | SND_PCI_QUIRK(0x1043, 0x817f, "ASUS P5", AD1986A_3STACK), |
816 | .config = AD1986A_LAPTOP_EAPD }, /* Samsung X60 Chane */ | 816 | SND_PCI_QUIRK(0x1043, 0x818f, "ASUS P5", AD1986A_LAPTOP), |
817 | { .pci_subvendor = 0x144d, .pci_subdevice = 0xc024, | 817 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS P5", AD1986A_3STACK), |
818 | .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */ | 818 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK), |
819 | { .pci_subvendor = 0x144d, .pci_subdevice = 0xc026, | 819 | SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK), |
820 | .config = AD1986A_LAPTOP_EAPD }, /* Samsung X11-T2300 Culesa */ | 820 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), |
821 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1153, | 821 | SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), |
822 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS M9 */ | 822 | SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), |
823 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213, | 823 | SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), |
824 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */ | 824 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), |
825 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7, | 825 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_LAPTOP_EAPD), |
826 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */ | 826 | SND_PCI_QUIRK(0x17c0, 0x2017, "Samsung M50", AD1986A_LAPTOP), |
827 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1263, | ||
828 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */ | ||
829 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297, | ||
830 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */ | ||
831 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x12b3, | ||
832 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS V1j */ | ||
833 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1302, | ||
834 | .config = AD1986A_LAPTOP_EAPD }, /* ASUS W3j */ | ||
835 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af, | ||
836 | .config = AD1986A_LAPTOP_EAPD }, /* HP Compaq Presario B2800 */ | ||
837 | { .pci_subvendor = 0x17aa, .pci_subdevice = 0x2066, | ||
838 | .config = AD1986A_LAPTOP_EAPD }, /* Lenovo 3000 N100-07684JU */ | ||
839 | {} | 827 | {} |
840 | }; | 828 | }; |
841 | 829 | ||
@@ -867,7 +855,9 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
867 | codec->patch_ops = ad198x_patch_ops; | 855 | codec->patch_ops = ad198x_patch_ops; |
868 | 856 | ||
869 | /* override some parameters */ | 857 | /* override some parameters */ |
870 | board_config = snd_hda_check_board_config(codec, ad1986a_cfg_tbl); | 858 | board_config = snd_hda_check_board_config(codec, AD1986A_MODELS, |
859 | ad1986a_models, | ||
860 | ad1986a_cfg_tbl); | ||
871 | switch (board_config) { | 861 | switch (board_config) { |
872 | case AD1986A_3STACK: | 862 | case AD1986A_3STACK: |
873 | spec->num_mixers = 2; | 863 | spec->num_mixers = 2; |
@@ -1397,20 +1387,27 @@ static struct hda_input_mux ad1981_thinkpad_capture_source = { | |||
1397 | }; | 1387 | }; |
1398 | 1388 | ||
1399 | /* models */ | 1389 | /* models */ |
1400 | enum { AD1981_BASIC, AD1981_HP, AD1981_THINKPAD }; | 1390 | enum { |
1391 | AD1981_BASIC, | ||
1392 | AD1981_HP, | ||
1393 | AD1981_THINKPAD, | ||
1394 | AD1981_MODELS | ||
1395 | }; | ||
1401 | 1396 | ||
1402 | static struct hda_board_config ad1981_cfg_tbl[] = { | 1397 | static const char *ad1981_models[AD1981_MODELS] = { |
1403 | { .modelname = "hp", .config = AD1981_HP }, | 1398 | [AD1981_HP] = "hp", |
1399 | [AD1981_THINKPAD] = "thinkpad", | ||
1400 | [AD1981_BASIC] = "basic", | ||
1401 | }; | ||
1402 | |||
1403 | static struct snd_pci_quirk ad1981_cfg_tbl[] = { | ||
1404 | /* All HP models */ | 1404 | /* All HP models */ |
1405 | { .pci_subvendor = 0x103c, .config = AD1981_HP }, | 1405 | SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), |
1406 | { .pci_subvendor = 0x30b0, .pci_subdevice = 0x103c, | 1406 | /* HP nx6320 (reversed SSID, H/W bug) */ |
1407 | .config = AD1981_HP }, /* HP nx6320 (reversed SSID, H/W bug) */ | 1407 | SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), |
1408 | { .modelname = "thinkpad", .config = AD1981_THINKPAD }, | ||
1409 | /* Lenovo Thinkpad T60/X60/Z6xx */ | 1408 | /* Lenovo Thinkpad T60/X60/Z6xx */ |
1410 | { .pci_subvendor = 0x17aa, .config = AD1981_THINKPAD }, | 1409 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), |
1411 | { .pci_subvendor = 0x1014, .pci_subdevice = 0x0597, | 1410 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), |
1412 | .config = AD1981_THINKPAD }, /* Z60m/t */ | ||
1413 | { .modelname = "basic", .config = AD1981_BASIC }, | ||
1414 | {} | 1411 | {} |
1415 | }; | 1412 | }; |
1416 | 1413 | ||
@@ -1443,7 +1440,9 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1443 | codec->patch_ops = ad198x_patch_ops; | 1440 | codec->patch_ops = ad198x_patch_ops; |
1444 | 1441 | ||
1445 | /* override some parameters */ | 1442 | /* override some parameters */ |
1446 | board_config = snd_hda_check_board_config(codec, ad1981_cfg_tbl); | 1443 | board_config = snd_hda_check_board_config(codec, AD1981_MODELS, |
1444 | ad1981_models, | ||
1445 | ad1981_cfg_tbl); | ||
1447 | switch (board_config) { | 1446 | switch (board_config) { |
1448 | case AD1981_HP: | 1447 | case AD1981_HP: |
1449 | spec->mixers[0] = ad1981_hp_mixers; | 1448 | spec->mixers[0] = ad1981_hp_mixers; |
@@ -2571,15 +2570,14 @@ static int ad1988_auto_init(struct hda_codec *codec) | |||
2571 | /* | 2570 | /* |
2572 | */ | 2571 | */ |
2573 | 2572 | ||
2574 | static struct hda_board_config ad1988_cfg_tbl[] = { | 2573 | static const char *ad1988_models[AD1988_MODEL_LAST] = { |
2575 | { .modelname = "6stack", .config = AD1988_6STACK }, | 2574 | [AD1988_6STACK] = "6stack", |
2576 | { .modelname = "6stack-dig", .config = AD1988_6STACK_DIG }, | 2575 | [AD1988_6STACK_DIG] = "6stack-dig", |
2577 | { .modelname = "3stack", .config = AD1988_3STACK }, | 2576 | [AD1988_3STACK] = "3stack", |
2578 | { .modelname = "3stack-dig", .config = AD1988_3STACK_DIG }, | 2577 | [AD1988_3STACK_DIG] = "3stack-dig", |
2579 | { .modelname = "laptop", .config = AD1988_LAPTOP }, | 2578 | [AD1988_LAPTOP] = "laptop", |
2580 | { .modelname = "laptop-dig", .config = AD1988_LAPTOP_DIG }, | 2579 | [AD1988_LAPTOP_DIG] = "laptop-dig", |
2581 | { .modelname = "auto", .config = AD1988_AUTO }, | 2580 | [AD1988_AUTO] = "auto", |
2582 | {} | ||
2583 | }; | 2581 | }; |
2584 | 2582 | ||
2585 | static int patch_ad1988(struct hda_codec *codec) | 2583 | static int patch_ad1988(struct hda_codec *codec) |
@@ -2597,8 +2595,9 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2597 | if (is_rev2(codec)) | 2595 | if (is_rev2(codec)) |
2598 | snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); | 2596 | snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); |
2599 | 2597 | ||
2600 | board_config = snd_hda_check_board_config(codec, ad1988_cfg_tbl); | 2598 | board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, |
2601 | if (board_config < 0 || board_config >= AD1988_MODEL_LAST) { | 2599 | ad1988_models, NULL); |
2600 | if (board_config < 0) { | ||
2602 | printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); | 2601 | printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); |
2603 | board_config = AD1988_AUTO; | 2602 | board_config = AD1988_AUTO; |
2604 | } | 2603 | } |