[alsa-devel] Correct use of ak4114.c?

Takashi Iwai tiwai at suse.de
Fri Mar 30 16:34:02 CEST 2007


At Fri, 30 Mar 2007 16:20:36 +0200 (CEST),
dustin at seznam.cz wrote:
> 
> Hello,
> >  ------------ Původní zpráva ------------
> >  Od: Takashi Iwai <tiwai at suse.de>
> >  Předmět: Re: [alsa-devel] Correct use of ak4114.c?
> >  Datum: 30.3.2007 15:44:02
> >  ----------------------------------------
> >  
> >  > My question: Is the correct way to add null pointer checks before
> >  > snd_ctl_notify calls only, or to use snd_ak4114_build insted of
> >  > snd_ak4114_create? If using snd_ak4114_build, where do I get the
> >  > parameters ply_substream and cap_substream? 
> >  
> >  I fixed this on HG tree now, so at least the driver should work even
> >  without calling snd_ak4114_build().  The patch is below.
> >  
> >  For working properly with the parameter change notifications, you'd
> >  need to call snd_ak4114_build() with PCM substreams that you made.
> >  That is, first create ak4114 instance via snd_ak4114_create(), create
> >  PCMs, then attach PCMs with snd_ak4114_build() later.
> >
> 
> Thanks a lot for incredibly fast response. Could snd_ak4114_build()
> be called for testing purposes somewhere towards the end of
> snd_vt1724_probe (ice1724.c), when pcms are already created?  

See below.

> BTW, what is difference between professional and spdif pcms? Is it
> only about digital format (like professional/consumer in iecset)?
> Sorry for stupid questions, but I do not know which pcm to use. 

VT1724 has seperate DMAs for the analog and the SPDIF streams while 
ICE1712 has only one for both (mixed up).

Confusingly the analog PCM is named "professional" there because it
was called so in ice1712 driver, and vt1724 driver is derived from
ice1712 driver.  ICE1712 has two analog connections modes, consumer
mode (usually via ac97) and professional mode (via i2s).

> Would I get to playback/capture substreams e.g. using
> ice->pcm_pro->streams[0/1]->substream at the end of
> snd_vt1724_probe? I understand I could probably find this
> information in alsa documentation.

The build_controls callback is called after creation of PCMs.
So, you can call it there.  The proposed fix for Juli is below.

Can any Juli users test the latest HG version with this patch?


thanks,

Takashi


diff -r 1df47bdd721a pci/ice1712/juli.c
--- a/pci/ice1712/juli.c	Fri Mar 30 15:38:39 2007 +0200
+++ b/pci/ice1712/juli.c	Fri Mar 30 16:31:35 2007 +0200
@@ -138,7 +138,16 @@ static struct snd_akm4xxx akm_juli_dac _
 
 static int __devinit juli_add_controls(struct snd_ice1712 *ice)
 {
-	return snd_ice1712_akm4xxx_build_controls(ice);
+	int err;
+	err = snd_ice1712_akm4xxx_build_controls(ice);
+	if (err < 0)
+		return err;
+	err = snd_ak4114_build(ice->spec.juli.ak4114,
+			       ice->pcm_pro->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
+			       ice->pcm_pro->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
+	if (err < 0)
+		return err;
+	return 0;
 }
 
 /*


More information about the Alsa-devel mailing list