From patchwork Sat Aug 12 11:00:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Code Kipper X-Patchwork-Id: 9897025 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 C302E603B4 for ; Sat, 12 Aug 2017 11:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B448928A53 for ; Sat, 12 Aug 2017 11:20:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8E8C28B67; Sat, 12 Aug 2017 11:20:30 +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=-2.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 87A7928C69 for ; Sat, 12 Aug 2017 11:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=T4xUY5DZ2j9t3XxejKuU34Q+sKnjYrHFokSJRuOTMj4=; b=T8yLsyCIPP2oLqVJe3knvIZPaz xc316uap1zOCmviEtJ3uxvxBIPfkD8XifbMPoA1yEpj62+5Tt85QlTwQABfOyzj4FgURaf/pP6Wnv ERYJE9VLMSp0+aIPWxmDAWmN0+pA2RZBJBm+q4VjOvm0Z/xHfj17fVrDmxoHnWRUkc1QVhgUv5icg BVfDBXcVCiImS2bmEHfQAW1tPkgD0jJzp16M7CscK04m40dCMnEEWjH7XOGRt5Uq2+iUapjnm3e53 Z2462AOxjcyS8zQ586IVJNFaovb0kV6XN9W9mvEeR3fblilckCUtWF91ZzZCfTedgnl/allZDjhXX BBJhbVUQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dgURr-0008VR-1m; Sat, 12 Aug 2017 11:19:19 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dgUAg-00087M-5f for linux-arm-kernel@lists.infradead.org; Sat, 12 Aug 2017 11:01:44 +0000 Received: by mail-lf0-x243.google.com with SMTP id y15so3706687lfd.5 for ; Sat, 12 Aug 2017 04:01:17 -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=3cMD9xMcMAZaVbMgOSQCfW3ELjtBLcSWAVm5Oazl548=; b=bCfeKdHCsfy+O5tFyL9Mjhpqczra3jTIprxHNs2S1UAH9R4cJi5rnXzu+CRrCmjzKY 2eOR+eDwPB2FzeI0NaJyU3T0f309voiZwmnYSgmeHNUHaWNYXXaGKRykBxNbIR39BA0y flOV5KnuGcElZTHQKpT6alCKijUmYEyI8tezK0r805UYdsdytEd/ZnjPhL+Ti9y2QFZ5 bKHw9j2SudMRp2Go7e6ELHv9Q+w8NeeH4njJ3FN6tizZvqsd7Ws2BhCMGHTRTvp2hrVv L1wU5tTFip1f4Bd4AlYOnJ3lEgGDfcVJEtqPcViI1bijiNFPvqfOJHeiuMEqosPF7ZK4 vIHA== 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=3cMD9xMcMAZaVbMgOSQCfW3ELjtBLcSWAVm5Oazl548=; b=G/BXV6GRR8kF9RO1O+g7nBReLdR1j0puYFxH2QGzWMdWU1wA2NKGOzeepbYJDkBGi3 GxnW/Kboc6Ea7esB4DptUgLsCejfq0ci7wm/iZS9uiLnJ1hL6Hp2ssqCB7RqnMA7lLT/ QAPmoUn3uh+l79WZxoGhGV61zka3P2PpNQl+qPs38VK8rvxQakCH0oZ3ZfUlZNHhf4f1 +bDdjRGMlQ9f6TE4txj8QHn1xgRhsK2WFGLkt/SJgtTe/ZJKeMqpHDAwuOkJ3ycmAuiy hZ42ys96JbZc7vzpBiw+OyW4XqzH5tD+dXQLplw1uGeBdD89gc9dZQJuC15oo/d/0Oy3 dSaw== X-Gm-Message-State: AHYfb5jx4IQqLIYc50ZyqJCViTS9lNnf+0/FU3WAKSKgwKtbR4cIg5Om fbaj6NmMn1ABjzFu X-Received: by 10.46.9.206 with SMTP id 197mr5441894ljj.45.1502535676335; Sat, 12 Aug 2017 04:01:16 -0700 (PDT) Received: from localhost.localdomain (c80-217-9-219.bredband.comhem.se. [80.217.9.219]) by smtp.gmail.com with ESMTPSA id h22sm432402ljb.41.2017.08.12.04.01.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 04:01:14 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com Subject: [PATCH v3 07/11] ASoC: sun4i-i2s: Add mclk enable regmap field Date: Sat, 12 Aug 2017 13:00:55 +0200 Message-Id: <20170812110059.5115-8-codekipper@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170812110059.5115-1-codekipper@gmail.com> References: <20170812110059.5115-1-codekipper@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170812_040135_003539_85C2E26E X-CRM114-Status: GOOD ( 13.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marcus Cooper The location of the mclk output enable bit is different on newer SoCs. Use a regmap field to enable it. Signed-off-by: Marcus Cooper --- sound/soc/sunxi/sun4i-i2s.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index a389cdf8c4dc..33af99076d62 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -101,6 +101,7 @@ * @mclk_offset: Value by which mclkdiv needs to be adjusted. * @bclk_offset: Value by which bclkdiv needs to be adjusted. * @fmt_offset: Value by which wss and sr needs to be adjusted. + * @field_clkdiv_mclk_en: regmap field to enable mclk output. * @field_fmt_wss: regmap field to set word select size. * @field_fmt_sr: regmap field to set sample resolution. * @field_fmt_bclk: regmap field to set clk polarity. @@ -119,6 +120,7 @@ struct sun4i_i2s_quirks { unsigned int fmt_offset; /* Register fields for i2s */ + struct reg_field field_clkdiv_mclk_en; struct reg_field field_fmt_wss; struct reg_field field_fmt_sr; struct reg_field field_fmt_bclk; @@ -141,6 +143,7 @@ struct sun4i_i2s { struct snd_dmaengine_dai_dma_data playback_dma_data; /* Register fields for i2s */ + struct regmap_field *field_clkdiv_mclk_en; struct regmap_field *field_fmt_wss; struct regmap_field *field_fmt_sr; struct regmap_field *field_fmt_bclk; @@ -283,8 +286,9 @@ static int sun4i_i2s_set_clk_rate(struct sun4i_i2s *i2s, regmap_write(i2s->regmap, SUN4I_I2S_CLK_DIV_REG, SUN4I_I2S_CLK_DIV_BCLK(bclk_div) | - SUN4I_I2S_CLK_DIV_MCLK(mclk_div) | - SUN4I_I2S_CLK_DIV_MCLK_EN); + SUN4I_I2S_CLK_DIV_MCLK(mclk_div)); + + regmap_field_write(i2s->field_clkdiv_mclk_en, 1); return 0; } @@ -713,6 +717,7 @@ static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { .has_reset = false, .reg_offset_txdata = SUN4I_I2S_FIFO_TX_REG, .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, + .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), .field_fmt_wss = REG_FIELD(SUN4I_I2S_FMT0_REG, 2, 3), .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), @@ -727,6 +732,7 @@ static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { .has_reset = true, .reg_offset_txdata = SUN4I_I2S_FIFO_TX_REG, .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, + .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), .field_fmt_wss = REG_FIELD(SUN4I_I2S_FMT0_REG, 2, 3), .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), @@ -742,10 +748,17 @@ static int sun4i_i2s_init_regmap_fields(struct device *dev, { int ret; - i2s->field_txchanmap = + i2s->field_clkdiv_mclk_en = devm_regmap_field_alloc(dev, i2s->regmap, - i2s->variant->field_txchanmap); - ret = PTR_ERR_OR_ZERO(i2s->field_txchanmap); + i2s->variant->field_clkdiv_mclk_en); + ret = PTR_ERR_OR_ZERO(i2s->field_clkdiv_mclk_en); + + if (!ret) { + i2s->field_txchanmap = + devm_regmap_field_alloc(dev, i2s->regmap, + i2s->variant->field_txchanmap); + ret = PTR_ERR_OR_ZERO(i2s->field_txchanmap); + } if (!ret) { i2s->field_rxchanmap =