Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3338106imu; Sun, 11 Nov 2018 12:41:56 -0800 (PST) X-Google-Smtp-Source: AJdET5dnpxxCo1CquiPOIytiLMJ6PWj5ljMJ1VvrkVNayhkj9wr/ISu0bjXPiQKstYXB4S7Smf04 X-Received: by 2002:a17:902:f24:: with SMTP id 33-v6mr17919937ply.228.1541968916334; Sun, 11 Nov 2018 12:41:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968916; cv=none; d=google.com; s=arc-20160816; b=Ls7vITRjXyzo+el/WhMLtax6KKEAgMIFDGKHPQky1P5dtUfTI6PGMvhthL4nNx+hku eYlkif7XSbxNAwPb5jIb3on6TM+ldJSBwSSFZIDJTyoSPn7MGqj7QzilKMlAbUOu3i5a oz3znxs3Om2daOHUn/f0sEz2vWOafhBWXGihObkYpMYv4Usn5UjkxSipIbLUTXJZfqkR FMshASX5PZ5iucBSSWb3aYtXBDPK/yQZo6okD1y42i9lBaWHbTxiOs4DKUnhEgic70i0 A5Njje5OxAp0fKz3JLdn0TByIhMgQgh0v9Twy8ZYy08/vZ8e3HQpH2ePbYWXmCgxPYX6 sI9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=HzuSc9NBZFyuExVPEmTSZGAsoJ4awacHRi4rFdARUoc=; b=uCe+mkr+Q0BG3kkHW58KfvOGIq2d1P60/Xb+sdzvoIphxT6BqDAx1F1G9HXO6e1K4V rcpkMtkTEwzvx6WP9gjjyzOAv8BDNXRyz3tVdGleuxsTT7qPZU3oT3W5vBtujCdZeY+a io8YphSFAeIZeRybjsvsK1vj02y7asqbaRkVDkj/i+RRlkJDbZHKJEyyXtFF2DWYltb5 kKzarOPcUJs1FsjHNpo1v9N7lbxYXEWTVibqTwK21nFNEBIlV2gSNdkSepG6K7kiz7jO 21rLpNHSZ82PXWvSVHcy/a/LmCWyqEdz+YMKdwUtVvXPA3Auq+5H07TQZAzYyVvhMz+v FuKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si15135650pld.424.2018.11.11.12.41.41; Sun, 11 Nov 2018 12:41:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730330AbeKLGas (ORCPT + 99 others); Mon, 12 Nov 2018 01:30:48 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:49386 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729848AbeKLFsD (ORCPT ); Mon, 12 Nov 2018 00:48:03 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsQ-0000lK-Gw; Sun, 11 Nov 2018 19:58:34 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsO-0001OQ-82; Sun, 11 Nov 2018 19:58:32 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Alexander Sverdlin" , "Mark Brown" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 030/366] ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Sverdlin commit 5d302ed3cc80564fb835bed5fdba1e1250ecc9e5 upstream. 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 Signed-off-by: Mark Brown Signed-off-by: Ben Hutchings --- sound/soc/cirrus/ep93xx-i2s.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) --- 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 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 /* 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; }