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: 10370375 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 66B57601BE for ; Sat, 28 Apr 2018 20:55:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5567428F5B for ; Sat, 28 Apr 2018 20:55:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4799F28FB8; Sat, 28 Apr 2018 20:55:23 +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.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC91B28F5B for ; Sat, 28 Apr 2018 20:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dTuQY7gDQUnsOagYibWstjqVlibIKyvvo2txVD3wxrQ=; b=csx0B+oNDidYIE H+lQH5kNie7WTCuLgQGRtSkxP0mVplvXzX1q9dpvtSGt/J3482kY2JZcoqmLFaRx5JWiDdgWs9cqP XgcQIIFqgYhkAhEEOzchvZY3ZVpxjnpnEdcAq9MQxjpiYeuhck/Amo69RcTpbshpjR42SjnrUjt9B eXk9jKD9cXnl6h3qJTINCJHK01UWngV1+iU98eCOCXqrHkaMHA8ZzsqbM1INRhPUbexjcLz/oOdPq i2NR4nHexr74AT3YY75SKuTSMw3Mt3xIYRFFFko6ee8mSCYC3t8a8T5uxcizugePDI34DS6t0LIMs iZXrTqPRl/vRy2m0/vdQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fCWsC-0000dM-9V; Sat, 28 Apr 2018 20:55:12 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fCWpt-0007zA-A6 for linux-arm-kernel@lists.infradead.org; Sat, 28 Apr 2018 20:52:51 +0000 Received: by mail-lf0-x242.google.com with SMTP id j16-v6so7365769lfb.7 for ; Sat, 28 Apr 2018 13:52:37 -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=ESnps27Tyl4wyTEQSVlir8VWUhyJmwG7LyTR5dpdhbCo4dE3Nu6douPqMd7Ny6HT3T bzGHqWAP9IZP5l/bEeoedVyIk964pZX1ft+z1DhgcgyVOiFLFwKvbN/am6HTZq+b/j0Z GSx32nIDLIlWFsw3rJV4CzQYe4LP15c5Lu+Ogu3/R7rzqRBJUsZrizusRVmeghL3EaYR /tM2qIHD9yjy+3ZlHFK1UV7VMDqs9x9oLjdRfuQ+YsUq67YqnFmoIi0HIfPD2vJtd0HY 9gz/dbO674SRnwPul2+n6vm0yUkQy51piacmkmHerHEZYz+FmWJOXkB0wzoEdS7dY4k+ EQ1A== X-Gm-Message-State: ALQs6tB5Horow9ymHE+NTHtAS+K/h5dkX0Zutfxr+huWwRqIcCV7chyl Ah82CE/TyxG+6JbQnSUWP6g= 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 Subject: [PATCH 2/5] ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180428_135249_389063_922CFD49 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Mallon , Takashi Iwai , Liam Girdwood , Hartley Sweeten , Mark Brown , Jaroslav Kysela , Alexander Sverdlin , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }