Re: [alsa-devel] looping S/PDIF data

From: Pierre Ossman
Date: Fri Jun 20 2008 - 19:09:30 EST


On Sat, 21 Jun 2008 00:23:51 +0200
Rene Herman <rene.herman@xxxxxxxxxxxx> wrote:

> On 21-06-08 00:00, Pierre Ossman wrote:
>
> > On Fri, 20 Jun 2008 21:52:55 +0200 Rene Herman
> > <rene.herman@xxxxxxxxxxxx> wrote:
> >
> >> On 20-06-08 21:45, Pierre Ossman wrote:
> >>> Are there any specs on this hardware? I could play around a bit
> >>> myself, but I can't really find any documentation on the
> >>> registers.
> >> At:
> >>
> >> ftp://ftp.alsa-project.org/pub/manuals/trident/
> >>
> >> there's a 4D-Wave DX technical reference manual and .doc files
> >> which at first glance look useful.
> >>
> >
> > Ah, thanks. This is an NX, but hopefully they don't differ that much.
>
> No idea, but if you come up with something and keep me in CC I'll test
> it on a DX. Just acquired one on eBay a few days ago as a coincedence.
>

Well aren't things just so much easier with a decent spec. I have this
one solved now. :)

The following patch disables both the S/PDIF output, and the DMA engine
when paused. As for Jaroslav's comment, the documentation seems to
suggest that the DMA disabled by the main code path is just for the
mixer engine, which is not used when feeding the S/PDIF directly. This
is supported by my tests as S/PDIF output is paused when using hw:0.0
(the mixer engine), but not with hw:0.2 (the raw S/PDIF).

Regarding the DX, the docs say that the DX lacks S/PDIF, so it should
be unaffected. For the SiS chip, Takashi's patch might still be needed.

--

trident: pause s/pdif output

Stop the S/PDIF DMA engine and output when the device is told to pause.
It will keep on looping the current buffer contents if this isn't done.

Signed-off-by: Pierre Ossman <drzeus@xxxxxxxxx>
--

diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index bbcee2c..a69b420 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -1590,7 +1590,10 @@ static int snd_trident_trigger(struct snd_pcm_substream *substream,
if (spdif_flag) {
if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
outl(trident->spdif_pcm_bits, TRID_REG(trident, NX_SPCSTATUS));
- outb(trident->spdif_pcm_ctrl, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
+ val = trident->spdif_pcm_ctrl;
+ if (!go)
+ val &= ~(0x28);
+ outb(val, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
} else {
outl(trident->spdif_pcm_bits, TRID_REG(trident, SI_SPDIF_CS));
val = inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)) | SPDIF_EN;

--
-- Pierre Ossman

WARNING: This correspondence is being monitored by the
Swedish government. Use end-to-end encryption where
possible.

Attachment: signature.asc
Description: PGP signature