From patchwork Thu Nov 26 14:07:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Mouiche X-Patchwork-Id: 7707371 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7BFC4BF90C for ; Thu, 26 Nov 2015 14:10:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DB0620771 for ; Thu, 26 Nov 2015 14:10:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0334520643 for ; Thu, 26 Nov 2015 14:10:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 24ACC266852; Thu, 26 Nov 2015 15:10:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AEC0226671C; Thu, 26 Nov 2015 15:08:04 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A1FDA261A5E; Thu, 26 Nov 2015 15:08:01 +0100 (CET) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by alsa0.perex.cz (Postfix) with ESMTP id 05688261A0A for ; Thu, 26 Nov 2015 15:07:54 +0100 (CET) Received: by wmvv187 with SMTP id v187so33106525wmv.1 for ; Thu, 26 Nov 2015 06:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invoxia-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OreGpUEUSlXxS2Cm69mt6c612FZEp/1Zb0QpfcErKrE=; b=kvuF4ksnjyiKiSAVW75P9GVpNUoS+dAImzvq8gZRaNennvslYYu4RAzcD8uZnfeiNa FGBtNDuVx0A4UKVEToCZUNeP3LaHfBvnTNK5XbrCGFVxsRQtUPQxicxAl2qMsqXQq4Lj X4CKZJ6G+PB02bvxzjTvn1CDTUQtaj+6QO9bpe5fw5DMAdgfVUHuryWkbZ8tKdT+8Ych aWI0EzN2uDn3zeLRKmbgzh3Qs3EgazkcVQwiLYF0z/xy9ZMBAXBooCcdIVTCW5/Lsjka vHEWQDOFd9aM2dWlBUaXbiak96dbDg2bMUY7/sf54UAAOrHWVeyjI89hBioSW7Mqmiui 2Teg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OreGpUEUSlXxS2Cm69mt6c612FZEp/1Zb0QpfcErKrE=; b=Dq6xWibyQZWBpQAjlGUc9qcKI0huGO4gGQHE86Fh0akvxCYKvEwOMhU5/AmDNGy+W5 ra+eeiDataU7xEbdJKVRQBb/9oTEQ7UZsh4Oe69r09O3UZMjQh2XPAr2eV4dplyVrIuX DvARBRV3lmL2cVx3FS0FJjtS7Y9ELlOtw7TWxk8RRtAayXXhIS2T/FLn42qFztbuwnAs WiTtWbyu/I5SOnrnF0hZxbCQ3uTKBKXnWzUlWvD8VX/CWPJ4HHGFAiRB3Dgd5CMbpoNH Cx9Vv/058S9cQkmLwlRufzh9mA9F5+NAJjQggvDS149Q3jdA7IC3j8AK14yJ9P9tl2+3 DnCA== X-Gm-Message-State: ALoCoQkQhYp7rcqSZJ9DzNLrHU4iwg0i8z8Cz1POouCRFzPnHO26Czqx/31/Ngob+m35tOybqpIM X-Received: by 10.194.92.4 with SMTP id ci4mr58179394wjb.175.1448546873703; Thu, 26 Nov 2015 06:07:53 -0800 (PST) Received: from amolinux.invoxia.net ([94.228.188.198]) by smtp.gmail.com with ESMTPSA id v196sm2907777wmv.10.2015.11.26.06.07.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Nov 2015 06:07:52 -0800 (PST) From: Arnaud Mouiche To: Caleb Crome , Roberto Fichera , Markus Pargmann , Fabio Estevam , "shawn.guo@linaro.org" , alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com Date: Thu, 26 Nov 2015 15:07:22 +0100 Message-Id: <1448546842-4584-6-git-send-email-arnaud.mouiche@invoxia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448546842-4584-1-git-send-email-arnaud.mouiche@invoxia.com> References: <1448546842-4584-1-git-send-email-arnaud.mouiche@invoxia.com> Cc: Arnaud Mouiche Subject: [alsa-devel] [PATCH 5/5] ASoC: fsl_ssi: Fix channel slipping on capture (or playback) restart in full duplex. X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Happened when the Playback (or Capture) is running continuously and Capture (or Playback) is restarted (xrun, manual stop/start...) Since the RX (or TX) FIFO are only reset when the whole SSI is disabled, pending samples from previous capture (or playback) session may still be present. They must be erased to not introduce channel slipping. FIFO Clear register fields are documented in IMX51, IMX35 reference manual. They are not documented in IMX50 or IMX6 RM, despite they are working as expected on IMX6SL. Signed-off-by: Arnaud Mouiche --- sound/soc/fsl/fsl_ssi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index c71e194..576a72b 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -404,6 +404,22 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable, * (online configuration) */ if (enable) { + /* + * Clear RX or TX FIFO to remove samples from the previous stream + * session which may be still present in the FIFO and may + * introduce bad samples and/or channel slipping. + * + * Note: The SOR is not documented in recent IMX datasheet, but + * is described in IMX51 reference manual at section 56.3.3.15. + */ + if (vals->scr & CCSR_SSI_SCR_RE) { + regmap_update_bits(regs, CCSR_SSI_SOR, + CCSR_SSI_SOR_RX_CLR, CCSR_SSI_SOR_RX_CLR ); + } else { + regmap_update_bits(regs, CCSR_SSI_SOR, + CCSR_SSI_SOR_TX_CLR, CCSR_SSI_SOR_TX_CLR ); + } + regmap_update_bits(regs, CCSR_SSI_SRCR, vals->srcr, vals->srcr); regmap_update_bits(regs, CCSR_SSI_STCR, vals->stcr, vals->stcr); regmap_update_bits(regs, CCSR_SSI_SIER, vals->sier, vals->sier);