[alsa-devel] [PATCH] Re: iec958 switch uneffective while playing ac3 stream
Takashi Iwai
tiwai at suse.de
Wed Apr 11 14:19:36 CEST 2007
At Thu, 05 Apr 2007 15:36:34 +0200,
I wrote:
>
> At Thu, 05 Apr 2007 12:09:22 +0200,
> I wrote:
> >
> > Yeah, that'd be better. I'll fix and commit to the HG tree later.
>
> OK, now it's on HG tree.
>
> While we're at it... I did a quick hack to add a new mixer element to
> choose the SPDIF playback route, either "Analog Duplicate" or
> "Exclusive PCM". (On AD codecs, it has more items for analog
> loopbacks.) This will solve one remaining problem, "SPDIF is blocked
> by analog open".
>
> Of course, this has another problem that user may choose an incorrect
> value accidentally, but I come to believe it's better than a module
> option.
After reconsideration, I found it much easier to change the driver to
allow access to the dedicated SPDIF stream even while analog dup
mode. When the SPDIF stream is opened, the SPDIF is forced to reset
and then the stream is reserved for the exclusive access until it's
closed.
The below is a test patch. Now you see it's so simple...
Can anyone test it?
thanks,
Takashi
diff -r 5ef5aabbbfe8 pci/hda/hda_codec.c
--- a/pci/hda/hda_codec.c Tue Apr 10 11:39:58 2007 +0200
+++ b/pci/hda/hda_codec.c Wed Apr 11 14:18:21 2007 +0200
@@ -1911,10 +1911,9 @@ int snd_hda_multi_out_dig_open(struct hd
int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout)
{
mutex_lock(&codec->spdif_mutex);
- if (mout->dig_out_used) {
- mutex_unlock(&codec->spdif_mutex);
- return -EBUSY; /* already being used */
- }
+ if (mout->dig_out_used == HDA_DIG_ANALOG_DUP)
+ /* already opened as analog dup; reset it once */
+ snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0);
mout->dig_out_used = HDA_DIG_EXCLUSIVE;
mutex_unlock(&codec->spdif_mutex);
return 0;
More information about the Alsa-devel
mailing list