summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2011-09-07 00:16:40 +0000
committerjmcneill <jmcneill@NetBSD.org>2011-09-07 00:16:40 +0000
commit5bf3754cc26c76877d8fa3ba3e3a0071f5e0eb3b (patch)
tree0ac01cf59c8307dadec3ffdd2f7b46979f9caeb2 /sys/dev
parentcd929d7c6c3337285c74916ebd28b966a36b4c64 (diff)
hdafg_stream_connect: if connecting a non-PCM stream, make sure only
converters that support non-PCM formats are configured to decode it
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/hdaudio/hdafg.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/pci/hdaudio/hdafg.c b/sys/dev/pci/hdaudio/hdafg.c
index 6198c251c15..dca9a436fd4 100644
--- a/sys/dev/pci/hdaudio/hdafg.c
+++ b/sys/dev/pci/hdaudio/hdafg.c
@@ -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 <support@precedence.co.uk>
@@ -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 @@ hdafg_stream_connect(struct hdafg_softc *sc, int mode)
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 @@ hdafg_stream_connect(struct hdafg_softc *sc, int mode)
}
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++) {