svn commit: r189177 - in projects/jbuild/sys/dev/sound: macio pci pci/hda pcm usb

John Birrell jb at FreeBSD.org
Sat Feb 28 09:54:50 PST 2009


Author: jb
Date: Sat Feb 28 17:54:49 2009
New Revision: 189177
URL: http://svn.freebsd.org/changeset/base/189177

Log:
  MFC

Added:
  projects/jbuild/sys/dev/sound/macio/
     - copied from r189173, head/sys/dev/sound/macio/
Replaced:
  projects/jbuild/sys/dev/sound/usb/uaudio.c
     - copied unchanged from r189173, head/sys/dev/sound/usb/uaudio.c
  projects/jbuild/sys/dev/sound/usb/uaudio.h
     - copied unchanged from r189173, head/sys/dev/sound/usb/uaudio.h
  projects/jbuild/sys/dev/sound/usb/uaudio_pcm.c
     - copied unchanged from r189173, head/sys/dev/sound/usb/uaudio_pcm.c
  projects/jbuild/sys/dev/sound/usb/uaudioreg.h
     - copied unchanged from r189173, head/sys/dev/sound/usb/uaudioreg.h
Deleted:
  projects/jbuild/sys/dev/sound/pci/au88x0.c
  projects/jbuild/sys/dev/sound/pci/au88x0.h
Modified:
  projects/jbuild/sys/dev/sound/pci/cmi.c
  projects/jbuild/sys/dev/sound/pci/ds1.c
  projects/jbuild/sys/dev/sound/pci/envy24.c
  projects/jbuild/sys/dev/sound/pci/envy24ht.c
  projects/jbuild/sys/dev/sound/pci/hda/hdac.c
  projects/jbuild/sys/dev/sound/pci/spicds.c
  projects/jbuild/sys/dev/sound/pcm/dsp.c
  projects/jbuild/sys/dev/sound/pcm/mixer.c
  projects/jbuild/sys/dev/sound/pcm/sound.c
  projects/jbuild/sys/dev/sound/pcm/sound.h

Modified: projects/jbuild/sys/dev/sound/pci/cmi.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pci/cmi.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pci/cmi.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -60,6 +60,7 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define CMI8338B_PCI_ID   0x010113f6
 #define CMI8738_PCI_ID    0x011113f6
 #define CMI8738B_PCI_ID   0x011213f6
+#define CMI120_USB_ID     0x01030d8c
 
 /* Buffer size max is 64k for permitted DMA boundaries */
 #define CMI_DEFAULT_BUFSZ      16384
@@ -916,6 +917,9 @@ cmi_probe(device_t dev)
 	case CMI8738B_PCI_ID:
 		device_set_desc(dev, "CMedia CMI8738B");
 		return BUS_PROBE_DEFAULT;
+	case CMI120_USB_ID:
+	        device_set_desc(dev, "CMedia CMI120");
+	        return BUS_PROBE_DEFAULT;
 	default:
 		return ENXIO;
 	}

Modified: projects/jbuild/sys/dev/sound/pci/ds1.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pci/ds1.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pci/ds1.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -396,7 +396,7 @@ ds_initpbank(volatile struct pbank *pb, 
 	pb->Format |= b16? 0 : 0x80000000;
 	pb->Format |= (stereo && (ch == 2 || ch == 4))? 0x00000001 : 0;
 	pb->LoopDefault = 0;
-	pb->PgBase = base? base : 0;
+	pb->PgBase = base;
 	pb->PgLoop = 0;
 	pb->PgLoopEnd = len >> ss;
 	pb->PgLoopFrac = 0;

Modified: projects/jbuild/sys/dev/sound/pci/envy24.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pci/envy24.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pci/envy24.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -20,7 +20,7 @@
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  */
@@ -278,7 +278,7 @@ static struct cfg_info cfg_table[] = {
 		"Envy24 audio (M Audio Delta Dio 2496)",
 		0x1412, 0xd631,
 		0x10, 0x80, 0xf0, 0x03,
-		0xff, 0x00, 0x00,
+		0x02, 0xc0, 0xfd,
 		0x10, 0x20, 0x40, 0x00, 0x00,
 		0x00,
 		&delta_codec,
@@ -301,6 +301,51 @@ static struct cfg_info cfg_table[] = {
 		0x00,
  		&delta_codec,
  	},
+        {
+                "Envy24 audio (M Audio Delta 66)",
+                0x1412, 0xd632,
+                0x15, 0x80, 0xf0, 0x03,
+                0x02, 0xc0, 0xfd,
+                0x10, 0x20, 0x40, 0x00, 0x00,
+                0x00,
+                &delta_codec,
+        },
+        {
+                "Envy24 audio (M Audio Delta 44)",
+                0x1412, 0xd633,
+                0x15, 0x80, 0xf0, 0x00,
+                0x02, 0xc0, 0xfd,
+                0x10, 0x20, 0x40, 0x00, 0x00,
+                0x00,
+                &delta_codec,
+        },
+        {
+                "Envy24 audio (M Audio Delta 1010)",
+                0x1412, 0xd630,
+                0x1f, 0x80, 0xf0, 0x03,
+                0x22, 0xd0, 0xdd,
+                0x10, 0x20, 0x40, 0x00, 0x00,
+                0x00,
+                &delta_codec,
+        },
+        {
+                "Envy24 audio (M Audio Delta 1010LT)",
+                0x1412, 0xd63b,
+                0x1f, 0x80, 0x72, 0x03,
+                0x04, 0x7e, 0xfb,
+                0x08, 0x02, 0x70, 0x00, 0x00,
+                0x00,
+                &delta_codec,
+        },
+        {
+                "Envy24 audio (Terratec EWX 2496)",
+                0x153b, 0x1130,
+                0x10, 0x80, 0xf0, 0x03,
+                0xc0, 0x3f, 0x3f,
+                0x10, 0x20, 0x01, 0x01, 0x00,
+                0x00,
+                &delta_codec,
+        },
 	{
 		"Envy24 audio (Generic)",
 		0, 0,

Modified: projects/jbuild/sys/dev/sound/pci/envy24ht.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pci/envy24ht.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pci/envy24ht.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -323,7 +323,7 @@ static struct cfg_info cfg_table[] = {
                 0x153b, 0x1150,
                 0x10, 0x80, 0xf0, 0xc3,
                 0x7ffbc7, 0x7fffff, 0x438,
-                0x20, 0x10, 0x400, 0x00, 0x00,
+                0x10, 0x20, 0x400, 0x01, 0x00,
                 0,
                 &spi_codec,
         },
@@ -349,7 +349,7 @@ static struct cfg_info cfg_table[] = {
                 "Envy24HT audio (M-Audio Revolution 7.1)",
                 0x1412, 0x3630,
                 0x43, 0x80, 0xf8, 0xc1,
-                0x3fff85, 0x72, 0x4000fa,
+                0x3fff85, 0x400072, 0x4000fa,
                 0x08, 0x02, 0x20, 0x00, 0x04,
                 0,
                 &spi_codec,
@@ -358,7 +358,7 @@ static struct cfg_info cfg_table[] = {
                 "Envy24GT audio (M-Audio Revolution 5.1)",
                 0x1412, 0x3631,
                 0x42, 0x80, 0xf8, 0xc1,
-                0x3fff85, 0x72, 0x4000fa,
+                0x3fff05, 0x4000f0, 0x4000fa,
                 0x08, 0x02, 0x10, 0x00, 0x03,
                 0,
                 &spi_codec,
@@ -391,6 +391,15 @@ static struct cfg_info cfg_table[] = {
                 &spi_codec,
         },
 	{
+                "Envy24HT-S audio (Terrasoniq TS22PCI)",
+                0x153b, 0x117b,
+                0x10, 0x80, 0xf0, 0xc3,
+                0x7ffbc7, 0x7fffff, 0x438,
+                0x10, 0x20, 0x400, 0x01, 0x00,
+                0,
+                &spi_codec,
+	},
+	{
 		"Envy24HT audio (Generic)",
 		0, 0,
 		0x0b, 0x80, 0xfc, 0xc3,

Modified: projects/jbuild/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pci/hda/hdac.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pci/hda/hdac.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -83,7 +83,7 @@
 
 #include "mixer_if.h"
 
-#define HDA_DRV_TEST_REV	"20081226_0122"
+#define HDA_DRV_TEST_REV	"20090226_0129"
 
 SND_DECLARE_FILE("$FreeBSD$");
 
@@ -109,12 +109,6 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define hdac_lockassert(sc)	snd_mtxassert((sc)->lock)
 #define hdac_lockowned(sc)	mtx_owned((sc)->lock)
 
-#undef HDAC_MSI_ENABLED
-#if __FreeBSD_version >= 700026 ||					\
-    (__FreeBSD_version < 700000 && __FreeBSD_version >= 602106)
-#define HDAC_MSI_ENABLED	1
-#endif
-
 #define HDA_FLAG_MATCH(fl, v)	(((fl) & (v)) == (v))
 #define HDA_DEV_MATCH(fl, v)	((fl) == (v) || \
 				(fl) == 0xffffffff || \
@@ -149,6 +143,7 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define HDA_INTEL_82801H	HDA_MODEL_CONSTRUCT(INTEL, 0x284b)
 #define HDA_INTEL_82801I	HDA_MODEL_CONSTRUCT(INTEL, 0x293e)
 #define HDA_INTEL_82801J	HDA_MODEL_CONSTRUCT(INTEL, 0x3a3e)
+#define HDA_INTEL_PCH		HDA_MODEL_CONSTRUCT(INTEL, 0x3b56)
 #define HDA_INTEL_SCH		HDA_MODEL_CONSTRUCT(INTEL, 0x811b)
 #define HDA_INTEL_ALL		HDA_MODEL_CONSTRUCT(INTEL, 0xffff)
 
@@ -178,6 +173,19 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define ATI_VENDORID		0x1002
 #define HDA_ATI_SB450		HDA_MODEL_CONSTRUCT(ATI, 0x437b)
 #define HDA_ATI_SB600		HDA_MODEL_CONSTRUCT(ATI, 0x4383)
+#define HDA_ATI_RS600		HDA_MODEL_CONSTRUCT(ATI, 0x793b)
+#define HDA_ATI_RS690		HDA_MODEL_CONSTRUCT(ATI, 0x7919)
+#define HDA_ATI_RS780		HDA_MODEL_CONSTRUCT(ATI, 0x960f)
+#define HDA_ATI_R600		HDA_MODEL_CONSTRUCT(ATI, 0xaa00)
+#define HDA_ATI_RV630		HDA_MODEL_CONSTRUCT(ATI, 0xaa08)
+#define HDA_ATI_RV610		HDA_MODEL_CONSTRUCT(ATI, 0xaa10)
+#define HDA_ATI_RV670		HDA_MODEL_CONSTRUCT(ATI, 0xaa18)
+#define HDA_ATI_RV635		HDA_MODEL_CONSTRUCT(ATI, 0xaa20)
+#define HDA_ATI_RV620		HDA_MODEL_CONSTRUCT(ATI, 0xaa28)
+#define HDA_ATI_RV770		HDA_MODEL_CONSTRUCT(ATI, 0xaa30)
+#define HDA_ATI_RV730		HDA_MODEL_CONSTRUCT(ATI, 0xaa38)
+#define HDA_ATI_RV710		HDA_MODEL_CONSTRUCT(ATI, 0xaa40)
+#define HDA_ATI_RV740		HDA_MODEL_CONSTRUCT(ATI, 0xaa48)
 #define HDA_ATI_ALL		HDA_MODEL_CONSTRUCT(ATI, 0xffff)
 
 /* VIA */
@@ -459,40 +467,56 @@ static uint32_t hdac_fmt[] = {
 
 static struct pcmchan_caps hdac_caps = {48000, 48000, hdac_fmt, 0};
 
+#define HDAC_NO_MSI	1
+
 static const struct {
 	uint32_t	model;
 	char		*desc;
+	char		flags;
 } hdac_devices[] = {
-	{ HDA_INTEL_82801F,  "Intel 82801F" },
-	{ HDA_INTEL_63XXESB, "Intel 631x/632xESB" },
-	{ HDA_INTEL_82801G,  "Intel 82801G" },
-	{ HDA_INTEL_82801H,  "Intel 82801H" },
-	{ HDA_INTEL_82801I,  "Intel 82801I" },
-	{ HDA_INTEL_82801J,  "Intel 82801J" },
-	{ HDA_INTEL_SCH,     "Intel SCH" },
-	{ HDA_NVIDIA_MCP51,  "NVidia MCP51" },
-	{ HDA_NVIDIA_MCP55,  "NVidia MCP55" },
-	{ HDA_NVIDIA_MCP61_1, "NVidia MCP61" },
-	{ HDA_NVIDIA_MCP61_2, "NVidia MCP61" },
-	{ HDA_NVIDIA_MCP65_1, "NVidia MCP65" },
-	{ HDA_NVIDIA_MCP65_2, "NVidia MCP65" },
-	{ HDA_NVIDIA_MCP67_1, "NVidia MCP67" },
-	{ HDA_NVIDIA_MCP67_2, "NVidia MCP67" },
-	{ HDA_NVIDIA_MCP73_1, "NVidia MCP73" },
-	{ HDA_NVIDIA_MCP73_2, "NVidia MCP73" },
-	{ HDA_NVIDIA_MCP78_1, "NVidia MCP78" },
-	{ HDA_NVIDIA_MCP78_2, "NVidia MCP78" },
-	{ HDA_NVIDIA_MCP78_3, "NVidia MCP78" },
-	{ HDA_NVIDIA_MCP78_4, "NVidia MCP78" },
-	{ HDA_NVIDIA_MCP79_1, "NVidia MCP79" },
-	{ HDA_NVIDIA_MCP79_2, "NVidia MCP79" },
-	{ HDA_NVIDIA_MCP79_3, "NVidia MCP79" },
-	{ HDA_NVIDIA_MCP79_4, "NVidia MCP79" },
-	{ HDA_ATI_SB450,     "ATI SB450"    },
-	{ HDA_ATI_SB600,     "ATI SB600"    },
-	{ HDA_VIA_VT82XX,    "VIA VT8251/8237A" },
-	{ HDA_SIS_966,       "SiS 966" },
-	{ HDA_ULI_M5461,     "ULI M5461" },
+	{ HDA_INTEL_82801F,  "Intel 82801F",	0 },
+	{ HDA_INTEL_63XXESB, "Intel 631x/632xESB",	0 },
+	{ HDA_INTEL_82801G,  "Intel 82801G",	0 },
+	{ HDA_INTEL_82801H,  "Intel 82801H",	0 },
+	{ HDA_INTEL_82801I,  "Intel 82801I",	0 },
+	{ HDA_INTEL_82801J,  "Intel 82801J",	0 },
+	{ HDA_INTEL_PCH,     "Intel PCH",	0 },
+	{ HDA_INTEL_SCH,     "Intel SCH",	0 },
+	{ HDA_NVIDIA_MCP51,  "NVidia MCP51",	HDAC_NO_MSI },
+	{ HDA_NVIDIA_MCP55,  "NVidia MCP55",	0 },
+	{ HDA_NVIDIA_MCP61_1, "NVidia MCP61",	0 },
+	{ HDA_NVIDIA_MCP61_2, "NVidia MCP61",	0 },
+	{ HDA_NVIDIA_MCP65_1, "NVidia MCP65",	0 },
+	{ HDA_NVIDIA_MCP65_2, "NVidia MCP65",	0 },
+	{ HDA_NVIDIA_MCP67_1, "NVidia MCP67",	0 },
+	{ HDA_NVIDIA_MCP67_2, "NVidia MCP67",	0 },
+	{ HDA_NVIDIA_MCP73_1, "NVidia MCP73",	0 },
+	{ HDA_NVIDIA_MCP73_2, "NVidia MCP73",	0 },
+	{ HDA_NVIDIA_MCP78_1, "NVidia MCP78",	0 },
+	{ HDA_NVIDIA_MCP78_2, "NVidia MCP78",	0 },
+	{ HDA_NVIDIA_MCP78_3, "NVidia MCP78",	0 },
+	{ HDA_NVIDIA_MCP78_4, "NVidia MCP78",	0 },
+	{ HDA_NVIDIA_MCP79_1, "NVidia MCP79",	0 },
+	{ HDA_NVIDIA_MCP79_2, "NVidia MCP79",	0 },
+	{ HDA_NVIDIA_MCP79_3, "NVidia MCP79",	0 },
+	{ HDA_NVIDIA_MCP79_4, "NVidia MCP79",	0 },
+	{ HDA_ATI_SB450,     "ATI SB450",	0 },
+	{ HDA_ATI_SB600,     "ATI SB600",	0 },
+	{ HDA_ATI_RS600,     "ATI RS600",	0 },
+	{ HDA_ATI_RS690,     "ATI RS690",	0 },
+	{ HDA_ATI_RS780,     "ATI RS780",	0 },
+	{ HDA_ATI_R600,      "ATI R600",	0 },
+	{ HDA_ATI_RV610,     "ATI RV610",	0 },
+	{ HDA_ATI_RV620,     "ATI RV620",	0 },
+	{ HDA_ATI_RV630,     "ATI RV630",	0 },
+	{ HDA_ATI_RV635,     "ATI RV635",	0 },
+	{ HDA_ATI_RV710,     "ATI RV710",	0 },
+	{ HDA_ATI_RV730,     "ATI RV730",	0 },
+	{ HDA_ATI_RV740,     "ATI RV740",	0 },
+	{ HDA_ATI_RV770,     "ATI RV770",	0 },
+	{ HDA_VIA_VT82XX,    "VIA VT8251/8237A",0 },
+	{ HDA_SIS_966,       "SiS 966",		0 },
+	{ HDA_ULI_M5461,     "ULI M5461",	0 },
 	/* Unknown */
 	{ HDA_INTEL_ALL,  "Intel (Unknown)"  },
 	{ HDA_NVIDIA_ALL, "NVidia (Unknown)" },
@@ -671,6 +695,7 @@ static const struct {
 
 /* Silicon Image */
 #define SII_VENDORID	0x1095
+#define HDA_CODEC_SII1390	HDA_CODEC_CONSTRUCT(SII, 0x1390)
 #define HDA_CODEC_SII1392	HDA_CODEC_CONSTRUCT(SII, 0x1392)
 #define HDA_CODEC_SIIXXXX	HDA_CODEC_CONSTRUCT(SII, 0xffff)
 
@@ -706,6 +731,22 @@ static const struct {
 #define HDA_CODEC_VT1708B_5	HDA_CODEC_CONSTRUCT(VIA, 0xe725)
 #define HDA_CODEC_VT1708B_6	HDA_CODEC_CONSTRUCT(VIA, 0xe726)
 #define HDA_CODEC_VT1708B_7	HDA_CODEC_CONSTRUCT(VIA, 0xe727)
+#define HDA_CODEC_VT1708S_0	HDA_CODEC_CONSTRUCT(VIA, 0x0397)
+#define HDA_CODEC_VT1708S_1	HDA_CODEC_CONSTRUCT(VIA, 0x1397)
+#define HDA_CODEC_VT1708S_2	HDA_CODEC_CONSTRUCT(VIA, 0x2397)
+#define HDA_CODEC_VT1708S_3	HDA_CODEC_CONSTRUCT(VIA, 0x3397)
+#define HDA_CODEC_VT1708S_4	HDA_CODEC_CONSTRUCT(VIA, 0x4397)
+#define HDA_CODEC_VT1708S_5	HDA_CODEC_CONSTRUCT(VIA, 0x5397)
+#define HDA_CODEC_VT1708S_6	HDA_CODEC_CONSTRUCT(VIA, 0x6397)
+#define HDA_CODEC_VT1708S_7	HDA_CODEC_CONSTRUCT(VIA, 0x7397)
+#define HDA_CODEC_VT1702_0	HDA_CODEC_CONSTRUCT(VIA, 0x0398)
+#define HDA_CODEC_VT1702_1	HDA_CODEC_CONSTRUCT(VIA, 0x1398)
+#define HDA_CODEC_VT1702_2	HDA_CODEC_CONSTRUCT(VIA, 0x2398)
+#define HDA_CODEC_VT1702_3	HDA_CODEC_CONSTRUCT(VIA, 0x3398)
+#define HDA_CODEC_VT1702_4	HDA_CODEC_CONSTRUCT(VIA, 0x4398)
+#define HDA_CODEC_VT1702_5	HDA_CODEC_CONSTRUCT(VIA, 0x5398)
+#define HDA_CODEC_VT1702_6	HDA_CODEC_CONSTRUCT(VIA, 0x6398)
+#define HDA_CODEC_VT1702_7	HDA_CODEC_CONSTRUCT(VIA, 0x7398)
 #define HDA_CODEC_VTXXXX	HDA_CODEC_CONSTRUCT(VIA, 0xffff)
 
 /* ATI */
@@ -716,9 +757,18 @@ static const struct {
 #define HDA_CODEC_ATIXXXX	HDA_CODEC_CONSTRUCT(ATI, 0xffff)
 
 /* NVIDIA */
+#define HDA_CODEC_NVIDIAMCP78	HDA_CODEC_CONSTRUCT(NVIDIA, 0x0002)
+#define HDA_CODEC_NVIDIAMCP78_2	HDA_CODEC_CONSTRUCT(NVIDIA, 0x0006)
+#define HDA_CODEC_NVIDIAMCP7A	HDA_CODEC_CONSTRUCT(NVIDIA, 0x0007)
+#define HDA_CODEC_NVIDIAMCP67	HDA_CODEC_CONSTRUCT(NVIDIA, 0x0067)
+#define HDA_CODEC_NVIDIAMCP73	HDA_CODEC_CONSTRUCT(NVIDIA, 0x8001)
 #define HDA_CODEC_NVIDIAXXXX	HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff)
 
 /* INTEL */
+#define HDA_CODEC_INTELG45_1	HDA_CODEC_CONSTRUCT(INTEL, 0x2801)
+#define HDA_CODEC_INTELG45_2	HDA_CODEC_CONSTRUCT(INTEL, 0x2802)
+#define HDA_CODEC_INTELG45_3	HDA_CODEC_CONSTRUCT(INTEL, 0x2803)
+#define HDA_CODEC_INTELG45_4	HDA_CODEC_CONSTRUCT(INTEL, 0x29fb)
 #define HDA_CODEC_INTELXXXX	HDA_CODEC_CONSTRUCT(INTEL, 0xffff)
 
 /* Codecs */
@@ -833,10 +883,36 @@ static const struct {
 	{ HDA_CODEC_VT1708B_5, "VIA VT1708B_5" },
 	{ HDA_CODEC_VT1708B_6, "VIA VT1708B_6" },
 	{ HDA_CODEC_VT1708B_7, "VIA VT1708B_7" },
+	{ HDA_CODEC_VT1708S_0, "VIA VT1708S_0" },
+	{ HDA_CODEC_VT1708S_1, "VIA VT1708S_1" },
+	{ HDA_CODEC_VT1708S_2, "VIA VT1708S_2" },
+	{ HDA_CODEC_VT1708S_3, "VIA VT1708S_3" },
+	{ HDA_CODEC_VT1708S_4, "VIA VT1708S_4" },
+	{ HDA_CODEC_VT1708S_5, "VIA VT1708S_5" },
+	{ HDA_CODEC_VT1708S_6, "VIA VT1708S_6" },
+	{ HDA_CODEC_VT1708S_7, "VIA VT1708S_7" },
+	{ HDA_CODEC_VT1702_0, "VIA VT1702_0" },
+	{ HDA_CODEC_VT1702_1, "VIA VT1702_1" },
+	{ HDA_CODEC_VT1702_2, "VIA VT1702_2" },
+	{ HDA_CODEC_VT1702_3, "VIA VT1702_3" },
+	{ HDA_CODEC_VT1702_4, "VIA VT1702_4" },
+	{ HDA_CODEC_VT1702_5, "VIA VT1702_5" },
+	{ HDA_CODEC_VT1702_6, "VIA VT1702_6" },
+	{ HDA_CODEC_VT1702_7, "VIA VT1702_7" },
 	{ HDA_CODEC_ATIRS600_1,"ATI RS600 HDMI" },
 	{ HDA_CODEC_ATIRS600_2,"ATI RS600 HDMI" },
 	{ HDA_CODEC_ATIRS690,  "ATI RS690/780 HDMI" },
 	{ HDA_CODEC_ATIR6XX,   "ATI R6xx HDMI" },
+	{ HDA_CODEC_NVIDIAMCP67, "NVidia MCP67 HDMI" },
+	{ HDA_CODEC_NVIDIAMCP73, "NVidia MCP73 HDMI" },
+	{ HDA_CODEC_NVIDIAMCP78, "NVidia MCP78 HDMI" },
+	{ HDA_CODEC_NVIDIAMCP78_2, "NVidia MCP78 HDMI" },
+	{ HDA_CODEC_NVIDIAMCP7A, "NVidia MCP7A HDMI" },
+	{ HDA_CODEC_INTELG45_1, "Intel G45 HDMI" },
+	{ HDA_CODEC_INTELG45_2, "Intel G45 HDMI" },
+	{ HDA_CODEC_INTELG45_3, "Intel G45 HDMI" },
+	{ HDA_CODEC_INTELG45_4, "Intel G45 HDMI" },
+	{ HDA_CODEC_SII1390,   "Silicon Image SiI1390 HDMI" },
 	{ HDA_CODEC_SII1392,   "Silicon Image SiI1392 HDMI" },
 	/* Unknown codec */
 	{ HDA_CODEC_ALCXXXX,   "Realtek (Unknown)" },
@@ -1671,13 +1747,11 @@ hdac_irq_alloc(struct hdac_softc *sc)
 	irq = &sc->irq;
 	irq->irq_rid = 0x0;
 
-#ifdef HDAC_MSI_ENABLED
 	if ((sc->flags & HDAC_F_MSI) &&
 	    (result = pci_msi_count(sc->dev)) == 1 &&
 	    pci_alloc_msi(sc->dev, &result) == 0)
 		irq->irq_rid = 0x1;
 	else
-#endif
 		sc->flags &= ~HDAC_F_MSI;
 
 	irq->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ,
@@ -1720,10 +1794,8 @@ hdac_irq_free(struct hdac_softc *sc)
 	if (irq->irq_res != NULL)
 		bus_release_resource(sc->dev, SYS_RES_IRQ, irq->irq_rid,
 		    irq->irq_res);
-#ifdef HDAC_MSI_ENABLED
-	if ((sc->flags & HDAC_F_MSI) && irq->irq_rid == 0x1)
+	if (irq->irq_rid == 0x1)
 		pci_release_msi(sc->dev);
-#endif
 	irq->irq_handle = NULL;
 	irq->irq_res = NULL;
 	irq->irq_rid = 0x0;
@@ -2443,9 +2515,10 @@ hdac_widget_pin_parse(struct hdac_widget
 {
 	struct hdac_softc *sc = w->devinfo->codec->sc;
 	uint32_t config, pincap;
-	const char *devstr, *connstr;
+	const char *devstr;
 	nid_t cad = w->devinfo->codec->cad;
 	nid_t nid = w->nid;
+	int conn, color;
 
 	config = hdac_widget_pin_getconfig(w);
 	w->wclass.pin.config = config;
@@ -2467,13 +2540,19 @@ hdac_widget_pin_parse(struct hdac_widget
 	devstr = HDA_DEVS[(config & HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) >>
 	    HDA_CONFIG_DEFAULTCONF_DEVICE_SHIFT];
 
-	connstr = HDA_CONNS[(config & HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK) >>
-	    HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT];
+	conn = (config & HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK) >>
+	    HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT;
+	color = (config & HDA_CONFIG_DEFAULTCONF_COLOR_MASK) >>
+	    HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT;
 
 	strlcat(w->name, ": ", sizeof(w->name));
 	strlcat(w->name, devstr, sizeof(w->name));
 	strlcat(w->name, " (", sizeof(w->name));
-	strlcat(w->name, connstr, sizeof(w->name));
+	if (conn == 0 && color != 0 && color != 15) {
+		strlcat(w->name, HDA_COLORS[color], sizeof(w->name));
+		strlcat(w->name, " ", sizeof(w->name));
+	}
+	strlcat(w->name, HDA_CONNS[conn], sizeof(w->name));
 	strlcat(w->name, ")", sizeof(w->name));
 }
 
@@ -2499,8 +2578,15 @@ hdac_widget_getcaps(struct hdac_widget *
 	   Change beeper pin node type to beeper to help parser. */
 	*waspin = 0;
 	switch (id) {
+	case HDA_CODEC_AD1882:
+	case HDA_CODEC_AD1883:
+	case HDA_CODEC_AD1984:
+	case HDA_CODEC_AD1984A:
+	case HDA_CODEC_AD1984B:
+	case HDA_CODEC_AD1987:
 	case HDA_CODEC_AD1988:
 	case HDA_CODEC_AD1988B:
+	case HDA_CODEC_AD1989B:
 		beeper = 26;
 		break;
 	case HDA_CODEC_ALC260:
@@ -3895,12 +3981,32 @@ hdac_attach(device_t dev)
 {
 	struct hdac_softc *sc;
 	int result;
-	int i;
+	int i, devid = -1;
+	uint32_t model;
+	uint16_t class, subclass;
 	uint16_t vendor;
 	uint8_t v;
 
 	device_printf(dev, "HDA Driver Revision: %s\n", HDA_DRV_TEST_REV);
 
+	model = (uint32_t)pci_get_device(dev) << 16;
+	model |= (uint32_t)pci_get_vendor(dev) & 0x0000ffff;
+	class = pci_get_class(dev);
+	subclass = pci_get_subclass(dev);
+
+	for (i = 0; i < HDAC_DEVICES_LEN; i++) {
+		if (hdac_devices[i].model == model) {
+			devid = i;
+			break;
+		}
+		if (HDA_DEV_MATCH(hdac_devices[i].model, model) &&
+		    class == PCIC_MULTIMEDIA &&
+		    subclass == PCIS_MULTIMEDIA_HDA) {
+			devid = i;
+			break;
+		}
+	}
+
 	sc = device_get_softc(dev);
 	sc->lock = snd_mtxcreate(device_get_nameunit(dev), HDAC_MTX_NAME);
 	sc->dev = dev;
@@ -3966,14 +4072,17 @@ hdac_attach(device_t dev)
 		);
 	}
 
-#ifdef HDAC_MSI_ENABLED
-	if (resource_int_value(device_get_name(dev),
-	    device_get_unit(dev), "msi", &i) == 0 && i != 0 &&
-	    pci_msi_count(dev) == 1)
-		sc->flags |= HDAC_F_MSI;
-	else
-#endif
+	if (devid >= 0 && (hdac_devices[devid].flags & HDAC_NO_MSI))
 		sc->flags &= ~HDAC_F_MSI;
+	else
+		sc->flags |= HDAC_F_MSI;
+	if (resource_int_value(device_get_name(dev),
+	    device_get_unit(dev), "msi", &i) == 0) {
+		if (i == 0)
+			sc->flags &= ~HDAC_F_MSI;
+		else
+			sc->flags |= HDAC_F_MSI;
+	}
 
 #if defined(__i386__) || defined(__amd64__)
 	sc->flags |= HDAC_F_DMA_NOCACHE;
@@ -4567,6 +4676,33 @@ hdac_vendor_patch_parse(struct hdac_devi
 		 * nid: 26 = Line-in, leave it alone.
 		 */
 		break;
+	case HDA_CODEC_AD1983:
+		/*
+		 * This codec has several possible usages, but none
+		 * fit the parser best. Help parser to choose better.
+		 */
+		/* Disable direct unmixed playback to get pcm volume. */
+		w = hdac_widget_get(devinfo, 5);
+		if (w != NULL)
+			w->connsenable[0] = 0;
+		w = hdac_widget_get(devinfo, 6);
+		if (w != NULL)
+			w->connsenable[0] = 0;
+		w = hdac_widget_get(devinfo, 11);
+		if (w != NULL)
+			w->connsenable[0] = 0;
+		/* Disable mic and line selectors. */
+		w = hdac_widget_get(devinfo, 12);
+		if (w != NULL)
+			w->connsenable[1] = 0;
+		w = hdac_widget_get(devinfo, 13);
+		if (w != NULL)
+			w->connsenable[1] = 0;
+		/* Disable recording from mono playback mix. */
+		w = hdac_widget_get(devinfo, 20);
+		if (w != NULL)
+			w->connsenable[3] = 0;
+		break;
 	case HDA_CODEC_AD1986A:
 		/*
 		 * This codec has overcomplicated input mixing.
@@ -4861,7 +4997,7 @@ hdac_audio_trace_as_out(struct hdac_devi
 	/* Find next pin */
 	for (i = seq; i < 16 && ases[as].pins[i] == 0; i++)
 		;
-	/* Check if there is no any left. If so - we succeded. */
+	/* Check if there is no any left. If so - we succeeded. */
 	if (i == 16)
 		return (1);
 	
@@ -4907,7 +5043,7 @@ hdac_audio_trace_as_out(struct hdac_devi
 		hdac_audio_trace_dac(devinfo, as, i,
 		    ases[as].pins[i], hpredir, min, res, 0);
 		ases[as].dacs[i] = res;
-		/* We succeded, so call next. */
+		/* We succeeded, so call next. */
 		if (hdac_audio_trace_as_out(devinfo, as, i + 1))
 			return (1);
 		/* If next failed, we should retry with next min */
@@ -5472,7 +5608,7 @@ hdac_audio_disable_crossas(struct hdac_d
 	struct hdac_audio_ctl *ctl;
 	int i, j;
 
-	/* Disable crossassociatement connections. */
+	/* Disable crossassociatement and unwanted crosschannel connections. */
 	/* ... using selectors */
 	for (i = devinfo->startnode; i < devinfo->endnode; i++) {
 		w = hdac_widget_get(devinfo, i);
@@ -5490,7 +5626,10 @@ hdac_audio_disable_crossas(struct hdac_d
 			cw = hdac_widget_get(devinfo, w->conns[j]);
 			if (cw == NULL || w->enable == 0)
 				continue;
-			if (w->bindas == cw->bindas || cw->bindas == -2)
+			if (cw->bindas == -2)
+				continue;
+			if (w->bindas == cw->bindas &&
+			    (w->bindseqmask & cw->bindseqmask) != 0)
 				continue;
 			w->connsenable[j] = 0;
 			HDA_BOOTHVERBOSE(
@@ -5509,7 +5648,8 @@ hdac_audio_disable_crossas(struct hdac_d
 		if (ctl->widget->bindas == -2 ||
 		    ctl->childwidget->bindas == -2)
 			continue;
-		if (ctl->widget->bindas != ctl->childwidget->bindas) {
+		if (ctl->widget->bindas != ctl->childwidget->bindas ||
+		    (ctl->widget->bindseqmask & ctl->childwidget->bindseqmask) == 0) {
 			ctl->forcemute = 1;
 			ctl->muted = HDA_AMP_MUTE_ALL;
 			ctl->left = 0;
@@ -5878,7 +6018,7 @@ retry:
 		if (res) {
 			HDA_BOOTVERBOSE(
 				device_printf(devinfo->codec->sc->dev,
-				    "Association %d (%d) trace succeded\n",
+				    "Association %d (%d) trace succeeded\n",
 				    j, as[j].index);
 			);
 		} else {
@@ -6025,6 +6165,29 @@ hdac_audio_prepare_pin_ctrl(struct hdac_
 }
 
 static void
+hdac_audio_ctl_commit(struct hdac_devinfo *devinfo)
+{
+	struct hdac_audio_ctl *ctl;
+	int i, z;
+
+	i = 0;
+	while ((ctl = hdac_audio_ctl_each(devinfo, &i)) != NULL) {
+		if (ctl->enable == 0 || ctl->ossmask != 0) {
+			/* Mute disabled and mixer controllable controls.
+			 * Last will be initialized by mixer_init().
+			 * This expected to reduce click on startup. */
+			hdac_audio_ctl_amp_set(ctl, HDA_AMP_MUTE_ALL, 0, 0);
+			continue;
+		}
+		/* Init fixed controls to 0dB amplification. */
+		z = ctl->offset;
+		if (z > ctl->step)
+			z = ctl->step;
+		hdac_audio_ctl_amp_set(ctl, HDA_AMP_MUTE_NONE, z, z);
+	}
+}
+
+static void
 hdac_audio_commit(struct hdac_devinfo *devinfo)
 {
 	struct hdac_softc *sc = devinfo->codec->sc;
@@ -6040,11 +6203,41 @@ hdac_audio_commit(struct hdac_devinfo *d
 		hdac_command(sc, HDA_CMD_12BIT(cad, devinfo->nid,
 		    0x7e7, 0), cad);
 
+	/* Commit controls. */
+	hdac_audio_ctl_commit(devinfo);
+	
+	/* Commit selectors, pins and EAPD. */
+	for (i = 0; i < devinfo->nodecnt; i++) {
+		w = &devinfo->widget[i];
+		if (w == NULL)
+			continue;
+		if (w->selconn == -1)
+			w->selconn = 0;
+		if (w->nconns > 0)
+			hdac_widget_connection_select(w, w->selconn);
+		if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) {
+			hdac_command(sc,
+			    HDA_CMD_SET_PIN_WIDGET_CTRL(cad, w->nid,
+			    w->wclass.pin.ctrl), cad);
+		}
+		if (w->param.eapdbtl != HDAC_INVALID) {
+		    	uint32_t val;
+
+			val = w->param.eapdbtl;
+			if (devinfo->function.audio.quirks &
+			    HDA_QUIRK_EAPDINV)
+				val ^= HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD;
+			hdac_command(sc,
+			    HDA_CMD_SET_EAPD_BTL_ENABLE(cad, w->nid,
+			    val), cad);
+		}
+	}
+
+	/* Commit GPIOs. */
 	gdata = 0;
 	gmask = 0;
 	gdir = 0;
 	commitgpio = 0;
-
 	numgpio = HDA_PARAM_GPIO_COUNT_NUM_GPIO(
 	    devinfo->function.audio.gpio);
 
@@ -6099,54 +6292,6 @@ hdac_audio_commit(struct hdac_devinfo *d
 		    HDA_CMD_SET_GPIO_DATA(cad, devinfo->nid,
 		    gdata), cad);
 	}
-
-	for (i = 0; i < devinfo->nodecnt; i++) {
-		w = &devinfo->widget[i];
-		if (w == NULL)
-			continue;
-		if (w->selconn == -1)
-			w->selconn = 0;
-		if (w->nconns > 0)
-			hdac_widget_connection_select(w, w->selconn);
-		if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) {
-			hdac_command(sc,
-			    HDA_CMD_SET_PIN_WIDGET_CTRL(cad, w->nid,
-			    w->wclass.pin.ctrl), cad);
-		}
-		if (w->param.eapdbtl != HDAC_INVALID) {
-		    	uint32_t val;
-
-			val = w->param.eapdbtl;
-			if (devinfo->function.audio.quirks &
-			    HDA_QUIRK_EAPDINV)
-				val ^= HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD;
-			hdac_command(sc,
-			    HDA_CMD_SET_EAPD_BTL_ENABLE(cad, w->nid,
-			    val), cad);
-
-		}
-	}
-}
-
-static void
-hdac_audio_ctl_commit(struct hdac_devinfo *devinfo)
-{
-	struct hdac_audio_ctl *ctl;
-	int i, z;
-
-	i = 0;
-	while ((ctl = hdac_audio_ctl_each(devinfo, &i)) != NULL) {
-		if (ctl->enable == 0) {
-			/* Mute disabled controls. */
-			hdac_audio_ctl_amp_set(ctl, HDA_AMP_MUTE_ALL, 0, 0);
-			continue;
-		}
-		/* Init controls to 0dB amplification. */
-		z = ctl->offset;
-		if (z > ctl->step)
-			z = ctl->step;
-		hdac_audio_ctl_amp_set(ctl, HDA_AMP_MUTE_NONE, z, z);
-	}
 }
 
 static void
@@ -6977,7 +7122,7 @@ hdac_config_fetch(struct hdac_softc *sc,
 			    hdac_quirks_tab[k].key, len - inv) != 0)
 				continue;
 			if (len - inv != strlen(hdac_quirks_tab[k].key))
-				break;
+				continue;
 			HDA_BOOTVERBOSE(
 				printf(" %s%s", (inv != 0) ? "no" : "",
 				    hdac_quirks_tab[k].key);
@@ -7391,10 +7536,6 @@ hdac_attach2(void *arg)
 		    	);
 			hdac_audio_commit(devinfo);
 		    	HDA_BOOTHVERBOSE(
-				device_printf(sc->dev, "Ctls commit...\n");
-			);
-			hdac_audio_ctl_commit(devinfo);
-		    	HDA_BOOTHVERBOSE(
 				device_printf(sc->dev, "HP switch init...\n");
 			);
 			hdac_hp_switch_init(devinfo);
@@ -7644,10 +7785,6 @@ hdac_resume(device_t dev)
 		    	);
 			hdac_audio_commit(devinfo);
 		    	HDA_BOOTHVERBOSE(
-				device_printf(dev, "Ctls commit...\n");
-			);
-			hdac_audio_ctl_commit(devinfo);
-		    	HDA_BOOTHVERBOSE(
 				device_printf(dev, "HP switch init...\n");
 			);
 			hdac_hp_switch_init(devinfo);

Modified: projects/jbuild/sys/dev/sound/pci/spicds.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pci/spicds.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pci/spicds.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -234,7 +234,7 @@ spicds_init(struct spicds_info *codec)
 	if (codec->type == SPICDS_TYPE_AK4358) 
 	spicds_wrcd(codec, 0x00, 0x07);		/* I2S, 24bit, power-up */
 	if (codec->type == SPICDS_TYPE_AK4381)
-	spicds_wrcd(codec, 0x00, 0x0f);		/* I2S, 24bit, power-up */
+	spicds_wrcd(codec, 0x00, 0x8f);		/* I2S, 24bit, power-up */
 	if (codec->type == SPICDS_TYPE_AK4396)
 	spicds_wrcd(codec, 0x00, 0x07);		/* I2S, 24bit, power-up */
 	snd_mtxunlock(codec->lock);
@@ -296,7 +296,8 @@ spicds_set(struct spicds_info *codec, in
 		case SPICDS_TYPE_WM8770:
                         right = right + 27;
 			break;
-		case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:
+		case SPICDS_TYPE_AK4381: 
+		case SPICDS_TYPE_AK4396:
 			right = right * 255 / 100;
 			break;
                 default:   

Modified: projects/jbuild/sys/dev/sound/pcm/dsp.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pcm/dsp.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pcm/dsp.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -814,7 +814,12 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd
 		case SNDCTL_SYSINFO:
 			sound_oss_sysinfo((oss_sysinfo *)arg);
 			break;
+		case SNDCTL_CARDINFO:
+			ret = sound_oss_card_info((oss_card_info *)arg);
+			break;
 		case SNDCTL_AUDIOINFO:
+		case SNDCTL_AUDIOINFO_EX:
+		case SNDCTL_ENGINEINFO:
 			ret = dsp_oss_audioinfo(i_dev, (oss_audioinfo *)arg);
 			break;
 		case SNDCTL_MIXERINFO:
@@ -1370,9 +1375,9 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd
 
     	case SNDCTL_DSP_GETCAPS:
 		pcm_lock(d);
-		*arg_i = DSP_CAP_REALTIME | DSP_CAP_MMAP | DSP_CAP_TRIGGER;
+		*arg_i = PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER;
 		if (rdch && wrch && !(dsp_get_flags(i_dev) & SD_F_SIMPLEX))
-			*arg_i |= DSP_CAP_DUPLEX;
+			*arg_i |= PCM_CAP_DUPLEX;
 		pcm_unlock(d);
 		break;
 
@@ -1770,18 +1775,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd
 		break;
 #if 0
 	/**
-	 * @note The SNDCTL_CARDINFO ioctl was omitted per 4Front developer
-	 * documentation.  "The usability of this call is very limited. It's
-	 * provided only for completeness of the API. OSS API doesn't have
-	 * any concept of card. Any information returned by this ioctl calld
-	 * is reserved exclusively for the utility programs included in the
-	 * OSS package. Applications should not try to use for this
-	 * information in any ways."
-	 */
-	case SNDCTL_CARDINFO:
-		ret = EINVAL;
-		break;
-	/**
 	 * @note The S/PDIF interface ioctls, @c SNDCTL_DSP_READCTL and
 	 * @c SNDCTL_DSP_WRITECTL have been omitted at the suggestion of
 	 * 4Front Technologies.
@@ -2282,13 +2275,14 @@ dsp_oss_audioinfo(struct cdev *i_dev, os
 			/*
 			 * These flags stolen from SNDCTL_DSP_GETCAPS handler.
 			 * Note, however, that a single channel operates in
-			 * only one direction, so DSP_CAP_DUPLEX is out.
+			 * only one direction, so PCM_CAP_DUPLEX is out.
 			 */
 			/**
 			 * @todo @c SNDCTL_AUDIOINFO::caps - Make drivers keep
 			 *       these in pcmchan::caps?
 			 */
-			ai->caps = DSP_CAP_REALTIME | DSP_CAP_MMAP | DSP_CAP_TRIGGER;
+			ai->caps = PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER |
+			    ((ch->direction == PCMDIR_PLAY) ? PCM_CAP_OUTPUT : PCM_CAP_INPUT);
 
 			/*
 			 * Collect formats supported @b natively by the
@@ -2345,7 +2339,8 @@ dsp_oss_audioinfo(struct cdev *i_dev, os
 			 * @c real_device - OSSv4 docs:  "Obsolete."
 			 */
 			ai->real_device = -1;
-			strlcpy(ai->devnode, devname, sizeof(ai->devnode));
+			strlcpy(ai->devnode, "/dev/", sizeof(ai->devnode));
+			strlcat(ai->devnode, devname, sizeof(ai->devnode));
 			ai->enabled = device_is_attached(d->dev) ? 1 : 0;
 			/**
 			 * @note
@@ -2369,6 +2364,9 @@ dsp_oss_audioinfo(struct cdev *i_dev, os
 
 			for (i = 0; i < ai->nrates; i++)
 				ai->rates[i] = rates[i];
+			
+			ai->next_play_engine = 0;
+			ai->next_rec_engine = 0;
 
 			CHN_UNLOCK(ch);
 		}

Modified: projects/jbuild/sys/dev/sound/pcm/mixer.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pcm/mixer.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pcm/mixer.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -1022,6 +1022,27 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_lo
 	int ret, *arg_i = (int *)arg;
 	int v = -1, j = cmd & 0xff;
 
+	/*
+	 * Certain ioctls may be made on any type of device (audio, mixer,
+	 * and MIDI).  Handle those special cases here.
+	 */
+	if (IOCGROUP(cmd) == 'X') {
+		switch (cmd) {
+		case SNDCTL_SYSINFO:
+			sound_oss_sysinfo((oss_sysinfo *)arg);
+			return (0);
+		case SNDCTL_CARDINFO:
+			return (sound_oss_card_info((oss_card_info *)arg));
+	    	case SNDCTL_AUDIOINFO:
+	    	case SNDCTL_AUDIOINFO_EX:
+	    	case SNDCTL_ENGINEINFO:
+			return (dsp_oss_audioinfo(i_dev, (oss_audioinfo *)arg));
+		case SNDCTL_MIXERINFO:
+			return (mixer_oss_mixerinfo(i_dev, (oss_mixerinfo *)arg));
+		}
+		return (EINVAL);
+	}
+
 	m = i_dev->si_drv1;
 
 	if (m == NULL)
@@ -1033,11 +1054,6 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_lo
 		return (EBADF);
 	}
 
-	if (cmd == SNDCTL_MIXERINFO) {
-		snd_mtxunlock(m->lock);
-		return (mixer_oss_mixerinfo(i_dev, (oss_mixerinfo *)arg));
-	}
-
 	if ((cmd & MIXER_WRITE(0)) == MIXER_WRITE(0)) {
 		if (j == SOUND_MIXER_RECSRC)
 			ret = mixer_setrecsrc(m, *arg_i);
@@ -1074,16 +1090,6 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_lo
 	ret = 0;
 
 	switch (cmd) {
- 	/** @todo Double check return values, error codes. */
-	case SNDCTL_SYSINFO:
-		snd_mtxunlock(m->lock);
-		sound_oss_sysinfo((oss_sysinfo *)arg);
-		return (ret);
-		break;
-	case SNDCTL_AUDIOINFO:
-		snd_mtxunlock(m->lock);
-		return (dsp_oss_audioinfo(i_dev, (oss_audioinfo *)arg));
-		break;
 	case SNDCTL_DSP_GET_RECSRC_NAMES:
 		bcopy((void *)&m->enuminfo, arg, sizeof(oss_mixer_enuminfo));
 		break;
@@ -1097,7 +1103,7 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_lo
 		*arg_i = SOUND_VERSION;
 		break;
 	default:
-		ret = ENXIO;
+		ret = EINVAL;
 		break;
 	}
 

Modified: projects/jbuild/sys/dev/sound/pcm/sound.c
==============================================================================
--- projects/jbuild/sys/dev/sound/pcm/sound.c	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pcm/sound.c	Sat Feb 28 17:54:49 2009	(r189177)
@@ -1405,6 +1405,7 @@ sound_oss_sysinfo(oss_sysinfo *si)
 {
 	static char si_product[] = "FreeBSD native OSS ABI";
 	static char si_version[] = __XSTRING(__FreeBSD_version);
+	static char si_license[] = "BSD";
 	static int intnbits = sizeof(int) * 8;	/* Better suited as macro?
 						   Must pester a C guru. */
 
@@ -1417,6 +1418,7 @@ sound_oss_sysinfo(oss_sysinfo *si)
 	strlcpy(si->product, si_product, sizeof(si->product));
 	strlcpy(si->version, si_version, sizeof(si->version));
 	si->versionnum = SOUND_VERSION;
+	strlcpy(si->license, si_license, sizeof(si->license));
 
 	/*
 	 * Iterate over PCM devices and their channels, gathering up data
@@ -1454,6 +1456,7 @@ sound_oss_sysinfo(oss_sysinfo *si)
 
 		pcm_unlock(d);
 	}
+	si->numaudioengines = si->numaudios;
 
 	si->numsynths = 0;	/* OSSv4 docs:  this field is obsolete */
 	/**
@@ -1490,6 +1493,38 @@ sound_oss_sysinfo(oss_sysinfo *si)
 		si->filler[i] = -1;
 }
 
+int
+sound_oss_card_info(oss_card_info *si)
+{
+	struct snddev_info *d;
+	int i, ncards;
+	
+	ncards = 0;
+
+	for (i = 0; pcm_devclass != NULL &&
+	    i < devclass_get_maxunit(pcm_devclass); i++) {
+		d = devclass_get_softc(pcm_devclass, i);
+		if (!PCM_REGISTERED(d))
+			continue;
+
+		if (ncards++ != si->card)
+			continue;
+
+		mtx_assert(d->lock, MA_NOTOWNED);
+		pcm_lock(d);
+		
+		strlcpy(si->shortname, device_get_nameunit(d->dev),
+		    sizeof(si->shortname));
+		strlcpy(si->longname, device_get_desc(d->dev),
+		    sizeof(si->longname));
+		strlcpy(si->hw_info, d->status, sizeof(si->hw_info));
+		si->intr_count = si->ack_count = 0;
+		pcm_unlock(d);
+		return (0);
+	}
+	return (ENXIO);
+}
+
 /************************************************************************/
 
 static int

Modified: projects/jbuild/sys/dev/sound/pcm/sound.h
==============================================================================
--- projects/jbuild/sys/dev/sound/pcm/sound.h	Sat Feb 28 17:54:25 2009	(r189176)
+++ projects/jbuild/sys/dev/sound/pcm/sound.h	Sat Feb 28 17:54:49 2009	(r189177)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list