Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp679599ybl; Wed, 14 Aug 2019 04:25:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyx2lGwLti9xOXVSvS0mtAjPNK++XLJ9yfLP5zSeyAk+jeqDb2HKb1gpwQ8Un1O0voTv/Os X-Received: by 2002:a63:fe17:: with SMTP id p23mr38375424pgh.103.1565781951421; Wed, 14 Aug 2019 04:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565781951; cv=none; d=google.com; s=arc-20160816; b=fK/UrCgCO4Y1OkxAdnH1oeQMiLA37lrZRe0E7hwDgAm5D897gF5twhTLlDZsmsWGHr 25fZQKSeamwo6NIz1IF6nisOt8RwFqVnlp988heWXMjyzpvXYEAXRWiub1DvT8OoE4k6 Z5qanEGNzZQcBe+NzUDG+iJ0/rtV43O6VZRvpLZQXDrJ//zledUDaZv3FQZyE+A7+mrU 7d1BwdzQ4vszfyEx7zSTZAbMfNQS2CLt679XeNth2yj1b/crPkH5XUT67SpjuFb4xGWm go5+TNqVOhSgjm1Lld/mGJYvMA/mXudy2ezAMIqT8H0JRygfyrDkvT4XyAGbuKqsR32X RKPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HUGbXBrBjsmS+Ai2+iPeBZiJZJaEtCScpBr1KbEOROc=; b=WMgeBC6PxZL48e9bGzaxWAB98S6uMSBEeJR/k08RBGzwqB3XvzVvNcRB3zrae4158y Bn8BaEwOfzcJVe44s+PlmjLCMKLl8PT3CUWna38U2+mhCuLkSHprk2hDFd6TL93mXhdr 3I3vOPa5JLTGN2q/yBOMzdnXG6CbKXK8AQZ/vWAeLLE8dy34hPutcPk428gi4sNpCYzD x2ssp7GUI2ucrXFWXyEz4zhU/U8qYqcVxXcvJZ2foNDYVWwWTbV6OovK1OSdBQ1N/jCe iAaOaHlSUikhHy3xt1k74/2n6kJk7qVnnttuQpYAI7UaTZ9/El7PVqXuoXSBkcg8lHZS lmLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PkjU82I1; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si8720827pls.3.2019.08.14.04.25.35; Wed, 14 Aug 2019 04:25:51 -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=@gmail.com header.s=20161025 header.b=PkjU82I1; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbfHNLYm (ORCPT + 99 others); Wed, 14 Aug 2019 07:24:42 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42500 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbfHNLYm (ORCPT ); Wed, 14 Aug 2019 07:24:42 -0400 Received: by mail-lj1-f195.google.com with SMTP id l14so1771488ljj.9 for ; Wed, 14 Aug 2019 04:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HUGbXBrBjsmS+Ai2+iPeBZiJZJaEtCScpBr1KbEOROc=; b=PkjU82I1Mi3dtcdhxyT5h+6hb39AQ7Nnc5myOYqUYUr53jt48ZbCascD3VQOPe2Smj I/9PI6CJfvkk2WhoN0gcrFQoW/LQM79KlXTQH+E+F1QCeDUggRHsl7nX2i9l3S/4MB2k OOw7gEQJZVJbWzTrNTaXGt31ef7zKCW5v9CUgEGFask9fTpgdMR0zEbCNF1BIFifTA7U xsaHsj8IHNtg+3SfpY/6bYIBAlgFWC1ovm+4vKdPYZ5NQp0OeK5kuO/cIzgqB7W3rFA9 bFALrkGAmT8rc70l4IPUENm/VIr9YHIIldmT8r4ZTST4D8oF/DzX0+fU6TLOY6Cm3wZ5 9yFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HUGbXBrBjsmS+Ai2+iPeBZiJZJaEtCScpBr1KbEOROc=; b=Zk7rZOzxSq3YEk+9MzZDippu0cBl6H6+ipOrYvnkTuX1OJgbvzLeYTNHkioLwECnE6 K9CBLFFpMZJDxIo1+Vz03k32SI0KUDRI1D8QIYCNzKzHwrrpDA14NztXkjeuBhMsNJCu wmYaA2s3TSyh1bsTsjqYaG0jgnPBZJieX1MrotfhVmoyEj6v1CXr83/sctVR48/We2WZ 2+LQKfcfdU6a6KGIwFouCLwE0C1iuwkx/aiH/7WOXnReJ6nkG20CcsoCKy8nJITW4Die IFsaGPgmTEjrMYNWEkkIowbIsDQDRs4S7rhklJTH2ZjNDl2RLyXHOiI0HFj9V4cb9zcu eA6A== X-Gm-Message-State: APjAAAUinpRpbBVSyTNvHDlCk1dQEIybf187VpJAbUxlIQasTRMTkWO+ 8Tig40efknVC1ATz3CV2V2SmVnudJfF1/iQKSpo= X-Received: by 2002:a2e:720c:: with SMTP id n12mr997564ljc.53.1565781877676; Wed, 14 Aug 2019 04:24:37 -0700 (PDT) MIME-Version: 1.0 References: <20190814060854.26345-1-codekipper@gmail.com> <20190814060854.26345-2-codekipper@gmail.com> <20190814064339.lgfngdkiaalygolk@flea> In-Reply-To: <20190814064339.lgfngdkiaalygolk@flea> From: Code Kipper Date: Wed, 14 Aug 2019 13:24:26 +0200 Message-ID: Subject: Re: [PATCH v5 01/15] ASoC: sun4i-i2s: Add regmap field to sign extend sample To: Maxime Ripard Cc: Chen-Yu Tsai , linux-sunxi , linux-arm-kernel , Liam Girdwood , Mark Brown , linux-kernel , Linux-ALSA , "Andrea Venturi (pers)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Aug 2019 at 13:08, Maxime Ripard wrote: > > Hi, > > On Wed, Aug 14, 2019 at 08:08:40AM +0200, codekipper@gmail.com 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 whilst 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. > > > > Signed-off-by: Marcus Cooper > > --- > > sound/soc/sunxi/sun4i-i2s.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > > index 793457394efe..8201334a059b 100644 > > --- a/sound/soc/sunxi/sun4i-i2s.c > > +++ b/sound/soc/sunxi/sun4i-i2s.c > > @@ -135,6 +135,7 @@ struct sun4i_i2s; > > * @field_fmt_bclk: regmap field to set clk polarity. > > * @field_fmt_lrclk: regmap field to set frame polarity. > > * @field_fmt_mode: regmap field to set the operational mode. > > + * @field_fmt_sext: regmap field to set the sign extension. > > * @field_txchanmap: location of the tx channel mapping register. > > * @field_rxchanmap: location of the rx channel mapping register. > > * @field_txchansel: location of the tx channel select bit fields. > > @@ -159,6 +160,7 @@ struct sun4i_i2s_quirks { > > struct reg_field field_fmt_bclk; > > struct reg_field field_fmt_lrclk; > > struct reg_field field_fmt_mode; > > + struct reg_field field_fmt_sext; > > struct reg_field field_txchanmap; > > struct reg_field field_rxchanmap; > > struct reg_field field_txchansel; > > @@ -186,6 +188,7 @@ struct sun4i_i2s { > > struct regmap_field *field_fmt_bclk; > > struct regmap_field *field_fmt_lrclk; > > struct regmap_field *field_fmt_mode; > > + struct regmap_field *field_fmt_sext; > > struct regmap_field *field_txchanmap; > > struct regmap_field *field_rxchanmap; > > struct regmap_field *field_txchansel; > > @@ -345,6 +348,9 @@ static int sun4i_i2s_set_clk_rate(struct snd_soc_dai *dai, > > SUN8I_I2S_FMT0_LRCK_PERIOD_MASK, > > SUN8I_I2S_FMT0_LRCK_PERIOD(32)); > > > > + /* Set sign extension to pad out LSB with 0 */ > > + regmap_field_write(i2s->field_fmt_sext, 0); > > + > > return 0; > > } > > > > @@ -917,6 +923,7 @@ static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { > > .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), > > .has_slave_select_bit = true, > > .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), > > + .field_fmt_sext = REG_FIELD(SUN4I_I2S_FMT1_REG, 8, 8), > > .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), > > .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), > > .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), > > @@ -936,6 +943,7 @@ static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { > > .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), > > .has_slave_select_bit = true, > > .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), > > + .field_fmt_sext = REG_FIELD(SUN4I_I2S_FMT1_REG, 8, 8), > > .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), > > .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), > > .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), > > @@ -979,6 +987,7 @@ static const struct sun4i_i2s_quirks sun8i_h3_i2s_quirks = { > > .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), > > .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 19, 19), > > .field_fmt_mode = REG_FIELD(SUN4I_I2S_CTRL_REG, 4, 5), > > + .field_fmt_sext = REG_FIELD(SUN4I_I2S_FMT1_REG, 4, 5), > > .field_txchanmap = REG_FIELD(SUN8I_I2S_TX_CHAN_MAP_REG, 0, 31), > > .field_rxchanmap = REG_FIELD(SUN8I_I2S_RX_CHAN_MAP_REG, 0, 31), > > .field_txchansel = REG_FIELD(SUN8I_I2S_TX_CHAN_SEL_REG, 0, 2), > > @@ -998,6 +1007,7 @@ static const struct sun4i_i2s_quirks sun50i_a64_codec_i2s_quirks = { > > .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), > > .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), > > .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), > > + .field_fmt_sext = REG_FIELD(SUN4I_I2S_FMT1_REG, 8, 8), > > .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), > > .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), > > .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), > > You're missing the A83t here ARRGGGHHHHH...ACK...thanks, CK > > Maxime > > -- > Maxime Ripard, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com