Received: by 10.223.176.46 with SMTP id f43csp800406wra; Wed, 24 Jan 2018 06:12:08 -0800 (PST) X-Google-Smtp-Source: AH8x2270q9NlBt2oUbPNUeYSOwtIQyRt+3+0CNctxq0HYE0bfrBfj5RQ5+m4YMOAKCygjYVIHBng X-Received: by 10.101.77.140 with SMTP id p12mr10759070pgq.195.1516803128577; Wed, 24 Jan 2018 06:12:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516803128; cv=none; d=google.com; s=arc-20160816; b=vzhHWf46EOZORXAp4JFWrfmnqyX0q3q9w5XcJ69vn2lK7nURPo0VP+Ar60vlgEZyhW rFhUryUIfrbo0Oyz5W5PSx5KeQsDpgXOHXZUfGV6i669vuSlf6QjBroK0YREcBjZIJZA D/cMif4XPf8fIc8Kc4IyfNnGC2z7BHUeXDGVa1NAA5BOzAOEdJg1Y3IiHmAxan2LY2qx Raxw5XoeQ/i1juexf9TIz3CNgLjOsb4bFlsAJMfPmDgXxFckuvbAK+7d/W2lzpdb2aSZ lTg30ojozCiIM5qNgfQpNXM389WOe9fOLaDi3tHH+xcZmi5WWKiT+T/mDBLb+N2ahTWv Wkng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=CNPQcN0DYIVjYTrspzcG1FvoGTQiebMTRodmd5RC/SQ=; b=JN0ETvR/cdtYJsLs/M51/a4UGXxWi6bmVdQoNh4d+uRttUG/tsBc9Q1AeS46Ba2FWg +js+v/3Pgn8lYK5xCaBsRSc+z8yYY5VC0Tk/ZuD0w3AAK4OLoZD05Iu0dhTB2rC8P/wd guV+6ELsB/R/JCK5sjeTauv32IQ5Z2T+70rJsr78S6zvPhvZ5Bw4u5QZHbSHY6fC6fau 8xiAxGNJEBf38sHm9ABVsRSQjmX0r4/tpmlQdnkPHMLf8U1OcBpCv/nc7KCGPx/8HsyQ tK2Rox4eTZiniBcs3inm8aWGTwZkOCOS8sodFb3iDDogYKgMB5HbpJ+lC/TMPAOD9D7T jHpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fuXpdonz; 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=NONE 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 r1si187216pgp.603.2018.01.24.06.11.54; Wed, 24 Jan 2018 06:12:08 -0800 (PST) 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=fuXpdonz; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934043AbeAXOLR (ORCPT + 99 others); Wed, 24 Jan 2018 09:11:17 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33674 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933842AbeAXOLI (ORCPT ); Wed, 24 Jan 2018 09:11:08 -0500 Received: by mail-lf0-f68.google.com with SMTP id t139so5444248lff.0 for ; Wed, 24 Jan 2018 06:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CNPQcN0DYIVjYTrspzcG1FvoGTQiebMTRodmd5RC/SQ=; b=fuXpdonzuGYym9QDoWcO2RpsHqLyJuSKoHeyladvaeQiUACeIv2yiE0Nl9tUHpA169 ZC90FtQvW45YiL5VdjA1kxOuqdPI3nIeHI+AUTLp5wgLfI+n/uUsQQ7X95SGGIiCl08X Wgx4fYsxBEdP+pmY2T2eYuMhq0/j6YsIkIekXYJkYX0d6X2HFpauauUwshnqW/xZgelg O1DThKNGo0iEgEyDwUSeE4Ipy+dt/JVFMvYkA53PaLA44nrCOWgO4UkpHQNvf6lfn0Js onn7DDH5fc9CeeyQQ7/WP0KpjmpG5FZU41UbZr7YrZficN87e0FP1XrxOfjyX/LnL5Y+ T1mw== 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=CNPQcN0DYIVjYTrspzcG1FvoGTQiebMTRodmd5RC/SQ=; b=YeFwzmYgS6oKflt85W2OqJuwQyM5ThmtIk3KXn4Du6N+qXyDvInWGh9j5bwryNQbvB pF0p3ocbzqte3OHeFS01jf0CtyXCs7NYRaexLxwrVFsMMwuC2lYzIvZGKXfQXjEYY049 S/saGOgeg5XLYXdN6FO9EdDUag88yeBjcpVio8aZFlwH9XKeweTnUVYBuYFDs9iFo6Jw EumDGOEcI5cWA4FqRjTy+8BA/AzXgNPPmEZIiy0u80CmAWQ773GGLgojJgSVqP5QfVIu AWtxfhFjGDFJQnEqiFoXHN84MJmL4o2M3JnsIkGnxYdmiaJPvTeWZfNHWm3G3nQtP0Qv KITA== X-Gm-Message-State: AKwxytfAp/Z6o2nd9iIaVeHKsvFQybK1bvp30zA56Sw2HdddJna6IGVX themJDxBuDGaDFKNl9Kyf5M= X-Received: by 10.46.124.11 with SMTP id x11mr3878098ljc.99.1516803067094; Wed, 24 Jan 2018 06:11:07 -0800 (PST) Received: from localhost.localdomain (c80-217-9-219.bredband.comhem.se. [80.217.9.219]) by smtp.gmail.com with ESMTPSA id r84sm579227lff.72.2018.01.24.06.11.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 06:11:06 -0800 (PST) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, be17068@iperbole.bo.it, Marcus Cooper Subject: [PATCH 3/3] ASoC: sun4i-i2s: Add regmap field to sign extend sample Date: Wed, 24 Jan 2018 15:11:01 +0100 Message-Id: <20180124141101.12867-4-codekipper@gmail.com> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180124141101.12867-1-codekipper@gmail.com> References: <20180124141101.12867-1-codekipper@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marcus Cooper On the newer SoCs this is set by default to transfer a 0 after each sample in each slot. Add the regmap field to configure this and set it so that it pads the sample with 0s. 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 626679057d0f..9fda1240b717 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -139,6 +139,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. @@ -164,6 +165,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; @@ -188,6 +190,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; @@ -358,6 +361,9 @@ static int sun4i_i2s_set_clk_rate(struct snd_soc_dai *dai, SUN8I_I2S_FMT0_LRCK_PERIOD_MASK, SUN8I_I2S_FMT0_LRCK_PERIOD(word_size)); + /* Set sign extension to pad out LSB with 0 */ + regmap_field_write(i2s->field_fmt_sext, 0); + return 0; } @@ -929,6 +935,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), @@ -946,6 +953,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), @@ -986,6 +994,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), @@ -1031,6 +1040,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.16.0