[alsa-devel] SPDIF/IEC958 sample rate on HDA/ALC882

Dag Lem dag at nimrod.no
Wed Mar 21 23:17:54 CET 2007

Takashi Iwai <tiwai <at> suse.de> writes:

> Hi,
> Sorry, looks like I overlooked this post...
> At Wed, 01 Nov 2006 17:58:55 +0100,
> Erik Slagter wrote:
> > 
> > Sorry if this is considered to be "user" question, but I got no response
> > at all from the "user" list. Guess the real cracks hang around here.
> > 
> > I have lots of questions I cannot resolve from all of the docs, but for
> > the moment I'll stick to the most important one.
> > 
> > The combination of HDA/ALC882 should be able to deliver sound at 96 kHz
> > (hda..., right...) Also the ALC882 datasheet says it can deliver sound
> > at 96 kHz.
> > 
> > In practise, though, I cannot get it to output any other sample rate
> > than 48 kHz. Any other sample rate handed to hw:0,0 is simply converted
> > (somewhere??? and badly...) to 48 kHz and the SPDIF is still driven at
> > 48 kHz.
> > 
> > iecset allows me to set the rate to 32/44.1/48 kHz, the spdif output is
> > still at 48 kHz. Some other flags from iecset are actually honoured
> > (like "data" and "emphasis").
> It's simply because iecset program doesn't support the rates over
> 48kHz.  But the hda-intel driver supports the rate, AFAIK.
> (At least, there is no particular code that restricts over-48kHz.)
> One thing to be noted is that if you use "hw" PCM device, you have to
> set up the SPDIF status bits _manually_ via control API.  If you use
> "iec958" or "spdif" PCM device, you can pass these bits as optional
> arguments at opening the PCM.
> > I can ask aplay to play at various rates (from a suitable PCM file), but
> > it complains at any other rate than 44.1 or 48 (notably 32) kHz that the
> > rate is not supported. It plays at 44.1 kHz though. And again converts
> > it to 48 kHz! Sigh...
> Who complains?  At least, the driver won't.
> > Maybe I am using the wrong "hw", there is also a "hw:0,2" device, which
> > I cannot make work properly at all (only one channel is output, large
> > chunks are discarded, much much clipping).
> The first PCM device is for the multi-output PCM.  It's for both
> analog and digital.  The dedicated SPDIF is the secondary one.
> Takashi
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


I was googling around and found this (old) post; I can confirm that there are
severe problems with the ALC882 and/or the driver code.

I'm experiencing the same problem as Erik - I cannot get the ALC882 to transmit
at any other sample rate than 48kHz over S/PDIF.

When I attempt to play 44.1kHz sound, the S/PDIF connection is still locked at
48kHz (shown by my amplifier), and the resulting sound is less than pleasing.
It would seem like a 44.1kHz signal packed in a 48kHz frame rate played back
directly - high-pitched sounds suffer badly from what my ears recognize as
straightforward sample picking as opposed to resampling.

Looking at hda_codec.c:convert_from_spdif_status() it seems that the IEC958
parameter bit for 44.1kHz/48kHz is not used for anything (correct me if I'm
wrong). This would mean that the rate is only set in
snd_hda_codec_setup_stream(), and as far as I can tell from looking at the array
rate_bits and the ALC882 Series Datasheet the setting is correct for 44.1kHz.

Since I can't find any obvious mistake in the HDA code, I guess there is some
problem in patch_realtek.c, or an initialization incompatibility with the HDA
code and the ALC882 chip.

There are certainly initialization problems somewhere, as the S/PDIF output is
sometimes not able to send AC3 data correctly (amplifier cannot detect AC3 and
stays silent), and  attempting to play audio (even 48kHz) results in
intermittent screeches. This is solved by setting and resetting the IEC958
control widget, trying again and again until it finally works. When it does
work, it works without a hitch until the next reboot.

Any ideas? Is there anything I can help to test in order to nail down the
problem? My motherboard is an Asus P5W DH Deluxe with an 82801G HDA controller,
in case this has any relevance.

Best regards,

Dag Lem

More information about the Alsa-devel mailing list