2.4.5 i810_audio.c, ac97_codec.c

2.4.5 i810_audio.c, ac97_codec.c

Post by Collin Par » Thu, 05 Jul 2001 07:10:06



Hello,

Attached is a patch to the above files.  Here's what they do:

1. ac97_codec.c, allow ad1886 to be recognized and brought up
   properly, and sets S/PDIF rate to the 48 kHz rate prescribed by
   ac97 2.2 spec.

   Reference for this is in...

        http://www.alsa-project.org/alsa/ftp/manuals/ad/AD1886.pdf
                (page 20)

   and
        ftp://download.intel.com/ial/scalableplatforms/ac97r22.pdf
                (page 62)

   Perhaps someone (Ollie?) would prefer that these changes apply to
   other ac97 codecs, since the ac97r22.pdf spec says that SPDIF bit
   in register 2A shall be 0 when modifying register 3A -- thus this
   is not unique to ad1886?

2. i810_audio.c, turn S/PDIF *on* when bringing up the codec; also
   added comments to explain what [some of] the bits do.

   Descriptions of the bits are [supposed to be] in the above PDF
   files: p.19 of the AD1886.pdf, p.59 of ac97r22.pdf

   There are some other bits whose function I don't understand; I
   didn't alter them, but inserted comments.

   Perhaps someone (Zach, Jaroslav, Alan, ...?) would prefer to look
   more closely at the bits being set in AC97_EXTENDED_STATUS... i.e.,
   the 0x8000 bit, which is not described in the ac97 2.2 spec as
   other than 'x', why we turn on PRL, PRK, and PRI but have PRJ
   turned off (indeed, with PRL=1, the mic adc is off, so why turn on
   VRM?), etc.  I don't know what most of these bits are, but as I
   mentioned just modify the bit[s] that I know I need set.

These patches were tested under 2.4.4 (neither file has changed much
from 2.4.4 to 2.4.5 and indeed a 2.4.4 patch goes cleanly onto 2.4.5).

Comments, corrections, suggestions?  In case TAB characters get
trashed by the mail system, these patches will also be available, for
a while anyway, at

    http://www.sonic.net/~cpark/245-sound-drivers.patch

---------------- cut here -------------------
diff -ru linux-2.4.5-stock/drivers/sound/ac97_codec.c linux-2.4.5_patched/drivers/sound/ac97_codec.c
--- linux-2.4.5-stock/drivers/sound/ac97_codec.c        Thu Apr 19 22:58:20 2001

 static int sigmatel_9721_init(struct ac97_codec *codec);
 static int sigmatel_9744_init(struct ac97_codec *codec);
 static int enable_eapd(struct ac97_codec *codec);
+static int setup_ad1886(struct ac97_codec *codec);
+

 /* sorted by vendor/device id */

        {0x41445340, "Analog Devices AD1881", NULL},
        {0x41445348, "Analog Devices AD1881A",        NULL},
        {0x41445460, "Analog Devices AD1885", enable_eapd},
+       {0x41445361, "Analog Devices AD1886"  , setup_ad1886},
        {0x414B4D00, "Asahi Kasei AK4540",    NULL},
        {0x414B4D01, "Asahi Kasei AK4542",    NULL},

        codec->codec_write(codec, AC97_POWER_CONTROL,
                codec->codec_read(codec, AC97_POWER_CONTROL)|0x8000);
        return 0;
+}
+
+/*
+ *      Bring up an AD1886
+ */
+
+static int setup_ad1886(struct ac97_codec * codec)
+{
+        /* The spec says not to mess with other bits unless
+           S/PDIF is turned *off* in reg 2A */
+        codec->codec_write(codec, AC97_EXTENDED_STATUS, 0);
+
+        /* The 1886 spec dated 08/25/00 says default value=0
+           but ac97 2.2 says it should be 0x2000. */
+        codec->codec_write(codec, AC97_RESERVED_3A, 0x2000); /* 48 kHz */
+        return 0;
 }

diff -ru linux-2.4.5-stock/drivers/sound/i810_audio.c linux-2.4.5_patched/drivers/sound/i810_audio.c
--- linux-2.4.5-stock/drivers/sound/i810_audio.c        Sat May 19 17:43:07 2001

                        printk(KERN_WARNING "i810_audio: only 48Khz playback available.\n");
                else
                {
-                       /* Enable variable rate mode */
-                       i810_ac97_set(codec, AC97_EXTENDED_STATUS, 9);
+                       /* Turn on VRA, VRM (enable variable rate mode), turn off DRA.
+                           Turn on SPDIF, set source data to AC-link slots 3&4.
+                           (see AC'97 component specification rev 2.2 from intel) */
+                       i810_ac97_set(codec, AC97_EXTENDED_STATUS, 0xD);
+                        /* ac'97 2.2 doesn't say what the 0x8000 bit is, but 0x6800
+                           bits turn PCM center DAC, PCM LFE DACs, and MIC ADC all off */
                        i810_ac97_set(codec,AC97_EXTENDED_STATUS,
                                i810_ac97_get(codec, AC97_EXTENDED_STATUS)|0xE800);
---------------- cut here -------------------

--
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. No sound with i810_audio/ac97_codec

I own an Intel D815EEA2 motherboard with on-board audio. My problem is
I am unable to get the audio to function. sndconfig detects the card,
and goes to play the audio. but I can't hear Linus! Oh linus, i'm so
lonely with no audio.  So I'm trying to find a solution to my problem.

Maybe more specs is what this place needs:

Motherboard: Intel D815EEA2

Dmesg says:
--------
Intel 810 + AC97 Audio, version 0.04, 23:59:42 Jan 15 2002
PCI: Found IRQ 9 for device 00:1f.5
PCI: Sharing IRQ 9 with 00:1f.3
PCI: Setting latency timer of device 00:1f.5 to 64
i810: Intel ICH2 found at IO 0xef00 and 0xe800, IRQ 9
i810_audio: Audio Controller supports 6 channels.
ac97_codec: AC97 Audio codec, id: 0x4144:0x5360 (Analog Devices
AD1885)
i810_audio: AC'97 codec 0 Unable to map surround DAC's (or DAC's not
present), total channels = 2
i810_audio: setting clocking to 7032

mpg123 says:
----
Directory: ./
Playing MPEG stream from thatspot.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
libao - OSS cannot set rate to 44100
Error opening libao oss driver.

lsmod says:
-----
Module                  Size  Used by
i810_audio             18448   0  (autoclean)
ac97_codec              9536   0  (autoclean) [i810_audio]
soundcore               3600   2  [i810_audio]

newsgroups says:
------
*cricket* ..... *cricket* ..... *cricket*

Any advice would be appreciated.
 - Dave

2. X kills terminal

3. Linux 2.4.21-pre7: compilation error in ac97_codec.c

4. Local delivery under smail?

5. ac97_codec and SB Live problems with 2.4.9

6. tar files on non-rewinding device

7. PROBLEM: linux-2.4.20 kernel bug (sound: ac97_codec.c prints garbage)

8. 3CC575BE with Dell Latitude CPi

9. C99 initializers for sound/pci/ac97/ac97_codec.c

10. 2.4.19 -- ac97_codec failure ALi 5451

11. New: compiler warning from sound/pci/ac97/ac97_codec.c (fwd)

12. Unused variable warning in ac97_codec.c

13. problems with via82cxxx_audio and ac97_codec