From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41870C433E0 for ; Fri, 10 Jul 2020 05:44:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 17E3E2077D for ; Fri, 10 Jul 2020 05:44:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sholland.org header.i=@sholland.org header.b="VPv8Xnmd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="aHTPbn6R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbgGJFox (ORCPT ); Fri, 10 Jul 2020 01:44:53 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:56109 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbgGJFot (ORCPT ); Fri, 10 Jul 2020 01:44:49 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id AC3C8D3C; Fri, 10 Jul 2020 01:44:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 10 Jul 2020 01:44:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:subject:to:cc:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=O ol9ctihqUSx+gzTjaCciQOFeooJU+2+HpXzalaTxyo=; b=VPv8XnmdWwAWD+Xjh dEwdlMcCCBclQtt1RE78+yGPuYhjIhAi7UlvJPCRy47rcuZTE9k3EdpklAZwMwTF iprOI0xNYphsShFdTh/KbRkewzlsK6RAbtan59V61GjKOqjei9JvE29fB59D8ed2 bK1Sys5PZwced9Trpx29RrgZoaXVspdgLB/T+0yfeA8qtO3h56cSEs5mwurotGCM QHnf9a9KE2YB3ZIMCQBTciQNpb1NA4E6Q95jNUD6XBs3XXSAZDTkCL5wZIcBTvCR vIl2iFDifI0q+Hgzym0XFAjgfA2RxHtSCqStfZKeMrWs5GnmsLWYkqRj5B1e2dt/ ezlAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Ool9ctihqUSx+gzTjaCciQOFeooJU+2+HpXzalaTx yo=; b=aHTPbn6RpXTQL/52pgbmUu8KPqRV0w/WDbIkx0O3c1D/u5dhBkkAEYdj1 Np09CzD7WSNFK/WNRJ0EmDVQDqywn9d19Z/hsKEq9MtAfLDKS5JnCchnmbdTEfuI a5wlrX5s2GCSu96KpLQC1MBAfW9R7T4czKAOM5svrvFZGBLjhgBdNe8LsdeAXtBA /D/5CSRCxBPwra7vGo/w/rLl7wOGu0EpgCqUmMJfU/LFhaia3c3zMnBQHQte702X umf65WOTOJjT/4ni8kogRC8MKMBh2H/6ONhafvjZz/w2WIbCeCbRJi5IjGg17iAn ydyHBcWOvr1YAmJL15G7pHcSC3UDw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrvddtgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffuvfhfkffffgggjggtgfesthekredttdefjeenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepvedvffegtdeiheefledtkeeljeevtddvfeeuheeuiefhvdejgfek fedugeejjedtnecukfhppeejtddrudefhedrudegkedrudehudenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgr nhgurdhorhhg X-ME-Proxy: Received: from [192.168.50.169] (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 9CF213280060; Fri, 10 Jul 2020 01:44:46 -0400 (EDT) From: Samuel Holland Subject: Re: [linux-sunxi] [PATCH 04/16] ASoC: sun4i-i2s: Set sign extend sample To: peron.clem@gmail.com, Maxime Ripard , Chen-Yu Tsai , Rob Herring , Mark Brown , Liam Girdwood Cc: Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Jernej Skrabec , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com References: <20200704113902.336911-1-peron.clem@gmail.com> <20200704113902.336911-5-peron.clem@gmail.com> Message-ID: <2910ec3c-25f1-d617-54a8-db6d21acb742@sholland.org> Date: Fri, 10 Jul 2020 00:44:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200704113902.336911-5-peron.clem@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/4/20 6:38 AM, Clément Péron wrote: > From: Marcus Cooper > > On the newer SoCs such as the H3 and A64 this is set by default > to transfer a 0 after each sample in each slot. However the A10 > and A20 SoCs that this driver was developed on had a default > setting where it padded the audio gain with zeros. > > This isn't a problem while we have only support for 16bit audio > but with larger sample resolution rates in the pipeline then SEXT > bits should be cleared so that they also pad at the LSB. Without > this the audio gets distorted. > > Set sign extend sample for all the sunxi generations even if they > are not affected. This will keep coherency and avoid relying on > default. > > Signed-off-by: Marcus Cooper > Signed-off-by: Clément Péron > --- > sound/soc/sunxi/sun4i-i2s.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > index 8bae97efea30..f78167e152ce 100644 > --- a/sound/soc/sunxi/sun4i-i2s.c > +++ b/sound/soc/sunxi/sun4i-i2s.c > @@ -48,6 +48,9 @@ > #define SUN4I_I2S_FMT0_FMT_I2S (0 << 0) > > #define SUN4I_I2S_FMT1_REG 0x08 > +#define SUN4I_I2S_FMT1_REG_SEXT_MASK BIT(8) > +#define SUN4I_I2S_FMT1_REG_SEXT(sext) ((sext) << 8) > + > #define SUN4I_I2S_FIFO_TX_REG 0x0c > #define SUN4I_I2S_FIFO_RX_REG 0x10 > > @@ -105,6 +108,9 @@ > #define SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED (1 << 7) > #define SUN8I_I2S_FMT0_BCLK_POLARITY_NORMAL (0 << 7) > > +#define SUN8I_I2S_FMT1_REG_SEXT_MASK GENMASK(5, 4) > +#define SUN8I_I2S_FMT1_REG_SEXT(sext) ((sext) << 4) > + > #define SUN8I_I2S_INT_STA_REG 0x0c > #define SUN8I_I2S_FIFO_TX_REG 0x20 > > @@ -663,6 +669,12 @@ static int sun4i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, > } > regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, > SUN4I_I2S_CTRL_MODE_MASK, val); > + > + /* Set sign extension to pad out LSB with 0 */ > + regmap_update_bits(i2s->regmap, SUN4I_I2S_FMT1_REG, > + SUN4I_I2S_FMT1_REG_SEXT_MASK, > + SUN4I_I2S_FMT1_REG_SEXT(0)); > + This is just a note; I'm not suggesting a change here: This does nothing, because SUN4I_I2S_FMT1_REG only affects PCM mode, which is not implemented in the driver for the sun4i generation of hardware. PCM mode requires setting bit 4 of SUN4I_I2S_CTRL_REG, and then configuring SUN4I_I2S_FMT1_REG instead of SUN4I_I2S_FMT0_REG. Regards, Samuel