From patchwork Wed Jan 21 13:38:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 5677361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4616EC058D for ; Wed, 21 Jan 2015 13:40:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7AD462024C for ; Wed, 21 Jan 2015 13:40:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94CC020218 for ; Wed, 21 Jan 2015 13:40:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDvUr-0005oO-6O; Wed, 21 Jan 2015 13:39:01 +0000 Received: from smtp-out-053.synserver.de ([212.40.185.53]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDvUU-0005Ol-GW for linux-arm-kernel@lists.infradead.org; Wed, 21 Jan 2015 13:38:40 +0000 Received: (qmail 21929 invoked by uid 0); 21 Jan 2015 13:38:16 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 21558 Received: from p4fc4610a.dip0.t-ipconnect.de (HELO lars-adi-laptop.analog.com) [79.196.97.10] by 217.119.54.73 with SMTP; 21 Jan 2015 13:38:15 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Subject: [PATCH v2 2/3] ASoC: sh: fsi: Fix clock inversion Date: Wed, 21 Jan 2015 14:38:11 +0100 Message-Id: <1421847492-8857-2-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1421847492-8857-1-git-send-email-lars@metafoo.de> References: <1421847492-8857-1-git-send-email-lars@metafoo.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150121_053838_962539_E139BEA7 X-CRM114-Status: GOOD ( 15.97 ) X-Spam-Score: -0.7 (/) Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen , Kuninori Morimoto , linux-sh@vger.kernel.org, Magnus Damm , Simon Horman , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to the sh7724 hardware user manual (Rev.2.00 Jan 2013) page 1851 to 1856 the FSI bit-clock is inverted to the bit-clock as specified by the I2S standard. This means the bit clock inversion bit should be set for a normal I2S clock and should not be set for an inverted I2S clock. Similarly when operating in left-justfied mode both the frame-clock and the bit-clock need to be inverted to be standards compliant. This means also that the exta clock inversion setting in the armadillo800eva machine driver for CPU component should now be removed. Signed-off-by: Lars-Peter Clausen --- I don't have the hardware but I'd like to get rid of the extra SND_SOC_DAIFMT_IB_NF in simple-card platform data, so we can remove the fmt field. Kuninori can you check if this works? Changes since v1: * Fix whitespace --- arch/arm/mach-shmobile/board-armadillo800eva.c | 1 - sound/soc/sh/fsi.c | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 75de26c..36aaeb1 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -1015,7 +1015,6 @@ static struct asoc_simple_card_info fsi_wm8978_info = { .platform = "sh_fsi2", .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, .cpu_dai = { - .fmt = SND_SOC_DAIFMT_IB_NF, .name = "fsia-dai", }, .codec_dai = { diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index b87b22e..6783d3f 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1594,6 +1594,12 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd, static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) { + /* + * FSI bit clock is inverted to the I2S specification, so we invert it + * when a non-inverted I2S clock was requested and vice versa. + */ + fsi->bit_clk_inv = !fsi->bit_clk_inv; + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: fsi->fmt = CR_I2S; @@ -1602,6 +1608,7 @@ static int fsi_set_fmt_dai(struct fsi_priv *fsi, unsigned int fmt) case SND_SOC_DAIFMT_LEFT_J: fsi->fmt = CR_PCM; fsi->chan_num = 2; + fsi->lr_clk_inv = !fsi->lr_clk_inv; break; default: return -EINVAL;