aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/maestro3.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/maestro3.c')
-rw-r--r--sound/pci/maestro3.c294
1 files changed, 127 insertions, 167 deletions
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 053ea4fdbffd..4526904e3f86 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -770,21 +770,6 @@ MODULE_PARM_DESC(amp_gpio, "GPIO pin number for external amp. (default = -1)");
770/* 770/*
771 */ 771 */
772 772
773/* quirk lists */
774struct m3_quirk {
775 const char *name; /* device name */
776 u16 vendor, device; /* subsystem ids */
777 int amp_gpio; /* gpio pin # for external amp, -1 = default */
778 int irda_workaround; /* non-zero if avoid to touch 0x10 on GPIO_DIRECTION
779 (e.g. for IrDA on Dell Inspirons) */
780};
781
782struct m3_hv_quirk {
783 u16 vendor, device, subsystem_vendor, subsystem_device;
784 u32 config; /* ALLEGRO_CONFIG hardware volume bits */
785 int is_omnibook; /* Do HP OmniBook GPIO magic? */
786};
787
788struct m3_list { 773struct m3_list {
789 int curlen; 774 int curlen;
790 int mem_addr; 775 int mem_addr;
@@ -832,8 +817,6 @@ struct snd_m3 {
832 struct snd_pcm *pcm; 817 struct snd_pcm *pcm;
833 818
834 struct pci_dev *pci; 819 struct pci_dev *pci;
835 const struct m3_quirk *quirk;
836 const struct m3_hv_quirk *hv_quirk;
837 820
838 int dacs_active; 821 int dacs_active;
839 int timer_users; 822 int timer_users;
@@ -847,7 +830,11 @@ struct snd_m3 {
847 u8 reset_state; 830 u8 reset_state;
848 831
849 int external_amp; 832 int external_amp;
850 int amp_gpio; 833 int amp_gpio; /* gpio pin # for external amp, -1 = default */
834 unsigned int hv_config; /* hardware-volume config bits */
835 unsigned irda_workaround :1; /* avoid to touch 0x10 on GPIO_DIRECTION
836 (e.g. for IrDA on Dell Inspirons) */
837 unsigned is_omnibook :1; /* Do HP OmniBook GPIO magic? */
851 838
852 /* midi */ 839 /* midi */
853 struct snd_rawmidi *rmidi; 840 struct snd_rawmidi *rmidi;
@@ -896,127 +883,104 @@ static struct pci_device_id snd_m3_ids[] = {
896 883
897MODULE_DEVICE_TABLE(pci, snd_m3_ids); 884MODULE_DEVICE_TABLE(pci, snd_m3_ids);
898 885
899static const struct m3_quirk m3_quirk_list[] = { 886static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = {
900 /* panasonic CF-28 "toughbook" */ 887 SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d),
901 { 888 SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d),
902 .name = "Panasonic CF-28", 889 SND_PCI_QUIRK(0x1033, 0x80f1, "NEC LM800J/7", 0x03),
903 .vendor = 0x10f7, 890 SND_PCI_QUIRK(0x1509, 0x1740, "LEGEND ZhaoYang 3100CF", 0x03),
904 .device = 0x833e, 891 { } /* END */
905 .amp_gpio = 0x0d, 892};
906 }, 893
907 /* panasonic CF-72 "toughbook" */ 894static struct snd_pci_quirk m3_irda_quirk_list[] __devinitdata = {
908 { 895 SND_PCI_QUIRK(0x1028, 0x00b0, "Dell Inspiron 4000", 1),
909 .name = "Panasonic CF-72", 896 SND_PCI_QUIRK(0x1028, 0x00a4, "Dell Inspiron 8000", 1),
910 .vendor = 0x10f7, 897 SND_PCI_QUIRK(0x1028, 0x00e6, "Dell Inspiron 8100", 1),
911 .device = 0x833d, 898 { } /* END */
912 .amp_gpio = 0x0d,
913 },
914 /* Dell Inspiron 4000 */
915 {
916 .name = "Dell Inspiron 4000",
917 .vendor = 0x1028,
918 .device = 0x00b0,
919 .amp_gpio = -1,
920 .irda_workaround = 1,
921 },
922 /* Dell Inspiron 8000 */
923 {
924 .name = "Dell Inspiron 8000",
925 .vendor = 0x1028,
926 .device = 0x00a4,
927 .amp_gpio = -1,
928 .irda_workaround = 1,
929 },
930 /* Dell Inspiron 8100 */
931 {
932 .name = "Dell Inspiron 8100",
933 .vendor = 0x1028,
934 .device = 0x00e6,
935 .amp_gpio = -1,
936 .irda_workaround = 1,
937 },
938 /* NEC LM800J/7 */
939 {
940 .name = "NEC LM800J/7",
941 .vendor = 0x1033,
942 .device = 0x80f1,
943 .amp_gpio = 0x03,
944 },
945 /* LEGEND ZhaoYang 3100CF */
946 {
947 .name = "LEGEND ZhaoYang 3100CF",
948 .vendor = 0x1509,
949 .device = 0x1740,
950 .amp_gpio = 0x03,
951 },
952 /* END */
953 { NULL }
954}; 899};
955 900
956/* These values came from the Windows driver. */ 901/* hardware volume quirks */
957static const struct m3_hv_quirk m3_hv_quirk_list[] = { 902static struct snd_pci_quirk m3_hv_quirk_list[] __devinitdata = {
958 /* Allegro chips */ 903 /* Allegro chips */
959 { 0x125D, 0x1988, 0x0E11, 0x002E, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 904 SND_PCI_QUIRK(0x0E11, 0x002E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
960 { 0x125D, 0x1988, 0x0E11, 0x0094, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 905 SND_PCI_QUIRK(0x0E11, 0x0094, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
961 { 0x125D, 0x1988, 0x0E11, 0xB112, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 906 SND_PCI_QUIRK(0x0E11, 0xB112, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
962 { 0x125D, 0x1988, 0x0E11, 0xB114, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 907 SND_PCI_QUIRK(0x0E11, 0xB114, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
963 { 0x125D, 0x1988, 0x103C, 0x0012, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 908 SND_PCI_QUIRK(0x103C, 0x0012, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
964 { 0x125D, 0x1988, 0x103C, 0x0018, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 909 SND_PCI_QUIRK(0x103C, 0x0018, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
965 { 0x125D, 0x1988, 0x103C, 0x001C, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 910 SND_PCI_QUIRK(0x103C, 0x001C, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
966 { 0x125D, 0x1988, 0x103C, 0x001D, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 911 SND_PCI_QUIRK(0x103C, 0x001D, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
967 { 0x125D, 0x1988, 0x103C, 0x001E, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 912 SND_PCI_QUIRK(0x103C, 0x001E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
968 { 0x125D, 0x1988, 0x107B, 0x3350, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 913 SND_PCI_QUIRK(0x107B, 0x3350, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
969 { 0x125D, 0x1988, 0x10F7, 0x8338, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 914 SND_PCI_QUIRK(0x10F7, 0x8338, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
970 { 0x125D, 0x1988, 0x10F7, 0x833C, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 915 SND_PCI_QUIRK(0x10F7, 0x833C, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
971 { 0x125D, 0x1988, 0x10F7, 0x833D, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 916 SND_PCI_QUIRK(0x10F7, 0x833D, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
972 { 0x125D, 0x1988, 0x10F7, 0x833E, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 917 SND_PCI_QUIRK(0x10F7, 0x833E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
973 { 0x125D, 0x1988, 0x10F7, 0x833F, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 918 SND_PCI_QUIRK(0x10F7, 0x833F, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
974 { 0x125D, 0x1988, 0x13BD, 0x1018, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 919 SND_PCI_QUIRK(0x13BD, 0x1018, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
975 { 0x125D, 0x1988, 0x13BD, 0x1019, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 920 SND_PCI_QUIRK(0x13BD, 0x1019, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
976 { 0x125D, 0x1988, 0x13BD, 0x101A, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 921 SND_PCI_QUIRK(0x13BD, 0x101A, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
977 { 0x125D, 0x1988, 0x14FF, 0x0F03, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 922 SND_PCI_QUIRK(0x14FF, 0x0F03, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
978 { 0x125D, 0x1988, 0x14FF, 0x0F04, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 923 SND_PCI_QUIRK(0x14FF, 0x0F04, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
979 { 0x125D, 0x1988, 0x14FF, 0x0F05, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 924 SND_PCI_QUIRK(0x14FF, 0x0F05, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
980 { 0x125D, 0x1988, 0x156D, 0xB400, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 925 SND_PCI_QUIRK(0x156D, 0xB400, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
981 { 0x125D, 0x1988, 0x156D, 0xB795, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 926 SND_PCI_QUIRK(0x156D, 0xB795, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
982 { 0x125D, 0x1988, 0x156D, 0xB797, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 927 SND_PCI_QUIRK(0x156D, 0xB797, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
983 { 0x125D, 0x1988, 0x156D, 0xC700, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD, 0 }, 928 SND_PCI_QUIRK(0x156D, 0xC700, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
984 { 0x125D, 0x1988, 0x1033, 0x80F1, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 929 SND_PCI_QUIRK(0x1033, 0x80F1, NULL,
985 { 0x125D, 0x1988, 0x103C, 0x001A, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, /* HP OmniBook 6100 */ 930 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
986 { 0x125D, 0x1988, 0x107B, 0x340A, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 931 SND_PCI_QUIRK(0x103C, 0x001A, NULL, /* HP OmniBook 6100 */
987 { 0x125D, 0x1988, 0x107B, 0x3450, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 932 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
988 { 0x125D, 0x1988, 0x109F, 0x3134, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 933 SND_PCI_QUIRK(0x107B, 0x340A, NULL,
989 { 0x125D, 0x1988, 0x109F, 0x3161, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 934 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
990 { 0x125D, 0x1988, 0x144D, 0x3280, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 935 SND_PCI_QUIRK(0x107B, 0x3450, NULL,
991 { 0x125D, 0x1988, 0x144D, 0x3281, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 936 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
992 { 0x125D, 0x1988, 0x144D, 0xC002, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 937 SND_PCI_QUIRK(0x109F, 0x3134, NULL,
993 { 0x125D, 0x1988, 0x144D, 0xC003, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 938 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
994 { 0x125D, 0x1988, 0x1509, 0x1740, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 939 SND_PCI_QUIRK(0x109F, 0x3161, NULL,
995 { 0x125D, 0x1988, 0x1610, 0x0010, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE, 0 }, 940 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
996 { 0x125D, 0x1988, 0x1042, 0x1042, HV_CTRL_ENABLE, 0 }, 941 SND_PCI_QUIRK(0x144D, 0x3280, NULL,
997 { 0x125D, 0x1988, 0x107B, 0x9500, HV_CTRL_ENABLE, 0 }, 942 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
998 { 0x125D, 0x1988, 0x14FF, 0x0F06, HV_CTRL_ENABLE, 0 }, 943 SND_PCI_QUIRK(0x144D, 0x3281, NULL,
999 { 0x125D, 0x1988, 0x1558, 0x8586, HV_CTRL_ENABLE, 0 }, 944 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
1000 { 0x125D, 0x1988, 0x161F, 0x2011, HV_CTRL_ENABLE, 0 }, 945 SND_PCI_QUIRK(0x144D, 0xC002, NULL,
946 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
947 SND_PCI_QUIRK(0x144D, 0xC003, NULL,
948 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
949 SND_PCI_QUIRK(0x1509, 0x1740, NULL,
950 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
951 SND_PCI_QUIRK(0x1610, 0x0010, NULL,
952 HV_CTRL_ENABLE | HV_BUTTON_FROM_GD | REDUCED_DEBOUNCE),
953 SND_PCI_QUIRK(0x1042, 0x1042, NULL, HV_CTRL_ENABLE),
954 SND_PCI_QUIRK(0x107B, 0x9500, NULL, HV_CTRL_ENABLE),
955 SND_PCI_QUIRK(0x14FF, 0x0F06, NULL, HV_CTRL_ENABLE),
956 SND_PCI_QUIRK(0x1558, 0x8586, NULL, HV_CTRL_ENABLE),
957 SND_PCI_QUIRK(0x161F, 0x2011, NULL, HV_CTRL_ENABLE),
1001 /* Maestro3 chips */ 958 /* Maestro3 chips */
1002 { 0x125D, 0x1998, 0x103C, 0x000E, HV_CTRL_ENABLE, 0 }, 959 SND_PCI_QUIRK(0x103C, 0x000E, NULL, HV_CTRL_ENABLE),
1003 { 0x125D, 0x1998, 0x103C, 0x0010, HV_CTRL_ENABLE, 1 }, /* HP OmniBook 6000 */ 960 SND_PCI_QUIRK(0x103C, 0x0010, NULL, HV_CTRL_ENABLE),
1004 { 0x125D, 0x1998, 0x103C, 0x0011, HV_CTRL_ENABLE, 1 }, /* HP OmniBook 500 */ 961 SND_PCI_QUIRK(0x103C, 0x0011, NULL, HV_CTRL_ENABLE),
1005 { 0x125D, 0x1998, 0x103C, 0x001B, HV_CTRL_ENABLE, 0 }, 962 SND_PCI_QUIRK(0x103C, 0x001B, NULL, HV_CTRL_ENABLE),
1006 { 0x125D, 0x1998, 0x104D, 0x80A6, HV_CTRL_ENABLE, 0 }, 963 SND_PCI_QUIRK(0x104D, 0x80A6, NULL, HV_CTRL_ENABLE),
1007 { 0x125D, 0x1998, 0x104D, 0x80AA, HV_CTRL_ENABLE, 0 }, 964 SND_PCI_QUIRK(0x104D, 0x80AA, NULL, HV_CTRL_ENABLE),
1008 { 0x125D, 0x1998, 0x107B, 0x5300, HV_CTRL_ENABLE, 0 }, 965 SND_PCI_QUIRK(0x107B, 0x5300, NULL, HV_CTRL_ENABLE),
1009 { 0x125D, 0x1998, 0x110A, 0x1998, HV_CTRL_ENABLE, 0 }, 966 SND_PCI_QUIRK(0x110A, 0x1998, NULL, HV_CTRL_ENABLE),
1010 { 0x125D, 0x1998, 0x13BD, 0x1015, HV_CTRL_ENABLE, 0 }, 967 SND_PCI_QUIRK(0x13BD, 0x1015, NULL, HV_CTRL_ENABLE),
1011 { 0x125D, 0x1998, 0x13BD, 0x101C, HV_CTRL_ENABLE, 0 }, 968 SND_PCI_QUIRK(0x13BD, 0x101C, NULL, HV_CTRL_ENABLE),
1012 { 0x125D, 0x1998, 0x13BD, 0x1802, HV_CTRL_ENABLE, 0 }, 969 SND_PCI_QUIRK(0x13BD, 0x1802, NULL, HV_CTRL_ENABLE),
1013 { 0x125D, 0x1998, 0x1599, 0x0715, HV_CTRL_ENABLE, 0 }, 970 SND_PCI_QUIRK(0x1599, 0x0715, NULL, HV_CTRL_ENABLE),
1014 { 0x125D, 0x1998, 0x5643, 0x5643, HV_CTRL_ENABLE, 0 }, 971 SND_PCI_QUIRK(0x5643, 0x5643, NULL, HV_CTRL_ENABLE),
1015 { 0x125D, 0x199A, 0x144D, 0x3260, HV_CTRL_ENABLE | REDUCED_DEBOUNCE, 0 }, 972 SND_PCI_QUIRK(0x144D, 0x3260, NULL, HV_CTRL_ENABLE | REDUCED_DEBOUNCE),
1016 { 0x125D, 0x199A, 0x144D, 0x3261, HV_CTRL_ENABLE | REDUCED_DEBOUNCE, 0 }, 973 SND_PCI_QUIRK(0x144D, 0x3261, NULL, HV_CTRL_ENABLE | REDUCED_DEBOUNCE),
1017 { 0x125D, 0x199A, 0x144D, 0xC000, HV_CTRL_ENABLE | REDUCED_DEBOUNCE, 0 }, 974 SND_PCI_QUIRK(0x144D, 0xC000, NULL, HV_CTRL_ENABLE | REDUCED_DEBOUNCE),
1018 { 0x125D, 0x199A, 0x144D, 0xC001, HV_CTRL_ENABLE | REDUCED_DEBOUNCE, 0 }, 975 SND_PCI_QUIRK(0x144D, 0xC001, NULL, HV_CTRL_ENABLE | REDUCED_DEBOUNCE),
1019 { 0 } 976 { } /* END */
977};
978
979/* HP Omnibook quirks */
980static struct snd_pci_quirk m3_omnibook_quirk_list[] __devinitdata = {
981 SND_PCI_QUIRK_ID(0x103c, 0x0010), /* HP OmniBook 6000 */
982 SND_PCI_QUIRK_ID(0x103c, 0x0011), /* HP OmniBook 500 */
983 { } /* END */
1020}; 984};
1021 985
1022/* 986/*
@@ -2055,7 +2019,7 @@ static void snd_m3_ac97_reset(struct snd_m3 *chip)
2055 2019
2056 for (i = 0; i < 5; i++) { 2020 for (i = 0; i < 5; i++) {
2057 dir = inw(io + GPIO_DIRECTION); 2021 dir = inw(io + GPIO_DIRECTION);
2058 if (! chip->quirk || ! chip->quirk->irda_workaround) 2022 if (!chip->irda_workaround)
2059 dir |= 0x10; /* assuming pci bus master? */ 2023 dir |= 0x10; /* assuming pci bus master? */
2060 2024
2061 snd_m3_remote_codec_config(io, 0); 2025 snd_m3_remote_codec_config(io, 0);
@@ -2478,7 +2442,7 @@ snd_m3_chip_init(struct snd_m3 *chip)
2478 DISABLE_LEGACY); 2442 DISABLE_LEGACY);
2479 pci_write_config_word(pcidev, PCI_LEGACY_AUDIO_CTRL, w); 2443 pci_write_config_word(pcidev, PCI_LEGACY_AUDIO_CTRL, w);
2480 2444
2481 if (chip->hv_quirk && chip->hv_quirk->is_omnibook) { 2445 if (chip->is_omnibook) {
2482 /* 2446 /*
2483 * Volume buttons on some HP OmniBook laptops don't work 2447 * Volume buttons on some HP OmniBook laptops don't work
2484 * correctly. This makes them work for the most part. 2448 * correctly. This makes them work for the most part.
@@ -2495,8 +2459,7 @@ snd_m3_chip_init(struct snd_m3 *chip)
2495 } 2459 }
2496 pci_read_config_dword(pcidev, PCI_ALLEGRO_CONFIG, &n); 2460 pci_read_config_dword(pcidev, PCI_ALLEGRO_CONFIG, &n);
2497 n &= ~(HV_CTRL_ENABLE | REDUCED_DEBOUNCE | HV_BUTTON_FROM_GD); 2461 n &= ~(HV_CTRL_ENABLE | REDUCED_DEBOUNCE | HV_BUTTON_FROM_GD);
2498 if (chip->hv_quirk) 2462 n |= chip->hv_config;
2499 n |= chip->hv_quirk->config;
2500 /* For some reason we must always use reduced debounce. */ 2463 /* For some reason we must always use reduced debounce. */
2501 n |= REDUCED_DEBOUNCE; 2464 n |= REDUCED_DEBOUNCE;
2502 n |= PM_CTRL_ENABLE | CLK_DIV_BY_49 | USE_PCI_TIMING; 2465 n |= PM_CTRL_ENABLE | CLK_DIV_BY_49 | USE_PCI_TIMING;
@@ -2544,7 +2507,7 @@ snd_m3_enable_ints(struct snd_m3 *chip)
2544 2507
2545 /* TODO: MPU401 not supported yet */ 2508 /* TODO: MPU401 not supported yet */
2546 val = ASSP_INT_ENABLE /*| MPU401_INT_ENABLE*/; 2509 val = ASSP_INT_ENABLE /*| MPU401_INT_ENABLE*/;
2547 if (chip->hv_quirk && (chip->hv_quirk->config & HV_CTRL_ENABLE)) 2510 if (chip->hv_config & HV_CTRL_ENABLE)
2548 val |= HV_INT_ENABLE; 2511 val |= HV_INT_ENABLE;
2549 outw(val, io + HOST_INT_CTRL); 2512 outw(val, io + HOST_INT_CTRL);
2550 outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE, 2513 outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE,
@@ -2708,8 +2671,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2708{ 2671{
2709 struct snd_m3 *chip; 2672 struct snd_m3 *chip;
2710 int i, err; 2673 int i, err;
2711 const struct m3_quirk *quirk; 2674 const struct snd_pci_quirk *quirk;
2712 const struct m3_hv_quirk *hv_quirk;
2713 static struct snd_device_ops ops = { 2675 static struct snd_device_ops ops = {
2714 .dev_free = snd_m3_dev_free, 2676 .dev_free = snd_m3_dev_free,
2715 }; 2677 };
@@ -2749,34 +2711,32 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2749 chip->pci = pci; 2711 chip->pci = pci;
2750 chip->irq = -1; 2712 chip->irq = -1;
2751 2713
2752 for (quirk = m3_quirk_list; quirk->vendor; quirk++) {
2753 if (pci->subsystem_vendor == quirk->vendor &&
2754 pci->subsystem_device == quirk->device) {
2755 printk(KERN_INFO "maestro3: enabled hack for '%s'\n", quirk->name);
2756 chip->quirk = quirk;
2757 break;
2758 }
2759 }
2760
2761 for (hv_quirk = m3_hv_quirk_list; hv_quirk->vendor; hv_quirk++) {
2762 if (pci->vendor == hv_quirk->vendor &&
2763 pci->device == hv_quirk->device &&
2764 pci->subsystem_vendor == hv_quirk->subsystem_vendor &&
2765 pci->subsystem_device == hv_quirk->subsystem_device) {
2766 chip->hv_quirk = hv_quirk;
2767 break;
2768 }
2769 }
2770
2771 chip->external_amp = enable_amp; 2714 chip->external_amp = enable_amp;
2772 if (amp_gpio >= 0 && amp_gpio <= 0x0f) 2715 if (amp_gpio >= 0 && amp_gpio <= 0x0f)
2773 chip->amp_gpio = amp_gpio; 2716 chip->amp_gpio = amp_gpio;
2774 else if (chip->quirk && chip->quirk->amp_gpio >= 0) 2717 else {
2775 chip->amp_gpio = chip->quirk->amp_gpio; 2718 quirk = snd_pci_quirk_lookup(pci, m3_amp_quirk_list);
2776 else if (chip->allegro_flag) 2719 if (quirk) {
2777 chip->amp_gpio = GPO_EXT_AMP_ALLEGRO; 2720 snd_printdd(KERN_INFO "maestro3: set amp-gpio "
2778 else /* presumably this is for all 'maestro3's.. */ 2721 "for '%s'\n", quirk->name);
2779 chip->amp_gpio = GPO_EXT_AMP_M3; 2722 chip->amp_gpio = quirk->value;
2723 } else if (chip->allegro_flag)
2724 chip->amp_gpio = GPO_EXT_AMP_ALLEGRO;
2725 else /* presumably this is for all 'maestro3's.. */
2726 chip->amp_gpio = GPO_EXT_AMP_M3;
2727 }
2728
2729 quirk = snd_pci_quirk_lookup(pci, m3_irda_quirk_list);
2730 if (quirk) {
2731 snd_printdd(KERN_INFO "maestro3: enabled irda workaround "
2732 "for '%s'\n", quirk->name);
2733 chip->irda_workaround = 1;
2734 }
2735 quirk = snd_pci_quirk_lookup(pci, m3_hv_quirk_list);
2736 if (quirk)
2737 chip->hv_config = quirk->value;
2738 if (snd_pci_quirk_lookup(pci, m3_omnibook_quirk_list))
2739 chip->is_omnibook = 1;
2780 2740
2781 chip->num_substreams = NR_DSPS; 2741 chip->num_substreams = NR_DSPS;
2782 chip->substreams = kcalloc(chip->num_substreams, sizeof(struct m3_dma), 2742 chip->substreams = kcalloc(chip->num_substreams, sizeof(struct m3_dma),