intel-hda patch for Dell Latitude D531

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have attached three files to this mail:

1. patch_sigmatel.c.diff

I have a Latitude D531 which has a ATI SB600 with a STAC 9205. The chip is detected, but no config was read with the latest drivers. The problems are the dmic_nids arrays, which are ignored for auto config lookup. This calles is_in_nid_list, which expects a 0 terminated list, but these arrays are not.

Additionally I updated the dell_9205_m43_pin_configs with values from the latest win drivers.

2. create_dell_tables.pl

When looking into the ini files and comparing the nids and config values of the various tables, I got really confused, so I wrote a litte script to extract the values and build the table. This is the extended version, after I got my sound working. It extracts all pin infos from all ini files, generates the apropriate tables and prepends the Version.txt from the driver, resultiung in a kind of C header. Maybe it's usefull for you.

3. patch_sigmatel_dell.h

Output from running create_dell_tables.pl on the latest drivers for my D531 from Dell.

HTH

Jan-Marek Glogowski


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

--- patch_sigmatel.c.orig	2007-10-10 20:17:29.000000000 +0200
+++ patch_sigmatel.c	2007-10-10 20:18:44.000000000 +0200
@@ -182,8 +182,11 @@
         0x02,
 };
 
-static hda_nid_t stac925x_dmic_nids[1] = {
-	0x15, 
+// DMic nids are ignored on auto config, so the array has to be NULL 
+// terminated for is_in_nid_list
+static int stac925x_dmic_nids_len = 1;
+static hda_nid_t stac925x_dmic_nids[stac925x_dmic_nids_len + 1] = {
+	0x15, 0x00,
 };
 
 static hda_nid_t stac922x_adc_nids[2] = {
@@ -210,8 +213,11 @@
         0x19, 0x1a
 };
 
-static hda_nid_t stac9205_dmic_nids[2] = {
-        0x17, 0x18,
+// DMic nids are ignored on auto config, so the array has to be NULL 
+// terminated for is_in_nid_list
+static int stac9205_dmic_nids_len = 2;
+static hda_nid_t stac9205_dmic_nids[stac9205_dmic_nids_len + 1] = {
+        0x17, 0x18, 0x00,
 };
 
 static hda_nid_t stac9200_pin_nids[8] = {
@@ -1146,9 +1152,10 @@
     10280201
 */
 static unsigned int dell_9205_m43_pin_configs[12] = {
-	0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
-	0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
-	0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
+	/* based on 92XXM4-3.ini from Dell Driver 5.10.0.5401 */
+	0x0321101f, 0x03a1102e, 0x90a70320, 0x90170310,
+	0x400000fe, 0x400000ff, 0x400000fd, 0x400000fb,
+	0x400000fa, 0x400000fc, 0x01441340, 0x400000f9,
 };
 
 static unsigned int dell_9205_m44_pin_configs[12] = {
@@ -2548,8 +2555,8 @@
 	case 0x83847633: /* STAC9202D */
 	case 0x83847636: /* STAC9251  */
 	case 0x83847637: /* STAC9251D */
-		spec->num_dmics = 1;
 		spec->dmic_nids = stac925x_dmic_nids;
+		spec->num_dmics = stac925x_dmic_nids_len;
 		break;
 	default:
 		spec->num_dmics = 0;
@@ -2798,7 +2805,7 @@
 	spec->mux_nids = stac9205_mux_nids;
 	spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
 	spec->dmic_nids = stac9205_dmic_nids;
-	spec->num_dmics = ARRAY_SIZE(stac9205_dmic_nids);
+	spec->num_dmics = stac9205_dmic_nids_len;
 	spec->dmux_nid = 0x1d;
 
 	spec->init = stac9205_core_init;
/**
 * This file was generated from the ini files of
 *
 * Title      : Audio: SIGMATEL STAC 92XX C-Major HD Audio Driver
 * Version    : A08
 * OEM Name   : SIGMATEL
 * OEM Ver    : 5.10.0.5401
 * Computers  : Latitude: ATG D630, D430, D531, D630, D631, D830; Precision: M4300; Vostro Notebook: 1000
 * OS         : Windows 2000,Windows XP,Windows XP x64
 * Languages  : Brazilian Portuguese, Chinese-S, Chinese-T, English, French, German, Japanese, Korean, Spanish
 * Created    : Wednesday, July 11, 2007
 **/

#ifndef PATCH_SIGMATEL_DELL_H
#define PATCH_SIGMATEL_DELL_H

// perl nid hash: 0x080x090x0d0x0e0x0f0x100x110x12
// matches to: stac9200
static hda_nid_t stac9200_pin_nids[8] = {
	0x08,       0x09,       0x0d,       0x0e,       0x0f,       
	0x10,       0x11,       0x12,       
};

// perl nid hash: 0x0a0x0b0x0c0x0d0x0e0x0f0x140x160x210x22
// matches to: stac_92xx_dell_m41
static hda_nid_t stac_92xx_dell_m41_pin_nids[10] = {
	0x0a,       0x0b,       0x0c,       0x0d,       0x0e,       
	0x0f,       0x14,       0x16,       0x21,       0x22,       
};

// perl nid hash: 0x0a0x0b0x0c0x0d0x0e0x0f0x140x160x170x180x210x22
// matches to: stac9205
static hda_nid_t stac9205_pin_nids[12] = {
	0x0a,       0x0b,       0x0c,       0x0d,       0x0e,       
	0x0f,       0x14,       0x16,       0x17,       0x18,       
	0x21,       0x22,       
};

// perl nid hash: 0x0a0x0b0x0c0x0d0x0e0x0f0x100x110x150x1b
// matches to: stac922x
static hda_nid_t stac922x_pin_nids[10] = {
	0x0a,       0x0b,       0x0c,       0x0d,       0x0e,       
	0x0f,       0x10,       0x11,       0x15,       0x1b,       
};

// perl nid hash: 0x0a0x0b0x0c0x0d0x0e0x0f0x100x110x120x130x140x210x22
// matches to: stac_92xx_dell_m83
static hda_nid_t stac_92xx_dell_m83_pin_nids[13] = {
	0x0a,       0x0b,       0x0c,       0x0d,       0x0e,       
	0x0f,       0x10,       0x11,       0x12,       0x13,       
	0x14,       0x21,       0x22,       
};

static unsigned int stac_9200_dell_m21_pin_configs[8] = {
	0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, 0x408003fb, 
	0x03a1102e, 0x401003fc, 0x403003fd, 
};

static unsigned int stac_9200_dell_m22_pin_configs[8] = {
	0x40c003fa, 0x01441340, 0x0321121f, 0x90170310, 0x90a70320, 
	0x03a1102e, 0x401003fb, 0x403003fc, 
};

static unsigned int stac_9200_dell_m23_pin_configs[8] = {
	0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, 0x408003fb, 
	0x04a1102e, 0x90170311, 0x403003fc, 
};

static unsigned int stac_9200_dell_m24_pin_configs[8] = {
	0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, 0x408003fc, 
	0x03a1102e, 0x401003fd, 0x403003fe, 
};

static unsigned int stac_9200_dell_m25_pin_configs[8] = {
	0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, 0x408003fb, 
	0x04a1102e, 0x401003fc, 0x403003fd, 
};

static unsigned int stac_9200_dell_m26_pin_configs[8] = {
	0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, 0x408003fc, 
	0x04a1102e, 0x401003fd, 0x403003fe, 
};

static unsigned int stac_9200_dell_m27_pin_configs[8] = {
	0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, 0x408003fb, 
	0x04a1102e, 0x90170311, 0x403003fc, 
};

static unsigned int stac_9200_dell_m28_pin_configs[8] = {
	0x40c003fa, 0x01441340, 0x0321121f, 0x90170310, 0x90a70320, 
	0x03a1102e, 0x401003fb, 0x403003fc, 
};

static unsigned int stac_9200_dell_m29_pin_configs[8] = {
	0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, 0x408003fc, 
	0x04a1102e, 0x401003fd, 0x403003fe, 
};

static unsigned int stac_9200_dell_nom_m28_pin_configs[8] = {
	0x40c003fa, 0x01441340, 0x0321121f, 0x90170310, 0x400003f1, 
	0x400003f2, 0x401003fb, 0x403003fc, 
};

static unsigned int stac_92xx_dell_m83_pin_configs[13] = {
	0x02211210, 0x400003fa, 0x400003fb, 0x90170310, 0x0281103e, 
	0x0221122f, 0x400003fc, 0x400003fd, 0x400003fe, 0x90a60330, 
	0x400003ff, 0x04441340, 0x40c003f1, 
};

static unsigned int stac_92xx_dell_m84_pin_configs[13] = {
	0x02211210, 0x400003fa, 0x400003fb, 0x90170310, 0x0281103e, 
	0x0221122f, 0x400003fc, 0x400003fd, 0x400003fe, 0x90a60330, 
	0x400003ff, 0x01441340, 0x40c003f1, 
};

static unsigned int stac_92xx_dell_m85_pin_configs[13] = {
	0x02211210, 0x400003fa, 0x400003fb, 0x90170310, 0x0281103e, 
	0x0221122f, 0x400003fc, 0x400003fd, 0x400003fe, 0x400003f2, 
	0x400003ff, 0x01441340, 0x40c003f1, 
};

static unsigned int stac_92xx_dell_m86_pin_configs[13] = {
	0x02211210, 0x400003fa, 0x400003fb, 0x90170310, 0x0281103e, 
	0x0221122f, 0x400003fc, 0x400003fd, 0x400003fe, 0x90a60330, 
	0x400003ff, 0x01441340, 0x40c003f1, 
};

static unsigned int stac_92xx_dell_nom_m83_pin_configs[13] = {
	0x02211210, 0x400003fa, 0x400003fb, 0x90170310, 0x02111022, 
	0x0221122f, 0x400003fc, 0x400003fd, 0x400003fe, 0x400003f2, 
	0x400003f3, 0x04441340, 0x40c003f1, 
};

static unsigned int stac_92xx_dell_nom_m84_pin_configs[13] = {
	0x02211210, 0x400003fa, 0x400003fb, 0x90170310, 0x02111022, 
	0x0221122f, 0x400003fc, 0x400003fd, 0x400003fe, 0x400003f2, 
	0x400003f3, 0x01441340, 0x40c003f1, 
};

static unsigned int stac_922x_dell_m81_pin_configs[10] = {
	0x0321121f, 0x01112024, 0x01111222, 0x91174220, 0x03811032, 
	0x01116221, 0x01452340, 0x40c003f1, 0x90a70330, 0x405003f0, 
};

static unsigned int stac_922x_dell_m82_pin_configs[10] = {
	0x02211210, 0x408103ff, 0x0281123e, 0x90100310, 0x408003f1, 
	0x0221122f, 0x03451340, 0x40c003f2, 0x508003f3, 0x405003f4, 
};

static unsigned int stac_9205_dell_m42_pin_configs[12] = {
	0x0421101f, 0x04a1102e, 0x400003fa, 0x90170310, 0x400003fb, 
	0x400003fc, 0x400003fd, 0x400003fe, 0x90a60320, 0x400003ff, 
	0x01441340, 0x40c003f1, 
};

static unsigned int stac_9205_dell_m43_pin_configs[12] = {
	0x0321101f, 0x03a1102e, 0x90a70320, 0x90170310, 0x400000fe, 
	0x400000ff, 0x400000fd, 0x400000fb, 0x400000fa, 0x400000fc, 
	0x01441340, 0x400000f9, 
};

static unsigned int stac_9205_dell_m44_pin_configs[12] = {
	0x0421101f, 0x04a1102e, 0x400003fa, 0x90170310, 0x400003fb, 
	0x400003fc, 0x400003fd, 0x400003fe, 0x90a60320, 0x400003ff, 
	0x01441340, 0x40c003f1, 
};

static unsigned int stac_9205_dell_m45_pin_configs[12] = {
	0x0321101f, 0x03a1102e, 0x90a70320, 0x90170310, 0x400000fe, 
	0x400000ff, 0x400000fd, 0x400000fb, 0x400000fa, 0x400000fc, 
	0x01441340, 0x400000f9, 
};

static unsigned int stac_9205_dell_nom_m42_pin_configs[12] = {
	0x0321101f, 0x400003f2, 0x400003fa, 0x90170310, 0x400003fb, 
	0x400003fc, 0x400003fd, 0x400003fe, 0x400003f3, 0x400003ff, 
	0x01441340, 0x40c003f1, 
};

static unsigned int stac_9205_dell_nom_m43_pin_configs[12] = {
	0x0321101f, 0x400003f8, 0x400003f7, 0x90170310, 0x400000fe, 
	0x400000ff, 0x400000fd, 0x400000fb, 0x400000fa, 0x400000fc, 
	0x01441340, 0x400000f9, 
};

static unsigned int stac_92xx_dell_m41_pin_configs[10] = {
	0x0321101f, 0x03a1102e, 0x90a70320, 0x90170310, 0x400000fe, 
	0x400000ff, 0x400000fd, 0x400000fb, 0x01441340, 0x400000f9, 
};

enum {
	STAC_9200_DELL_M21,
	STAC_9200_DELL_M22,
	STAC_9200_DELL_M23,
	STAC_9200_DELL_M24,
	STAC_9200_DELL_M25,
	STAC_9200_DELL_M26,
	STAC_9200_DELL_M27,
	STAC_9200_DELL_M28,
	STAC_9200_DELL_M29,
	STAC_9200_DELL_NOM_M28,
	STAC_9200_DELL_MODELS
};

enum {
	STAC_92XX_DELL_M83,
	STAC_92XX_DELL_M84,
	STAC_92XX_DELL_M85,
	STAC_92XX_DELL_M86,
	STAC_92XX_DELL_NOM_M83,
	STAC_92XX_DELL_NOM_M84,
	STAC_92XX_DELL_M83_MODELS
};

enum {
	STAC_922X_DELL_M81,
	STAC_922X_DELL_M82,
	STAC_922X_DELL_MODELS
};

enum {
	STAC_9205_DELL_M42,
	STAC_9205_DELL_M43,
	STAC_9205_DELL_M44,
	STAC_9205_DELL_M45,
	STAC_9205_DELL_NOM_M42,
	STAC_9205_DELL_NOM_M43,
	STAC_9205_DELL_MODELS
};

enum {
	STAC_92XX_DELL_M41,
	STAC_92XX_DELL_M41_MODELS
};

static unsigned int *stac_9200_dell_brd_tbl[STAC_9200_DELL_MODELS] = {
	[STAC_9200_DELL_M21] = stac_9200_dell_m21_pin_config,
	[STAC_9200_DELL_M22] = stac_9200_dell_m22_pin_config,
	[STAC_9200_DELL_M23] = stac_9200_dell_m23_pin_config,
	[STAC_9200_DELL_M24] = stac_9200_dell_m24_pin_config,
	[STAC_9200_DELL_M25] = stac_9200_dell_m25_pin_config,
	[STAC_9200_DELL_M26] = stac_9200_dell_m26_pin_config,
	[STAC_9200_DELL_M27] = stac_9200_dell_m27_pin_config,
	[STAC_9200_DELL_M28] = stac_9200_dell_m28_pin_config,
	[STAC_9200_DELL_M29] = stac_9200_dell_m29_pin_config,
	[STAC_9200_DELL_NOM_M28] = stac_9200_dell_nom_m28_pin_config,
};

static unsigned int *stac_92xx_dell_m83_brd_tbl[STAC_92XX_DELL_M83_MODELS] = {
	[STAC_92XX_DELL_M83] = stac_92xx_dell_m83_pin_config,
	[STAC_92XX_DELL_M84] = stac_92xx_dell_m84_pin_config,
	[STAC_92XX_DELL_M85] = stac_92xx_dell_m85_pin_config,
	[STAC_92XX_DELL_M86] = stac_92xx_dell_m86_pin_config,
	[STAC_92XX_DELL_NOM_M83] = stac_92xx_dell_nom_m83_pin_config,
	[STAC_92XX_DELL_NOM_M84] = stac_92xx_dell_nom_m84_pin_config,
};

static unsigned int *stac_922x_dell_brd_tbl[STAC_922X_DELL_MODELS] = {
	[STAC_922X_DELL_M81] = stac_922x_dell_m81_pin_config,
	[STAC_922X_DELL_M82] = stac_922x_dell_m82_pin_config,
};

static unsigned int *stac_9205_dell_brd_tbl[STAC_9205_DELL_MODELS] = {
	[STAC_9205_DELL_M42] = stac_9205_dell_m42_pin_config,
	[STAC_9205_DELL_M43] = stac_9205_dell_m43_pin_config,
	[STAC_9205_DELL_M44] = stac_9205_dell_m44_pin_config,
	[STAC_9205_DELL_M45] = stac_9205_dell_m45_pin_config,
	[STAC_9205_DELL_NOM_M42] = stac_9205_dell_nom_m42_pin_config,
	[STAC_9205_DELL_NOM_M43] = stac_9205_dell_nom_m43_pin_config,
};

static unsigned int *stac_92xx_dell_m41_brd_tbl[STAC_92XX_DELL_M41_MODELS] = {
	[STAC_92XX_DELL_M41] = stac_92xx_dell_m41_pin_config,
};

static struct snd_pci_quirk stac_9200_dell_cfg_tbl[] = {
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01b5,
			"Unknown Dell", STAC_9200_DELL_M21),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01d8,
			"Unknown Dell", STAC_9200_DELL_M21),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01c2,
			"Unknown Dell", STAC_9200_DELL_M22),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01c8,
			"Unknown Dell", STAC_9200_DELL_M22),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01cc,
			"Unknown Dell", STAC_9200_DELL_M22),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01d4,
			"Unknown Dell", STAC_9200_DELL_M22),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01d6,
			"Unknown Dell", STAC_9200_DELL_M22),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01ce,
			"Unknown Dell", STAC_9200_DELL_M23),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01cf,
			"Unknown Dell", STAC_9200_DELL_M23),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01c9,
			"Unknown Dell", STAC_9200_DELL_M24),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01ca,
			"Unknown Dell", STAC_9200_DELL_M24),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01cb,
			"Unknown Dell", STAC_9200_DELL_M24),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01d3,
			"Unknown Dell", STAC_9200_DELL_M24),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01bd,
			"Unknown Dell", STAC_9200_DELL_M25),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01ee,
			"Unknown Dell", STAC_9200_DELL_M25),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01ef,
			"Unknown Dell", STAC_9200_DELL_M25),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f6,
			"Unknown Dell", STAC_9200_DELL_M26),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01cd,
			"Unknown Dell", STAC_9200_DELL_M27),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0201,
			"Unknown Dell", STAC_9200_DELL_M28),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f5,
			"Unknown Dell", STAC_9200_DELL_M29),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0218,
			"Unknown Dell", STAC_9200_DELL_NOM_M28),
};

static struct snd_pci_quirk stac_92xx_dell_m83_cfg_tbl[] = {
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f3,
			"Unknown Dell", STAC_92XX_DELL_M83),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0209,
			"Unknown Dell", STAC_92XX_DELL_M83),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x020a,
			"Unknown Dell", STAC_92XX_DELL_M83),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x020d,
			"Unknown Dell", STAC_92XX_DELL_M83),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x020e,
			"Unknown Dell", STAC_92XX_DELL_M83),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f8,
			"Unknown Dell", STAC_92XX_DELL_M84),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0203,
			"Unknown Dell", STAC_92XX_DELL_M85),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f7,
			"Unknown Dell", STAC_92XX_DELL_M86),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x021a,
			"Unknown Dell", STAC_92XX_DELL_NOM_M83),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x021c,
			"Unknown Dell", STAC_92XX_DELL_NOM_M84),
};

static struct snd_pci_quirk stac_922x_dell_cfg_tbl[] = {
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01bf,
			"Unknown Dell", STAC_922X_DELL_M81),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01d7,
			"Unknown Dell", STAC_922X_DELL_M82),
};

static struct snd_pci_quirk stac_9205_dell_cfg_tbl[] = {
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0204,
			"Unknown Dell", STAC_9205_DELL_M42),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f9,
			"Unknown Dell", STAC_9205_DELL_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01fa,
			"Unknown Dell", STAC_9205_DELL_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01fe,
			"Unknown Dell", STAC_9205_DELL_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01ff,
			"Unknown Dell", STAC_9205_DELL_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0206,
			"Unknown Dell", STAC_9205_DELL_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f1,
			"Unknown Dell", STAC_9205_DELL_M44),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01f2,
			"Unknown Dell", STAC_9205_DELL_M44),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01fc,
			"Unknown Dell", STAC_9205_DELL_M44),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01fd,
			"Unknown Dell", STAC_9205_DELL_M44),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x021f,
			"Unknown Dell", STAC_9205_DELL_M44),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0200,
			"Unknown Dell", STAC_9205_DELL_M45),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0217,
			"Unknown Dell", STAC_9205_DELL_NOM_M42),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0212,
			"Unknown Dell", STAC_9205_DELL_NOM_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0213,
			"Unknown Dell", STAC_9205_DELL_NOM_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0216,
			"Unknown Dell", STAC_9205_DELL_NOM_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x0219,
			"Unknown Dell", STAC_9205_DELL_NOM_M43),
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x021b,
			"Unknown Dell", STAC_9205_DELL_NOM_M43),
};

static struct snd_pci_quirk stac_92xx_dell_m41_cfg_tbl[] = {
	SND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x01e9,
			"Unknown Dell", STAC_92XX_DELL_M41),
};

#endif

#!/usr/bin/perl -w

# (c) 2007 Jan-Marek Glogowski <glogow@xxxxxxxxxx>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

use strict;
use warnings;

use Config::IniFiles;

print << "EOF";
/**
 * This file was generated from the ini files of
 *
EOF

open( VERSION, "<../Version.txt" ) || die( "Couldn't open ../Version.txt: $!\n" );
while( <VERSION> ) {
  print " * $_";
}
close( VERSION );

print << "EOF";
 **/

#ifndef PATCH_SIGMATEL_DELL_H
#define PATCH_SIGMATEL_DELL_H

EOF

my $cfg = Config::IniFiles->new( -file => 'Sthda.ini' );

my @models = $cfg->Parameters( 'Models' );

my %subini_models;
my %subini_enum; # ini -> enum
my %enum_subini; # enum -> ini

# Map to nid "hash" to alsa table names
my %nid_function_map = (
	'0x080x090x0d0x0e0x0f0x100x110x12' => '9200',
	'0x0a0x0b0x0c0x0d0x0e0x0f0x140x160x170x180x210x22' => '9205',
	'0x0a0x0b0x0c0x0d0x0e0x0f0x100x110x150x1b' => '922x',
);

# Parse models in main driver.ini
foreach my $model (@models)
{
	next if( 'DEFAULT' eq $model );

	my $arrayref;
	my $subini = $cfg->val( 'Models', $model );
	if( ! exists $subini_models{ $subini } ) {
		my @tmparray = ();
		$subini_models{ $subini } = \@tmparray;
	}
	$arrayref = $subini_models{ $subini };

	if( $model =~ m/VEN_(....)&DEV_(....)&SUBSYS_(....)(....)$/ ) {
		my %id = ();
		$id{ 'vendor' } = lc( $1 );
		$id{ 'device' } = lc( $2 );
		$id{ 'subvendor' } = lc( $3 );
		$id{ 'subdevice' } = lc( $4 );
		push( @$arrayref, \%id );
	}
}

# Generate enum from INI values of models
foreach my $ini (sort keys %subini_models) {
	my $enum;
	if( $ini =~ /^92XX(..)-(.)\.INI/i ) { 
		$enum = "STAC_92XX_DELL_${1}${2}";
	}
	elsif( $ini =~ /^NOM_(..)-(.)\.INI/i ) {
		$enum = "STAC_92XX_DELL_NOM_${1}${2}";
	}
	else { next; }
	$subini_enum{ $ini } = $enum;
	$enum_subini{ $enum } = $ini;
}

my %nid_configs;

# Open sub INIs to get pins
foreach my $ini (sort keys %subini_models) {
	my $subcfg = Config::IniFiles->new( -file => $ini, -allowsingles => 1 );
	if( ! defined $subcfg ) {
		print( "Error reading '$ini'\n" . join( "\n  ", @Config::IniFiles::errors ) . "\n" );
		next;
	}
	my @sections = $subcfg->Sections();
	my %pins;

	# Extract pins
	foreach my $section (@sections) {
		if( $section =~ /^HKR\\Settings\\pin\\(.*)$/i ) {
			my $pin = lc( "0x$1" );
			my $confval = $subcfg->val( $section, 'CfgDflt' );
			$confval =~ s/^ *//;
			$confval =~ s/ *$//;
			if( $confval =~ /^dword: (0x.{8})$/ ) {
				$pins{ $pin } = lc( $1 );
			}
			else { print( "Error: '$confval'\n" ); }
		}
	}

	if( 0 == scalar keys %pins ) {
		print( "Couln't extract pin config from '$ini'\n" );
		next;
	}

	# Generate nid tables - catches dups
	my $nids_hash = join( '', sort keys %pins );
	my $model_config;
	if( ! exists $nid_configs{ $nids_hash } ) {
		my %new_config = ();
		$nid_configs{ $nids_hash } = \%new_config;
		my $nid_name = lc( $subini_enum{ $ini } );
		if( exists $nid_function_map{ $nids_hash } ) {
			$nid_name = "stac" . $nid_function_map{ $nids_hash };
			$new_config{ 'DEFAULT' } = $nids_hash;
		}
		else { $new_config{ 'DEFAULT' } = $nid_name; }
		print( "// perl nid hash: $nids_hash\n" );
		print( "// matches to: $nid_name\n" );
		print( "static hda_nid_t " . $nid_name 
			. '_pin_nids[' . scalar keys( %pins ) . '] = {' );
		my $i = 0;
		for my $pin (sort keys %pins) {
			print( "\n\t" ) if( 0 == $i % 5 );
			print( "$pin,       " );
			$i++;
		}
		print( "\n};\n\n" );
	}

	$model_config = $nid_configs{ $nids_hash };
	my @config = map( $pins{ $_ }, sort keys %pins );

	# If nid "hash" matches alsa table rename enums
	if( exists $nid_function_map{ $nids_hash } ) {
		my $enum = $subini_enum{ $ini };
		my $name = uc( $nid_function_map{ $nids_hash } );
		$enum =~ s/^STAC_92XX/STAC_$name/;
		$subini_enum{ $ini } = $enum;
		$enum_subini{ $enum } = $ini;
	}
	$model_config->{ $subini_enum{ $ini } } = \@config; 
}

# Write pin configs for all models
foreach my $nid (sort keys %nid_configs) {
	foreach my $model (sort keys %{$nid_configs{$nid}}) {
		next if( 'DEFAULT' eq $model );
		my $configs = $nid_configs{$nid}->{$model};
		print( "static unsigned int " . lc( $model )
			. '_pin_configs[' . scalar @$configs . '] = {' );
		my $i = 0;
		for my $config (@$configs) {
			print( "\n\t" ) if( 0 == $i % 5 );
			print( "$config, " );
			$i++;
		}
		print( "\n};\n\n" );
	}
}

# Write list of enums
foreach my $nid (sort keys %nid_configs) {
	my $nids = $nid_configs{$nid}->{'DEFAULT'};
	$nids = 'STAC_' . $nid_function_map{ $nids } . '_DELL'
		if( exists $nid_function_map{ $nids } );
	$nids = uc( $nids );
	print( "enum {\n" );
	foreach my $model (sort keys %{$nid_configs{$nid}}) {
		next if( 'DEFAULT' eq $model );
		print( "\t$model,\n" );
	}
	print( "\t${nids}_MODELS\n" );
	print( "};\n\n" );
}

# Write table of models per nid 
foreach my $nid (sort keys %nid_configs) {
	my $nids = $nid_configs{$nid}->{'DEFAULT'};
	$nids = 'STAC_' . $nid_function_map{ $nids } . '_DELL'
		if( exists $nid_function_map{ $nids } );
	$nids = uc( $nids );
	print( 'static unsigned int *' . lc( $nids )
		. "_brd_tbl[${nids}_MODELS] = {\n" );
	foreach my $model (sort keys %{$nid_configs{$nid}}) {
		next if( 'DEFAULT' eq $model );
		print( "\t[${model}] = " . lc($model) . "_pin_config,\n" );
	}
	print( "};\n\n" );
}

# Write quirk tables
foreach my $nid (sort keys %nid_configs) {
	my $nids = $nid_configs{$nid}->{'DEFAULT'};
	$nids = 'STAC_' . $nid_function_map{ $nids } . '_DELL'
		if( exists $nid_function_map{ $nids } );
	print( 'static struct snd_pci_quirk ' . lc( $nids )
		. "_cfg_tbl[] = {\n" );
	foreach my $model (sort keys %{$nid_configs{$nid}}) {
		next if( 'DEFAULT' eq $model );
		my $ini = $enum_subini{ $model };
		my $modelids = $subini_models{ $ini };
		for my $modelid (@$modelids) {
			print( "\tSND_PCI_QUIRK[PCI_VENDOR_ID_DELL, 0x" 
				. $modelid->{subdevice} . ",\n" 
				. "\t\t\t\"Unknown Dell\", ${model}),\n" );
		}
	}
	print( "};\n\n" );
}

print <<"EOF";
#endif

EOF

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux