alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Audio support for Armada 370 DB
@ 2014-02-12 17:20 Thomas Petazzoni
  2014-02-12 17:20 ` [PATCH v2 1/7] sound: ASoC: add ASoC board driver " Thomas Petazzoni
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

Hello,

This series of patches enable audio support on the Marvell Armada 370
Development Board. Since both the I2S controller on the SoC side and
the I2C audio codec are already supported by the kernel, the amount of
work is fairly limited.

Changes since v1:

 * Drop patches "sound: codec: add Device Tree binding to cs42l51" and
   " sound: soc: enable Kirkwood driver for mvebu platforms" since
   they have been applied by Mark Brown.

 * Set DAI format directly in the snd_soc_dai_link structure instead
   of separately calling snd_soc_dai_set_fmt(). Suggested by Mark
   Brown.

 * Do not call snd_soc_dapm_enable_pin(), as Mark Brown mentionned
   that DAPM widgets default to enabled. It allowed to entirely remove
   the dai_init operation.

 * Use devm_snd_soc_register_card() instead of
   snd_soc_register_card(), as suggested by Mark Brown.

 * Wrote a Device Tree binding document for the DT binding introduced
   by this driver. Requested by Mark Brown.

 * Use the DT to look up the controller and the codec, as suggested by
   Mark Brown.

 * Add S/PDIF support, which has been successfully tested. I've kept
   it as separate patches (for both the ASoC machine driver, and the
   Device Tree bits), so that it can be reviewed and applied
   separately.

 * Modified the commit title so that they contain "ASoC", as requested
   by Mark Brown.

Patches 1 and 2 are to be reviewed/applied by the ASoC maintainer Mark
Brown, while patches 3 to 7 are to be reviewed/applied by the ARM
mvebu maintainers.

Note that the audio support for Armada 370 also needs a fix to the
CS42L51, which is being discussed with the author of the change that
apparently introduced the problem (see discussion at
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-January/071916.html).

Thanks,

Thomas

Thomas Petazzoni (7):
  sound: ASoC: add ASoC board driver for Armada 370 DB
  sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver
  ARM: mvebu: add audio I2S controller to Armada 370 Device Tree
  ARM: mvebu: add I2C0 muxing option for Armada 370 SoC
  ARM: mvebu: add audio support to Armada 370 DB
  ARM: mvebu: enable S/PDIF audio in Armada 370 DB Device Tree
  ARM: mvebu: enable audio options in mvebu_defconfig

 .../bindings/sound/armada-370db-audio.txt          |  27 ++++
 arch/arm/boot/dts/armada-370-db.dts                |  56 ++++++++
 arch/arm/boot/dts/armada-370.dtsi                  |  28 ++++
 arch/arm/configs/mvebu_defconfig                   |   5 +
 sound/soc/kirkwood/Kconfig                         |   9 ++
 sound/soc/kirkwood/Makefile                        |   2 +
 sound/soc/kirkwood/armada-370-db.c                 | 148 +++++++++++++++++++++
 7 files changed, 275 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/armada-370db-audio.txt
 create mode 100644 sound/soc/kirkwood/armada-370-db.c

-- 
1.8.3.2

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

* [PATCH v2 1/7] sound: ASoC: add ASoC board driver for Armada 370 DB
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
@ 2014-02-12 17:20 ` Thomas Petazzoni
  2014-02-14 20:36   ` Mark Brown
  2014-02-12 17:20 ` [PATCH v2 2/7] sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver Thomas Petazzoni
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

This commit adds a simple ASoC board driver fo the Armada 370
Development Board, which connects the audio unit of the Armada 370 SoC
to the I2C-based CS42L51.

For now, only the analog audio input and output through the CS42L51
are supported, but a followup patch adds S/PDIF support to this
driver.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../bindings/sound/armada-370db-audio.txt          |  24 +++++
 sound/soc/kirkwood/Kconfig                         |   8 ++
 sound/soc/kirkwood/Makefile                        |   2 +
 sound/soc/kirkwood/armada-370-db.c                 | 120 +++++++++++++++++++++
 4 files changed, 154 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/armada-370db-audio.txt
 create mode 100644 sound/soc/kirkwood/armada-370-db.c

diff --git a/Documentation/devicetree/bindings/sound/armada-370db-audio.txt b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
new file mode 100644
index 0000000..3893b4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
@@ -0,0 +1,24 @@
+Device Tree bindings for the Armada 370 DB audio
+================================================
+
+These Device Tree bindings are used to describe the audio complex
+found on the Armada 370 DB platform.
+
+Mandatory properties:
+
+ * compatible: must be "marvell,a370db-audio"
+
+ * marvell,audio-controller: a phandle that points to the audio
+   controller of the Armada 370 SoC.
+
+ * marvell,audio-codec: a phandle that points to the analog audio
+   codec connected to the Armada 370 SoC.
+
+Example:
+
+	sound {
+	      compatible = "marvell,a370db-audio";
+	      marvell,audio-controller = <&audio_controller>;
+	      marvell,audio-codec = <&audio_codec>;
+	      status = "okay";
+	};
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig
index 764a0ef..2dc3ecf 100644
--- a/sound/soc/kirkwood/Kconfig
+++ b/sound/soc/kirkwood/Kconfig
@@ -6,6 +6,14 @@ config SND_KIRKWOOD_SOC
 	  the Kirkwood I2S interface. You will also need to select the
 	  audio interfaces to support below.
 
+config SND_KIRKWOOD_SOC_ARMADA370_DB
+	tristate "SoC Audio support for Armada 370 DB"
+	depends on SND_KIRKWOOD_SOC && (ARCH_MVEBU || COMPILE_TEST) && I2C
+	select SND_SOC_CS42L51
+	help
+	  Say Y if you want to add support for SoC audio on
+	  the Armada 370 Development Board.
+
 config SND_KIRKWOOD_SOC_OPENRD
 	tristate "SoC Audio support for Kirkwood Openrd Client"
 	depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE || COMPILE_TEST)
diff --git a/sound/soc/kirkwood/Makefile b/sound/soc/kirkwood/Makefile
index 9e78138..7c1d8fe 100644
--- a/sound/soc/kirkwood/Makefile
+++ b/sound/soc/kirkwood/Makefile
@@ -4,6 +4,8 @@ obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o
 
 snd-soc-openrd-objs := kirkwood-openrd.o
 snd-soc-t5325-objs := kirkwood-t5325.o
+snd-soc-armada-370-db-objs := armada-370-db.o
 
+obj-$(CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB) += snd-soc-armada-370-db.o
 obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o
 obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o
diff --git a/sound/soc/kirkwood/armada-370-db.c b/sound/soc/kirkwood/armada-370-db.c
new file mode 100644
index 0000000..977639b
--- /dev/null
+++ b/sound/soc/kirkwood/armada-370-db.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2014 Marvell
+ *
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <sound/soc.h>
+#include <linux/of.h>
+#include <linux/platform_data/asoc-kirkwood.h>
+#include "../codecs/cs42l51.h"
+
+static int a370db_hw_params(struct snd_pcm_substream *substream,
+			    struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	unsigned int freq;
+
+	switch (params_rate(params)) {
+	default:
+	case 44100:
+		freq = 11289600;
+		break;
+	case 48000:
+		freq = 12288000;
+		break;
+	case 96000:
+		freq = 24576000;
+		break;
+	}
+
+	return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN);
+}
+
+static struct snd_soc_ops a370db_ops = {
+	.hw_params = a370db_hw_params,
+};
+
+static const struct snd_soc_dapm_widget a370db_dapm_widgets[] = {
+	SND_SOC_DAPM_HP("Out Jack", NULL),
+	SND_SOC_DAPM_LINE("In Jack", NULL),
+};
+
+static const struct snd_soc_dapm_route a370db_route[] = {
+	{ "Out Jack",	NULL,	"HPL" },
+	{ "Out Jack",	NULL,	"HPR" },
+	{ "AIN1L",	NULL,	"In Jack" },
+	{ "AIN1L",	NULL,	"In Jack" },
+};
+
+static struct snd_soc_dai_link a370db_dai[] = {
+{
+	.name = "CS42L51",
+	.stream_name = "analog",
+	.cpu_dai_name = "i2s",
+	.codec_dai_name = "cs42l51-hifi",
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
+	.ops = &a370db_ops,
+},
+};
+
+static struct snd_soc_card a370db = {
+	.name = "a370db",
+	.owner = THIS_MODULE,
+	.dai_link = a370db_dai,
+	.num_links = ARRAY_SIZE(a370db_dai),
+	.dapm_widgets = a370db_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(a370db_dapm_widgets),
+	.dapm_routes = a370db_route,
+	.num_dapm_routes = ARRAY_SIZE(a370db_route),
+};
+
+static int a370db_probe(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = &a370db;
+
+	card->dev = &pdev->dev;
+
+	a370db_dai[0].cpu_of_node =
+		of_parse_phandle(pdev->dev.of_node,
+				 "marvell,audio-controller", 0);
+	a370db_dai[0].platform_of_node = a370db_dai[0].cpu_of_node;
+
+	a370db_dai[0].codec_of_node =
+		of_parse_phandle(pdev->dev.of_node,
+				 "marvell,audio-codec", 0);
+
+	return devm_snd_soc_register_card(card->dev, card);
+}
+
+static const struct of_device_id a370db_dt_ids[] = {
+	{ .compatible = "marvell,a370db-audio" },
+	{ },
+};
+
+static struct platform_driver a370db_driver = {
+	.driver		= {
+		.name	= "a370db-audio",
+		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(a370db_dt_ids),
+	},
+	.probe		= a370db_probe,
+};
+
+module_platform_driver(a370db_driver);
+
+MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
+MODULE_DESCRIPTION("ALSA SoC a370db audio client");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:a370db-audio");
-- 
1.8.3.2

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

* [PATCH v2 2/7] sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
  2014-02-12 17:20 ` [PATCH v2 1/7] sound: ASoC: add ASoC board driver " Thomas Petazzoni
@ 2014-02-12 17:20 ` Thomas Petazzoni
  2014-03-18 18:38   ` Mark Brown
  2014-02-12 17:20 ` [PATCH v2 3/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree Thomas Petazzoni
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

The Armada 370 DB board not only has analog audio input/output, but
also S/PDIF input/output. This commit adds support for S/PDIF in the
ASoC machine driver of the Armada 370 DB platform, and adjusts the
Device Tree bindings documentation accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../bindings/sound/armada-370db-audio.txt          |  9 ++++---
 sound/soc/kirkwood/Kconfig                         |  1 +
 sound/soc/kirkwood/armada-370-db.c                 | 28 ++++++++++++++++++++++
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/armada-370db-audio.txt b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
index 3893b4d..bf984d2 100644
--- a/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
+++ b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
@@ -11,14 +11,17 @@ Mandatory properties:
  * marvell,audio-controller: a phandle that points to the audio
    controller of the Armada 370 SoC.
 
- * marvell,audio-codec: a phandle that points to the analog audio
-   codec connected to the Armada 370 SoC.
+ * marvell,audio-codec: a set of three phandles that points to:
+
+    1/ the analog audio codec connected to the Armada 370 SoC
+    2/ the S/PDIF transceiver
+    3/ the S/PDIF receiver
 
 Example:
 
 	sound {
 	      compatible = "marvell,a370db-audio";
 	      marvell,audio-controller = <&audio_controller>;
-	      marvell,audio-codec = <&audio_codec>;
+	      marvell,audio-codec = <&audio_codec &spdif_out &spdif_in>;
 	      status = "okay";
 	};
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig
index 2dc3ecf..49f8437 100644
--- a/sound/soc/kirkwood/Kconfig
+++ b/sound/soc/kirkwood/Kconfig
@@ -10,6 +10,7 @@ config SND_KIRKWOOD_SOC_ARMADA370_DB
 	tristate "SoC Audio support for Armada 370 DB"
 	depends on SND_KIRKWOOD_SOC && (ARCH_MVEBU || COMPILE_TEST) && I2C
 	select SND_SOC_CS42L51
+	select SND_SOC_SPDIF
 	help
 	  Say Y if you want to add support for SoC audio on
 	  the Armada 370 Development Board.
diff --git a/sound/soc/kirkwood/armada-370-db.c b/sound/soc/kirkwood/armada-370-db.c
index 977639b..c443338 100644
--- a/sound/soc/kirkwood/armada-370-db.c
+++ b/sound/soc/kirkwood/armada-370-db.c
@@ -67,6 +67,20 @@ static struct snd_soc_dai_link a370db_dai[] = {
 	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
 	.ops = &a370db_ops,
 },
+{
+	.name = "S/PDIF out",
+	.stream_name = "spdif-out",
+	.cpu_dai_name = "spdif",
+	.codec_dai_name = "dit-hifi",
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
+},
+{
+	.name = "S/PDIF in",
+	.stream_name = "spdif-in",
+	.cpu_dai_name = "spdif",
+	.codec_dai_name = "dir-hifi",
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
+},
 };
 
 static struct snd_soc_card a370db = {
@@ -95,6 +109,20 @@ static int a370db_probe(struct platform_device *pdev)
 		of_parse_phandle(pdev->dev.of_node,
 				 "marvell,audio-codec", 0);
 
+	a370db_dai[1].cpu_of_node = a370db_dai[0].cpu_of_node;
+	a370db_dai[1].platform_of_node = a370db_dai[0].cpu_of_node;
+
+	a370db_dai[1].codec_of_node =
+		of_parse_phandle(pdev->dev.of_node,
+				 "marvell,audio-codec", 1);
+
+	a370db_dai[2].cpu_of_node = a370db_dai[0].cpu_of_node;
+	a370db_dai[2].platform_of_node = a370db_dai[0].cpu_of_node;
+
+	a370db_dai[2].codec_of_node =
+		of_parse_phandle(pdev->dev.of_node,
+				 "marvell,audio-codec", 2);
+
 	return devm_snd_soc_register_card(card->dev, card);
 }
 
-- 
1.8.3.2

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

* [PATCH v2 3/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
  2014-02-12 17:20 ` [PATCH v2 1/7] sound: ASoC: add ASoC board driver " Thomas Petazzoni
  2014-02-12 17:20 ` [PATCH v2 2/7] sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver Thomas Petazzoni
@ 2014-02-12 17:20 ` Thomas Petazzoni
  2014-02-12 17:20 ` [PATCH v2 4/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC Thomas Petazzoni
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

The Armada 370 SoC has an I2S audio controller. This commit adds the
description of this controller to the Device Tree describing this SoC,
as well as two possible muxing configurations for the I2S bus pins.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/armada-370.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 0d8530c..e3f4c18 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -132,6 +132,20 @@
 							"mpp51", "mpp52", "mpp53";
 					marvell,function = "sd0";
 				};
+
+				i2s_pins1: i2s-pins1 {
+					marvell,pins = "mpp5", "mpp6", "mpp7",
+						       "mpp8", "mpp9", "mpp10",
+						       "mpp12", "mpp13";
+					marvell,function = "audio";
+				};
+
+				i2s_pins2: i2s-pins2 {
+					marvell,pins = "mpp49", "mpp47", "mpp50",
+						       "mpp59", "mpp57", "mpp61",
+						       "mpp62", "mpp60", "mpp58";
+					marvell,function = "audio";
+				};
 			};
 
 			gpio0: gpio@18100 {
@@ -196,6 +210,15 @@
 				clocks = <&coreclk 2>;
 			};
 
+			audio_controller: audio-controller@30000 {
+				compatible = "marvell,armada370-audio";
+				reg = <0x30000 0x4000>;
+				interrupts = <93>;
+				clocks = <&gateclk 0>;
+				clock-names = "internal";
+				status = "disabled";
+			};
+
 			usb@50000 {
 				clocks = <&coreclk 0>;
 			};
-- 
1.8.3.2

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

* [PATCH v2 4/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2014-02-12 17:20 ` [PATCH v2 3/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree Thomas Petazzoni
@ 2014-02-12 17:20 ` Thomas Petazzoni
  2014-02-12 17:21 ` [PATCH v2 5/7] ARM: mvebu: add audio support to Armada 370 DB Thomas Petazzoni
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

This commit adds a pin-muxing configuration for the I2C0 bus of the
Armada 370, which is used on the Armada 370 DB platform to interface
with the CS42L51 audio codec.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/armada-370.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index e3f4c18..6f216f0 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -133,6 +133,11 @@
 					marvell,function = "sd0";
 				};
 
+				i2c0_pins: i2c0-pins {
+					marvell,pins = "mpp2", "mpp3";
+					marvell,function = "i2c0";
+				};
+
 				i2s_pins1: i2s-pins1 {
 					marvell,pins = "mpp5", "mpp6", "mpp7",
 						       "mpp8", "mpp9", "mpp10",
-- 
1.8.3.2

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

* [PATCH v2 5/7] ARM: mvebu: add audio support to Armada 370 DB
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2014-02-12 17:20 ` [PATCH v2 4/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC Thomas Petazzoni
@ 2014-02-12 17:21 ` Thomas Petazzoni
  2014-02-12 17:21 ` [PATCH v2 6/7] ARM: mvebu: enable S/PDIF audio in Armada 370 DB Device Tree Thomas Petazzoni
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:21 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

This commit adds the necessary Device Tree informations to enable
audio support on the Armada 370 DB platform. In details it:

 * Instantiates the CS42L51 audio codec on the I2C0 bus, and
   configures this bus with the appropriate pin-muxing configuration.

 * Enables the I2S audio controller, and configures it with the
   appropriate pin-muxing configuration.

 * Through hog pins, ensures that the other pins possibly used for I2S
   are muxed with another function than I2S.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/armada-370-db.dts | 48 +++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 08a56bc..7df1866 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -64,6 +64,22 @@
 				phy-mode = "rgmii-id";
 			};
 
+			i2c@11000 {
+				pinctrl-0 = <&i2c0_pins>;
+				pinctrl-names = "default";
+				status = "okay";
+				audio_codec: audio-codec@4a {
+					compatible = "cirrus,cs42l51";
+					reg = <0x4a>;
+				};
+			};
+
+			audio-controller@30000 {
+				pinctrl-0 = <&i2s_pins2>;
+				pinctrl-names = "default";
+				status = "okay";
+			};
+
 			mvsdio@d4000 {
 				pinctrl-0 = <&sdio_pins1>;
 				pinctrl-names = "default";
@@ -80,6 +96,30 @@
 				broken-cd;
 			};
 
+			pinctrl {
+				/*
+				 * These pins might be muxed as I2S by
+				 * the bootloader, but it conflicts
+				 * with the real I2S pins that are
+				 * muxed using i2s_pins. We must mux
+				 * those pins to a function other than
+				 * I2S.
+				 */
+				pinctrl-0 = <&hog_pins1 &hog_pins2>;
+				pinctrl-names = "default";
+
+				hog_pins1: hog-pins1 {
+					marvell,pins = "mpp6",  "mpp8", "mpp10",
+						       "mpp12", "mpp13";
+					marvell,function = "gpio";
+				};
+
+				hog_pins2: hog-pins2 {
+					marvell,pins = "mpp5", "mpp7", "mpp9";
+					marvell,function = "gpo";
+				};
+			};
+
 			usb@50000 {
 				status = "okay";
 			};
@@ -112,10 +152,18 @@
 				/* Port 0, Lane 0 */
 				status = "okay";
 			};
+
 			pcie@2,0 {
 				/* Port 1, Lane 0 */
 				status = "okay";
 			};
 		};
 	};
+
+	sound {
+	      compatible = "marvell,a370db-audio";
+	      marvell,audio-controller = <&audio_controller>;
+	      marvell,audio-codec = <&audio_codec>;
+	      status = "okay";
+	};
 };
-- 
1.8.3.2

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

* [PATCH v2 6/7] ARM: mvebu: enable S/PDIF audio in Armada 370 DB Device Tree
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2014-02-12 17:21 ` [PATCH v2 5/7] ARM: mvebu: add audio support to Armada 370 DB Thomas Petazzoni
@ 2014-02-12 17:21 ` Thomas Petazzoni
  2014-02-12 17:21 ` [PATCH v2 7/7] ARM: mvebu: enable audio options in mvebu_defconfig Thomas Petazzoni
  2014-02-17  2:46 ` [PATCH v2 0/7] Audio support for Armada 370 DB Jason Cooper
  7 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:21 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

In addition to the analog audio input and output, the Armada 370 DB
also has S/PDIF input and output optical connectors. This commit
improves the Device Tree description of the Armada 370 DB platform to
enable the S/PDIF support.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/armada-370-db.dts | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 7df1866..82f238a 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -163,7 +163,15 @@
 	sound {
 	      compatible = "marvell,a370db-audio";
 	      marvell,audio-controller = <&audio_controller>;
-	      marvell,audio-codec = <&audio_codec>;
+	      marvell,audio-codec = <&audio_codec &spdif_out &spdif_in>;
 	      status = "okay";
 	};
+
+	spdif_out: spdif-out {
+	      compatible = "linux,spdif-dit";
+	};
+
+	spdif_in: spdif-in {
+	      compatible = "linux,spdif-dir";
+	};
 };
-- 
1.8.3.2

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

* [PATCH v2 7/7] ARM: mvebu: enable audio options in mvebu_defconfig
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2014-02-12 17:21 ` [PATCH v2 6/7] ARM: mvebu: enable S/PDIF audio in Armada 370 DB Device Tree Thomas Petazzoni
@ 2014-02-12 17:21 ` Thomas Petazzoni
  2014-02-17  2:46 ` [PATCH v2 0/7] Audio support for Armada 370 DB Jason Cooper
  7 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2014-02-12 17:21 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Gregory Clement,
	Andrew Lunn, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Tawfik Bayouk, Ezequiel Garcia,
	linux-arm-kernel

Since at least the Armada 370 SoC has audio support, it makes sense to
enable the corresponding kernel configuration options in
mvebu_defconfig.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/configs/mvebu_defconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 0f4511d..5c58559 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -62,6 +62,11 @@ CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_SOC=y
+CONFIG_SND_KIRKWOOD_SOC=y
+CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB=y
 CONFIG_USB_SUPPORT=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
-- 
1.8.3.2

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

* Re: [PATCH v2 1/7] sound: ASoC: add ASoC board driver for Armada 370 DB
  2014-02-12 17:20 ` [PATCH v2 1/7] sound: ASoC: add ASoC board driver " Thomas Petazzoni
@ 2014-02-14 20:36   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2014-02-14 20:36 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Tawfik Bayouk, Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth


[-- Attachment #1.1: Type: text/plain, Size: 249 bytes --]

On Wed, Feb 12, 2014 at 06:20:56PM +0100, Thomas Petazzoni wrote:
> This commit adds a simple ASoC board driver fo the Armada 370
> Development Board, which connects the audio unit of the Armada 370 SoC
> to the I2C-based CS42L51.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH v2 0/7] Audio support for Armada 370 DB
  2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2014-02-12 17:21 ` [PATCH v2 7/7] ARM: mvebu: enable audio options in mvebu_defconfig Thomas Petazzoni
@ 2014-02-17  2:46 ` Jason Cooper
  7 siblings, 0 replies; 11+ messages in thread
From: Jason Cooper @ 2014-02-17  2:46 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Tawfik Bayouk,
	Liam Girdwood, Mark Brown, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth

On Wed, Feb 12, 2014 at 06:20:55PM +0100, Thomas Petazzoni wrote:
> Hello,
> 
> This series of patches enable audio support on the Marvell Armada 370
> Development Board. Since both the I2S controller on the SoC side and
> the I2C audio codec are already supported by the kernel, the amount of
> work is fairly limited.
> 
> Changes since v1:
> 
>  * Drop patches "sound: codec: add Device Tree binding to cs42l51" and
>    " sound: soc: enable Kirkwood driver for mvebu platforms" since
>    they have been applied by Mark Brown.
> 
>  * Set DAI format directly in the snd_soc_dai_link structure instead
>    of separately calling snd_soc_dai_set_fmt(). Suggested by Mark
>    Brown.
> 
>  * Do not call snd_soc_dapm_enable_pin(), as Mark Brown mentionned
>    that DAPM widgets default to enabled. It allowed to entirely remove
>    the dai_init operation.
> 
>  * Use devm_snd_soc_register_card() instead of
>    snd_soc_register_card(), as suggested by Mark Brown.
> 
>  * Wrote a Device Tree binding document for the DT binding introduced
>    by this driver. Requested by Mark Brown.
> 
>  * Use the DT to look up the controller and the codec, as suggested by
>    Mark Brown.
> 
>  * Add S/PDIF support, which has been successfully tested. I've kept
>    it as separate patches (for both the ASoC machine driver, and the
>    Device Tree bits), so that it can be reviewed and applied
>    separately.
> 
>  * Modified the commit title so that they contain "ASoC", as requested
>    by Mark Brown.
> 
> Patches 1 and 2 are to be reviewed/applied by the ASoC maintainer Mark
> Brown, while patches 3 to 7 are to be reviewed/applied by the ARM
> mvebu maintainers.
> 
> Note that the audio support for Armada 370 also needs a fix to the
> CS42L51, which is being discussed with the author of the change that
> apparently introduced the problem (see discussion at
> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-January/071916.html).
> 
> Thanks,
> 
> Thomas
> 
> Thomas Petazzoni (7):
>   sound: ASoC: add ASoC board driver for Armada 370 DB
>   sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver
>   ARM: mvebu: add audio I2S controller to Armada 370 Device Tree
>   ARM: mvebu: add I2C0 muxing option for Armada 370 SoC
>   ARM: mvebu: add audio support to Armada 370 DB
>   ARM: mvebu: enable S/PDIF audio in Armada 370 DB Device Tree
>   ARM: mvebu: enable audio options in mvebu_defconfig
> 
>  .../bindings/sound/armada-370db-audio.txt          |  27 ++++
>  arch/arm/boot/dts/armada-370-db.dts                |  56 ++++++++
>  arch/arm/boot/dts/armada-370.dtsi                  |  28 ++++
>  arch/arm/configs/mvebu_defconfig                   |   5 +
>  sound/soc/kirkwood/Kconfig                         |   9 ++
>  sound/soc/kirkwood/Makefile                        |   2 +
>  sound/soc/kirkwood/armada-370-db.c                 | 148 +++++++++++++++++++++
>  7 files changed, 275 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/armada-370db-audio.txt
>  create mode 100644 sound/soc/kirkwood/armada-370-db.c

Patches 3 to 6 applied to mvebu/dt.  Patch 7 applied to mvebu/defconfig

thx,

Jason.

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

* Re: [PATCH v2 2/7] sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver
  2014-02-12 17:20 ` [PATCH v2 2/7] sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver Thomas Petazzoni
@ 2014-03-18 18:38   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2014-03-18 18:38 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Tawfik Bayouk, Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth


[-- Attachment #1.1: Type: text/plain, Size: 344 bytes --]

On Wed, Feb 12, 2014 at 06:20:57PM +0100, Thomas Petazzoni wrote:
> The Armada 370 DB board not only has analog audio input/output, but
> also S/PDIF input/output. This commit adds support for S/PDIF in the
> ASoC machine driver of the Armada 370 DB platform, and adjusts the
> Device Tree bindings documentation accordingly.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2014-03-18 18:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 17:20 [PATCH v2 0/7] Audio support for Armada 370 DB Thomas Petazzoni
2014-02-12 17:20 ` [PATCH v2 1/7] sound: ASoC: add ASoC board driver " Thomas Petazzoni
2014-02-14 20:36   ` Mark Brown
2014-02-12 17:20 ` [PATCH v2 2/7] sound: ASoC: add S/PDIF support to Armada 370 DB ASoC driver Thomas Petazzoni
2014-03-18 18:38   ` Mark Brown
2014-02-12 17:20 ` [PATCH v2 3/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree Thomas Petazzoni
2014-02-12 17:20 ` [PATCH v2 4/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC Thomas Petazzoni
2014-02-12 17:21 ` [PATCH v2 5/7] ARM: mvebu: add audio support to Armada 370 DB Thomas Petazzoni
2014-02-12 17:21 ` [PATCH v2 6/7] ARM: mvebu: enable S/PDIF audio in Armada 370 DB Device Tree Thomas Petazzoni
2014-02-12 17:21 ` [PATCH v2 7/7] ARM: mvebu: enable audio options in mvebu_defconfig Thomas Petazzoni
2014-02-17  2:46 ` [PATCH v2 0/7] Audio support for Armada 370 DB Jason Cooper

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