From patchwork Tue Sep 20 13:26:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12982184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F530C54EE9 for ; Tue, 20 Sep 2022 13:29:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3BCDEE0E; Tue, 20 Sep 2022 15:28:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3BCDEE0E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663680579; bh=/dxfWhqmMkQmV7S5CRMZVDD51+9HbcPvMYerh1tpzBg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FaTrQfFM1Sx0GriTjnl+hGTsZu7GuvJz3qtZPK8v69tnSHly2uG8s6hxWv9Hr3Org GaKFd4GihOAwAAA4Bf0RjHnpPu/hZzetm2EGoDKCCGzYxBYn9n8m0YnjHBRvkh8p2q Ua7WPSZcGMCbbkjY1xvKo1orCZ2ASuEcdbZImgUs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 26BD4F80549; Tue, 20 Sep 2022 15:27:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1F8E7F801D5; Tue, 20 Sep 2022 15:27:40 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1B65AF80153 for ; Tue, 20 Sep 2022 15:27:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1B65AF80153 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="STSFalZE" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1B11620D1; Tue, 20 Sep 2022 13:27:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE75DC433D7; Tue, 20 Sep 2022 13:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663680451; bh=/dxfWhqmMkQmV7S5CRMZVDD51+9HbcPvMYerh1tpzBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=STSFalZEwXGSEbc6nzmDWOmroSB9N7vampXEwj0HJR6GHPGblhrcNNSGuZL1lggO7 v+FPFbxoj6zVWhkCs2gQeKfD2+Q/xNK7SOrsQzi1q5igaHHZ6rSXtkg7C44XEK6wq3 jFfPgH8EufOtbDAaU/gU0osBDkYeqFMSvXv869DRAQOsGIzIYvxFIYFdGpx7OtB6ij bk50QXw6rV2MC0/HqyLr9aIyrQRJCaCoiTii94KZdE+fSEfUJMVPjIRVFEGIg+bJ2G sFveGHx3WWc5hbVZxENS+TuEV7wp+f6fBC7qkdhPLXE0DfSENDwMNMSfdtaNbo6anC pFwb9VxQYe0Mw== Received: by pali.im (Postfix) id 378762B6E; Tue, 20 Sep 2022 15:27:28 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Liam Girdwood , Mark Brown , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Marcin Wojtas Subject: [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Date: Tue, 20 Sep 2022 15:26:44 +0200 Message-Id: <20220920132648.2008-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220920132648.2008-1-pali@kernel.org> References: <20220920132648.2008-1-pali@kernel.org> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Marcin Wojtas The audio unit of Marvell Armada38x SoC is similar to the ones comprised by other Marvell SoCs (Kirkwood, Dove and Armada 370). Therefore KW audio driver can be used to support it and this commit adds new compatible string to identify Armada 38x variant. Two new memory regions are added: first one for PLL configuration and the second one for choosing one of audio I/O modes (I2S or S/PDIF). For the latter purpose a new optional DT property is added ('spdif-mode'). kirkwood-i2s driver is extended by adding a new init function for Armada 38x flavor and also a routine that enables PLL output (i.e. MCLK) configuration. Signed-off-by: Marcin Wojtas Tested-by: Star_Automation Reviewed-by: Nadav Haklai Reviewed-by: Lior Amsalem Tested-by: Lior Amsalem Signed-off-by: Hezi Shahmoon Reviewed-by: Neta Zur Hershkovits [pali: Fix support for pre-38x SoCs] Signed-off-by: Pali Rohár --- .../devicetree/bindings/sound/mvebu-audio.txt | 14 +- sound/soc/kirkwood/kirkwood-i2s.c | 136 +++++++++++++++++- sound/soc/kirkwood/kirkwood.h | 2 + 3 files changed, 149 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/mvebu-audio.txt b/Documentation/devicetree/bindings/sound/mvebu-audio.txt index cb8c07c81ce4..4f5dec5cb3c2 100644 --- a/Documentation/devicetree/bindings/sound/mvebu-audio.txt +++ b/Documentation/devicetree/bindings/sound/mvebu-audio.txt @@ -6,9 +6,14 @@ Required properties: "marvell,kirkwood-audio" for Kirkwood platforms "marvell,dove-audio" for Dove platforms "marvell,armada370-audio" for Armada 370 platforms + "marvell,armada-380-audio" for Armada 38x platforms - reg: physical base address of the controller and length of memory mapped - region. + region (named "i2s_regs"). + With "marvell,armada-380-audio" two other regions are required: + first of those is dedicated for Audio PLL Configuration registers + (named "pll_regs") and the second one ("soc_ctrl") - for register + where one of exceptive I/O types (I2S or S/PDIF) is set. - interrupts: with "marvell,kirkwood-audio", the audio interrupt @@ -23,6 +28,13 @@ Required properties: "internal" for the internal clock "extclk" for the external clock +Optional properties: + +- spdif-mode: + Enable S/PDIF mode on Armada 38x SoC. Using this property + disables standard I2S I/O. Valid only with "marvell,armada-380-audio" + compatible string. + Example: i2s1: audio-controller@b4000 { diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 2a4ffe945177..ac387b5ca094 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -31,6 +31,122 @@ (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE) +/* These registers are relative to the second register region - + * audio pll configuration. + */ +#define A38X_PLL_CONF_REG0 0x0 +#define A38X_PLL_FB_CLK_DIV_OFFSET 10 +#define A38X_PLL_FB_CLK_DIV_MASK 0x7fc00 +#define A38X_PLL_CONF_REG1 0x4 +#define A38X_PLL_FREQ_OFFSET_MASK 0xffff +#define A38X_PLL_FREQ_OFFSET_VALID BIT(16) +#define A38X_PLL_SW_RESET BIT(31) +#define A38X_PLL_CONF_REG2 0x8 +#define A38X_PLL_AUDIO_POSTDIV_MASK 0x7f + +/* Bit below belongs to SoC control register corresponding to the third + * register region. + */ +#define A38X_SPDIF_MODE_ENABLE BIT(27) + +static int armada_38x_i2s_init_quirk(struct platform_device *pdev, + struct kirkwood_dma_data *priv, + struct snd_soc_dai_driver *dai_drv) +{ + struct device_node *np = pdev->dev.of_node; + u32 reg_val; + int i; + + priv->pll_config = devm_platform_ioremap_resource_byname(pdev, "pll_regs"); + if (IS_ERR(priv->pll_config)) + return -ENOMEM; + + priv->soc_control = devm_platform_ioremap_resource_byname(pdev, "soc_ctrl"); + if (IS_ERR(priv->soc_control)) + return -ENOMEM; + + /* Select one of exceptive modes: I2S or S/PDIF */ + reg_val = readl(priv->soc_control); + if (of_property_read_bool(np, "spdif-mode")) { + reg_val |= A38X_SPDIF_MODE_ENABLE; + dev_info(&pdev->dev, "using S/PDIF mode\n"); + } else { + reg_val &= ~A38X_SPDIF_MODE_ENABLE; + dev_info(&pdev->dev, "using I2S mode\n"); + } + writel(reg_val, priv->soc_control); + + /* Update available rates of mclk's fs */ + for (i = 0; i < 2; i++) { + dai_drv[i].playback.rates |= SNDRV_PCM_RATE_192000; + dai_drv[i].capture.rates |= SNDRV_PCM_RATE_192000; + } + + return 0; +} + +static inline void armada_38x_set_pll(void __iomem *base, unsigned long rate) +{ + u32 reg_val; + u16 freq_offset = 0x22b0; + u8 audio_postdiv, fb_clk_div = 0x1d; + + /* Set frequency offset value to not valid and enable PLL reset */ + reg_val = readl(base + A38X_PLL_CONF_REG1); + reg_val &= ~A38X_PLL_FREQ_OFFSET_VALID; + reg_val &= ~A38X_PLL_SW_RESET; + writel(reg_val, base + A38X_PLL_CONF_REG1); + + udelay(1); + + /* Update PLL parameters */ + switch (rate) { + default: + case 44100: + freq_offset = 0x735; + fb_clk_div = 0x1b; + audio_postdiv = 0xc; + break; + case 48000: + audio_postdiv = 0xc; + break; + case 96000: + audio_postdiv = 0x6; + break; + case 192000: + audio_postdiv = 0x3; + break; + } + + reg_val = readl(base + A38X_PLL_CONF_REG0); + reg_val &= ~A38X_PLL_FB_CLK_DIV_MASK; + reg_val |= (fb_clk_div << A38X_PLL_FB_CLK_DIV_OFFSET); + writel(reg_val, base + A38X_PLL_CONF_REG0); + + reg_val = readl(base + A38X_PLL_CONF_REG2); + reg_val &= ~A38X_PLL_AUDIO_POSTDIV_MASK; + reg_val |= audio_postdiv; + writel(reg_val, base + A38X_PLL_CONF_REG2); + + reg_val = readl(base + A38X_PLL_CONF_REG1); + reg_val &= ~A38X_PLL_FREQ_OFFSET_MASK; + reg_val |= freq_offset; + writel(reg_val, base + A38X_PLL_CONF_REG1); + + udelay(1); + + /* Disable reset */ + reg_val |= A38X_PLL_SW_RESET; + writel(reg_val, base + A38X_PLL_CONF_REG1); + + /* Wait 50us for PLL to lock */ + udelay(50); + + /* Restore frequency offset value validity */ + reg_val |= A38X_PLL_FREQ_OFFSET_VALID; + writel(reg_val, base + A38X_PLL_CONF_REG1); +} + static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { @@ -106,7 +222,10 @@ static void kirkwood_set_rate(struct snd_soc_dai *dai, * defined in kirkwood_i2s_dai */ dev_dbg(dai->dev, "%s: dco set rate = %lu\n", __func__, rate); - kirkwood_set_dco(priv->io, rate); + if (priv->pll_config) + armada_38x_set_pll(priv->pll_config, rate); + else + kirkwood_set_dco(priv->io, rate); clks_ctrl = KIRKWOOD_MCLK_SOURCE_DCO; } else { @@ -532,7 +651,10 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, priv); - priv->io = devm_platform_ioremap_resource(pdev, 0); + if (of_device_is_compatible(np, "marvell,armada-380-audio")) + priv->io = devm_platform_ioremap_resource_byname(pdev, "i2s_regs"); + else + priv->io = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->io)) return PTR_ERR(priv->io); @@ -540,6 +662,15 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) if (priv->irq < 0) return priv->irq; + if (of_device_is_compatible(np, "marvell,armada-380-audio")) { + err = armada_38x_i2s_init_quirk(pdev, priv, soc_dai); + /* Set initial pll frequency */ + if (priv->pll_config) + armada_38x_set_pll(priv->pll_config, 44100); + if (err < 0) + return err; + } + if (np) { priv->burst = 128; /* might be 32 or 128 */ } else if (data) { @@ -623,6 +754,7 @@ static const struct of_device_id mvebu_audio_of_match[] = { { .compatible = "marvell,kirkwood-audio" }, { .compatible = "marvell,dove-audio" }, { .compatible = "marvell,armada370-audio" }, + { .compatible = "marvell,armada-380-audio" }, { } }; MODULE_DEVICE_TABLE(of, mvebu_audio_of_match); diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h index a1733a6aace5..79bb9aa7f086 100644 --- a/sound/soc/kirkwood/kirkwood.h +++ b/sound/soc/kirkwood/kirkwood.h @@ -131,6 +131,8 @@ struct kirkwood_dma_data { void __iomem *io; + void __iomem *pll_config; + void __iomem *soc_control; struct clk *clk; struct clk *extclk; uint32_t ctl_play; From patchwork Tue Sep 20 13:26:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12982183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF788ECAAD8 for ; Tue, 20 Sep 2022 13:29:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E422B161F; Tue, 20 Sep 2022 15:28:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E422B161F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663680566; bh=WOUQBrIy2nuOaYfvDaQXTDXDqtrzKIbQcne/3MYSJbg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I9KBOfWpuaWHML1AEJ1wC/Fo+HMU1JJm5lMQFDoXopLtl09oTD05R2ouZwXKJxt3E Eg+IVafI5HX41i9a8d7wEGmZVo18g3K2OSP7znXxGA5rvsSrYxVuwLLfyllgkA2o/y W9bNboD3cRYIDiteitYRiX1Cu6d6FaAr5pj4tYq0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B152BF8053D; Tue, 20 Sep 2022 15:27:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D1DAAF804DA; Tue, 20 Sep 2022 15:27:39 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C94F5F8012B for ; Tue, 20 Sep 2022 15:27:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C94F5F8012B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JGnJqYy9" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4EE4B8293B; Tue, 20 Sep 2022 13:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BAB3C433B5; Tue, 20 Sep 2022 13:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663680451; bh=WOUQBrIy2nuOaYfvDaQXTDXDqtrzKIbQcne/3MYSJbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JGnJqYy9PZG4SYQaDS8DD17bSV5ZObGQVIk8b/vW4R+D53BI3IhxOuA7hePFobBs6 5UrVMIMaABXcM0Ka/9/6H3sudRQIfbDeTfOWWxo+nGZbHZN45xR725m6GhV0kqugo1 yrt7iwhKLa43o2nm7TlD33hX9bEpWtPJkLjaiiuUJviXhvMO9NzGmmiC3sWS5cB3Pb enZCTUGqgsMB3b3M1R6pRPoa8PX6+gpfLfWUbXL6OsGA+eTKAOvwOt5Egjr73ifsO5 QxOcOBqrTvcLOz3hsF23mN4v7AqP7n7ktSEUKtkheXOfG9WJENv9CjTAhPhnrJI/Er Km4Yh14ldfewA== Received: by pali.im (Postfix) id 98E342D4C; Tue, 20 Sep 2022 15:27:28 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Liam Girdwood , Mark Brown , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Marcin Wojtas Subject: [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree Date: Tue, 20 Sep 2022 15:26:45 +0200 Message-Id: <20220920132648.2008-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220920132648.2008-1-pali@kernel.org> References: <20220920132648.2008-1-pali@kernel.org> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Marcin Wojtas This commit adds the description of the I2S controller to the Marvell Armada 38x SoC's Device Tree, as well as its pin configuration. Signed-off-by: Marcin Wojtas Reviewed-by: Nadav Haklai Tested-by: Nadav Haklai Tested-by: Lior Amsalem [pali: Fix i2s-pins name] Signed-off-by: Pali Rohár Reviewed-by: Andrew Lunn --- arch/arm/boot/dts/armada-38x.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index df3c8d1d8f64..11e0e4286ec2 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi @@ -289,6 +289,13 @@ marvell,pins = "mpp44"; marvell,function = "sata3"; }; + + i2s_pins: i2s-pins { + marvell,pins = "mpp48", "mpp49", + "mpp50", "mpp51", + "mpp52", "mpp53"; + marvell,function = "audio"; + }; }; gpio0: gpio@18100 { @@ -618,6 +625,18 @@ status = "disabled"; }; + audio_controller: audio-controller@e8000 { + #sound-dai-cells = <1>; + compatible = "marvell,armada-380-audio"; + reg = <0xe8000 0x4000>, <0x18410 0xc>, + <0x18204 0x4>; + reg-names = "i2s_regs", "pll_regs", "soc_ctrl"; + interrupts = ; + clocks = <&gateclk 0>; + clock-names = "internal"; + status = "disabled"; + }; + usb3_0: usb3@f0000 { compatible = "marvell,armada-380-xhci"; reg = <0xf0000 0x4000>,<0xf4000 0x4000>; From patchwork Tue Sep 20 13:26:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12982185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16362C54EE9 for ; Tue, 20 Sep 2022 13:30:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0FA5D85D; Tue, 20 Sep 2022 15:29:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0FA5D85D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663680605; bh=j3AJ+gvrSPJXkwy4uwzUn+Y5wSHluaeR3mpbyFCwTGQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KCT1+xaubMSfwE81qbNNxM5LQewEoYGOgmt37eVm6HE7h3HCNQxqpaj53C5jfu8di tRxuxHCB7LBX0X1MmMHl1mLqGTCQWsVUBIQrIGdsSwQchc28ro96WCduWq5GthI+ok hxlkcX2WAC+jdqajCa347MA4ovNjQdnmjVdjlQCA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 494EDF8055A; Tue, 20 Sep 2022 15:27:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D9A82F80553; Tue, 20 Sep 2022 15:27:44 +0200 (CEST) Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 47EFBF80171 for ; Tue, 20 Sep 2022 15:27:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 47EFBF80171 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UzwC/fMp" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 16023CE185D; Tue, 20 Sep 2022 13:27:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 896EBC43142; Tue, 20 Sep 2022 13:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663680451; bh=j3AJ+gvrSPJXkwy4uwzUn+Y5wSHluaeR3mpbyFCwTGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzwC/fMpcZHK84uKl1WNEWXfZiWlnD4YDAVv6EFoTILb4768oyWqSVjTBD6QHuVK5 xB/Q/fsYK5DxTNoJkfKSwBDNNiuwrFLB8YmCMXAVQtwWk9N20TNplX60AUapFg+ONQ ul6/vQRAB99CN2s6op8JgR0AxQNGhwNmbLqonH3JJluEZSZK97kDfRtuKdFPibwaKj 06Boyk+oJ1B55V+WA/4GHIl9GKFWIXMgWD7FLE7RYAWlXQNRBDTLoEzO40zrYGAacS WVsGGLhnCPVzpwd0WDw+lxu+ZjAm5CrkMxsWaaFZAu5xS/rYcmpOg6tGrnvYb8ahii qDc2/z+ljCZkw== Received: by pali.im (Postfix) id 08B1B2D7D; Tue, 20 Sep 2022 15:27:29 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Liam Girdwood , Mark Brown , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Marcin Wojtas Subject: [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB Date: Tue, 20 Sep 2022 15:26:46 +0200 Message-Id: <20220920132648.2008-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220920132648.2008-1-pali@kernel.org> References: <20220920132648.2008-1-pali@kernel.org> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Marcin Wojtas This commit adds the necessary Device Tree information to enable audio support on the Armada 385 DB platform. In details it: * Instantiates the CS42L51 audio codec on the I2C0 bus * Adds simple-card DT binding for audio on Armada 385 DB * Adds description for both analog I2S and S/PDIF I/O * Disabled by default Signed-off-by: Marcin Wojtas Signed-off-by: Nadav Haklai Tested-by: Star_Automation Tested-by: Lior Amsalem Reviewed-by: Andrew Lunn --- arch/arm/boot/dts/armada-388-db.dts | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/arch/arm/boot/dts/armada-388-db.dts b/arch/arm/boot/dts/armada-388-db.dts index 5130eccc32af..2bcec5419b66 100644 --- a/arch/arm/boot/dts/armada-388-db.dts +++ b/arch/arm/boot/dts/armada-388-db.dts @@ -36,6 +36,11 @@ i2c@11000 { status = "okay"; clock-frequency = <100000>; + audio_codec: audio-codec@4a { + #sound-dai-cells = <0>; + compatible = "cirrus,cs42l51"; + reg = <0x4a>; + }; }; i2c@11100 { @@ -99,6 +104,12 @@ no-1-8-v; }; + audio-controller@e8000 { + pinctrl-0 = <&i2s_pins>; + pinctrl-names = "default"; + status = "disabled"; + }; + usb3@f0000 { status = "okay"; }; @@ -128,6 +139,64 @@ }; }; }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "Armada 385 DB Audio"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Headphone", "Out Jack", + "Line", "In Jack"; + simple-audio-card,routing = + "Out Jack", "HPL", + "Out Jack", "HPR", + "AIN1L", "In Jack", + "AIN1R", "In Jack"; + status = "disabled"; + + simple-audio-card,dai-link@0 { + format = "i2s"; + cpu { + sound-dai = <&audio_controller 0>; + }; + + codec { + sound-dai = <&audio_codec>; + }; + }; + + simple-audio-card,dai-link@1 { + format = "i2s"; + cpu { + sound-dai = <&audio_controller 1>; + }; + + codec { + sound-dai = <&spdif_out>; + }; + }; + + simple-audio-card,dai-link@2 { + format = "i2s"; + cpu { + sound-dai = <&audio_controller 1>; + }; + + codec { + sound-dai = <&spdif_in>; + }; + }; + }; + + spdif_out: spdif-out { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; + }; + + spdif_in: spdif-in { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dir"; + }; }; &spi0 { From patchwork Tue Sep 20 13:26:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12982181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DFBE3C54EE9 for ; Tue, 20 Sep 2022 13:28:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E1B87E0F; Tue, 20 Sep 2022 15:28:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E1B87E0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663680536; bh=duF10gD9sbZA+Bm4zPNQqJO6kJ7WkRZ4TTW0Qx0ckj8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QjR997P4Y3jYlCbS5X/oFjuE5ZA7cJtzE+7IBczrjl7Y+8UuhOUTerC8y4vMk848A ZYA2IKi1Drt1pM6PDfIKX9yzmtUtvErgl3FmiHJFQVRJJb5uDLQeuadBmj0HWT+DSK Vokcrlx8GG0pLNSp3Do3xSLEmxrt9B/zUQIkGtAY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3947AF8012B; Tue, 20 Sep 2022 15:27:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0FC90F80539; Tue, 20 Sep 2022 15:27:38 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 432A1F80171 for ; Tue, 20 Sep 2022 15:27:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 432A1F80171 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OXKncDma" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B6A1629AD; Tue, 20 Sep 2022 13:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B35C43143; Tue, 20 Sep 2022 13:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663680452; bh=duF10gD9sbZA+Bm4zPNQqJO6kJ7WkRZ4TTW0Qx0ckj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OXKncDma0pSYX1etnuN2SPD0MgPfZQL51GSltE/BThnJglBHGeZ+mD21FaQ0MO8Kc 8mP6299DTIVsLYdW5Crx+K82zavm8vw1PpboiX0r0Oh4MmAtHhbHdzwWBk82EyKKxq iO6LivBbTwCPIeI5QFBtNPohnbN6CRjWtSgT4lvfd2xKcdSn4BXltW6XeHUBBdLIF6 QFI6d0IYZ/iv3wq1ZZmkOAI+5nLkbJ8TG4h5Ffs3Ame2lR2r4qfT9syQ4BmmfKbSRO TvkynXwxLvJHgcsQ0QSf6JpGgSA511DXe2kYD/y4I8zK8074af2pS6yfOGKGdHlMqQ SBd/Fir4R6I4w== Received: by pali.im (Postfix) id 70D882E0F; Tue, 20 Sep 2022 15:27:29 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Liam Girdwood , Mark Brown , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Marcin Wojtas Subject: [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x Date: Tue, 20 Sep 2022 15:26:47 +0200 Message-Id: <20220920132648.2008-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220920132648.2008-1-pali@kernel.org> References: <20220920132648.2008-1-pali@kernel.org> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" S/PDIF function on Armada 38x uses only mpp51 pin. So add spdif-pins mpp pins section for it. It is needed for boards without i2s. Signed-off-by: Pali Rohár Reviewed-by: Andrew Lunn --- arch/arm/boot/dts/armada-38x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index 11e0e4286ec2..b09a48de9906 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi @@ -296,6 +296,11 @@ "mpp52", "mpp53"; marvell,function = "audio"; }; + + spdif_pins: spdif-pins { + marvell,pins = "mpp51"; + marvell,function = "audio"; + }; }; gpio0: gpio@18100 { From patchwork Tue Sep 20 13:26:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12982182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89A8BC54EE9 for ; Tue, 20 Sep 2022 13:29:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AD754857; Tue, 20 Sep 2022 15:28:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AD754857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663680558; bh=1fcbXZeScQcLotv0gPiS1nNUsEdY9jyJFjsJdQHPPQI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dsZ1m23qGf55VqB/04xFSK8+K98crsq8s9I5eYNhEy6947bUYYGL5Bo8c0yLlIc74 SG7S5vDOIRo7up+EfNqHsEh41NMUJNNBDKP0+YwFJpPf1Xwx6No2B9jIskKuIwKCom kAyWh8WljE6mHJoX0HHvzkjzgbVK5uSeq+OAyEk0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F0B72F80153; Tue, 20 Sep 2022 15:27:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8EB42F80538; Tue, 20 Sep 2022 15:27:39 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 96D63F801D5 for ; Tue, 20 Sep 2022 15:27:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 96D63F801D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n+FRQAnx" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C4AAB82939; Tue, 20 Sep 2022 13:27:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74AF0C4347C; Tue, 20 Sep 2022 13:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663680451; bh=1fcbXZeScQcLotv0gPiS1nNUsEdY9jyJFjsJdQHPPQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n+FRQAnxkPyOxYuPptioo1CnZfLJ4GXyMQm14RjccLhABRTQZ/A1kp9/IfxmH1QIM HG2yNpVQwu8TxZwklm8QhHfhzEO0kSPlHsHCEa5fWQ20oO+Gnga7PCnkb1kWWPbPwK 1UbDtg9j+k6ac0FRy2E6FZyQiOLzjLEfklchKHFEE3s1ydrQy4YhRkD2jXrGOpgOiw L/rHEZtYF71vffBn2KBUkCQLnypLGNzZNWF1eKiDe6xTZRKYVX9917hKJPFlszNmcZ iZVfNgqq7qIBxFC5oRyVZ/u7kgNFLhrPLKU2+2571HDR4sH42Z6OIh3VQC9IFG7orb tbgofw/Ivi1fA== Received: by pali.im (Postfix) id E25DB2E12; Tue, 20 Sep 2022 15:27:29 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Liam Girdwood , Mark Brown , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Marcin Wojtas Subject: [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card Date: Tue, 20 Sep 2022 15:26:48 +0200 Message-Id: <20220920132648.2008-6-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220920132648.2008-1-pali@kernel.org> References: <20220920132648.2008-1-pali@kernel.org> MIME-Version: 1.0 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Turris Omnia has GPIO51 exported on pin header U16, which works in S/PDIF output mode. So define S/PDIF audio output card for this pin. Signed-off-by: Pali Rohár Reviewed-by: Andrew Lunn --- arch/arm/boot/dts/armada-385-turris-omnia.dts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts index d1e0db6e5730..fd0960157589 100644 --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts @@ -105,6 +105,33 @@ */ status = "disabled"; }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "SPDIF"; + simple-audio-card,format = "i2s"; + + simple-audio-card,cpu { + sound-dai = <&audio_controller 1>; + }; + + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; + }; +}; + +&audio_controller { + /* Pin header U16, GPIO51 in SPDIFO mode */ + pinctrl-0 = <&spdif_pins>; + pinctrl-names = "default"; + spdif-mode; + status = "okay"; }; &bm {