From patchwork Thu Sep 5 16:17:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 173171 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp936643ilq; Thu, 5 Sep 2019 09:19:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4z1ZN51/V6Uo7E5MvLsOlYTFUf6JCprQe1hciivdVrNhDbAg3nFgY+SSJqPOW9MS7urLb X-Received: by 2002:a17:902:8541:: with SMTP id d1mr3742160plo.39.1567700366913; Thu, 05 Sep 2019 09:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567700366; cv=none; d=google.com; s=arc-20160816; b=TEjrcKxvsBSX7i1TpcsPlDos2FLZbSAU77vuiks41cQvdAiEcGjQzuU9kQImSOT/Bb F8y/gtV9YaZe80e1LT52FxmFxp/nWsUxkcrFmmV/inFJnzF5FFIFMf7SvBQGy93G1YQz 197bxY3xGsEoLKulY0fK5C8YosKC1Ib8Dbfhqtf2qAKHvDk8ZMZWtVaTPG7wPCj7IH9B BesjQ7xNQiU3MWI7W9p78c3PJkSzMKHYZjIsNFaPhUI4MDqB3THDw6+7oNvq9k441wma byN5XV7BOSd+7hmUgEtmDtA2rxYpakYCQgF8wwZ/u77xEt0NxAO3GbUXB4sxbumY8UUo pupQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=M87R1B83CdvCffRmdlG/Mhks+Wha362vswolhcqWNWM=; b=fQkjD+7unY+aWcyPv4nB9K8lm/BFMSa2CRxnXDXdC7eX/HtadjB/VTaaBqq80JRy5N 5nZ7CZYsStVYXfoNbpf09LfAnPO39aLiZxBrGjfzeXhtEhnUVhyflZDE8pgcngWi5LeH DtcZ+nEFXFlnEfiL5RGGtvfIQHWLJMvWCqr95sXFyEsP7jNPD4N+WWQdajtlLe0i6Bj+ y2T1LMayXlRdjWreCM+pw+7/oTwfnKWjcrM55uFcQhTZkEXB0CK786I+ct02Brmd1Yy0 lVkdyON/6IjF6gBjQHGdgkIB7tCM/HErNeqrfBQRjbE2XyWWI+gd9MFie+12pZO0SXoV Bw6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=D65NNRJi; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DhtZCS6p; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id i3si2370198pli.19.2019.09.05.09.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 09:19:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=D65NNRJi; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DhtZCS6p; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=M87R1B83CdvCffRmdlG/Mhks+Wha362vswolhcqWNWM=; b=D65NNRJiCh/MHqtxQnfb7cnnPz o75RXiyghXQuuQfir2++HEoNIBdLRVETJe98qkdh7pEB3z8SwI/nZNj66mH6dBGeqpyIIyQMkDOQc cTvKmMC9OSrDoSenFiwdu0dwZ7LfqDN/CcGNiT11BMud4wZgPC2GnEt3DX3zosB2xIhxqx4LYXBUC IFxB5AG5Hsu10gsTWjR/bibPTwh1bUWB9Azecd/bcB4KDvPRZiUOwTyXZLEOKfDWV0l85OBdYXJ18 E1ksjNeJG//PVjQGuU9WGwuuusTp83PCliYeQD5caF+oS0EolpYPlv3ocySp3p8uQH+fZPzKeve8S 9qr3d8AQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i5uTg-0002OV-5L; Thu, 05 Sep 2019 16:19:20 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i5uSX-0000vA-4c for linux-mtd@lists.infradead.org; Thu, 05 Sep 2019 16:18:10 +0000 Received: by mail-pf1-x444.google.com with SMTP id h195so2075742pfe.5 for ; Thu, 05 Sep 2019 09:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rjuaqfgsXjJPwAACoDEoQUxKOEl2ZmoHXoDNdOHfK/8=; b=DhtZCS6pEqVXAANTeuPn229D+BZX3X67QaHqNgnEKoio/f3XFGIKudVgM5FDU+7o8L nQ6C8zCJpGUG562Tdrhhk+jzdjUxPEUMlyMrosXluqm8s7BPYWWQ2Sfl8GPdcyN3+vz3 WgC0nx5vQPM/ac0gkVSlnhW9uet9jY41HdO0XoqnQ4dQQgwZRDvRXdAX5pdKiXWoz78p gJ/gB20nx7nFBvvCBuWrSZgl46CenVN2LnP6ZluOUqhvk/2lQx7TA+V1EqPfUJ0tOjn4 d9umZlIflwKbjOrolidHP4+2mwXkt5JzsO/HIsQg2gt2s/+L0G/cpcGqNlGMyilyzdUy uaqw== 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; bh=rjuaqfgsXjJPwAACoDEoQUxKOEl2ZmoHXoDNdOHfK/8=; b=ujnxEjKSRG/xoEwbtwm8HHmDIqeZN5tW+wETkD3cBvXrkKBdWEPmA7IBPYiuFRHbRo D+BKydYSpdBBkXnLA2/PkRl7iZoF1Im6Dw4auYIvqk7TU2YRLKUoEim8UpkNlE3L93wl OdrnR0kSy2WIK8I1O6b6mm1GtElPq4rmSQWqop/adJFXwmLJNxjQ1htlaDnJudxdbhrg LlCiLTzlHeja7HseuD07eEfP+0W064BOAyntybSluGoCRPFo0VzkTNg2JxvEotL9d6Ua ui6vUji1FeJH3oEH9erX53uiEXwl525cvCVbrGq4O+FwpNur1d5Fw8qhLoZJQ06iRzHw DrHw== X-Gm-Message-State: APjAAAUoMKMa7gUOxDXOqOdrHo6VE7IfHbrUyflQG2O5k7UIAb4tiN32 7vwdAFSIYaVI+Xzjj5/+0KFzJA== X-Received: by 2002:a63:394:: with SMTP id 142mr3929328pgd.43.1567700288547; Thu, 05 Sep 2019 09:18:08 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id m129sm6324005pga.39.2019.09.05.09.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 09:18:08 -0700 (PDT) From: Mathieu Poirier To: stable@vger.kernel.org Subject: [BACKPORT 4.14.y 06/18] ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes Date: Thu, 5 Sep 2019 10:17:47 -0600 Message-Id: <20190905161759.28036-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190905161759.28036-1-mathieu.poirier@linaro.org> References: <20190905161759.28036-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190905_091809_306011_CBDDDEA2 X-CRM114-Status: GOOD ( 11.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org From: "Andrew F. Davis" commit dcb407b257af06fa58b0544ec01ec9e0d3927e02 upstream 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 Signed-off-by: Mathieu Poirier --- sound/soc/codecs/tlv320aic31xx.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 54a87a905eb6..d3bd0bf15ddb 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -924,6 +924,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: @@ -931,16 +943,12 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_DSP_A: dsp_a_val = 0x1; 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;