Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp72425ybp; Thu, 3 Oct 2019 10:19:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcprLNV9fBEiQ6HGx8NNcv7v8UD2HRb0+R4dH6iy8VfLIL/8xkeqr8CIjfOvUP4ydqLgde X-Received: by 2002:a50:9402:: with SMTP id p2mr10708394eda.111.1570123193333; Thu, 03 Oct 2019 10:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570123193; cv=none; d=google.com; s=arc-20160816; b=hF0TdTp6IbJe+NKCo8BTYDMnRb8aicSq7Vni3qQY/QKHPJIeg0YvaZXjSXqWACLWy1 sjKy4D7rf5T2BFFxvN8iaETcYf8/eG++PETO7uEE9u5njfjU02oZM+1W9fp5FY5e9vPy 2z3dRGes96tLVStfYv2vpIY92uq8H+vpTgPc3LeV6HBqI8fhUD5aRNeDoIHjRHE+IEFH gKYan80GyBE46jfmrQ6gDAxIlzni2VNeOQDaT5FzBBBrHNfNN2na2mgEWtNnMkv7VsI+ H36qcVP+YpgZRebWsIjr6PCW81bSImqAMHmMWWcJzzgsUz2nU6iA8XBswEkaLsj8v+nW 7SNw== 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=YOWuqtAz6zfw5sLwjKHmhMjJpip81hPamPrzqU55Jaw=; b=Q8eFUCDGkzIk5OVQyBKDO4tKwWSvEYyCUC9V3BVABVm8kjN4L/EhsgUh/naF5Lp9rR tahg/uzk4USf6PpwGGfv7xJY7u/GjqU9KKiWJtkTiSr5kgj+odptRk5cQFZn9c6jV6QC TyLrovmUs/LqZ+HOQZ1/QtltxNat7Gt/uf8I+p6/An40fnYuXFC4tGn6SWLRsCkt0Mdy HEw8FsfAC2yQVH9dSDBc/R6DC/xxxhPlDNdCa0wJLSK2SDmJgKY71hm5a5GMKmPnOFey 5LPs6Wc4D/ptMLe/eQhfemlAsRO8bQzlZYVPrZ/e86K3DsvPVUrBSmYA11onX6ke+tZL a3WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fHy1CKFp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si2001525edm.240.2019.10.03.10.19.29; Thu, 03 Oct 2019 10:19:53 -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=fHy1CKFp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388567AbfJCQVn (ORCPT + 99 others); Thu, 3 Oct 2019 12:21:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:49980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390178AbfJCQVk (ORCPT ); Thu, 3 Oct 2019 12:21:40 -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 D4FAE21783; Thu, 3 Oct 2019 16:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119698; bh=kfvdiciDmqZ1VtqoBpuDh3Z6dlpATwLZE7GsvgO6uLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHy1CKFpfxYeXOuYiPAN9W8N8ZVW32IgqV4OHMigoY6NJlLb69cv+4ek2NaHypWvm dFLfF2Dm3G5ANkbGNyS/ZOwCilCns8HYFEZ+sp4bId/10gWOD4dNTWpYCfBfIM+zBB xyKHWeugmhCK6lcKwb/8t+l01JHDYRlAdTh1qoig= 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 4.19 111/211] ASoC: fsl_ssi: Fix clock control issue in master mode Date: Thu, 3 Oct 2019 17:52:57 +0200 Message-Id: <20191003154512.786799494@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 09b2967befd96..d83be26d64467 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