From patchwork Wed Jul 5 15:43:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Code Kipper X-Patchwork-Id: 9826743 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 2A471608B8 for ; Wed, 5 Jul 2017 15:43:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18E9728560 for ; Wed, 5 Jul 2017 15:43:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D0B22856D; Wed, 5 Jul 2017 15:43: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 9F12028560 for ; Wed, 5 Jul 2017 15:43:37 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 844C1266EB6; Wed, 5 Jul 2017 17:43:35 +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 C7A74266EEC; Wed, 5 Jul 2017 17:43:30 +0200 (CEST) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by alsa0.perex.cz (Postfix) with ESMTP id AE8CC266EB6 for ; Wed, 5 Jul 2017 17:43:28 +0200 (CEST) Received: by mail-lf0-f65.google.com with SMTP id f28so21294279lfi.3 for ; Wed, 05 Jul 2017 08:43:28 -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=2YEGM0BNiCT1c75qopobGXAzN55W6jeaduP8go1igMY=; b=SJCeCTwUXNm/ZFvDTRINYHwBBY0rFb57Lt4Z30RznlHRZpaQVNMp/BYatR4dvh4Arl pzqbTDGHbJDYhx/sGPsODc7mMy++o8m+Ru/FcvyXKjd4S5+/ZdSUeY/QdQwh0AD+qvne hu3qg5CZ+AzTAGCjg/79TX5+HNd3Nh/T5E/5nTB6OBgLiC6++WF2LZFbTQjHAiDyhnmg 3qUmaoO604mRvUWb2oxba3r9uIH976WUFevlwVGPgMT1QiO13w9dkfKAG4DwF4mfjMNW z9nPrY6ghyx5wb28XKNBPTpWNR/ZfAN9iWe7OlUDT6rHsoNnAIUuKTJR4GOoJtEWGf4V EfWg== 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=2YEGM0BNiCT1c75qopobGXAzN55W6jeaduP8go1igMY=; b=TWEiyeD/2gBc98qhiL0FDXME9mCBKPSbeTllfJrTeSMu082yWCvz4QhBQ0BN3tZctE LrSKU3nDtV7HQ8G4cm/kvbCGrG0sqqY/7YaJ8Hw6AJYSAOP1iBkWbxJm+SSt2rezDIec ju9bs+MfeUFI5vZqCXf5JbjNlgVesnM33fL9Bc74MyYvZ0wqYd6RkTfRLySMQyEChOmI UCCyo/LFvVOQ/3hL5Tihu71NgIJ/4SAbE7CGoowsnEWQg0peumvNE9lvio5XFJdF8Cam a+50FaYT3FeGwxKTYEgoI5ivSM4NE4rzqTwGVlXoyUqS4PVATno1UHmmOC+PvpVnccaN CLCw== X-Gm-Message-State: AKS2vOyclEZkagvIsmfstMeW87zvma/AaCx3IVSNFTQqzMNB4XxhgvM2 TUfd/xVZebG//A== X-Received: by 10.46.75.2 with SMTP id y2mr9026605lja.78.1499269408017; Wed, 05 Jul 2017 08:43:28 -0700 (PDT) Received: from localhost.localdomain (c80-217-9-219.bredband.comhem.se. [80.217.9.219]) by smtp.gmail.com with ESMTPSA id v1sm4602221lja.18.2017.07.05.08.43.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 08:43:27 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com Date: Wed, 5 Jul 2017 17:43:22 +0200 Message-Id: <20170705154324.14565-2-codekipper@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170705154324.14565-1-codekipper@gmail.com> References: <20170705154324.14565-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 1/3] ASoC: sun4i-i2s: Add more quirks for newer SoCs 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 The Allwinner H3 has some differences to its I2S block such as a different address for the TXFIFO and various register changes. This patch prepares the driver for these changes. Signed-off-by: Marcus Cooper --- sound/soc/sunxi/sun4i-i2s.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 3635bbc72cbc..38ab0144f897 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -544,7 +544,6 @@ static struct snd_soc_dai_driver sun4i_i2s_dai = { .rates = SNDRV_PCM_RATE_8000_192000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, - .ops = &sun4i_i2s_dai_ops, .symmetric_rates = 1, }; @@ -655,15 +654,24 @@ static int sun4i_i2s_runtime_suspend(struct device *dev) } struct sun4i_i2s_quirks { - bool has_reset; + bool has_reset; + unsigned int reg_offset_txdata; /* TX FIFO */ + const struct regmap_config *sun4i_i2s_regmap; + const struct snd_soc_dai_ops *ops; }; static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { - .has_reset = false, + .has_reset = false, + .reg_offset_txdata = SUN4I_I2S_FIFO_TX_REG, + .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, + .ops = &sun4i_i2s_dai_ops, }; static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { - .has_reset = true, + .has_reset = true, + .reg_offset_txdata = SUN4I_I2S_FIFO_TX_REG, + .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, + .ops = &sun4i_i2s_dai_ops, }; static int sun4i_i2s_probe(struct platform_device *pdev) @@ -702,8 +710,14 @@ static int sun4i_i2s_probe(struct platform_device *pdev) return PTR_ERR(i2s->bus_clk); } + quirks = of_device_get_match_data(&pdev->dev); + if (quirks == NULL) { + dev_err(&pdev->dev, "Failed to determine the quirks to use\n"); + return -ENODEV; + } + i2s->regmap = devm_regmap_init_mmio(&pdev->dev, regs, - &sun4i_i2s_regmap_config); + quirks->sun4i_i2s_regmap); if (IS_ERR(i2s->regmap)) { dev_err(&pdev->dev, "Regmap initialisation failed\n"); return PTR_ERR(i2s->regmap); @@ -732,7 +746,7 @@ static int sun4i_i2s_probe(struct platform_device *pdev) } } - i2s->playback_dma_data.addr = res->start + SUN4I_I2S_FIFO_TX_REG; + i2s->playback_dma_data.addr = res->start + quirks->reg_offset_txdata; i2s->playback_dma_data.maxburst = 8; i2s->capture_dma_data.addr = res->start + SUN4I_I2S_FIFO_RX_REG; @@ -745,6 +759,8 @@ static int sun4i_i2s_probe(struct platform_device *pdev) goto err_pm_disable; } + /* Register ops with dai */ + sun4i_i2s_dai.ops = quirks->ops; ret = devm_snd_soc_register_component(&pdev->dev, &sun4i_i2s_component, &sun4i_i2s_dai, 1);