All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
To: alsa-devel@lists.sourceforge.net
Subject: Re: How to add full duplex capture and playback?
Date: Fri, 19 May 2006 12:44:58 +0200	[thread overview]
Message-ID: <446DA1AA.1080907@atmel.com> (raw)
In-Reply-To: <446D9014.1070300@atmel.com>

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

  reply	other threads:[~2006-05-19 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-19  9:29 How to add full duplex capture and playback? Hans-Christian Egtvedt
2006-05-19 10:44 ` Hans-Christian Egtvedt [this message]
2006-05-19 12:54   ` Takashi Iwai
2006-05-19 15:42     ` Hans-Christian Egtvedt
2006-05-19 16:08       ` Takashi Iwai
2006-05-23 12:57         ` Hans-Christian Egtvedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=446DA1AA.1080907@atmel.com \
    --to=hcegtvedt@atmel.com \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.