alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: broonie@kernel.org
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	alsa-devel@alsa-project.org, b42378@freescale.com
Subject: [PATCH] ASoC: fsl: fsl_ssi: Fix simultaneous capture and playback
Date: Mon, 23 Sep 2013 01:08:25 -0300	[thread overview]
Message-ID: <1379909305-23572-1-git-send-email-festevam@gmail.com> (raw)

From: Fabio Estevam <fabio.estevam@freescale.com>

When doing simultaneous capture and playback on a mx6 board we get the following
error:

$ arecord -f cd  | aplay -f cd
imx-sgtl5000 sound.13: set sample size in capture stream first
fsl-ssi-dai 2028000.ssi: ASoC: can't open interface 2028000.ssi: -11
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_
open) unable to open slave
aplay: main:660: audio open error: Device or resource busy
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

The 'arecord -f cd  | aplay -f cd' always trigger cause the 
'if (!first_runtime->sample_bits)' block to be true which returns an error.

Adjust the logic inside fsl_ssi_startup(), so that we do not always hit the 
error when playing  'arecord | aplay' line for the first time.

Reported-by: Chris Clepper <cgclepper@gmail.com>
Suggested-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/fsl/fsl_ssi.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 6ac8730..cdbb641 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -469,19 +469,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 			 * parameters, then the second stream may be
 			 * constrained to the wrong sample rate or size.
 			 */
-			if (!first_runtime->sample_bits) {
-				dev_err(substream->pcm->card->dev,
-					"set sample size in %s stream first\n",
-					substream->stream ==
-					SNDRV_PCM_STREAM_PLAYBACK
-					? "capture" : "playback");
-				return -EAGAIN;
-			}
-
-			snd_pcm_hw_constraint_minmax(substream->runtime,
-				SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
+			if (first_runtime->sample_bits) {
+				snd_pcm_hw_constraint_minmax(substream->runtime,
+						SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
 				first_runtime->sample_bits,
 				first_runtime->sample_bits);
+			}
 		}
 
 		ssi_private->second_stream = substream;
-- 
1.8.1.2

             reply	other threads:[~2013-09-23  4:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  4:08 Fabio Estevam [this message]
2013-09-24 10:00 ` [PATCH] ASoC: fsl: fsl_ssi: Fix simultaneous capture and playback Mark Brown

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=1379909305-23572-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b42378@freescale.com \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@freescale.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).