Re: How to add full duplex capture and playback?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hans-Christian Egtvedt wrote:
> Hello
> 
> I'm strugling a bit with getting my AC97 driver to be full duplex. The
> hardware supports it, but I can't seem to enable it correctly in the driver.
> 
> Is there anything I've missed other than this?
> err = snd_pcm_new(chip->card, "Atmel AC97", 0, 1, 1, &pcm);

This is actually correct I see, I have both a substream for capture and
a substream for playback:
~ # aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AC97 [Atmel AVR32 AC97], device 0: Atmel AC97 [Atmel AC97]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
~ # arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: AC97 [Atmel AVR32 AC97], device 0: Atmel AC97 [Atmel AC97]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I assume this is a "good" output from the utils.

> AFAIK this should give me two substreams, one for capture and one for
> playback. Do I have to take some care with other calls?
> 
> When I try to playback and record simultaneously I get the following error:
> ALSA lib pcm_params.c:2152:(snd_pcm_hw_refine_slave) Slave PCM not usable
> aplay: set_params:879: Broken configuration for this PCM: no
> configurations available

This problem is due to the following open call, and was solved by
commenting it out, which is not an option for the final driver.

Open call:
static int
snd_atmel_ac97_playback_open(snd_pcm_substream_t *substream)
{
	atmel_ac97_t *chip = snd_pcm_substream_chip(substream);
	snd_pcm_runtime_t *runtime = substream->runtime;

	chip->playback_active = 1;

	printk(KERN_INFO "atmel-ac97: entering playback open\n");

	runtime->hw = snd_atmel_ac97_playback_hw;

	/* Setup hardware to match capture settings */
#if 0
	if (chip->capture_active) {
		int err = 0;
		snd_pcm_runtime_t *capture_runtime =
			chip->capture_substream->runtime;

		hw_rates[0] = (unsigned int)capture_runtime->rate;
		hw_constraint_rates.count	= ARRAY_SIZE(hw_rates);
		hw_constraint_rates.list	= hw_rates;
		hw_constraint_rates.mask	= 0;

		hw_formats[0] = (unsigned int)capture_runtime->format;
		hw_constraint_formats.count	= ARRAY_SIZE(hw_formats);
		hw_constraint_formats.list	= hw_formats;
		hw_constraint_formats.mask	= 0;

		printk(KERN_INFO "atmel_ac97: capture active, set limits to playback\n");

		err = snd_pcm_hw_constraint_list(substream->runtime, 0,
				SNDRV_PCM_HW_PARAM_RATE,
				&hw_constraint_rates);

		err = snd_pcm_hw_constraint_list(substream->runtime, 0,
				SNDRV_PCM_HW_PARAM_FORMAT,
				&hw_constraint_formats);

		printk(KERN_INFO "atmel-ac97: limiting playback rate to %d\n",
capture_runtime->rate);

		if (err < 0)
			return err;
	}
#endif

	chip->playback_substream = substream;
	chip->period = 0;
	return 0;
}

Seems like this open call (without #if 0) clear the configuration for
the PCM, basicly leaving it unusable.

Any comments?

-- 
With kind regards,
Med vennlig hilsen,

Hans-Christian Egtvedt
Applications Engineer - AVR Applications Lab
Atmel Norway


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux