Module Name: src
Committed By: sborrill
Date: Fri Sep 25 19:49:31 UTC 2009
Modified Files:
src/sys/dev/pci/hdaudio: hdaudio_afg.c
Log Message:
If the codec does not specify any supported sample size or rates,
assume it supports 16-bit. This can be overridden completely by the widgets, so
some vendors don't specify a setting at the codec level. Fixes a panic in
this situation.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio_afg.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.11 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.12
--- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.11 Thu Sep 17 18:48:47 2009
+++ src/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Sep 25 19:49:31 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.11 2009/09/17 18:48:47 apb Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.12 2009/09/25 19:49:31 sborrill Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.11 2009/09/17 18:48:47 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.12 2009/09/25 19:49:31 sborrill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -2794,11 +2794,11 @@
static bool
hdaudio_afg_probe_encoding(struct hdaudio_afg_softc *sc,
- u_int minrate, u_int maxrate, u_int validbits, u_int precision)
+ u_int minrate, u_int maxrate, u_int validbits, u_int precision, bool force)
{
struct audio_format f;
- if (hdaudio_afg_bits_supported(sc, validbits) == false)
+ if (!force && hdaudio_afg_bits_supported(sc, validbits) == false)
return false;
memset(&f, 0, sizeof(f));
@@ -2885,17 +2885,22 @@
if (minrate != maxrate)
hda_print1(sc, "-%uHz", maxrate);
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 8, 16))
+ if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 8, 16, false))
hda_print1(sc, " 8/16");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16))
+ if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, false))
hda_print1(sc, " 16/16");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 20, 32))
+ if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 20, 32, false))
hda_print1(sc, " 20/32");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 24, 32))
+ if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 24, 32, false))
hda_print1(sc, " 24/32");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 32, 32))
+ if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 32, 32, false))
hda_print1(sc, " 32/32");
+ if (sc->sc_audiodev.ad_nformats == 0) {
+ hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, true);
+ hda_print1(sc, " 16/16*");
+ }
+
/*
* XXX JDM 20090614
* MI audio assumes that at least one playback and one capture format