Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3116475ybl; Mon, 19 Aug 2019 12:29:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEfX49cd/y4ykzSTQscXgPneQ3di3Tv/I2vlVaJRsJphlGLV2x0sMCJmXrz9HlR5kS1Y2U X-Received: by 2002:a63:d315:: with SMTP id b21mr21940233pgg.326.1566242956009; Mon, 19 Aug 2019 12:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566242956; cv=none; d=google.com; s=arc-20160816; b=iniVdKiL4UvArhUB59JWwOi7k+qRcFzLZGJUC4HACce2YHWVyxulsG1H+iQ9q4auFV oquZ00AXNcsf1iM+y+vXZ6dWsu8A9poH/TOHv0SBUdvxqa3/sADC7wt9Rzpx+xsMP+7e Ee7zcpaHfkalLqHPM/TlYENCbZ0qozyIBoo974qhKKzNAQUfUUbeKZVPwrpbqSw/WjRd zjAISxZ4+mEZrKZYo7IxVGQgYyNrMuml5IJeVJscKgOfH9PjeoKEAviNjyCrZ98EUG+u kwdLiqBdsfo80F9Rw7G2Ik9dC68NlxUp02p2qfB9zhfEH7FajWySmTIaf8QlihIAZwNO gAfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p0VFJg9patKV8FOx48tvuA+Sae9vcCrqnIYg5tlH53k=; b=RD+QPNjKbx5sb+hxjhw39PbIW0foJS+XBS8+5lZ+P7/aj817zE+kr673OdQGfmI9nN kkaZbK/YWXuOJ6TZeAUexjslcLeCXumvYRcqZAi6fiL7eYhurOtNan/WewwPFdU5UOze 5pesbqRsY6cZQqGJw5BUHprWpj5i7soB8hqOrIBYhkStJYXDOjymKKZnhW3Uuk/ET8pj vNTKXeFh59UANA31WdtPhK5dKlzZNzSYi/5G4FRdHECI3iKtAXWw6temdiVVZBAPxye+ kx9CYLPQYurAGgP9rOJhWLuj2UqIvrCo60dJLiYXBodQ/qcHMALUI+8p4YeAuCG04S55 /cTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vSAqU7a6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94si10696783plf.221.2019.08.19.12.29.01; Mon, 19 Aug 2019 12:29:15 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=vSAqU7a6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728899AbfHST1b (ORCPT + 99 others); Mon, 19 Aug 2019 15:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:42050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728681AbfHST0N (ORCPT ); Mon, 19 Aug 2019 15:26:13 -0400 Received: from localhost (lfbn-1-10718-76.w90-89.abo.wanadoo.fr [90.89.68.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7220322CEC; Mon, 19 Aug 2019 19:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566242773; bh=naLkSi6HCcekYJoGDeGYtnqekGWpuAududHuhSwuFWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vSAqU7a6ySkxUsTrRCfziifAcrtQ/XNk8+ABQzWN7UWvv9bOqv6nHRkFIRD6SHpzX v1w0iabbQwQbJP6z7hr9SYFJyq8BQVuW1syY+tuttuVU4A1dgSauyKwuyOqupnHCkd bEK4RbQm6q7v/pcX1WwuyFviiT1gSV71PQXvQJVs= From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , lgirdwood@gmail.com, broonie@kernel.org Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, codekipper@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH 13/21] ASoC: sun4i-i2s: Fix the LRCK polarity Date: Mon, 19 Aug 2019 21:25:20 +0200 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard The LRCK polarity "normal" polarity in the I2S/TDM specs and in the Allwinner datasheet are not the same. In the case where the i2s controller is being used as the LRCK master, it's pretty clear when looked at under a scope. Let's fix this, and add a comment to clear up as much the confusion as possible. Fixes: 7d2993811a1e ("ASoC: sun4i-i2s: Add support for H3") Fixes: 21faaea1343f ("ASoC: sun4i-i2s: Add support for A83T") Signed-off-by: Maxime Ripard --- sound/soc/sunxi/sun4i-i2s.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index e614c2d52af5..9c9061621b15 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -570,23 +570,29 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, u32 mode, val; u8 offset; - /* DAI clock polarity */ + /* + * DAI clock polarity + * + * The setup for LRCK contradicts the datasheet, but under a + * scope it's clear that the LRCK polarity is reversed + * compared to the expected polarity on the bus. + */ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { case SND_SOC_DAIFMT_IB_IF: /* Invert both clocks */ - val = SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED | - SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED; + val = SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED; break; case SND_SOC_DAIFMT_IB_NF: /* Invert bit clock */ - val = SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED; + val = SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED | + SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED; break; case SND_SOC_DAIFMT_NB_IF: /* Invert frame clock */ - val = SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED; + val = 0; break; case SND_SOC_DAIFMT_NB_NF: - val = 0; + val = SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED; break; default: return -EINVAL; -- git-series 0.9.1