Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/hdaudio If the codec does not specify any suppor...



details:   https://anonhg.NetBSD.org/src/rev/41a821763241
branches:  trunk
changeset: 747639:41a821763241
user:      sborrill <sborrill%NetBSD.org@localhost>
date:      Fri Sep 25 19:49:31 2009 +0000

description:
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.

diffstat:

 sys/dev/pci/hdaudio/hdaudio_afg.c |  23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diffs (60 lines):

diff -r 01ecba2c513d -r 41a821763241 sys/dev/pci/hdaudio/hdaudio_afg.c
--- a/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Sep 25 19:47:09 2009 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_afg.c Fri Sep 25 19:49:31 2009 +0000
@@ -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 <support%precedence.co.uk@localhost>
@@ -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



Home | Main Index | Thread Index | Old Index