[alsa-devel] setup_dig_out_stream() resets the SPDIF steam causing clicks
Hi,
I'm playing audio via SPDIF, with a Realtek codec, and there's a problem that whenever audio is started, or seeking in every music player I tried, the DAC lost sync briefly, which made it 'click' when it muted and unmuted itself.
I recently upgraded the DAC, and this problem only happened with the new DAC, but not the old one, I don't know (or really care) why - the old DAC had much worse problems.
Here's what I did to fix this:
diff -up linux-3.5.4/sound/pci/hda/hda_codec.c.orig linux-3.5.4/sound/pci/hda/hda_codec.c --- linux-3.5.4/sound/pci/hda/hda_codec.c.orig 2012-09-28 00:13:25.000000000 +0100 +++ linux-3.5.4/sound/pci/hda/hda_codec.c 2012-09-28 00:39:31.000000000 +0100 @@ -4693,9 +4693,11 @@ static void setup_dig_out_stream(struct format); } /* turn on again (if needed) */ - if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) + if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) { set_dig_out_convert(codec, nid, spdif->ctls & 0xff, -1); + codec->spdif_status_reset=0; + } }
static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid)
That makes SPDIF turn off and on just once when sound is first played (i.e. it clicks once then, then no more). In patch_realtek.c it's got this:
/* FIXME: do we need this for all Realtek codec models? */ codec->spdif_status_reset = 1;
If I set that to 0, then the left channel doesn't initialize and is silent, so the reset really does need to happen once (for my realtek model anyway, I don't know how to find out what that would be?)
So, is the above an acceptable fix?
Regards, Laurence
participants (1)
-
Laurence Darby