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: 9826753 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 2B66F60317 for ; Wed, 5 Jul 2017 15:44:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A3F628562 for ; Wed, 5 Jul 2017 15:44:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EC4F28575; Wed, 5 Jul 2017 15:44:22 +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.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM 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 83CBC28562 for ; Wed, 5 Jul 2017 15:44:21 +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=O4YvktzRH/gY5WGvGb0RDIzth4I+E8KSubsYFbUtj5M=; b=fzATxHNa57ZpKxDj6R+nWoihVc 8nAgCmMaD10BNfXGTT2YASQJnhotKBThvm+JRoAFDZOEnlSB1+iFEPe75EJYxgllIzZiGW7zkPjXa 7XMg61uuss+8UTcgYDgg5Kuv+rHqi6h0pXE95vQN/iJfeOq3ROjDOzJR0dEqhcy9pWHT4lrzshL1Z 4LXaTGm25zHRD6mF1FPv58uDcfxZ6aK9EELtvi/2Yi6cO8EfTOaIoV3yEoN3PPsV9Ycqvm58zriOx 5sGTxzVYkTZuKWWXFGqZssJJ0r6JE+1LDzIXwfzP4XnAPHsHchms8Oc72ntjcSyFcua5A4wYlsBHH PjysYvNA==; 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 1dSmTS-00066H-OY; Wed, 05 Jul 2017 15:44:18 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dSmT2-0005Nr-As for linux-arm-kernel@lists.infradead.org; Wed, 05 Jul 2017 15:43:55 +0000 Received: by mail-lf0-x242.google.com with SMTP id g21so21317835lfk.1 for ; Wed, 05 Jul 2017 08:43:31 -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=G5UmJ7Lex8FSoa4Rbj0JEBc9+6cg7bUTeNvCCL2jrqYb6CupO3iBG+m8Qms7IcRb+r vBefJfnZ4QM02S+C3nt9jJTG+dIl+RaDIcQmqF3uNLL1TbyytuhVPMamba4e0tt3JsXG lVkVGKzsfgSXCgd0uZcKQqXQon7q/w5N1W3aCb/Hj492L0yoW0Gs7ennZ5CJq/ifMqE1 SjTuyL1Voaqmnzo2ncKEMsWCei105Ykhkg5Ycctbh3jOL4foS1o/NcYvuryPN3muApnF g2/d+xHsu0ZIQmBWRPLV5suiECZxLJoLXJc+4MRUOrKIsQppPfDazuAYPM4xsFCo2KDd HiuA== X-Gm-Message-State: AKS2vOxRnwDLLlwHPC2A3A5chZl5F493nZPT7pQtKJ84L9uwr1Vt27EA WCOfzUKiQZ5H3A== 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 Subject: [PATCH 1/3] ASoC: sun4i-i2s: Add more quirks for newer SoCs 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170705_084352_581053_347D2616 X-CRM114-Status: GOOD ( 14.95 ) 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 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);