Module Name: src
Committed By: jmcneill
Date: Wed Sep 7 00:16:40 UTC 2011
Modified Files:
src/sys/dev/pci/hdaudio: hdafg.c
Log Message:
hdafg_stream_connect: if connecting a non-PCM stream, make sure only
converters that support non-PCM formats are configured to decode it
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/hdaudio/hdafg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/hdaudio/hdafg.c
diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.4 src/sys/dev/pci/hdaudio/hdafg.c:1.5
--- src/sys/dev/pci/hdaudio/hdafg.c:1.4 Tue Sep 6 11:14:17 2011
+++ src/sys/dev/pci/hdaudio/hdafg.c Wed Sep 7 00:16:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.4 2011/09/06 11:14:17 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.4 2011/09/06 11:14:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -3100,6 +3100,15 @@
if (as[i].as_activated == false)
c = 0;
+ /*
+ * If a non-PCM stream is being connected, and the
+ * converter doesn't support non-PCM streams, then
+ * don't decode it
+ */
+ if ((fmt & HDAUDIO_FMT_TYPE_NONPCM) &&
+ !(w->w_p.stream_format & COP_STREAM_FORMAT_AC3))
+ c = 0;
+
hdaudio_command(sc->sc_codec, w->w_nid,
CORB_SET_CONVERTER_FORMAT, fmt);
if (w->w_p.aw_cap & COP_AWCAP_DIGITAL) {
@@ -3118,7 +3127,8 @@
}
hdaudio_command(sc->sc_codec, w->w_nid,
CORB_SET_CONVERTER_STREAM_CHANNEL, c);
- chn += COP_AWCAP_CHANNEL_COUNT(w->w_p.aw_cap);
+ if (c != 0)
+ chn += COP_AWCAP_CHANNEL_COUNT(w->w_p.aw_cap);
}
for (j = 0; j < HDAUDIO_MAXPINS; j++) {