Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5096685ybi; Tue, 4 Jun 2019 00:55:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZjIeu3B0AfWMtXfFukwpMuLhyAHntQRW9YoRb/9OKLAnn0cJ1QBdX0iEjs2FdimVcP9BK X-Received: by 2002:a63:5d54:: with SMTP id o20mr31971384pgm.97.1559634926455; Tue, 04 Jun 2019 00:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559634926; cv=none; d=google.com; s=arc-20160816; b=OuD3GgDNEUKpkrprWS0WRrkMA8PAoy7RG3nUhJX6YuwAxKB4IlMPdQHJRdDTkGWbQj UYVHIo7P/zddSDetSIG03Kgzrm1mbcMQ5ngoCZbgUhxOBkhZZMFKpB9BDyDksHc0gQzq khk8LoHF6ax/5eZxtBn3YlFI8Wfi9jeTwG8ste1W+cxAjikNpkcfWFsRr3sVu8LgI+Az LjYpNXBCkxFSBbIAs67u1MqW4XKoMO+aeGgldRxocwSkNHdAsfpXg1up6pL2gR1Jbi3k VkN9P4XNKhzqhnRqd+QC/CBJxmJ7dfMDYBEN3WuGLyPVPyDSnS8FYFKDBF99EST9BB3E WL2Q== 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; bh=aB9PHKPiyzkndYybRF10NmFg3rVLDNHgbfKcERc7zQk=; b=HImw4jdWAfrRtBYc1JnhqNygSAcYRD/8f7tiRgsxpHnI9sjtRiDfitmlX5Bc5CTJDT Pnc/GMdHzhm0cr21cY/9Av/NT+5dqjfVAAUUw8kTuyjSrjouDMt7I0lc1qz+9tFyfPs7 xW/PzbrI2hAoXVXlosRb9p4rszCtbfhmBT46m2Wd6y7UEY8jvxmehPfb3HltrKeb/J+6 PE9UI5846Bqwkq93X7Bx4ZOKwACOjVGVQYRqK8k53wpWEy9rpjtLj732989MfnX4XhaR fB0IHZq+ZImfYj2WzJeRq1tJvrVbntl5TrcE+j/S1p7BxX3fK9ejPz4KPgDuuNz4Y88a E04g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q195si21916436pgq.119.2019.06.04.00.55.09; Tue, 04 Jun 2019 00:55:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727011AbfFDHyB (ORCPT + 99 others); Tue, 4 Jun 2019 03:54:01 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:34192 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbfFDHyA (ORCPT ); Tue, 4 Jun 2019 03:54:00 -0400 Received: by mail-ed1-f66.google.com with SMTP id c26so20498495edt.1 for ; Tue, 04 Jun 2019 00:53:59 -0700 (PDT) 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=aB9PHKPiyzkndYybRF10NmFg3rVLDNHgbfKcERc7zQk=; b=NxypKmpUE9nFsNzIRcplDL8fVYJ9DY7/jU8kiui47QwF76xiHAl460hUv6xGGxMBaG ohClMqN1e6EArOlvzD7VzdjyVI/JkA/lINOtsYCqK7BH7W9qLIG2JhKvo71IpunucESK +pmjtjbJPtMhh+KGnXVkhvBhZGtUa81W9+GJvbFeAvdYfjLZYdh550lY1ii2SsKqh3ib f/Uj5yzkxOWP3HEEWvOsLjVyZXa26NyNSYpWZmz8y4YUWPxI15epf2TRL3k0bDZt7kVK 67eOv2S1fFFTBwd5SWshHaeKtqj+kT5hKXv54twtp5itAY4Bkg3KW6BURI4/A30Rb2xx V36w== X-Gm-Message-State: APjAAAW+HSqDRTWfhzckgYj8wPlM4lFAYYsnxvysBIap8WoV0ZBiF76J LaHAnx3XaREolBPo4+JAMuyomVf5C+U= X-Received: by 2002:a17:907:20d0:: with SMTP id qq16mr16730581ejb.244.1559634838031; Tue, 04 Jun 2019 00:53:58 -0700 (PDT) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com. [209.85.128.54]) by smtp.gmail.com with ESMTPSA id i45sm4678921eda.67.2019.06.04.00.53.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 00:53:57 -0700 (PDT) Received: by mail-wm1-f54.google.com with SMTP id g135so10548876wme.4 for ; Tue, 04 Jun 2019 00:53:56 -0700 (PDT) X-Received: by 2002:a1c:3942:: with SMTP id g63mr15671103wma.61.1559634836417; Tue, 04 Jun 2019 00:53:56 -0700 (PDT) MIME-Version: 1.0 References: <20190603174735.21002-1-codekipper@gmail.com> <20190603174735.21002-4-codekipper@gmail.com> In-Reply-To: <20190603174735.21002-4-codekipper@gmail.com> From: Chen-Yu Tsai Date: Tue, 4 Jun 2019 15:53:46 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linux-sunxi] [PATCH v4 3/9] ASoC: sun4i-i2s: Add regmap field to sign extend sample To: Code Kipper Cc: Maxime Ripard , 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 Tue, Jun 4, 2019 at 1:47 AM wrote: > > From: Marcus Cooper > > On the newer SoCs this is set by default to transfer a 0 after > each sample in each slot. However the platform that this driver > was developed on had the 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 it should be fixed to also pad. Without this > the audio gets distorted. Curious, both the A10 and A20 manuals say the default value for this field is 0, which means 0 padding. sun4i_i2s_reg_defaults[] also has that field set to 0. You're saying you are seeing the field set to 1? ChenYu > Signed-off-by: Marcus Cooper > --- > sound/soc/sunxi/sun4i-i2s.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > index fd7c37596f21..e2961d8f6e8c 100644 > --- a/sound/soc/sunxi/sun4i-i2s.c > +++ b/sound/soc/sunxi/sun4i-i2s.c > @@ -134,6 +134,7 @@ > * @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; > @@ -183,6 +185,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; > @@ -342,6 +345,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; > } > > @@ -887,6 +893,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), > @@ -904,6 +911,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), > @@ -944,6 +952,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), > @@ -1006,6 +1015,12 @@ static int sun4i_i2s_init_regmap_fields(struct device *dev, > if (IS_ERR(i2s->field_fmt_mode)) > return PTR_ERR(i2s->field_fmt_mode); > > + i2s->field_fmt_sext = > + devm_regmap_field_alloc(dev, i2s->regmap, > + i2s->variant->field_fmt_sext); > + if (IS_ERR(i2s->field_fmt_sext)) > + return PTR_ERR(i2s->field_fmt_sext); > + > i2s->field_txchanmap = > devm_regmap_field_alloc(dev, i2s->regmap, > i2s->variant->field_txchanmap); > -- > 2.21.0 > > -- > You received this message because you are subscribed to the Google Groups "linux-sunxi" group. > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com. > To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/20190603174735.21002-4-codekipper%40gmail.com. > For more options, visit https://groups.google.com/d/optout.