alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Audio support for Armada 370 DB
@ 2014-01-30 17:14 Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51 Thomas Petazzoni
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, 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.

Also, since the DT bindings that allows to replace the ASoC board
driver are still being ironed out, I'm proposing to add an old-style
ASoC board driver for now.

This set of patches only provide support for the analog output and
input, I am waiting for the optical cable to arrive to get the digital
input and output to work.

Patches 1 to 3 are to be taken by the ASoC maintainer, while patches 4
to 7 are to be taken by the 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: codec: add Device Tree binding to cs42l51
  sound: soc: enable Kirkwood driver for mvebu platforms
  sound: soc: add ASoC board driver for Armada 370 DB
  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 audio options in mvebu_defconfig

 .../devicetree/bindings/i2c/trivial-devices.txt    |   1 +
 .../devicetree/bindings/sound/mvebu-audio.txt      |   1 +
 arch/arm/boot/dts/armada-370-db.dts                |  46 +++++++
 arch/arm/boot/dts/armada-370.dtsi                  |  29 +++++
 arch/arm/configs/mvebu_defconfig                   |   5 +
 sound/soc/codecs/cs42l51.c                         |   7 +
 sound/soc/kirkwood/Kconfig                         |  10 +-
 sound/soc/kirkwood/Makefile                        |   2 +
 sound/soc/kirkwood/armada-370-db.c                 | 144 +++++++++++++++++++++
 sound/soc/kirkwood/kirkwood-i2s.c                  |   1 +
 10 files changed, 245 insertions(+), 1 deletion(-)
 create mode 100644 sound/soc/kirkwood/armada-370-db.c

-- 
1.8.3.2

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

* [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-02-11 12:35   ` Mark Brown
  2014-01-30 17:14 ` [PATCH 2/7] sound: soc: enable Kirkwood driver for mvebu platforms Thomas Petazzoni
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Ezequiel Garcia, linux-arm-kernel

This commit adds a trivial Device Tree binding to the I2C-based
cs42l51 sound codec, so that it can be used from Device Tree based
platforms.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Documentation/devicetree/bindings/i2c/trivial-devices.txt | 1 +
 sound/soc/codecs/cs42l51.c                                | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index b1cb341..041e560 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -17,6 +17,7 @@ at,24c08		i2c serial eeprom  (24cxx)
 atmel,24c02		i2c serial eeprom  (24cxx)
 atmel,at97sc3204t	i2c trusted platform module (TPM)
 catalyst,24c32		i2c serial eeprom
+cirrus,cs42l51		Cirrus Logic CS42L51 audio codec
 dallas,ds1307		64 x 8, Serial, I2C Real-Time Clock
 dallas,ds1338		I2C RTC with 56-Byte NV RAM
 dallas,ds1339		I2C Serial Real-Time Clock
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 1e0fa3b..4a7a733 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -604,10 +604,17 @@ static const struct i2c_device_id cs42l51_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, cs42l51_id);
 
+static const struct of_device_id cs42l51_of_match[] = {
+	{ .compatible = "cirrus,cs42l51", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, cs42l51_of_match);
+
 static struct i2c_driver cs42l51_i2c_driver = {
 	.driver = {
 		.name = "cs42l51-codec",
 		.owner = THIS_MODULE,
+		.of_match_table = cs42l51_of_match,
 	},
 	.id_table = cs42l51_id,
 	.probe = cs42l51_i2c_probe,
-- 
1.8.3.2

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

* [PATCH 2/7] sound: soc: enable Kirkwood driver for mvebu platforms
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51 Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-02-11 12:38   ` Mark Brown
  2014-01-30 17:14 ` [PATCH 3/7] sound: soc: add ASoC board driver for Armada 370 DB Thomas Petazzoni
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, Ezequiel Garcia, linux-arm-kernel

The audio unit found in the Armada 370 SoC is similar to the one used
in the Marvell Kirkwood and Marvell Dove SoCs. Therefore, this commit
allows the Kirkwood audio driver to be built on mvebu platforms, and
adds an additional compatible string to identify the Armada 370
variant of the audio unit.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Documentation/devicetree/bindings/sound/mvebu-audio.txt | 1 +
 sound/soc/kirkwood/Kconfig                              | 2 +-
 sound/soc/kirkwood/kirkwood-i2s.c                       | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/mvebu-audio.txt b/Documentation/devicetree/bindings/sound/mvebu-audio.txt
index f0062c5..cb8c07c 100644
--- a/Documentation/devicetree/bindings/sound/mvebu-audio.txt
+++ b/Documentation/devicetree/bindings/sound/mvebu-audio.txt
@@ -5,6 +5,7 @@ Required properties:
 - compatible:
   "marvell,kirkwood-audio" for Kirkwood platforms
   "marvell,dove-audio" for Dove platforms
+  "marvell,armada370-audio" for Armada 370 platforms
 
 - reg: physical base address of the controller and length of memory mapped
   region.
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig
index 78ed4a4..764a0ef 100644
--- a/sound/soc/kirkwood/Kconfig
+++ b/sound/soc/kirkwood/Kconfig
@@ -1,6 +1,6 @@
 config SND_KIRKWOOD_SOC
 	tristate "SoC Audio for the Marvell Kirkwood and Dove chips"
-	depends on ARCH_KIRKWOOD || ARCH_DOVE || COMPILE_TEST
+	depends on ARCH_KIRKWOOD || ARCH_DOVE || ARCH_MVEBU || COMPILE_TEST
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the Kirkwood I2S interface. You will also need to select the
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 3920a5e..9f84222 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -633,6 +633,7 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
 static struct of_device_id mvebu_audio_of_match[] = {
 	{ .compatible = "marvell,kirkwood-audio" },
 	{ .compatible = "marvell,dove-audio" },
+	{ .compatible = "marvell,armada370-audio" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, mvebu_audio_of_match);
-- 
1.8.3.2

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

* [PATCH 3/7] sound: soc: add ASoC board driver for Armada 370 DB
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51 Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 2/7] sound: soc: enable Kirkwood driver for mvebu platforms Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-02-11 12:48   ` Mark Brown
  2014-01-30 17:14 ` [PATCH 4/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree Thomas Petazzoni
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, 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 in the near future, digital audio input and output
support will be added through SPDIF.

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

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..d5d8388
--- /dev/null
+++ b/sound/soc/kirkwood/armada-370-db.c
@@ -0,0 +1,144 @@
+/*
+ * 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;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret;
+	unsigned int freq, fmt;
+
+	fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS;
+	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_fmt(codec_dai, fmt);
+	if (ret < 0)
+		return ret;
+
+	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 int a370db_dai_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+
+	snd_soc_dapm_enable_pin(dapm, "Out Jack");
+	snd_soc_dapm_enable_pin(dapm, "In Jack");
+
+	return 0;
+}
+
+static struct snd_soc_dai_link a370db_dai[] = {
+{
+	.name = "CS42L51",
+	.stream_name = "CS42L51 HiFi",
+	.cpu_dai_name = "i2s",
+	.platform_name = "d0030000.audio-controller",
+	.codec_dai_name = "cs42l51-hifi",
+	.codec_name = "cs42l51-codec.0-004a",
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
+	.ops = &a370db_ops,
+	.init = a370db_dai_init,
+},
+};
+
+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;
+	int ret;
+
+	card->dev = &pdev->dev;
+
+	return snd_soc_register_card(card);
+}
+
+static int a370db_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	return snd_soc_unregister_card(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,
+	.remove		= a370db_remove,
+};
+
+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] 16+ messages in thread

* [PATCH 4/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2014-01-30 17:14 ` [PATCH 3/7] sound: soc: add ASoC board driver for Armada 370 DB Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 5/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC Thomas Petazzoni
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, 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 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 7a4b82e..d3bb66a 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -128,6 +128,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 {
@@ -241,6 +255,16 @@
 					0x18304 0x4>;
 				status = "okay";
 			};
+
+			audio-controller@30000 {
+				compatible = "marvell,armada370-audio";
+				reg = <0x30000 0x4000>;
+				interrupts = <93>;
+				clocks = <&gateclk 0>;
+				clock-names = "internal";
+				status = "disabled";
+			};
+
 		};
 	};
 };
-- 
1.8.3.2

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

* [PATCH 5/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2014-01-30 17:14 ` [PATCH 4/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 6/7] ARM: mvebu: add audio support to Armada 370 DB Thomas Petazzoni
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, 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 d3bb66a..ef3cc22 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -129,6 +129,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] 16+ messages in thread

* [PATCH 6/7] ARM: mvebu: add audio support to Armada 370 DB
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2014-01-30 17:14 ` [PATCH 5/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-01-30 17:14 ` [PATCH 7/7] ARM: mvebu: enable audio options in mvebu_defconfig Thomas Petazzoni
  2014-02-10 14:21 ` [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
  7 siblings, 0 replies; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, 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 | 46 +++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 08a56bc..bc305d7 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@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,16 @@
 				/* Port 0, Lane 0 */
 				status = "okay";
 			};
+
 			pcie@2,0 {
 				/* Port 1, Lane 0 */
 				status = "okay";
 			};
 		};
 	};
+
+	sound {
+	      compatible = "marvell,a370db-audio";
+	      status = "okay";
+	};
 };
-- 
1.8.3.2

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

* [PATCH 7/7] ARM: mvebu: enable audio options in mvebu_defconfig
  2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2014-01-30 17:14 ` [PATCH 6/7] ARM: mvebu: add audio support to Armada 370 DB Thomas Petazzoni
@ 2014-01-30 17:14 ` Thomas Petazzoni
  2014-01-30 21:07   ` Jason Cooper
  2014-02-10 14:21 ` [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
  7 siblings, 1 reply; 16+ messages in thread
From: Thomas Petazzoni @ 2014-01-30 17:14 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jason Cooper, Andrew Lunn,
	Gregory Clement, Sebastian Hesselbarth
  Cc: Lior Amsalem, alsa-devel, 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 594d706..e481f01 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -60,6 +60,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] 16+ messages in thread

* Re: [PATCH 7/7] ARM: mvebu: enable audio options in mvebu_defconfig
  2014-01-30 17:14 ` [PATCH 7/7] ARM: mvebu: enable audio options in mvebu_defconfig Thomas Petazzoni
@ 2014-01-30 21:07   ` Jason Cooper
  0 siblings, 0 replies; 16+ messages in thread
From: Jason Cooper @ 2014-01-30 21:07 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Liam Girdwood, Mark Brown,
	Ezequiel Garcia, Gregory Clement, linux-arm-kernel,
	Sebastian Hesselbarth

On Thu, Jan 30, 2014 at 06:14:11PM +0100, Thomas Petazzoni wrote:
> 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(+)

Please, let's also get in the habit of updating multi_v7_defconfig as
well.

thx,

Jason.

> diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
> index 594d706..e481f01 100644
> --- a/arch/arm/configs/mvebu_defconfig
> +++ b/arch/arm/configs/mvebu_defconfig
> @@ -60,6 +60,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	[flat|nested] 16+ messages in thread

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

Hello,

Any comments on the patch series? I'd like these to be included in
3.15, and so far I've only received one simple comment from Jason
Cooper regarding the defconfig changes, but no other comments.

Thanks a lot!

Thomas

On Thu, 30 Jan 2014 18:14:04 +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.
> 
> Also, since the DT bindings that allows to replace the ASoC board
> driver are still being ironed out, I'm proposing to add an old-style
> ASoC board driver for now.
> 
> This set of patches only provide support for the analog output and
> input, I am waiting for the optical cable to arrive to get the digital
> input and output to work.
> 
> Patches 1 to 3 are to be taken by the ASoC maintainer, while patches 4
> to 7 are to be taken by the 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: codec: add Device Tree binding to cs42l51
>   sound: soc: enable Kirkwood driver for mvebu platforms
>   sound: soc: add ASoC board driver for Armada 370 DB
>   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 audio options in mvebu_defconfig
> 
>  .../devicetree/bindings/i2c/trivial-devices.txt    |   1 +
>  .../devicetree/bindings/sound/mvebu-audio.txt      |   1 +
>  arch/arm/boot/dts/armada-370-db.dts                |  46 +++++++
>  arch/arm/boot/dts/armada-370.dtsi                  |  29 +++++
>  arch/arm/configs/mvebu_defconfig                   |   5 +
>  sound/soc/codecs/cs42l51.c                         |   7 +
>  sound/soc/kirkwood/Kconfig                         |  10 +-
>  sound/soc/kirkwood/Makefile                        |   2 +
>  sound/soc/kirkwood/armada-370-db.c                 | 144 +++++++++++++++++++++
>  sound/soc/kirkwood/kirkwood-i2s.c                  |   1 +
>  10 files changed, 245 insertions(+), 1 deletion(-)
>  create mode 100644 sound/soc/kirkwood/armada-370-db.c
> 



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 0/7] Audio support for Armada 370 DB
  2014-02-10 14:21 ` [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
@ 2014-02-10 14:57   ` Mark Brown
  2014-02-10 15:04     ` Thomas Petazzoni
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Brown @ 2014-02-10 14:57 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth


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

On Mon, Feb 10, 2014 at 03:21:41PM +0100, Thomas Petazzoni wrote:

> Any comments on the patch series? I'd like these to be included in
> 3.15, and so far I've only received one simple comment from Jason
> Cooper regarding the defconfig changes, but no other comments.

Don't send contentless pings, they're more noise in the inbox.  In this
case the fact that you didn't use subject lines matching the subsystem
means that they tend to get pushed down my list (or more exactly don't
come up when I search for patches for the subsystems I maintain).  If
your subject lines stand out in git shortlog output for the area you're
working on that's generally an issue, for example with ASoC you're
looking for an "ASoC: ".

[-- 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] 16+ messages in thread

* Re: [PATCH 0/7] Audio support for Armada 370 DB
  2014-02-10 14:57   ` Mark Brown
@ 2014-02-10 15:04     ` Thomas Petazzoni
  2014-02-10 18:25       ` Mark Brown
  0 siblings, 1 reply; 16+ messages in thread
From: Thomas Petazzoni @ 2014-02-10 15:04 UTC (permalink / raw)
  To: Mark Brown
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth

Mark,

On Mon, 10 Feb 2014 14:57:29 +0000, Mark Brown wrote:

> > Any comments on the patch series? I'd like these to be included in
> > 3.15, and so far I've only received one simple comment from Jason
> > Cooper regarding the defconfig changes, but no other comments.
> 
> Don't send contentless pings, they're more noise in the inbox.  In this
> case the fact that you didn't use subject lines matching the subsystem
> means that they tend to get pushed down my list (or more exactly don't
> come up when I search for patches for the subsystems I maintain).  If
> your subject lines stand out in git shortlog output for the area you're
> working on that's generally an issue, for example with ASoC you're
> looking for an "ASoC: ".

Sure, sorry. The patches that are of interest to you are prefixed by
"sound: codec" (for the patch touching sound/soc/codecs) and "sound:
soc" (for the patches touching sound/soc/kirkwood).

If you want, I can resend with subject lines containing 'ASoC:',
however maybe it's better if some other comments are made before, to
avoid additional noise.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 0/7] Audio support for Armada 370 DB
  2014-02-10 15:04     ` Thomas Petazzoni
@ 2014-02-10 18:25       ` Mark Brown
  0 siblings, 0 replies; 16+ messages in thread
From: Mark Brown @ 2014-02-10 18:25 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth


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

On Mon, Feb 10, 2014 at 04:04:32PM +0100, Thomas Petazzoni wrote:

> Sure, sorry. The patches that are of interest to you are prefixed by
> "sound: codec" (for the patch touching sound/soc/codecs) and "sound:
> soc" (for the patches touching sound/soc/kirkwood).

> If you want, I can resend with subject lines containing 'ASoC:',
> however maybe it's better if some other comments are made before, to
> avoid additional noise.

It's OK, they are on the list and I will get to them (most likely
tomorrow now) - I did notice them.

[-- 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] 16+ messages in thread

* Re: [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51
  2014-01-30 17:14 ` [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51 Thomas Petazzoni
@ 2014-02-11 12:35   ` Mark Brown
  0 siblings, 0 replies; 16+ messages in thread
From: Mark Brown @ 2014-02-11 12:35 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth


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

On Thu, Jan 30, 2014 at 06:14:05PM +0100, Thomas Petazzoni wrote:
> This commit adds a trivial Device Tree binding to the I2C-based
> cs42l51 sound codec, so that it can be used from Device Tree based
> platforms.

Applied, thanks.

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

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

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH 2/7] sound: soc: enable Kirkwood driver for mvebu platforms
  2014-01-30 17:14 ` [PATCH 2/7] sound: soc: enable Kirkwood driver for mvebu platforms Thomas Petazzoni
@ 2014-02-11 12:38   ` Mark Brown
  0 siblings, 0 replies; 16+ messages in thread
From: Mark Brown @ 2014-02-11 12:38 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Lior Amsalem, Andrew Lunn, alsa-devel, Jason Cooper,
	Liam Girdwood, Ezequiel Garcia, Gregory Clement,
	linux-arm-kernel, Sebastian Hesselbarth


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

On Thu, Jan 30, 2014 at 06:14:06PM +0100, Thomas Petazzoni wrote:
> The audio unit found in the Armada 370 SoC is similar to the one used
> in the Marvell Kirkwood and Marvell Dove SoCs. Therefore, this commit
> allows the Kirkwood audio driver to be built on mvebu platforms, and
> adds an additional compatible string to identify the Armada 370
> variant of the audio unit.

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] 16+ messages in thread

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


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

On Thu, Jan 30, 2014 at 06:14:07PM +0100, Thomas Petazzoni wrote:

> +	fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS;
> +	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = snd_soc_dai_set_fmt(codec_dai, fmt);
> +	if (ret < 0)
> +		return ret;

Set .dai_fmt in the DAI link.

> +static int a370db_dai_init(struct snd_soc_pcm_runtime *rtd)
> +{
> +	struct snd_soc_codec *codec = rtd->codec;
> +	struct snd_soc_dapm_context *dapm = &codec->dapm;
> +
> +	snd_soc_dapm_enable_pin(dapm, "Out Jack");
> +	snd_soc_dapm_enable_pin(dapm, "In Jack");

No need to do this, everything defaults to enabled.

> +
> +	card->dev = &pdev->dev;
> +
> +	return snd_soc_register_card(card);
> +}

devm_snd_soc_register_card().

> +static const struct of_device_id a370db_dt_ids[] = {
> +	{ .compatible = "marvell,a370db-audio" },
> +	{ },
> +};

No binding document for this, and you should be using DT to look up the
controller and CODEC rather than hard coding their names (which may
change in future when instantiated from DT, especially the platform
device).

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

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

_______________________________________________
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] 16+ messages in thread

end of thread, other threads:[~2014-02-11 12:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 17:14 [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
2014-01-30 17:14 ` [PATCH 1/7] sound: codec: add Device Tree binding to cs42l51 Thomas Petazzoni
2014-02-11 12:35   ` Mark Brown
2014-01-30 17:14 ` [PATCH 2/7] sound: soc: enable Kirkwood driver for mvebu platforms Thomas Petazzoni
2014-02-11 12:38   ` Mark Brown
2014-01-30 17:14 ` [PATCH 3/7] sound: soc: add ASoC board driver for Armada 370 DB Thomas Petazzoni
2014-02-11 12:48   ` Mark Brown
2014-01-30 17:14 ` [PATCH 4/7] ARM: mvebu: add audio I2S controller to Armada 370 Device Tree Thomas Petazzoni
2014-01-30 17:14 ` [PATCH 5/7] ARM: mvebu: add I2C0 muxing option for Armada 370 SoC Thomas Petazzoni
2014-01-30 17:14 ` [PATCH 6/7] ARM: mvebu: add audio support to Armada 370 DB Thomas Petazzoni
2014-01-30 17:14 ` [PATCH 7/7] ARM: mvebu: enable audio options in mvebu_defconfig Thomas Petazzoni
2014-01-30 21:07   ` Jason Cooper
2014-02-10 14:21 ` [PATCH 0/7] Audio support for Armada 370 DB Thomas Petazzoni
2014-02-10 14:57   ` Mark Brown
2014-02-10 15:04     ` Thomas Petazzoni
2014-02-10 18:25       ` Mark Brown

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