From patchwork Thu Oct 3 15:52:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175158 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp576943ill; Thu, 3 Oct 2019 09:46:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsph66QBGj9Nj9DwmNxWvrbfnHN9f1y/oc7quzTUa/4hcjYTPQY/u1eM35cf9vlFRzKDZJ X-Received: by 2002:a17:906:2cc8:: with SMTP id r8mr8466160ejr.197.1570121165297; Thu, 03 Oct 2019 09:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570121165; cv=none; d=google.com; s=arc-20160816; b=uWg2M7hcjwlEKISJ0Wi4QdJc71TRm1s78kAC2p47LhhksOLMuTZhCkHthMtUjUPpEs Q4qqeBbjn5Bx34bzENfqgPo/US8QogsZ/Mxp1pZTjK/KLrD1OjHay8ZPsZVI8O7LqSoc 23r7fxaTfDHxNu2mYLCNMf4FziPjddwA0Jg3TUP30MXm3CO7Uz82yNy8T1pxRG3RMFVa KgNHo0oUKWIJ/5lYjwrRzN6TT0cNYnuhcmibxtMps41xGdWYZ72HfYBDGcJ3E6x+lb0+ oTY4IDOiY5iEfoQH/xjQTKY1/F7yBipwMcUxk5nHrtUxI19JQ9rmd/GlhcNPrraMfx7l eUSw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8a2os4W1LPwm6IPEJ8Q/8Fy0oOs0Aj2zQJ74N/eqAiA=; b=SalSQcI9TeOBrjmaOQdoKJ1xDsNGSZQ8/Wd+p9aph2bqoFH7Dm9MxsdqozVCcI2rSi T7B0sV5RigM1YcgFCwvWCQEUgGLld91TqnYihZ2DbheJ48uM2txXCAtY530UkHZfv5hY 8dVn9xESKg3vKy65TnozVY/TwCkd1J6nlz9ZYum0jwUDnRO+Ryh2g4Ad+jRT716SpVvf JKctwdzD0OK+LK2c4PdN4oMOqDyXNRgnmi68kIW6jI/vqyJHF/L5JJqVyP2QrWg4K0wF kFAN4edgS9x+tFZNes8P/wcbLXMj6feE9vkz7eZL4Xqzu/p8i5qok6y9RmvYNSMDnagx mDJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sld6ZMhS; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l22si1977039edb.241.2019.10.03.09.46.05; Thu, 03 Oct 2019 09:46:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=sld6ZMhS; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392841AbfJCQqD (ORCPT + 14 others); Thu, 3 Oct 2019 12:46:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:58968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732663AbfJCQqD (ORCPT ); Thu, 3 Oct 2019 12:46:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0119C20830; Thu, 3 Oct 2019 16:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570121162; bh=Dp16fsSU8hxNbAKOIIQ6JCkszM+DVXRU4bOKtGvh95U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sld6ZMhS4W+h2imD2DEuecQJYPYSs6ji76Mvov1oKeMZK5LTjpcQp/3Q5j/3kxZjb NN+vqyeoC/6PTtaLYyWLPFBE5jLgOgpfzFyJY8eamSgnw64+s8HLpGfsxOmrgGRkLK plyZ7Z6Ap677T6i24MZcFKF1K0x86IrHys13OzUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.3 176/344] ASoC: fsl_ssi: Fix clock control issue in master mode Date: Thu, 3 Oct 2019 17:52:21 +0200 Message-Id: <20191003154557.605507644@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154540.062170222@linuxfoundation.org> References: <20191003154540.062170222@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.20.1 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