From patchwork Thu Nov 26 15:05:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Mouiche X-Patchwork-Id: 7707511 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 426D49F2E9 for ; Thu, 26 Nov 2015 15:08:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58A522052D for ; Thu, 26 Nov 2015 15:08:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2348720570 for ; Thu, 26 Nov 2015 15:08:56 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 392D526687D; Thu, 26 Nov 2015 16:08:55 +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, NO_DNS_FOR_FROM,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 1811A2666CF; Thu, 26 Nov 2015 16:06:26 +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 BB41B261A5E; Thu, 26 Nov 2015 16:06:20 +0100 (CET) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by alsa0.perex.cz (Postfix) with ESMTP id 355D7261A8C for ; Thu, 26 Nov 2015 16:06:15 +0100 (CET) Received: by wmec201 with SMTP id c201so35188306wme.0 for ; Thu, 26 Nov 2015 07:06:15 -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=TO5Tm5KRyvpAhqOxq/49ikTPxBl4rACmULyaaw2nj8Y=; b=NQa9YQUlBX23HsieHGjy8V/kNUziAbYYmQbiGACOj0niDjQHYGSOmpocKgJMcYrYBp zqDi3ugCsEwlBOPptNV6WIq98UrN3Ztv3d9JXe9iNR7NnqSk/R2yTHDVKYtcXmSxyqrJ XUx+9g8kM7hEEvat85BlfwRt7x5OKNAxs8wcdVVD7BdbDnd6PUwXmv8TiyUsOLtj3FJT WJROv724fK1xT6XF8WMArf5m3fWuzXOs9+Ofo5ZtASI7LMkRuCAZjEhNhZkW9dyjP3is F/6kjSupAZe19qsGHGawmn1PTfX1nlrth8XeBFVp85esUasE2eCfXiQdfnfaVz9xW5GS up4g== 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=TO5Tm5KRyvpAhqOxq/49ikTPxBl4rACmULyaaw2nj8Y=; b=Qt1rDJW4hGl0BWq8Eh2nV4jrUvDFqWhRWlpemNKt8MAGfaS0OOGAvyrda3ga8OoXUG gNsclF1Izj4OMaOc9F4Q8EursEP7iqa03OzoN/2a8z+tj+YxVG4sg2mZaHduYXF/sL/k BpzXRSfySsIP9O8WKZ7nFISNTA7k+ySraTlVPIFsFqMlYAdEG14neqh0kpJ1fT7RmJki CKdrOBpNbPrCAHbFSouWHDtxwIfMedkgsJxcjfbhQVP7HZ1zqI1M4uUpQw6yukbiFkgv O1e1seBxKuHbwo1th62Se93fAABbz3Weoaxa/3uqs0ycBZtpdlduaGEwGEPy2t0ncRxR 5SGQ== X-Gm-Message-State: ALoCoQk820Ck+9XDoEgd+YKTn8rJRRPnAV6Uoiba44Hk/7XlCY1Z5MRGDjKWmIcYivaZsx1c8zsq X-Received: by 10.194.173.5 with SMTP id bg5mr50404566wjc.142.1448550374952; Thu, 26 Nov 2015 07:06:14 -0800 (PST) Received: from amolinux.invoxia.net ([94.228.188.198]) by smtp.gmail.com with ESMTPSA id gl4sm1079618wjd.17.2015.11.26.07.06.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Nov 2015 07:06:14 -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 16:05:41 +0100 Message-Id: <1448550341-11765-7-git-send-email-arnaud.mouiche@invoxia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448550341-11765-1-git-send-email-arnaud.mouiche@invoxia.com> References: <1448550341-11765-1-git-send-email-arnaud.mouiche@invoxia.com> Cc: Arnaud Mouiche Subject: [alsa-devel] [PATCH v2 6/6] 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 9d5c677..0fd548e 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);