linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x
@ 2022-09-20 13:26 Pali Rohár
  2022-09-20 13:26 ` [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Pali Rohár
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Pali Rohár @ 2022-09-20 13:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

This patch series add audio support for Armada 38x. It contains commits
from Marvell linux repository

https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/a1d70444cb0476a7524273274ca8e6d52ce6f1fe
https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/f365c93237787c7a64f2617da9425eb01e09e71f
https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/b645bfa9121214d6456de3df6b8e577f2c01c6b3
https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/829c96c206f2930e5323064cef57158bd780730d

first two squashed, rebased on top of the current linux master branch
(at v6.0-rc6) with additional patches which adds S/PDIF support on
Turris Omnia - A385 board.

Marcin Wojtas (3):
  ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
  ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
  ARM: mvebu: add audio support to Armada 385 DB

Pali Rohár (2):
  ARM: mvebu: Add spdif-pins mpp pins for Armada 38x
  ARM: dts: turris-omnia: Define S/PDIF audio card

 .../devicetree/bindings/sound/mvebu-audio.txt |  14 +-
 arch/arm/boot/dts/armada-385-turris-omnia.dts |  27 ++++
 arch/arm/boot/dts/armada-388-db.dts           |  69 +++++++++
 arch/arm/boot/dts/armada-38x.dtsi             |  24 ++++
 sound/soc/kirkwood/kirkwood-i2s.c             | 136 +++++++++++++++++-
 sound/soc/kirkwood/kirkwood.h                 |   2 +
 6 files changed, 269 insertions(+), 3 deletions(-)

-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
  2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
@ 2022-09-20 13:26 ` Pali Rohár
  2022-09-20 13:39   ` Andrew Lunn
  2022-09-26 19:48   ` Rob Herring
  2022-09-20 13:26 ` [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree Pali Rohár
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: Pali Rohár @ 2022-09-20 13:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

From: Marcin Wojtas <mw@semihalf.com>

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 <mw@semihalf.com>
Tested-by: Star_Automation <star@marvell.com>
Reviewed-by: Nadav Haklai <nadavh@marvell.com>
Reviewed-by: Lior Amsalem <alior@marvell.com>
Tested-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Hezi Shahmoon <hezi@marvell.com>
Reviewed-by: Neta Zur Hershkovits <neta@marvell.com>
[pali: Fix support for pre-38x SoCs]
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 .../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;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
  2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
  2022-09-20 13:26 ` [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Pali Rohár
@ 2022-09-20 13:26 ` Pali Rohár
  2022-09-20 13:40   ` Andrew Lunn
  2022-09-20 13:26 ` [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB Pali Rohár
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Pali Rohár @ 2022-09-20 13:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

From: Marcin Wojtas <mw@semihalf.com>

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 <mw@semihalf.com>
Reviewed-by: Nadav Haklai <nadavh@marvell.com>
Tested-by: Nadav Haklai <nadavh@marvell.com>
Tested-by: Lior Amsalem <alior@marvell.com>
[pali: Fix i2s-pins name]
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 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 = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&gateclk 0>;
+				clock-names = "internal";
+				status = "disabled";
+			};
+
 			usb3_0: usb3@f0000 {
 				compatible = "marvell,armada-380-xhci";
 				reg = <0xf0000 0x4000>,<0xf4000 0x4000>;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB
  2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
  2022-09-20 13:26 ` [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Pali Rohár
  2022-09-20 13:26 ` [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree Pali Rohár
@ 2022-09-20 13:26 ` Pali Rohár
  2022-09-20 13:41   ` Andrew Lunn
  2022-09-20 13:26 ` [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x Pali Rohár
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Pali Rohár @ 2022-09-20 13:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

From: Marcin Wojtas <mw@semihalf.com>

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 <mw@semihalf.com>
Signed-off-by: Nadav Haklai <nadavh@marvell.com>
Tested-by: Star_Automation <star@marvell.com>
Tested-by: Lior Amsalem <alior@marvell.com>
---
 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 {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x
  2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
                   ` (2 preceding siblings ...)
  2022-09-20 13:26 ` [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB Pali Rohár
@ 2022-09-20 13:26 ` Pali Rohár
  2022-09-20 13:41   ` Andrew Lunn
  2022-09-20 13:26 ` [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card Pali Rohár
  2022-09-23 15:14 ` [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Gregory CLEMENT
  5 siblings, 1 reply; 14+ messages in thread
From: Pali Rohár @ 2022-09-20 13:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

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 <pali@kernel.org>
---
 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 {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card
  2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
                   ` (3 preceding siblings ...)
  2022-09-20 13:26 ` [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x Pali Rohár
@ 2022-09-20 13:26 ` Pali Rohár
  2022-09-20 13:42   ` Andrew Lunn
  2022-09-23 15:14 ` [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Gregory CLEMENT
  5 siblings, 1 reply; 14+ messages in thread
From: Pali Rohár @ 2022-09-20 13:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

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 <pali@kernel.org>
---
 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 {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
  2022-09-20 13:26 ` [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Pali Rohár
@ 2022-09-20 13:39   ` Andrew Lunn
  2022-09-26 19:48   ` Rob Herring
  1 sibling, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2022-09-20 13:39 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Liam Girdwood, Mark Brown, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

> +	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;

A nitpick: It would be better to do the test for err before calling
armada_38x_set_pll(), and then there is no need for the NULL check.

      Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
  2022-09-20 13:26 ` [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree Pali Rohár
@ 2022-09-20 13:40   ` Andrew Lunn
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2022-09-20 13:40 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Liam Girdwood, Mark Brown, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

On Tue, Sep 20, 2022 at 03:26:45PM +0200, Pali Rohár wrote:
> From: Marcin Wojtas <mw@semihalf.com>
> 
> 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 <mw@semihalf.com>
> Reviewed-by: Nadav Haklai <nadavh@marvell.com>
> Tested-by: Nadav Haklai <nadavh@marvell.com>
> Tested-by: Lior Amsalem <alior@marvell.com>
> [pali: Fix i2s-pins name]
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB
  2022-09-20 13:26 ` [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB Pali Rohár
@ 2022-09-20 13:41   ` Andrew Lunn
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2022-09-20 13:41 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Liam Girdwood, Mark Brown, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

On Tue, Sep 20, 2022 at 03:26:46PM +0200, Pali Rohár wrote:
> From: Marcin Wojtas <mw@semihalf.com>
> 
> 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 <mw@semihalf.com>
> Signed-off-by: Nadav Haklai <nadavh@marvell.com>
> Tested-by: Star_Automation <star@marvell.com>
> Tested-by: Lior Amsalem <alior@marvell.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x
  2022-09-20 13:26 ` [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x Pali Rohár
@ 2022-09-20 13:41   ` Andrew Lunn
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2022-09-20 13:41 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Liam Girdwood, Mark Brown, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

On Tue, Sep 20, 2022 at 03:26:47PM +0200, Pali Rohár wrote:
> 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 <pali@kernel.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card
  2022-09-20 13:26 ` [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card Pali Rohár
@ 2022-09-20 13:42   ` Andrew Lunn
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2022-09-20 13:42 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Liam Girdwood, Mark Brown, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

On Tue, Sep 20, 2022 at 03:26:48PM +0200, Pali Rohár wrote:
> 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 <pali@kernel.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x
  2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
                   ` (4 preceding siblings ...)
  2022-09-20 13:26 ` [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card Pali Rohár
@ 2022-09-23 15:14 ` Gregory CLEMENT
  5 siblings, 0 replies; 14+ messages in thread
From: Gregory CLEMENT @ 2022-09-23 15:14 UTC (permalink / raw)
  To: Pali Rohár, Liam Girdwood, Mark Brown, Andrew Lunn,
	Sebastian Hesselbarth, Marcin Wojtas
  Cc: alsa-devel, devicetree, linux-kernel, linux-arm-kernel

Pali Rohár <pali@kernel.org> writes:

> This patch series add audio support for Armada 38x. It contains commits
> from Marvell linux repository
>
> https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/a1d70444cb0476a7524273274ca8e6d52ce6f1fe
> https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/f365c93237787c7a64f2617da9425eb01e09e71f
> https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/b645bfa9121214d6456de3df6b8e577f2c01c6b3
> https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/829c96c206f2930e5323064cef57158bd780730d
>
> first two squashed, rebased on top of the current linux master branch
> (at v6.0-rc6) with additional patches which adds S/PDIF support on
> Turris Omnia - A385 board.
>
> Marcin Wojtas (3):
>   ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
>   ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
>   ARM: mvebu: add audio support to Armada 385 DB
>
> Pali Rohár (2):
>   ARM: mvebu: Add spdif-pins mpp pins for Armada 38x
>   ARM: dts: turris-omnia: Define S/PDIF audio card
>

Patches 2 to 5 applied on mvebu/dt

The first one has to be applied in sound subsystem.

Thanks,

Gregory


>  .../devicetree/bindings/sound/mvebu-audio.txt |  14 +-
>  arch/arm/boot/dts/armada-385-turris-omnia.dts |  27 ++++
>  arch/arm/boot/dts/armada-388-db.dts           |  69 +++++++++
>  arch/arm/boot/dts/armada-38x.dtsi             |  24 ++++
>  sound/soc/kirkwood/kirkwood-i2s.c             | 136 +++++++++++++++++-
>  sound/soc/kirkwood/kirkwood.h                 |   2 +
>  6 files changed, 269 insertions(+), 3 deletions(-)
>
> -- 
> 2.20.1
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
  2022-09-20 13:26 ` [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Pali Rohár
  2022-09-20 13:39   ` Andrew Lunn
@ 2022-09-26 19:48   ` Rob Herring
  2022-09-26 20:04     ` Andrew Lunn
  1 sibling, 1 reply; 14+ messages in thread
From: Rob Herring @ 2022-09-26 19:48 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Liam Girdwood, Mark Brown, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

On Tue, Sep 20, 2022 at 03:26:44PM +0200, Pali Rohár wrote:
> From: Marcin Wojtas <mw@semihalf.com>
> 
> 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 <mw@semihalf.com>
> Tested-by: Star_Automation <star@marvell.com>
> Reviewed-by: Nadav Haklai <nadavh@marvell.com>
> Reviewed-by: Lior Amsalem <alior@marvell.com>
> Tested-by: Lior Amsalem <alior@marvell.com>
> Signed-off-by: Hezi Shahmoon <hezi@marvell.com>
> Reviewed-by: Neta Zur Hershkovits <neta@marvell.com>
> [pali: Fix support for pre-38x SoCs]
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  .../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

Perhaps be consistent with the 370 string above it.

>  
>  - reg: physical base address of the controller and length of memory mapped
> -  region.
> +  region (named "i2s_regs").

So you are adding 'reg-names'? The values belong under 'reg-names' then. 
'_regs' is also redundant.


> +  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.

So boolean?

> +
>  Example:
>  
>  i2s1: audio-controller@b4000 {

DT changes should be separate patch. It would also be nice to see this 
converted to schema first.

Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
  2022-09-26 19:48   ` Rob Herring
@ 2022-09-26 20:04     ` Andrew Lunn
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2022-09-26 20:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Pali Rohár, Liam Girdwood, Mark Brown, Gregory Clement,
	Sebastian Hesselbarth, Marcin Wojtas, alsa-devel, devicetree,
	linux-kernel, linux-arm-kernel

On Mon, Sep 26, 2022 at 02:48:32PM -0500, Rob Herring wrote:
> On Tue, Sep 20, 2022 at 03:26:44PM +0200, Pali Rohár wrote:
> > From: Marcin Wojtas <mw@semihalf.com>
> > 
> > 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 <mw@semihalf.com>
> > Tested-by: Star_Automation <star@marvell.com>
> > Reviewed-by: Nadav Haklai <nadavh@marvell.com>
> > Reviewed-by: Lior Amsalem <alior@marvell.com>
> > Tested-by: Lior Amsalem <alior@marvell.com>
> > Signed-off-by: Hezi Shahmoon <hezi@marvell.com>
> > Reviewed-by: Neta Zur Hershkovits <neta@marvell.com>
> > [pali: Fix support for pre-38x SoCs]
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> >  .../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
> 
> Perhaps be consistent with the 370 string above it.

Hi Rob

That was something i also considered. But actually, all 380
compatibles use armada-380-FOOBAR. So this is inconsistent with
armada370-audio, but consistent with armada-380 in general.

	 Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-09-26 20:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 13:26 [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Pali Rohár
2022-09-20 13:26 ` [PATCH 1/5] ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms Pali Rohár
2022-09-20 13:39   ` Andrew Lunn
2022-09-26 19:48   ` Rob Herring
2022-09-26 20:04     ` Andrew Lunn
2022-09-20 13:26 ` [PATCH 2/5] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree Pali Rohár
2022-09-20 13:40   ` Andrew Lunn
2022-09-20 13:26 ` [PATCH 3/5] ARM: mvebu: add audio support to Armada 385 DB Pali Rohár
2022-09-20 13:41   ` Andrew Lunn
2022-09-20 13:26 ` [PATCH 4/5] ARM: mvebu: Add spdif-pins mpp pins for Armada 38x Pali Rohár
2022-09-20 13:41   ` Andrew Lunn
2022-09-20 13:26 ` [PATCH 5/5] ARM: dts: turris-omnia: Define S/PDIF audio card Pali Rohár
2022-09-20 13:42   ` Andrew Lunn
2022-09-23 15:14 ` [PATCH 0/5] ARM: mvebu: Add audio support for Armada 38x Gregory CLEMENT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).