--- /dev/null
+From 9cb36c2afc298a2f2085ae0071924b7e3f55e72d Mon Sep 17 00:00:00 2001
+From: Mauro Carvalho Chehab <mchehab@infradead.org>
+Date: Mon, 11 Aug 2008 10:18:39 +0200
+Subject: ALSA: patch_sigmatel: Add missing Gateway entries and autodetection
+Patch-mainline: 2.6.29-rc1
+References: bnc#460478
+
+
+Gateway autodetection and entries are incomplete.
+
+This patch adds the entries found at the .INI file for their driver version
+5.10.5082.0.
+
+It also uses the proper code to seek for notebook ID, since this is based on
+codec subsystem ID on those devices.
+
+This should provide a proper pinup for several gateways notebooks:
+ Gateway M465-E Notebook [Part #1008637]
+ Gateway M465-G Notebook [Part #1008667]
+ Gateway NX260X Notebook [Part #1008794]
+ Gateway NX100X Notebook [Part #1008798]
+ Gateway E-100M Notebook [Part #1008799]
+ Gateway E-100M G Notebook [Part #1008800]
+ Gateway M255-E Notebook [Part #1008801]
+ Gateway M255-G Notebook [Part #1008803]
+ Gateway M285-E Convertible Notebook [Part #1008804]
+ Gateway M285-G Convertible Notebook [Part #1008805]
+ Gateway CX210S Convertible Notebook [Part #1008807]
+ Gateway CX210X Convertible Notebook [Part #1008808]
+ Gateway E-100M SB Notebook [Part #1008973]
+ Gateway M255-E SB Notebook [Part #1008989]
+ Gateway M285-E SB Convertible Notebook [Part #1008990]
+ Gateway M465-E Notebook [Part #1009022]
+ Gateway CX2724 Convertible Notebook [Part #1009036]
+ Gateway MX1025 Notebook [Part #1009046]
+ Gateway CX2720 Convertible Notebook [Part #1009063]
+ Gateway CX2724h Convertible Notebook [Part #1009089]
+ Gateway MX1023 Notebook [Part #1009097]
+ Gateway MX1023h Notebook [Part #1009098]
+ Gateway NX260X Notebook [Part #1009112]
+ Gateway E-100M Notebook [Part #1009126]
+ Gateway MX7533 Notebook [Part #1009146] [Part #1009163]
+ Gateway CX210X Convertible Notebook [Part #1009346]
+ Gateway NX570X Notebook [Part #1009442]
+ Gateway NX570X Notebook [Part #1009448]
+ Gateway NX270S Notebook [Part #1009550]
+ Gateway MX6448 Notebook [Part #1013912R]
+ Gateway MX6453 Notebook [Part #1013913R]
+ Gateway MX6216 Notebook [Part #1013916R]
+ Gateway MX6931 Notebook [Part #1013918R]
+ Gateway CX2726 Convertible Notebook [Part #1013921R]
+ Gateway MP8708 Notebook [Part #1013924R]
+ Gateway MX6446 Notebook [Part #1013927R]
+ Gateway MX6930 Notebook [Part #1013928R]
+ Gateway MX6447 Notebook [Part #1013932R]
+ Gateway MX6454 Notebook [Part #1013943R]
+ Gateway MX6439 Notebook [Part #1013947R] [Part #1013955R] [Part #1013971R]
+ Gateway MX6930h Notebook [Part #1013973R] [Part #1013974R] [Part #1013975R]
+ Gateway MX6955 Notebook [Part #1014028R]
+ Gateway MX6956 Notebook [Part #1014033R]
+ Gateway MX6959 Notebook [Part #1014061R]
+ Gateway MX6957 Notebook [Part #1014065R]
+ Gateway MX6960 Notebook [Part #1014068R]
+ Gateway MX6958 Notebook [Part #1014072R]
+ Gateway NX570X Notebook [Part #1014077R]
+ Gateway NX570XL Notebook [Part #1014078R]
+ Gateway NX570QS Notebook [Part #1014079R]
+ Gateway MX6961 Notebook [Part #1014080R] [Part #1014106R]
+ Gateway MX6961h Notebook [Part #1014112R]
+ Gateway NX270S Notebook [Part #1014120R]
+ Gateway MX6431 Notebook [Part #1014121R]
+ Gateway MX8710 Notebook [Part #2905895R]
+ Gateway MX3702 Notebook [Part #2905898R]
+ Blade-K8F GW UMA Single Core Motherboard w/RS485M and 1394 - Quanta (FRU) [Part #4006133R]
+
+Since some entries conflict with existing pinups, I'm providing a separate
+patch to fix those entries.
+
+Tested only with Gateway MX6453.
+
+Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_sigmatel.c | 89 +++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 81 insertions(+), 8 deletions(-)
+
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -94,7 +94,13 @@ enum {
+
+ enum {
+ STAC_925x_REF,
++ STAC_M1,
++ STAC_M1_2,
++ STAC_M2,
+ STAC_M2_2,
++ STAC_M3,
++ STAC_M5,
++ STAC_M6,
+ STAC_MA6,
+ STAC_PA6,
+ STAC_925x_MODELS
+@@ -1551,11 +1557,40 @@ static unsigned int ref925x_pin_configs[
+ 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
+ };
+
++static unsigned int stac925xM1_pin_configs[8] = {
++ 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
++ 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
++};
++static unsigned int stac925xM1_2_pin_configs[8] = {
++ 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
++ 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
++};
++static unsigned int stac925xM2_pin_configs[8] = {
++ 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
++ 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
++};
++
++static unsigned int stac925xM3_pin_configs[8] = {
++ 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
++ 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
++};
++static unsigned int stac925xM5_pin_configs[8] = {
++ 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
++ 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
++};
++
++/* Original M6 entry at .ini file */
++static unsigned int stac925xM6_pin_configs[8] = {
++ 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
++ 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
++};
++
+ static unsigned int stac925x_MA6_pin_configs[8] = {
+ 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
+ 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
+ };
+
++/* This entry should be M2 */
+ static unsigned int stac925x_PA6_pin_configs[8] = {
+ 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
+ 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
+@@ -1568,27 +1603,55 @@ static unsigned int stac925xM2_2_pin_con
+
+ static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
+ [STAC_REF] = ref925x_pin_configs,
++ [STAC_M1] = stac925xM1_pin_configs,
++ [STAC_M1_2] = stac925xM1_2_pin_configs,
++ [STAC_M2] = stac925xM2_pin_configs,
+ [STAC_M2_2] = stac925xM2_2_pin_configs,
++ [STAC_M3] = stac925xM3_pin_configs,
++ [STAC_M5] = stac925xM5_pin_configs,
++ [STAC_M6] = stac925xM6_pin_configs,
+ [STAC_MA6] = stac925x_MA6_pin_configs,
+ [STAC_PA6] = stac925x_PA6_pin_configs,
+ };
+
+ static const char *stac925x_models[STAC_925x_MODELS] = {
+ [STAC_REF] = "ref",
++ [STAC_M1] = "m1",
++ [STAC_M1_2] = "m1-2",
++ [STAC_M2] = "m2",
+ [STAC_M2_2] = "m2-2",
+- [STAC_MA6] = "m6",
++ [STAC_M3] = "m3",
++ [STAC_M5] = "m5",
++ [STAC_M6] = "m6",
++ [STAC_MA6] = "ma6",
+ [STAC_PA6] = "pa6",
+ };
+
+-static struct snd_pci_quirk stac925x_cfg_tbl[] = {
+- /* SigmaTel reference board */
+- SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
+- SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
++static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
+ SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
+ SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
++
+ SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
+ SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
+- SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
++ SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
++
++ /* Not sure about the brand name for those */
++ SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
++ SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
++ SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
++ SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
++
++ {} /* terminator */
++};
++
++static struct snd_pci_quirk stac925x_cfg_tbl[] = {
++ /* SigmaTel reference board */
++ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
++ SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
++
++ /* Default table for unknown ID */
++ SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
++
+ {} /* terminator */
+ };
+
+@@ -4149,12 +4212,22 @@ static int patch_stac925x(struct hda_cod
+ codec->spec = spec;
+ spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
+ spec->pin_nids = stac925x_pin_nids;
+- spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
++
++ /* Check first for codec ID */
++ spec->board_config = snd_hda_check_board_codec_sid_config(codec,
++ STAC_925x_MODELS,
++ stac925x_models,
++ stac925x_codec_id_cfg_tbl);
++
++ /* Now checks for PCI ID, if codec ID is not found */
++ if (spec->board_config < 0)
++ spec->board_config = snd_hda_check_board_config(codec,
++ STAC_925x_MODELS,
+ stac925x_models,
+ stac925x_cfg_tbl);
+ again:
+ if (spec->board_config < 0) {
+- snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
++ snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
+ "using BIOS defaults\n");
+ err = stac92xx_save_bios_config_regs(codec);
+ if (err < 0) {