From patchwork Fri Mar 31 22:15:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9657323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15787601D2 for ; Fri, 31 Mar 2017 22:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1C83286AB for ; Fri, 31 Mar 2017 22:15:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E649D286B0; Fri, 31 Mar 2017 22:15:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A5BE286AB for ; Fri, 31 Mar 2017 22:15:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C3917267344; Sat, 1 Apr 2017 00:15:27 +0200 (CEST) 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 D0187267345; Sat, 1 Apr 2017 00:15:26 +0200 (CEST) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by alsa0.perex.cz (Postfix) with ESMTP id C92DB2668F6 for ; Sat, 1 Apr 2017 00:15:22 +0200 (CEST) Received: by mail-qt0-f196.google.com with SMTP id n37so11981198qtb.3 for ; Fri, 31 Mar 2017 15:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=jCLOY1tK33NNpiCRNMd1QSj084fhgytfeVC8FfJ3Ptg=; b=WT0G9l1LpQk5gRoDoSlln4+x0jiCFHEFiPLVz6yPeYsUW6Jk2yKUA7jlvMmcmsZvKJ D58R5JKP5KApQHrRLHeXvO+TZBrVmz1Io8+iys6dDQ+i1NLCrEzYiZx5k0o9zOtmKR+S hu7Cm1S1GgDtnrt2WWd3Rl9Qu82TQmdA73Mf6rdAFjyoIZMWncIi5OxikoTrf+z0RmOz PREUDeUpCrtT1kU7miUkDv96QdQv90ytWi8sab3za3SqSrlz8tKTE6hKiNuqJpEwJPUe PiSQ3dn7NiabHF8/wJYLrU4K//EuIgbCuM9S/zjE/d5MF1fOXYlmDLmkZoDVQIv43fr0 nlzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jCLOY1tK33NNpiCRNMd1QSj084fhgytfeVC8FfJ3Ptg=; b=lWf5NXRNrQZyfUxUvT2oW8u0RHDbZF1J+RW2xSkDQ+BZjy7FZls83KLpwXZbyG6SrF iVGOkUnUmQ0zpl7lrQsbpKy7bwAFWffBOG6CHzsi0q6LQgV9u4tEhka/VQZblhFPM6/p 1GL7yExDVc0AuGoQRsCujSx2EDZjPUWfjIYVQYuzLmbFrQ9Cgk138luXEglcOVHDu1ro A7bONkQyDJHVF0q/VYdvrMSzqO7psOTVAysMOxdOcyqKdqFQKdwVNVwslzfbi1J2MlWG YGXe/e7Nymi5jRLF/NXMtNVImvNUnIPpi+/JFKmHajl9uq85swrBfPdhNyAtUD2yYjn9 gXlA== X-Gm-Message-State: AFeK/H2dzHnyW8IlgOWOhrh/o6b3ffN7vL7aVuF/pY5DsfYE3V2sAfTOBXyjGTDoiqztEA== X-Received: by 10.237.37.71 with SMTP id w7mr5049453qtc.34.1490998520022; Fri, 31 Mar 2017 15:15:20 -0700 (PDT) Received: from localhost.localdomain ([187.180.184.115]) by smtp.gmail.com with ESMTPSA id h27sm4463442qtf.24.2017.03.31.15.15.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Mar 2017 15:15:19 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Fri, 31 Mar 2017 19:15:03 -0300 Message-Id: <1490998503-1191-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: alsa-devel@alsa-project.org, arnaud.mouiche@invoxia.com, timur@tabi.org, caleb@crome.org, nicoleotsuka@gmail.com, Fabio Estevam , max.krummenacher@toradex.com, mpa@pengutronix.de Subject: [alsa-devel] [PATCH] ASoC: fsl_ssi: Fix channel swap on playback start 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 From: Fabio Estevam Commit f8fdf5375e2005f2 ("ASoC: fsl-ssi: add SSIEN errata work around") implemented the workaround for the following erratum found on i.MX35 errata document: ENGcm06222: SSI:Transmission does not take place in bit length early frame sync configuration and also for ENGcm06222 from the same document. However it has been only applied for AC97 mode. Apply it to I2S mode as well so that it can fix audio channel swap during playback start. The channel swap can be noticed in about 10% of the times an audio track starts. With the recommended workaround in place no more channel swap happened after running audio start/stop sequence in more than 2000 times. Tested on a mx6dl-wandboard. Signed-off-by: Fabio Estevam --- sound/soc/fsl/fsl_ssi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index fde08660..17f92b8 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -93,6 +93,9 @@ CCSR_SSI_SIER_TLS_EN | CCSR_SSI_SIER_TFS_EN | \ CCSR_SSI_SIER_TUE0_EN | CCSR_SSI_SIER_TFRC_EN) +#define FSLSSI_SSIEN_WORKAROUND (CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE | \ + CCSR_SSI_SCR_RE) + enum fsl_ssi_type { FSL_SSI_MCP8610, FSL_SSI_MX21, @@ -559,7 +562,8 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable, int i; int max_loop = 100; regmap_update_bits(regs, CCSR_SSI_SCR, - CCSR_SSI_SCR_SSIEN, CCSR_SSI_SCR_SSIEN); + FSLSSI_SSIEN_WORKAROUND, + FSLSSI_SSIEN_WORKAROUND); for (i = 0; i < max_loop; i++) { u32 sfcsr; regmap_read(regs, CCSR_SSI_SFCSR, &sfcsr); @@ -650,8 +654,7 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi_private *ssi_private) * codec before a stream is started. */ regmap_update_bits(regs, CCSR_SSI_SCR, - CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE, - CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE); + FSLSSI_SSIEN_WORKAROUND, FSLSSI_SSIEN_WORKAROUND); regmap_write(regs, CCSR_SSI_SOR, CCSR_SSI_SOR_WAIT(3)); }