From patchwork Sat Jul 29 14:17:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Code Kipper X-Patchwork-Id: 9870001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 964C860382 for ; Sat, 29 Jul 2017 14:20:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8179228726 for ; Sat, 29 Jul 2017 14:20:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 763C428859; Sat, 29 Jul 2017 14:20:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E2828881 for ; Sat, 29 Jul 2017 14:20:39 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D70B02677BC; Sat, 29 Jul 2017 16:18:16 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EE85D2677C8; Sat, 29 Jul 2017 16:18:13 +0200 (CEST) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by alsa0.perex.cz (Postfix) with ESMTP id C402A2677B6 for ; Sat, 29 Jul 2017 16:18:08 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id t128so11570734lff.3 for ; Sat, 29 Jul 2017 07:18:08 -0700 (PDT) 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=FSRFPNW/0uyvY5MCQgt5d81ts+iNmu3r0y86xk66aao=; b=siiCa0R1eMLGR18QKYlZwyZQvSJ4KTqkqWrBCxBlSrTMUSuxWSvE2ar7IJaVrgbtov FTh2mvree7IZUQHdbK9ssKe1VIGleAK2L7imI/UnYMwo5zC3MWPG6erV5/2GaqejBoCC Zog53RxDrhnrponnHmvuZvG+5FjYB6hBF/8LeVX71kL4ivHzgiDpQw+NAVbbAL/7Y+gI 5Ivz3OB6dttBQUD2MfYc5IM3QOy29KuJ3bwmoHpBUYd3DbAAST5NpQAoBn3cpT13vD6+ +s1aa9Kodm3+pQAdmceWsVzlIJkiEhqV5fCW1u5qjaP1pTuhsyWukiqFAmA+bdiafaVV uRwg== 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=FSRFPNW/0uyvY5MCQgt5d81ts+iNmu3r0y86xk66aao=; b=WBKWP+zWNB3RvFu9B87e6OqbLAinBs4QY4R0+N6XqTwIF7br/Z6hJ/h35MJCjPWeNk kIvew3bBj8ylL+TFPV2HH7YHC5597fJeS7Ulyj5UkzVW87lmyaeI2uvKD8obSAvJtzER EyJB34cOZmUYqw/bacA1Q2JE3IxpOtv4nyiFLNyt5YjTOSPiDksa7rXJNfTeKmn1XAwW BDIvMFkx3KJfShoJw6PT/DDODuVev690rayfdEFh0fnbrjSNZW0w5ivRu7OGyxWrshPN KPKSMc4wM6nnMCvHMOVmuwcNl1ODhaljL4HalBqzJuRrNec1BvBkWW6UBQ7jlx8dYhbN hZoQ== X-Gm-Message-State: AIVw110OpfMPLGU68oVIBCsBNELpuU3Csq2ylFdr9AtLO7ni6tHu8PE1 KOds7YM2Yche5GSR X-Received: by 10.25.59.29 with SMTP id i29mr3525390lfa.224.1501337887927; Sat, 29 Jul 2017 07:18:07 -0700 (PDT) Received: from localhost.localdomain (c80-217-9-219.bredband.comhem.se. [80.217.9.219]) by smtp.gmail.com with ESMTPSA id s189sm4581958lja.77.2017.07.29.07.18.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Jul 2017 07:18:07 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com Date: Sat, 29 Jul 2017 16:17:50 +0200 Message-Id: <20170729141753.20174-10-codekipper@gmail.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170729141753.20174-1-codekipper@gmail.com> References: <20170729141753.20174-1-codekipper@gmail.com> Cc: alsa-devel@alsa-project.org, Marcus Cooper , lgirdwood@gmail.com, linux-kernel@vger.kernel.org, be17068@iperbole.bo.it, linux-sunxi@googlegroups.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v3 09/12] ASoC: sun4i-i2s: Add regmap field to set format X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marcus Cooper On the newer SoCs the bits to configure the operational mode are located in a different register. Add a regmap field so that this location can be configured. Signed-off-by: Marcus Cooper --- sound/soc/sunxi/sun4i-i2s.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 6d8d2c4a675b..9e060d1b73d5 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -106,6 +106,7 @@ * @field_fmt_set_sr: regmap field to set sample resolution. * @field_fmt_set_bclk_polarity: regmap field to set clk polarity. * @field_fmt_set_lrclk_polarity: regmap field to set frame polarity. + * @field_fmt_set_mode: regmap field to set the operational mode. * @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. @@ -125,6 +126,7 @@ struct sun4i_i2s_quirks { struct reg_field field_fmt_set_sr; struct reg_field field_fmt_set_bclk_polarity; struct reg_field field_fmt_set_lrclk_polarity; + struct reg_field field_fmt_set_mode; struct reg_field field_txchanmap; struct reg_field field_rxchanmap; struct reg_field field_txchansel; @@ -148,6 +150,7 @@ struct sun4i_i2s { struct regmap_field *field_fmt_set_sr; struct regmap_field *field_fmt_set_bclk_polarity; struct regmap_field *field_fmt_set_lrclk_polarity; + struct regmap_field *field_fmt_set_mode; struct regmap_field *field_txchanmap; struct regmap_field *field_rxchanmap; struct regmap_field *field_txchansel; @@ -362,9 +365,7 @@ static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } - regmap_update_bits(i2s->regmap, SUN4I_I2S_FMT0_REG, - SUN4I_I2S_FMT0_FMT_MASK, - val); + regmap_field_write(i2s->field_fmt_set_mode, val); /* DAI clock polarity */ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { @@ -721,6 +722,7 @@ static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { .field_fmt_set_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), .field_fmt_set_bclk_polarity = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), .field_fmt_set_lrclk_polarity = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), + .field_fmt_set_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), .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), @@ -738,6 +740,7 @@ static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { .field_fmt_set_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), .field_fmt_set_bclk_polarity = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), .field_fmt_set_lrclk_polarity = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), + .field_fmt_set_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), .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), @@ -770,6 +773,12 @@ static int sun4i_i2s_init_regmap_fields(struct device *dev, struct sun4i_i2s *i2 if (IS_ERR(i2s->field_fmt_set_lrclk_polarity)) return PTR_ERR(i2s->field_fmt_set_lrclk_polarity); + i2s->field_fmt_set_mode = + devm_regmap_field_alloc(dev, i2s->regmap, + i2s->variant->field_fmt_set_mode); + if (IS_ERR(i2s->field_fmt_set_mode)) + return PTR_ERR(i2s->field_fmt_set_mode); + i2s->field_clkdiv_mclk_en = devm_regmap_field_alloc(dev, i2s->regmap, i2s->variant->field_clkdiv_mclk_en);