Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp3220865ybj; Mon, 23 Sep 2019 17:17:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXg2yz3a3pgCvGaFHcYc47S4ztpQAKjWutg73axfP5DV+wuE01IMjMItHgmE7sRFbNl+BK X-Received: by 2002:aa7:d7c9:: with SMTP id e9mr2869718eds.237.1569284279520; Mon, 23 Sep 2019 17:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569284279; cv=none; d=google.com; s=arc-20160816; b=dtvaAFUOx6wFm3zxqiv069UDAR1HdaNX8RThcgO7siFM8eszZlXynpEeiytYqKYekV qSCSJ5WbaPaLzLGn4F9f6HCOCYOtH+aVKfKw398a832ROVlC5+PRVNWDDgYfXEI3pxrJ I2FOuNXpXJHVb5+TPNND6LC1lZ58VPP3gUtCH5Cw7znbAjGcavTC+oF43A8ojZ+5sclv 1d8AAF+xc2i7/36mj3NqN8io6R0p3CswdSLBXSRADQ6RQSA2MnuH4R4FECIDSRbsOpco S+Gbi0uQ/slUQ8Mn/lANQTbDMOdQNdKv3sleOrbea9ljA04zw9UcbZKAkyVATNJvw3d5 cSVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8a2os4W1LPwm6IPEJ8Q/8Fy0oOs0Aj2zQJ74N/eqAiA=; b=0qvtCYEuScHRjj0S8bB69+Ayx2NHbwd4/GtQsUvpBuoN2f/e22guxHN8cAC145rdkn SH5IKrvQOWXnyvBAfTsbgRoLkAYvTzV7nCrnLzH6xBEMx4qEy/tlFSrIRo8DRhm5RvQ9 KanGyqiKCGHOvWeXHEH0Dlp89s50sIHBZFb0CIhYce3vIfLXaVqgac3fWAn5Vy3fCSS4 C8Cups/syU4KUvnObwGJeh3KY2THx8sM4jzHXg2cgmh973h+fpjnPc5B71wQCefjHTZz 3ueaBncdYClbd+XmxpgUsbqXMQ+rSZBidtQnCIe03j+5OYsziYh9MiO2K1RIwYcSli2/ 2PPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hkfgBwx2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l22si68297edq.174.2019.09.23.17.16.49; Mon, 23 Sep 2019 17:17:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hkfgBwx2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391298AbfIVSr7 (ORCPT + 99 others); Sun, 22 Sep 2019 14:47:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:44438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391193AbfIVSrv (ORCPT ); Sun, 22 Sep 2019 14:47:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1569C21D6C; Sun, 22 Sep 2019 18:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178070; bh=Dp16fsSU8hxNbAKOIIQ6JCkszM+DVXRU4bOKtGvh95U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkfgBwx2NXsnsmnUm9AoDGV5lyna6DX8gmbNk4ffuYBcLicja20Tonj6rtvSjojbL 9obZ3TwY7lUKoDOzBTIPNpee/a+Z4ALQfT5aHQ1BYKfRHeaLaW8MkYlUeQiNZzBUjV jFNd0sfq9qhAu1dVxH9nKV4qsJlsyzoiqYkMK/w4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shengjiu Wang , Mark Brown , Sasha Levin , linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.3 143/203] ASoC: fsl_ssi: Fix clock control issue in master mode Date: Sun, 22 Sep 2019 14:42:49 -0400 Message-Id: <20190922184350.30563-143-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184350.30563-1-sashal@kernel.org> References: <20190922184350.30563-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shengjiu Wang [ Upstream commit 696d05225cebffd172008d212657be90e823eac0 ] The test case is arecord -Dhw:0 -d 10 -f S16_LE -r 48000 -c 2 temp.wav & aplay -Dhw:0 -d 30 -f S16_LE -r 48000 -c 2 test.wav There will be error after end of arecord: aplay: pcm_write:2051: write error: Input/output error Capture and Playback work in parallel in master mode, one substream stops, the other substream is impacted, the reason is that clock is disabled wrongly. The clock's reference count is not increased when second substream starts, the hw_param() function returns in the beginning because first substream is enabled, then in end of first substream, the hw_free() disables the clock. This patch is to move the clock enablement to the place before checking of the device enablement in hw_param(). Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1567012817-12625-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/fsl_ssi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index fa862af25c1a3..085855f9b08d4 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -799,15 +799,6 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, u32 wl = SSI_SxCCR_WL(sample_size); int ret; - /* - * SSI is properly configured if it is enabled and running in - * the synchronous mode; Note that AC97 mode is an exception - * that should set separate configurations for STCCR and SRCCR - * despite running in the synchronous mode. - */ - if (ssi->streams && ssi->synchronous) - return 0; - if (fsl_ssi_is_i2s_master(ssi)) { ret = fsl_ssi_set_bclk(substream, dai, hw_params); if (ret) @@ -823,6 +814,15 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, } } + /* + * SSI is properly configured if it is enabled and running in + * the synchronous mode; Note that AC97 mode is an exception + * that should set separate configurations for STCCR and SRCCR + * despite running in the synchronous mode. + */ + if (ssi->streams && ssi->synchronous) + return 0; + if (!fsl_ssi_is_ac97(ssi)) { /* * Keep the ssi->i2s_net intact while having a local variable -- 2.20.1