All pastes #452608 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-22 11:52 UTC
rendered paste body
# HG changeset patch
# User tiwai
# Date 1162912140 -3600
# Node ID 2ad24f7f3313b2b59aace15348e19b1971e93b12
# Parent  b854fbfd238f18cbcc4b4030a40aac8815735e57
hda-codec - Fix detection of supported sample rates

 Don't include 9.6kHz in the list of supported sample rates.
Since this rate isn't indicated in AC_PAR_PCM parameter,
the driver might guess wrongly as if it's available.

 ================================================================

IIRC, it was due to a possible problem that some codecs wrongly report
384kHz bit that points 96kHz in hda_codec.c.  I overlooked that si3043
supports 96kHz.

The patch below should fix the problem.  Please give it a try.


Takashi

diff -r 42321871a7dc pci/hda/hda_codec.c
--- a/pci/hda/hda_codec.c       Thu Apr 05 17:08:57 2007 +0200
+++ b/pci/hda/hda_codec.c       Tue Apr 10 11:08:35 2007 +0200
@@ -1368,6 +1368,11 @@ static struct hda_rate_tbl rate_bits[] =
        { 96000, SNDRV_PCM_RATE_96000, 0x0800 }, /* 2 x 48 */
        { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */
        { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */
+#define AC_PAR_PCM_RATE_BITS   11
+       /* up to bits 10, 384kHZ isn't supported properly */
+
+       /* not autodetected value */
+       { 9600, SNDRV_PCM_RATE_KNOT, 0x0400 }, /* 1/5 x 48 */

        { 0 } /* terminator */

@@ -1461,7 +1466,7 @@ int
snd_hda_query_supported_pcm(struct h

        if (ratesp) {
                 u32 rates = 0;
-               for (i = 0; rate_bits[i].hz; i++) {
+               for (i = 0; i < AC_PAR_PCM_RATE_BITS; i++) {
                        if (val & (1 << i))
                                rates |=rate_bits[i].alsa_bits;
                 }
 @@ -1555,13 +1560,13 @@ int
snd_hda_is_supported_format(struct h
         }

       rate = format & 0xff00;
-       for (i = 0; rate_bits[i].hz; i++)
+       for (i = 0; i < AC_PAR_PCM_RATE_BITS; i++)
                 if (rate_bits[i].hda_fmt == rate) {
                         if (val & (1 << i))
                                 break;
                         return 0;
                }
-       if (! rate_bits[i].hz)
+       if (i >= AC_PAR_PCM_RATE_BITS)
                 return 0;

        stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM);