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 kern/43542: 32kHz playback sounds like h...
details: https://anonhg.NetBSD.org/src/rev/617a755d0138
branches: trunk
changeset: 757134:617a755d0138
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Aug 15 22:32:02 2010 +0000
description:
kern/43542: 32kHz playback sounds like hissing analog TV snow
Instead of specifying a range of supported sample rates based on the lowest
and highest available frequencies, only advertise rates that the codec reports
as working. Let aurateconv take care of the rest.
diffstat:
sys/dev/pci/hdaudio/hdaudio_afg.c | 57 +++++++++++++++++---------------------
1 files changed, 25 insertions(+), 32 deletions(-)
diffs (120 lines):
diff -r 8f513412e6d9 -r 617a755d0138 sys/dev/pci/hdaudio/hdaudio_afg.c
--- a/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Aug 15 22:05:14 2010 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_afg.c Sun Aug 15 22:32:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.25 2010/08/15 22:32:02 jmcneill 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.24 2010/08/15 19:39:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.25 2010/08/15 22:32:02 jmcneill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -110,6 +110,11 @@
#define HDAUDIO_HP_SENSE_PERIOD hz
+const u_int hdaudio_afg_possible_rates[] = {
+ 8000, 11025, 16000, 22050, 32000, 44100,
+ 48000, 88200, 96000, 176500, 192000, /* 384000, */
+};
+
static const char *hdaudio_afg_mixer_names[] = HDAUDIO_DEVICE_NAMES;
static const char *hdaudio_afg_port_connectivity[] = {
@@ -2903,9 +2908,10 @@
static bool
hdaudio_afg_probe_encoding(struct hdaudio_afg_softc *sc,
- u_int minrate, u_int maxrate, u_int validbits, u_int precision, bool force)
+ u_int validbits, u_int precision, bool force)
{
struct audio_format f;
+ int i;
if (!force && hdaudio_afg_bits_supported(sc, validbits) == false)
return false;
@@ -2919,8 +2925,11 @@
f.channels = 0;
f.channel_mask = 0;
f.frequency_type = 0;
- f.frequency[0] = minrate;
- f.frequency[1] = maxrate;
+ for (i = 0; i < __arraycount(hdaudio_afg_possible_rates); i++) {
+ u_int rate = hdaudio_afg_possible_rates[i];
+ if (hdaudio_afg_rate_supported(sc, rate))
+ f.frequency[f.frequency_type++] = rate;
+ }
#define HDAUDIO_INITFMT(ch, chmask) \
do { \
@@ -2953,17 +2962,11 @@
static void
hdaudio_afg_configure_encodings(struct hdaudio_afg_softc *sc)
{
- const u_int possible_rates[] = {
- 8000, 11025, 16000, 22050, 32000, 44100,
- 48000, 88200, 96000, 176500, 192000, /* 384000, */
- };
struct hdaudio_assoc *as = sc->sc_assocs;
struct audio_format f;
- u_int minrate, maxrate;
int nchan, i;
sc->sc_pchan = sc->sc_rchan = 0;
- minrate = maxrate = 0;
for (nchan = 0, i = 0; i < sc->sc_nassocs; i++) {
nchan = hdaudio_afg_assoc_count_channels(sc, &as[i],
@@ -2979,34 +2982,24 @@
}
hda_print(sc, "%dch/%dch", sc->sc_pchan, sc->sc_rchan);
- for (i = 0; __arraycount(possible_rates); i++)
- if (hdaudio_afg_rate_supported(sc, possible_rates[i])) {
- minrate = possible_rates[i];
- break;
- }
- for (i = __arraycount(possible_rates) - 1; i >= 0; i--)
- if (hdaudio_afg_rate_supported(sc, possible_rates[i])) {
- maxrate = possible_rates[i];
- break;
- }
- KASSERT(minrate > 0 && maxrate > 0); /* impossible */
- hda_print1(sc, " %uHz", minrate);
- if (minrate != maxrate)
- hda_print1(sc, "-%uHz", maxrate);
-
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 8, 16, false))
+ for (i = 0; i < __arraycount(hdaudio_afg_possible_rates); i++)
+ if (hdaudio_afg_rate_supported(sc,
+ hdaudio_afg_possible_rates[i]))
+ hda_print1(sc, " %uHz", hdaudio_afg_possible_rates[i]);
+
+ if (hdaudio_afg_probe_encoding(sc, 8, 16, false))
hda_print1(sc, " 8/16");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 16, 16, false))
+ if (hdaudio_afg_probe_encoding(sc, 16, 16, false))
hda_print1(sc, " 16/16");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 20, 32, false))
+ if (hdaudio_afg_probe_encoding(sc, 20, 32, false))
hda_print1(sc, " 20/32");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 24, 32, false))
+ if (hdaudio_afg_probe_encoding(sc, 24, 32, false))
hda_print1(sc, " 24/32");
- if (hdaudio_afg_probe_encoding(sc, minrate, maxrate, 32, 32, false))
+ if (hdaudio_afg_probe_encoding(sc, 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);
+ hdaudio_afg_probe_encoding(sc, 16, 16, true);
hda_print1(sc, " 16/16*");
}
Home |
Main Index |
Thread Index |
Old Index