From patchwork Sat Apr 28 20:51:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 10371711 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 E8C906038F for ; Mon, 30 Apr 2018 12:40:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7FC128AEB for ; Mon, 30 Apr 2018 12:40:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CADCF28AF1; Mon, 30 Apr 2018 12:40:52 +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=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable 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 F2B6728AEB for ; Mon, 30 Apr 2018 12:40:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 56AE5267672; Mon, 30 Apr 2018 14:40:14 +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 29E2826735E; Sat, 28 Apr 2018 22:52:41 +0200 (CEST) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by alsa0.perex.cz (Postfix) with ESMTP id B816326725C for ; Sat, 28 Apr 2018 22:52:36 +0200 (CEST) Received: by mail-lf0-f65.google.com with SMTP id u21-v6so7362231lfu.9 for ; Sat, 28 Apr 2018 13:52:36 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=qI1as39gQSh8aTmHwd5JTMaQZ9JbXlaXsZZG1lmtsZM=; b=i1DPqmw4naVQdGxe7dUa0IoXShDebLkHNuSiuwL7DzOi0wfESVn5sGMN3N8zGaoOPb Hvv9ihlqf8L10ji9pYjaq3HysuPPXq49dJUJdM38VdO4HSnUruJ6Wzf2NHm/kxfoU5ks a6Lb1lBQ0wff/+XuKZ4dpygLnsolGb2xceYsYmgVtPYQPIvFVBqikzrOn2M8kZLqEntY 5GVJ9aFj+IlHLsSzWRo1DyJpW2jA0oP4E2CYugq2DD+XsltaDrrru5akijoDgJ4I3cGk R+q/634Xs1tyj1KJrxeV5QuowsZZkXIspdqDR2Q2xFuOwKhyVnpGTgFIRj4Bj+DJmkEc 7/wQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=qI1as39gQSh8aTmHwd5JTMaQZ9JbXlaXsZZG1lmtsZM=; b=bxTxdMo+vwxVQCW6l857FucuB2ebzUBw5fsC6Xcm+N5q+ZiMGt1br0asz0BINxkpsJ kX1XWIMNYA43EU/HidI+de5pkfHmCLgtqFLeK+BBp1Ym3yU39X3M6RvmqtocXZ7iDYB8 +pAAzdm5GdGjHKDHDkGG+ItPZvYosfPvvN6JMjO+eD5SUkLKRLdT/ZPG+jcDzcY58ch3 7MxMYQjuVf4o8Ez3kVixW8Udi08gMsWsVvwXz8+YJZF+prDlTkAOYRe98LbjhfA3Q6nX AE3vjdUL1ZM9JbdFFX3k44etHsw6ydvh+CmwxzbgpeMrJ2l7ZLM5qkZit8Fvdc/ZqOhL zP0w== X-Gm-Message-State: ALQs6tB3z5fYw0aVfgEnIxI4oVMEnht+yPAw0tZw0aP+1LO0jkT3LnkA nI1Nz/9YHd4nDytWsJzRfRjERprt X-Google-Smtp-Source: AB8JxZo34R9iNxRbt82KSVFjo56WC/vUf/cQDRaNecJFVHuASqqDnL30wj+Ff8g4cab6Dafb9cugGg== X-Received: by 2002:a19:11da:: with SMTP id 87-v6mr4428718lfr.125.1524948756153; Sat, 28 Apr 2018 13:52:36 -0700 (PDT) Received: from giga1.localdomain ([195.245.44.8]) by smtp.gmail.com with ESMTPSA id t24-v6sm852578ljg.65.2018.04.28.13.52.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Apr 2018 13:52:35 -0700 (PDT) From: Alexander Sverdlin To: alsa-devel@alsa-project.org Date: Sat, 28 Apr 2018 22:51:39 +0200 Message-Id: <20180428205142.31921-3-alexander.sverdlin@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180428205142.31921-1-alexander.sverdlin@gmail.com> References: <20180428205142.31921-1-alexander.sverdlin@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 30 Apr 2018 14:39:59 +0200 Cc: Ryan Mallon , Takashi Iwai , Liam Girdwood , Hartley Sweeten , Mark Brown , Alexander Sverdlin , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH 2/5] ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP According to "EP93xx User’s Guide", I2STXLinCtrlData and I2SRXLinCtrlData registers actually have different format. The only currently used bit (Left_Right_Justify) has different position. Fix this and simplify the whole setup taking into account the fact that both registers have zero default value. The practical effect of the above is repaired SND_SOC_DAIFMT_RIGHT_J support (currently unused). Signed-off-by: Alexander Sverdlin --- sound/soc/cirrus/ep93xx-i2s.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index 38c240c97041..0dc3852c4621 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -51,7 +51,9 @@ #define EP93XX_I2S_WRDLEN_24 (1 << 0) #define EP93XX_I2S_WRDLEN_32 (2 << 0) -#define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2) /* Right justify */ +#define EP93XX_I2S_RXLINCTRLDATA_R_JUST BIT(1) /* Right justify */ + +#define EP93XX_I2S_TXLINCTRLDATA_R_JUST BIT(2) /* Right justify */ #define EP93XX_I2S_CLKCFG_LRS (1 << 0) /* lrclk polarity */ #define EP93XX_I2S_CLKCFG_CKP (1 << 1) /* Bit clock polarity */ @@ -170,25 +172,25 @@ static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai); - unsigned int clk_cfg, lin_ctrl; + unsigned int clk_cfg; + unsigned int txlin_ctrl = 0; + unsigned int rxlin_ctrl = 0; clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG); - lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA); switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: clk_cfg |= EP93XX_I2S_CLKCFG_REL; - lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; break; case SND_SOC_DAIFMT_LEFT_J: clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; - lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; break; case SND_SOC_DAIFMT_RIGHT_J: clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; - lin_ctrl |= EP93XX_I2S_LINCTRLDATA_R_JUST; + rxlin_ctrl |= EP93XX_I2S_RXLINCTRLDATA_R_JUST; + txlin_ctrl |= EP93XX_I2S_TXLINCTRLDATA_R_JUST; break; default: @@ -237,8 +239,8 @@ static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, /* Write new register values */ ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg); ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg); - ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl); - ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl); + ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, rxlin_ctrl); + ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, txlin_ctrl); return 0; }