From patchwork Fri Dec 1 13:42:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 120322 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1154099qgn; Fri, 1 Dec 2017 05:43:04 -0800 (PST) X-Google-Smtp-Source: AGs4zMaaU3PQsc5fu0A2VHSt53rBuRqzLm4OF4vtMTRBq/vWprxATqPYycCzHow/5Oaa1uzyCtyE X-Received: by 10.223.189.135 with SMTP id l7mr5540882wrh.231.1512135784452; Fri, 01 Dec 2017 05:43:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512135784; cv=none; d=google.com; s=arc-20160816; b=fdN2bGAtUQV9/HvujacXqAt9+wkaHy8fHzqCHKa52QS3MSv1Ywdse8N8sbaZJWvxwe YxpC+YkG0qmT3kLLZOyFEaO1SU8D6BAJ+hcVTsIsBGIc1k3+blXBEPT9cAIt0HndXyKj AdcGQz/lzSVfhXyf2fEgqYPYGjLTNc732BAQu2muKwr8gggEfYeK/KKGKaM6YsRW0QbE nan1iyfYhL01VRBOZZpQcdXYnjtIqXBrYkPQoGmQ8Gum51ycDCxNesY78F/zlzuwuOqR dyrwvHySq1z1tZH9KWjSi5IWNdzJGQv5xMh7YkVvGKFe3eokreIJznfz3KlH1lcu49aV MSyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=DSt94m7qu+MeE/kuPP7D/xZuiByr8qqrfMDa0/8MVfI=; b=boZSpmZzmceSl31eYq4RmFMjjy0gYlURwx6U73/gMcC9Pef2IuaMd1o5+N0UlRQsgH KRkURLzfCqB3yOApVKhwIMhDP0URKscKuQgM8wcIbnvyTWqAVFwM1y9tw+Klqn7NETOh gGWRz3YkAP9+LQEjeeJlsAaa4dub3SuNLT1G3t2dm1FDeh0gIHaA13ScMiTJ8MeR1tx1 tJ6NMfOSVuZ7YAjVmYqSJfmtrFuTKozsMossUI3J9FzUvj2P3kIsQqafMhWNZBebd1Pm /S8Bnmdjj1/mhyW8xo6WurcN2Z/sVsGrpzq0vsmIrrxQBU4GH86WtNIWlUbn39YxD3kM gi2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=TtM/7TY9; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id x18si800332wmh.9.2017.12.01.05.43.04; Fri, 01 Dec 2017 05:43:04 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=TtM/7TY9; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 06514267C30; Fri, 1 Dec 2017 14:43:03 +0100 (CET) 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 845CF267C2E; Fri, 1 Dec 2017 14:43:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id BC864267C23 for ; Fri, 1 Dec 2017 14:43:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=kmz8IUz64ZZHSjjuylxXEeR3EgMEbL8EevFnqNc9Uug=; b=TtM/7TY9Se+c xBIyhhJ3pH2GBylatyRW1Xk38myldcVMGW3tSRhWAV7lROCgZki3gXcAZM7GkacKlk/m3wR+hUXWD ZZkPvxkEQ1xwMY4yI4hmRktOgjGplPKjGXC0MIsqu4Y2RNrRxCywVfaHZtKcUhW0X5RacKiEb4gN8 SeGgo=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eKlai-0005Mw-1C; Fri, 01 Dec 2017 13:42:56 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1eKlah-00018p-Kw; Fri, 01 Dec 2017 13:42:55 +0000 From: Mark Brown To: Andrew F. Davis In-Reply-To: <20171129213300.20021-14-afd@ti.com> Message-Id: Date: Fri, 01 Dec 2017 13:42:55 +0000 Cc: Mark Rutland , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Tony Lindgren , Liam Girdwood , Rob Herring , linux-kernel@vger.kernel.org, Mark Brown , =?utf-8?q?Beno=C3=AEt_Cousson?= , "Andrew F . Davis" Subject: [alsa-devel] Applied "ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes" to the asoc tree 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From dcb407b257af06fa58b0544ec01ec9e0d3927e02 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Wed, 29 Nov 2017 15:32:54 -0600 Subject: [PATCH] ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes Currently BCLK inverting is only handled when the DAI format is DSP, but the BCLK may be inverted in any supported mode. Without this using this CODEC in any other mode than DSP with the BCLK inverted leads to bad sampling timing and very poor audio quality. Signed-off-by: Andrew F. Davis Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic31xx.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- 2.15.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index d77cc36d7360..38fd6ea275fb 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -938,6 +938,18 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } + /* signal polarity */ + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: + break; + case SND_SOC_DAIFMT_IB_NF: + iface_reg2 |= AIC31XX_BCLKINV_MASK; + break; + default: + dev_err(codec->dev, "Invalid DAI clock signal polarity\n"); + return -EINVAL; + } + /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: @@ -945,16 +957,12 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_DSP_A: dsp_a_val = 0x1; /* fall through */ case SND_SOC_DAIFMT_DSP_B: - /* NOTE: BCLKINV bit value 1 equas NB and 0 equals IB */ - switch (fmt & SND_SOC_DAIFMT_INV_MASK) { - case SND_SOC_DAIFMT_NB_NF: - iface_reg2 |= AIC31XX_BCLKINV_MASK; - break; - case SND_SOC_DAIFMT_IB_NF: - break; - default: - return -EINVAL; - } + /* + * NOTE: This CODEC samples on the falling edge of BCLK in + * DSP mode, this is inverted compared to what most DAIs + * expect, so we invert for this mode + */ + iface_reg2 ^= AIC31XX_BCLKINV_MASK; iface_reg1 |= (AIC31XX_DSP_MODE << AIC31XX_IFACE1_DATATYPE_SHIFT); break;