From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753028AbcD0QPU (ORCPT ); Wed, 27 Apr 2016 12:15:20 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:50062 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbcD0QPS (ORCPT ); Wed, 27 Apr 2016 12:15:18 -0400 Date: Wed, 27 Apr 2016 17:15:04 +0100 From: Mark Brown To: Peter Rosin Cc: alsa-devel@alsa-project.org, Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-kernel@vger.kernel.org Message-ID: <20160427161504.GZ3217@sirena.org.uk> References: <1461746959-11443-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iwOtj70Sz1+p37c3" Content-Disposition: inline In-Reply-To: <1461746959-11443-1-git-send-email-peda@axentia.se> X-Cookie: Tomorrow, you can be anywhere. User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH] ASoC: pcm: allow changing the playback/capture rates for symmetric links X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --iwOtj70Sz1+p37c3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 27, 2016 at 10:49:19AM +0200, Peter Rosin wrote: > The below program fails on a dai link with symmetric rates without this > patch. The patch makes it work. You've not articulated the problem you're trying to fix here, what in concrete terms is the program trying to accomplish and why should it succeed? > if ((fd = open("/dev/dsp", O_WRONLY, 0)) == -1) { > perror("open"); > return 1; > } This is using the OSS interfaces which really haven't ever been especially supported for ASoC. > + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { > + if (!cpu_dai->capture_active) > + return 0; > + } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { > + if (!cpu_dai->playback_active) > + return 0; > + } > + > rate = params_rate(params); > channels = params_channels(params); > sample_bits = snd_pcm_format_physical_width(params_format(params)); This means we've opened up a race where the stream is configured but not started where the opposite direction can configure a different setup. Since starting both directions very close together is a common operation it seems likely to cause issues. --iwOtj70Sz1+p37c3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXIOWHAAoJECTWi3JdVIfQU2kH/R921cVN0sx1JZWj0x1Y0++d 7dvtSh2Tg0mQ4UharOjjvjarALgIoaxT9S48W5ECNaAY/XV8qSDnkS4bmJyEl8eR f0ekxEfx3KVgAGlV7Um4jNDZKJa31bjfsXUueEJ4ezeyKHK5IRY0kYv093fVMp+w meDdX4gZ01zmogUD+QbpKskTmTro00ctcOSo8mtgAhXzYZPX7CPyKSXRU9GeAkSB k+DCCqU+3yPTK3LRKYe08OO4rQocYyQXMzjjXvB4cCQOrj3Z54mlZMW2j/9JsPSc 8Jd+dRnRM78npg/DEp2jNS0OIp6R4U85BbZL7lC253Wy7SVciXCHcPb+U5ovtsY= =dM+p -----END PGP SIGNATURE----- --iwOtj70Sz1+p37c3--