All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/7] Sound support for at91sam9x5-wm8731 based boards
@ 2013-07-11 16:15 ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

Hi,

This patchset add sound on the at91sam9x5ek board.
It's based on Nicolas Ferre's work in the 2.6.39 atmel patch for sam9x5:
https://github.com/linux4sam/linux-at91/commit/0aa157c9e71ccccf3abc30fa37eb5c95b392978d

It needs Bo Chen's patchset on the generic dmaengine (topic/atmel branch
on Mark's sound tree) and the SSC interrupts disabled (cf
http://www.spinics.net/lists/arm-kernel/msg256901.html)

Outstanding issue:
If this machine driver will support more SoCs maybe we should name it differently.


It has been tested on at91sam9g35ek, and should work on g15, g25, x25 and x35 also.

patches applies on next-20130711

[I let the original signed-off from Nicolas and Uwe in place, I don't
know if I should replace them by something like "originaly-signed-off-by"
since the code has been changed.]

Changes from v4:
 * Move the rates constraints into the codec
 * Hard code the DAI format since it cannot be changed anyway (and
remove the DT bindings accordingly)
 * Add some consistency in the functions naming (sam9x5ek/at91sam9x5ek/sam9x5)
 * Retrieve the SSC id from the SSC controller phandle
 * Clarify the atmel-ssc.txt documentation
 * Develop audio-routing documentation
 * Tidy up the includes in the machine driver

Changes from v3:
 * Remove the use of macros in device tree documentation.

Changes from v2:
 * Change atmel,sam9x5-audio-wm8731 to atmel,sam9x5-wm8731-audio for
consistency with sam9g20 machine driver.
 * Use the snd_pcm_hw_constraint() API as suggested by Mark and Lars-Peter.
 * Remove the unnecessary snd_soc_dapm_sync() call as Lars-Peter suggested.
 * Add documentation for machine driver DT binding.
 * Update atmel-ssc DT binding documentation.
 * Add GPL license instead of just the "GPL" word (hope that's ok !)

Changes from v1-RFC:
 * drop patches on SSC since Bo Chen already did the work
 * reorder patches to have the machine driver first
 * drop code already handled by the ASoC framework
 * drop unneeded SND_ATMEL_SOC_PDC config selection
 * use static snd_soc_card and  snd_soc_dai_link structures.

Best regards,
Richard.

Nicolas Ferre (1):
  sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards

Richard Genoud (6):
  sound: codec: wm8731: add rates constraints
  Documentation: DT: update atmel SSC with DMA binding
  ARM: AT91: DTS: sam9x5: add SSC DMA parameters
  ARM: AT91: DTS: sam9x5ek: add WM8731 codec
  ARM: AT91: DTS: sam9x5ek: enable SSC
  ARM: AT91: DTS: sam9x5ek: add sound configuration

 .../devicetree/bindings/misc/atmel-ssc.txt         |   23 ++-
 .../bindings/sound/atmel-sam9x5-wm8731-audio.txt   |   41 ++++
 arch/arm/boot/dts/at91sam9x5.dtsi                  |    3 +
 arch/arm/boot/dts/at91sam9x5ek.dtsi                |   24 +++
 sound/soc/atmel/Kconfig                            |   10 +
 sound/soc/atmel/Makefile                           |    2 +
 sound/soc/atmel/sam9x5_wm8731.c                    |  207 ++++++++++++++++++++
 sound/soc/codecs/wm8731.c                          |   57 +++++-
 8 files changed, 363 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
 create mode 100644 sound/soc/atmel/sam9x5_wm8731.c

-- 
1.7.10.4


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

* [PATCH v5 0/7] Sound support for at91sam9x5-wm8731 based boards
@ 2013-07-11 16:15 ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This patchset add sound on the at91sam9x5ek board.
It's based on Nicolas Ferre's work in the 2.6.39 atmel patch for sam9x5:
https://github.com/linux4sam/linux-at91/commit/0aa157c9e71ccccf3abc30fa37eb5c95b392978d

It needs Bo Chen's patchset on the generic dmaengine (topic/atmel branch
on Mark's sound tree) and the SSC interrupts disabled (cf
http://www.spinics.net/lists/arm-kernel/msg256901.html)

Outstanding issue:
If this machine driver will support more SoCs maybe we should name it differently.


It has been tested on at91sam9g35ek, and should work on g15, g25, x25 and x35 also.

patches applies on next-20130711

[I let the original signed-off from Nicolas and Uwe in place, I don't
know if I should replace them by something like "originaly-signed-off-by"
since the code has been changed.]

Changes from v4:
 * Move the rates constraints into the codec
 * Hard code the DAI format since it cannot be changed anyway (and
remove the DT bindings accordingly)
 * Add some consistency in the functions naming (sam9x5ek/at91sam9x5ek/sam9x5)
 * Retrieve the SSC id from the SSC controller phandle
 * Clarify the atmel-ssc.txt documentation
 * Develop audio-routing documentation
 * Tidy up the includes in the machine driver

Changes from v3:
 * Remove the use of macros in device tree documentation.

Changes from v2:
 * Change atmel,sam9x5-audio-wm8731 to atmel,sam9x5-wm8731-audio for
consistency with sam9g20 machine driver.
 * Use the snd_pcm_hw_constraint() API as suggested by Mark and Lars-Peter.
 * Remove the unnecessary snd_soc_dapm_sync() call as Lars-Peter suggested.
 * Add documentation for machine driver DT binding.
 * Update atmel-ssc DT binding documentation.
 * Add GPL license instead of just the "GPL" word (hope that's ok !)

Changes from v1-RFC:
 * drop patches on SSC since Bo Chen already did the work
 * reorder patches to have the machine driver first
 * drop code already handled by the ASoC framework
 * drop unneeded SND_ATMEL_SOC_PDC config selection
 * use static snd_soc_card and  snd_soc_dai_link structures.

Best regards,
Richard.

Nicolas Ferre (1):
  sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards

Richard Genoud (6):
  sound: codec: wm8731: add rates constraints
  Documentation: DT: update atmel SSC with DMA binding
  ARM: AT91: DTS: sam9x5: add SSC DMA parameters
  ARM: AT91: DTS: sam9x5ek: add WM8731 codec
  ARM: AT91: DTS: sam9x5ek: enable SSC
  ARM: AT91: DTS: sam9x5ek: add sound configuration

 .../devicetree/bindings/misc/atmel-ssc.txt         |   23 ++-
 .../bindings/sound/atmel-sam9x5-wm8731-audio.txt   |   41 ++++
 arch/arm/boot/dts/at91sam9x5.dtsi                  |    3 +
 arch/arm/boot/dts/at91sam9x5ek.dtsi                |   24 +++
 sound/soc/atmel/Kconfig                            |   10 +
 sound/soc/atmel/Makefile                           |    2 +
 sound/soc/atmel/sam9x5_wm8731.c                    |  207 ++++++++++++++++++++
 sound/soc/codecs/wm8731.c                          |   57 +++++-
 8 files changed, 363 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
 create mode 100644 sound/soc/atmel/sam9x5_wm8731.c

-- 
1.7.10.4

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

* [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

Depending on the mclk (or crystal) selected, the wm8731 codec have some
constraints on its data sampling rates:
e.g. with a 12.288MHz or 18.432MHz crystal, the authorized rates are
8KHz, 32KHz, 48KHz and 96KHz.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 sound/soc/codecs/wm8731.c |   57 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 5276062..fc031ed 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -45,6 +45,7 @@ static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
 struct wm8731_priv {
 	struct regmap *regmap;
 	struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
+	const struct snd_pcm_hw_constraint_list *constraints;
 	unsigned int sysclk;
 	int sysclk_type;
 	int playback_fs;
@@ -290,6 +291,36 @@ static const struct _coeff_div coeff_div[] = {
 	{12000000, 88200, 136, 0xf, 0x1, 0x1},
 };
 
+/* rates constraints */
+static const unsigned int wm8731_rates_12000000[] = {
+	8000, 32000, 44100, 48000, 96000, 88200,
+};
+
+static const unsigned int wm8731_rates_12288000_18432000[] = {
+	8000, 32000, 48000, 96000,
+};
+
+static const unsigned int wm8731_rates_11289600_16934400[] = {
+	8000, 44100, 88200,
+};
+
+static const struct snd_pcm_hw_constraint_list wm8731_constraints_12000000 = {
+	.list = wm8731_rates_12000000,
+	.count = ARRAY_SIZE(wm8731_rates_12000000),
+};
+
+static const
+struct snd_pcm_hw_constraint_list wm8731_constraints_12288000_18432000 = {
+	.list = wm8731_rates_12288000_18432000,
+	.count = ARRAY_SIZE(wm8731_rates_12288000_18432000),
+};
+
+static const
+struct snd_pcm_hw_constraint_list wm8731_constraints_11289600_16934400 = {
+	.list = wm8731_rates_11289600_16934400,
+	.count = ARRAY_SIZE(wm8731_rates_11289600_16934400),
+};
+
 static inline int get_coeff(int mclk, int rate)
 {
 	int i;
@@ -362,17 +393,23 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 	}
 
 	switch (freq) {
-	case 11289600:
 	case 12000000:
+		wm8731->constraints = &wm8731_constraints_12000000;
+		break;
 	case 12288000:
-	case 16934400:
 	case 18432000:
-		wm8731->sysclk = freq;
+		wm8731->constraints = &wm8731_constraints_12288000_18432000;
+		break;
+	case 16934400:
+	case 11289600:
+		wm8731->constraints = &wm8731_constraints_11289600_16934400;
 		break;
 	default:
 		return -EINVAL;
 	}
 
+	wm8731->sysclk = freq;
+
 	snd_soc_dapm_sync(&codec->dapm);
 
 	return 0;
@@ -475,12 +512,26 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
 	return 0;
 }
 
+static int wm8731_startup(struct snd_pcm_substream *substream,
+	struct snd_soc_dai *dai)
+{
+	struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(dai->codec);
+
+	if (wm8731->constraints)
+		snd_pcm_hw_constraint_list(substream->runtime, 0,
+					   SNDRV_PCM_HW_PARAM_RATE,
+					   wm8731->constraints);
+
+	return 0;
+}
+
 #define WM8731_RATES SNDRV_PCM_RATE_8000_96000
 
 #define WM8731_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
 	SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops wm8731_dai_ops = {
+	.startup	= wm8731_startup,
 	.hw_params	= wm8731_hw_params,
 	.digital_mute	= wm8731_mute,
 	.set_sysclk	= wm8731_set_dai_sysclk,
-- 
1.7.10.4


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

* [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

Depending on the mclk (or crystal) selected, the wm8731 codec have some
constraints on its data sampling rates:
e.g. with a 12.288MHz or 18.432MHz crystal, the authorized rates are
8KHz, 32KHz, 48KHz and 96KHz.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 sound/soc/codecs/wm8731.c |   57 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 5276062..fc031ed 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -45,6 +45,7 @@ static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
 struct wm8731_priv {
 	struct regmap *regmap;
 	struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
+	const struct snd_pcm_hw_constraint_list *constraints;
 	unsigned int sysclk;
 	int sysclk_type;
 	int playback_fs;
@@ -290,6 +291,36 @@ static const struct _coeff_div coeff_div[] = {
 	{12000000, 88200, 136, 0xf, 0x1, 0x1},
 };
 
+/* rates constraints */
+static const unsigned int wm8731_rates_12000000[] = {
+	8000, 32000, 44100, 48000, 96000, 88200,
+};
+
+static const unsigned int wm8731_rates_12288000_18432000[] = {
+	8000, 32000, 48000, 96000,
+};
+
+static const unsigned int wm8731_rates_11289600_16934400[] = {
+	8000, 44100, 88200,
+};
+
+static const struct snd_pcm_hw_constraint_list wm8731_constraints_12000000 = {
+	.list = wm8731_rates_12000000,
+	.count = ARRAY_SIZE(wm8731_rates_12000000),
+};
+
+static const
+struct snd_pcm_hw_constraint_list wm8731_constraints_12288000_18432000 = {
+	.list = wm8731_rates_12288000_18432000,
+	.count = ARRAY_SIZE(wm8731_rates_12288000_18432000),
+};
+
+static const
+struct snd_pcm_hw_constraint_list wm8731_constraints_11289600_16934400 = {
+	.list = wm8731_rates_11289600_16934400,
+	.count = ARRAY_SIZE(wm8731_rates_11289600_16934400),
+};
+
 static inline int get_coeff(int mclk, int rate)
 {
 	int i;
@@ -362,17 +393,23 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 	}
 
 	switch (freq) {
-	case 11289600:
 	case 12000000:
+		wm8731->constraints = &wm8731_constraints_12000000;
+		break;
 	case 12288000:
-	case 16934400:
 	case 18432000:
-		wm8731->sysclk = freq;
+		wm8731->constraints = &wm8731_constraints_12288000_18432000;
+		break;
+	case 16934400:
+	case 11289600:
+		wm8731->constraints = &wm8731_constraints_11289600_16934400;
 		break;
 	default:
 		return -EINVAL;
 	}
 
+	wm8731->sysclk = freq;
+
 	snd_soc_dapm_sync(&codec->dapm);
 
 	return 0;
@@ -475,12 +512,26 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
 	return 0;
 }
 
+static int wm8731_startup(struct snd_pcm_substream *substream,
+	struct snd_soc_dai *dai)
+{
+	struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(dai->codec);
+
+	if (wm8731->constraints)
+		snd_pcm_hw_constraint_list(substream->runtime, 0,
+					   SNDRV_PCM_HW_PARAM_RATE,
+					   wm8731->constraints);
+
+	return 0;
+}
+
 #define WM8731_RATES SNDRV_PCM_RATE_8000_96000
 
 #define WM8731_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
 	SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops wm8731_dai_ops = {
+	.startup	= wm8731_startup,
 	.hw_params	= wm8731_hw_params,
 	.digital_mute	= wm8731_mute,
 	.set_sysclk	= wm8731_set_dai_sysclk,
-- 
1.7.10.4

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

* [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Uwe Kleine-König,
	Richard Genoud

From: Nicolas Ferre <nicolas.ferre@atmel.com>

Description of the Asoc machine driver for an at91sam9x5 based board
with a wm8731 audio DAC. Wm8731 is clocked by a crystal and used as a
master on the SSC/I2S interface. Its connections are a headphone jack
and an Line input jack.

[Richard: this is based on an old patch from Nicolas that I forward
ported and reworked to use only device tree]

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 .../bindings/sound/atmel-sam9x5-wm8731-audio.txt   |   41 ++++
 sound/soc/atmel/Kconfig                            |   10 +
 sound/soc/atmel/Makefile                           |    2 +
 sound/soc/atmel/sam9x5_wm8731.c                    |  207 ++++++++++++++++++++
 4 files changed, 260 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
 create mode 100644 sound/soc/atmel/sam9x5_wm8731.c

diff --git a/Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt b/Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
new file mode 100644
index 0000000..630ef8b
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
@@ -0,0 +1,41 @@
+* Atmel at91sam9x5ek wm8731 audio complex
+
+Required properties:
+  - compatible: "atmel,sam9x5-wm8731-audio"
+  - atmel,model: The user-visible name of this sound complex.
+  - atmel,ssc-controller: The phandle of the SSC controller
+  - atmel,audio-codec: The phandle of the WM8731 audio codec
+  - atmel,audio-routing: A list of the connections between audio components.
+    Each entry is a pair of strings, the first being the connection's sink,
+    the second being the connection's source.
+
+Available audio endpoints for the audio-routing table:
+
+Board connectors:
+ * Headphone Jack
+ * Line In Jack
+
+sam9x5 pins:
+ * LOUT
+ * ROUT
+ * LHPOUT
+ * RHPOUT
+ * LLINEIN
+ * RLINEIN
+ * MICIN
+
+Example:
+sound {
+	compatible = "atmel,sam9x5-wm8731-audio";
+
+	atmel,model = "wm8731 @ AT91SAM9X5EK";
+
+	atmel,audio-routing =
+		"Headphone Jack", "RHPOUT",
+		"Headphone Jack", "LHPOUT",
+		"LLINEIN", "Line In Jack",
+		"RLINEIN", "Line In Jack";
+
+	atmel,ssc-controller = <&ssc0>;
+	atmel,audio-codec = <&wm8731>;
+};
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index 1c0b185..9eb8c49 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -33,6 +33,16 @@ config SND_AT91_SOC_SAM9G20_WM8731
 	  Say Y if you want to add support for SoC audio on WM8731-based
 	  AT91sam9g20 evaluation board.
 
+config SND_AT91_SOC_SAM9X5_WM8731
+	tristate "SoC Audio support for WM8731-based at91sam9x5 board"
+	depends on ATMEL_SSC && SND_ATMEL_SOC && SOC_AT91SAM9X5
+	select SND_ATMEL_SOC_SSC
+	select SND_ATMEL_SOC_DMA
+	select SND_SOC_WM8731
+	help
+	  Say Y if you want to add support for audio SoC on an
+	  at91sam9x5 based board that is using WM8731 codec.
+
 config SND_AT91_SOC_AFEB9260
 	tristate "SoC Audio support for AFEB9260 board"
 	depends on ARCH_AT91 && ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile
index 41967cc..7784c09 100644
--- a/sound/soc/atmel/Makefile
+++ b/sound/soc/atmel/Makefile
@@ -11,6 +11,8 @@ obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
 
 # AT91 Machine Support
 snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
+snd-soc-sam9x5-wm8731-objs := sam9x5_wm8731.o
 
 obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o
+obj-$(CONFIG_SND_AT91_SOC_SAM9X5_WM8731) += snd-soc-sam9x5-wm8731.o
 obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o
diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
new file mode 100644
index 0000000..8ecf29f
--- /dev/null
+++ b/sound/soc/atmel/sam9x5_wm8731.c
@@ -0,0 +1,207 @@
+/*
+ * sam9x5_wm8731   --	SoC audio for AT91SAM9X5-based boards
+ *			that are using WM8731 as codec.
+ *
+ *  Copyright (C) 2011 Atmel,
+ *		  Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ *  Copyright (C) 2013 Paratronic,
+ *		  Richard Genoud <richard.genoud@gmail.com>
+ *
+ * Based on sam9g20_wm8731.c by:
+ * Sedji Gaouaou <sedji.gaouaou@atmel.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/of.h>
+#include <linux/export.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/device.h>
+
+#include <sound/soc.h>
+#include <sound/soc-dai.h>
+#include <sound/soc-dapm.h>
+
+#include "../codecs/wm8731.h"
+#include "atmel_ssc_dai.h"
+
+
+#define MCLK_RATE 12288000
+
+#define DRV_NAME "sam9x5-snd-wm8731"
+
+struct sam9x5_drvdata {
+	int ssc_id;
+};
+
+/*
+ * Logic for a wm8731 as connected on a at91sam9x5ek based board.
+ */
+static int sam9x5_wm8731_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct device *dev = rtd->dev;
+	int ret;
+
+	dev_dbg(dev, "ASoC: %s called\n", __func__);
+
+	/* set the codec system clock for DAC and ADC */
+	ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL,
+				     MCLK_RATE, SND_SOC_CLOCK_IN);
+	if (ret < 0) {
+		dev_err(dev, "ASoC: Failed to set WM8731 SYSCLK: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+/*
+ * Audio paths on at91sam9x5ek board:
+ *
+ *  |A| ------------> |      | ---R----> Headphone Jack
+ *  |T| <----\        |  WM  | ---L--/
+ *  |9| ---> CLK <--> | 8731 | <--R----- Line In Jack
+ *  |1| <------------ |      | <--L--/
+ */
+static const struct snd_soc_dapm_widget sam9x5_dapm_widgets[] = {
+	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_LINE("Line In Jack", NULL),
+};
+
+static struct snd_soc_dai_link sam9x5_dai = {
+	.name = "WM8731",
+	.stream_name = "WM8731 PCM",
+	.codec_dai_name = "wm8731-hifi",
+	.init = sam9x5_wm8731_init,
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
+		| SND_SOC_DAIFMT_CBM_CFM,
+};
+
+static struct sam9x5_drvdata sam9x5_priv;
+
+static struct snd_soc_card snd_soc_sam9x5 = {
+	.owner = THIS_MODULE,
+	.dai_link = &sam9x5_dai,
+	.num_links = 1,
+	.dapm_widgets = sam9x5_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(sam9x5_dapm_widgets),
+	.drvdata = &sam9x5_priv,
+};
+
+static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct device_node *codec_np, *cpu_np;
+	int ret;
+
+	if (!np) {
+		dev_err(&pdev->dev, "No device node supplied\n");
+		return -EINVAL;
+	}
+
+	snd_soc_sam9x5.dev = &pdev->dev;
+
+	ret = snd_soc_of_parse_card_name(&snd_soc_sam9x5, "atmel,model");
+	if (ret) {
+		dev_err(&pdev->dev, "atmel,model node missing\n");
+		goto out;
+	}
+
+	ret = snd_soc_of_parse_audio_routing(&snd_soc_sam9x5,
+					     "atmel,audio-routing");
+	if (ret) {
+		dev_err(&pdev->dev, "atmel,audio-routing node missing\n");
+		goto out;
+	}
+
+	codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
+	if (!codec_np) {
+		dev_err(&pdev->dev, "atmel,audio-codec node missing\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	sam9x5_dai.codec_of_node = codec_np;
+
+	cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0);
+	if (!cpu_np) {
+		dev_err(&pdev->dev, "atmel,ssc-controller node missing\n");
+		ret = -EINVAL;
+		goto out;
+	}
+	sam9x5_dai.cpu_of_node = cpu_np;
+	sam9x5_dai.platform_of_node = cpu_np;
+
+	sam9x5_priv.ssc_id = of_alias_get_id(cpu_np, "ssc");
+
+	ret = atmel_ssc_set_audio(sam9x5_priv.ssc_id);
+	if (ret != 0) {
+		dev_err(&pdev->dev,
+			"ASoC: Failed to set SSC %d for audio: %d\n",
+			ret, sam9x5_priv.ssc_id);
+		goto out;
+	}
+
+	of_node_put(codec_np);
+	of_node_put(cpu_np);
+
+	ret = snd_soc_register_card(&snd_soc_sam9x5);
+	if (ret) {
+		dev_err(&pdev->dev,
+			"ASoC: Platform device allocation failed\n");
+		goto out_put_audio;
+	}
+
+	platform_set_drvdata(pdev, &snd_soc_sam9x5);
+
+	dev_dbg(&pdev->dev, "ASoC: %s ok\n", __func__);
+
+	return ret;
+
+out_put_audio:
+	atmel_ssc_put_audio(sam9x5_priv.ssc_id);
+out:
+	return ret;
+}
+
+static int sam9x5_wm8731_driver_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct sam9x5_drvdata *sam9x5_priv = card->drvdata;
+
+	snd_soc_unregister_card(card);
+	atmel_ssc_put_audio(sam9x5_priv->ssc_id);
+
+	return 0;
+}
+
+static const struct of_device_id sam9x5_wm8731_of_match[] = {
+	{ .compatible = "atmel,sam9x5-wm8731-audio", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sam9x5_wm8731_of_match);
+
+static struct platform_driver sam9x5_wm8731_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(sam9x5_wm8731_of_match),
+	},
+	.probe = sam9x5_wm8731_driver_probe,
+	.remove = sam9x5_wm8731_driver_remove,
+};
+module_platform_driver(sam9x5_wm8731_driver);
+
+/* Module information */
+MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
+MODULE_AUTHOR("Richard Genoud <richard.genoud@gmail.com>");
+MODULE_DESCRIPTION("ALSA SoC machine driver for AT91SAM9x5 - WM8731");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRV_NAME);
-- 
1.7.10.4


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

* [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nicolas Ferre <nicolas.ferre@atmel.com>

Description of the Asoc machine driver for an at91sam9x5 based board
with a wm8731 audio DAC. Wm8731 is clocked by a crystal and used as a
master on the SSC/I2S interface. Its connections are a headphone jack
and an Line input jack.

[Richard: this is based on an old patch from Nicolas that I forward
ported and reworked to use only device tree]

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 .../bindings/sound/atmel-sam9x5-wm8731-audio.txt   |   41 ++++
 sound/soc/atmel/Kconfig                            |   10 +
 sound/soc/atmel/Makefile                           |    2 +
 sound/soc/atmel/sam9x5_wm8731.c                    |  207 ++++++++++++++++++++
 4 files changed, 260 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
 create mode 100644 sound/soc/atmel/sam9x5_wm8731.c

diff --git a/Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt b/Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
new file mode 100644
index 0000000..630ef8b
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel-sam9x5-wm8731-audio.txt
@@ -0,0 +1,41 @@
+* Atmel at91sam9x5ek wm8731 audio complex
+
+Required properties:
+  - compatible: "atmel,sam9x5-wm8731-audio"
+  - atmel,model: The user-visible name of this sound complex.
+  - atmel,ssc-controller: The phandle of the SSC controller
+  - atmel,audio-codec: The phandle of the WM8731 audio codec
+  - atmel,audio-routing: A list of the connections between audio components.
+    Each entry is a pair of strings, the first being the connection's sink,
+    the second being the connection's source.
+
+Available audio endpoints for the audio-routing table:
+
+Board connectors:
+ * Headphone Jack
+ * Line In Jack
+
+sam9x5 pins:
+ * LOUT
+ * ROUT
+ * LHPOUT
+ * RHPOUT
+ * LLINEIN
+ * RLINEIN
+ * MICIN
+
+Example:
+sound {
+	compatible = "atmel,sam9x5-wm8731-audio";
+
+	atmel,model = "wm8731 @ AT91SAM9X5EK";
+
+	atmel,audio-routing =
+		"Headphone Jack", "RHPOUT",
+		"Headphone Jack", "LHPOUT",
+		"LLINEIN", "Line In Jack",
+		"RLINEIN", "Line In Jack";
+
+	atmel,ssc-controller = <&ssc0>;
+	atmel,audio-codec = <&wm8731>;
+};
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index 1c0b185..9eb8c49 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -33,6 +33,16 @@ config SND_AT91_SOC_SAM9G20_WM8731
 	  Say Y if you want to add support for SoC audio on WM8731-based
 	  AT91sam9g20 evaluation board.
 
+config SND_AT91_SOC_SAM9X5_WM8731
+	tristate "SoC Audio support for WM8731-based at91sam9x5 board"
+	depends on ATMEL_SSC && SND_ATMEL_SOC && SOC_AT91SAM9X5
+	select SND_ATMEL_SOC_SSC
+	select SND_ATMEL_SOC_DMA
+	select SND_SOC_WM8731
+	help
+	  Say Y if you want to add support for audio SoC on an
+	  at91sam9x5 based board that is using WM8731 codec.
+
 config SND_AT91_SOC_AFEB9260
 	tristate "SoC Audio support for AFEB9260 board"
 	depends on ARCH_AT91 && ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile
index 41967cc..7784c09 100644
--- a/sound/soc/atmel/Makefile
+++ b/sound/soc/atmel/Makefile
@@ -11,6 +11,8 @@ obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
 
 # AT91 Machine Support
 snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
+snd-soc-sam9x5-wm8731-objs := sam9x5_wm8731.o
 
 obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o
+obj-$(CONFIG_SND_AT91_SOC_SAM9X5_WM8731) += snd-soc-sam9x5-wm8731.o
 obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o
diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
new file mode 100644
index 0000000..8ecf29f
--- /dev/null
+++ b/sound/soc/atmel/sam9x5_wm8731.c
@@ -0,0 +1,207 @@
+/*
+ * sam9x5_wm8731   --	SoC audio for AT91SAM9X5-based boards
+ *			that are using WM8731 as codec.
+ *
+ *  Copyright (C) 2011 Atmel,
+ *		  Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ *  Copyright (C) 2013 Paratronic,
+ *		  Richard Genoud <richard.genoud@gmail.com>
+ *
+ * Based on sam9g20_wm8731.c by:
+ * Sedji Gaouaou <sedji.gaouaou@atmel.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/of.h>
+#include <linux/export.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/device.h>
+
+#include <sound/soc.h>
+#include <sound/soc-dai.h>
+#include <sound/soc-dapm.h>
+
+#include "../codecs/wm8731.h"
+#include "atmel_ssc_dai.h"
+
+
+#define MCLK_RATE 12288000
+
+#define DRV_NAME "sam9x5-snd-wm8731"
+
+struct sam9x5_drvdata {
+	int ssc_id;
+};
+
+/*
+ * Logic for a wm8731 as connected on a at91sam9x5ek based board.
+ */
+static int sam9x5_wm8731_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct device *dev = rtd->dev;
+	int ret;
+
+	dev_dbg(dev, "ASoC: %s called\n", __func__);
+
+	/* set the codec system clock for DAC and ADC */
+	ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL,
+				     MCLK_RATE, SND_SOC_CLOCK_IN);
+	if (ret < 0) {
+		dev_err(dev, "ASoC: Failed to set WM8731 SYSCLK: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+/*
+ * Audio paths on at91sam9x5ek board:
+ *
+ *  |A| ------------> |      | ---R----> Headphone Jack
+ *  |T| <----\        |  WM  | ---L--/
+ *  |9| ---> CLK <--> | 8731 | <--R----- Line In Jack
+ *  |1| <------------ |      | <--L--/
+ */
+static const struct snd_soc_dapm_widget sam9x5_dapm_widgets[] = {
+	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_LINE("Line In Jack", NULL),
+};
+
+static struct snd_soc_dai_link sam9x5_dai = {
+	.name = "WM8731",
+	.stream_name = "WM8731 PCM",
+	.codec_dai_name = "wm8731-hifi",
+	.init = sam9x5_wm8731_init,
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
+		| SND_SOC_DAIFMT_CBM_CFM,
+};
+
+static struct sam9x5_drvdata sam9x5_priv;
+
+static struct snd_soc_card snd_soc_sam9x5 = {
+	.owner = THIS_MODULE,
+	.dai_link = &sam9x5_dai,
+	.num_links = 1,
+	.dapm_widgets = sam9x5_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(sam9x5_dapm_widgets),
+	.drvdata = &sam9x5_priv,
+};
+
+static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct device_node *codec_np, *cpu_np;
+	int ret;
+
+	if (!np) {
+		dev_err(&pdev->dev, "No device node supplied\n");
+		return -EINVAL;
+	}
+
+	snd_soc_sam9x5.dev = &pdev->dev;
+
+	ret = snd_soc_of_parse_card_name(&snd_soc_sam9x5, "atmel,model");
+	if (ret) {
+		dev_err(&pdev->dev, "atmel,model node missing\n");
+		goto out;
+	}
+
+	ret = snd_soc_of_parse_audio_routing(&snd_soc_sam9x5,
+					     "atmel,audio-routing");
+	if (ret) {
+		dev_err(&pdev->dev, "atmel,audio-routing node missing\n");
+		goto out;
+	}
+
+	codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
+	if (!codec_np) {
+		dev_err(&pdev->dev, "atmel,audio-codec node missing\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	sam9x5_dai.codec_of_node = codec_np;
+
+	cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0);
+	if (!cpu_np) {
+		dev_err(&pdev->dev, "atmel,ssc-controller node missing\n");
+		ret = -EINVAL;
+		goto out;
+	}
+	sam9x5_dai.cpu_of_node = cpu_np;
+	sam9x5_dai.platform_of_node = cpu_np;
+
+	sam9x5_priv.ssc_id = of_alias_get_id(cpu_np, "ssc");
+
+	ret = atmel_ssc_set_audio(sam9x5_priv.ssc_id);
+	if (ret != 0) {
+		dev_err(&pdev->dev,
+			"ASoC: Failed to set SSC %d for audio: %d\n",
+			ret, sam9x5_priv.ssc_id);
+		goto out;
+	}
+
+	of_node_put(codec_np);
+	of_node_put(cpu_np);
+
+	ret = snd_soc_register_card(&snd_soc_sam9x5);
+	if (ret) {
+		dev_err(&pdev->dev,
+			"ASoC: Platform device allocation failed\n");
+		goto out_put_audio;
+	}
+
+	platform_set_drvdata(pdev, &snd_soc_sam9x5);
+
+	dev_dbg(&pdev->dev, "ASoC: %s ok\n", __func__);
+
+	return ret;
+
+out_put_audio:
+	atmel_ssc_put_audio(sam9x5_priv.ssc_id);
+out:
+	return ret;
+}
+
+static int sam9x5_wm8731_driver_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct sam9x5_drvdata *sam9x5_priv = card->drvdata;
+
+	snd_soc_unregister_card(card);
+	atmel_ssc_put_audio(sam9x5_priv->ssc_id);
+
+	return 0;
+}
+
+static const struct of_device_id sam9x5_wm8731_of_match[] = {
+	{ .compatible = "atmel,sam9x5-wm8731-audio", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sam9x5_wm8731_of_match);
+
+static struct platform_driver sam9x5_wm8731_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(sam9x5_wm8731_of_match),
+	},
+	.probe = sam9x5_wm8731_driver_probe,
+	.remove = sam9x5_wm8731_driver_remove,
+};
+module_platform_driver(sam9x5_wm8731_driver);
+
+/* Module information */
+MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
+MODULE_AUTHOR("Richard Genoud <richard.genoud@gmail.com>");
+MODULE_DESCRIPTION("ALSA SoC machine driver for AT91SAM9x5 - WM8731");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRV_NAME);
-- 
1.7.10.4

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

* [PATCH v5 3/7] Documentation: DT: update atmel SSC with DMA binding
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

As atmel-ssc can be used with DMA, the documentation should be updated.
Also, a configuration DMA example is given.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 .../devicetree/bindings/misc/atmel-ssc.txt         |   23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
index 38e51ad..a45ae08 100644
--- a/Documentation/devicetree/bindings/misc/atmel-ssc.txt
+++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
@@ -7,9 +7,30 @@ Required properties:
 - reg: Should contain SSC registers location and length
 - interrupts: Should contain SSC interrupt
 
-Example:
+
+Required properties for devices compatible with "atmel,at91sam9g45-ssc":
+- dmas: DMA specifier, consisting of a phandle to DMA controller node,
+  the memory interface and SSC DMA channel ID (for tx and rx).
+  See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
+- dma-names: Must be "tx", "rx".
+
+Examples:
+- PDC transfer:
 ssc0: ssc@fffbc000 {
 	compatible = "atmel,at91rm9200-ssc";
 	reg = <0xfffbc000 0x4000>;
 	interrupts = <14 4 5>;
 };
+
+- DMA transfer:
+ssc0: ssc@f0010000 {
+      compatible = "atmel,at91sam9g45-ssc";
+      reg = <0xf0010000 0x4000>;
+      interrupts = <28 4 5>;
+      dmas = <&dma0 1 13>,
+	     <&dma0 1 14>;
+      dma-names = "tx", "rx";
+      pinctrl-names = "default";
+      pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
+      status = "disabled";
+};
-- 
1.7.10.4


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

* [PATCH v5 3/7] Documentation: DT: update atmel SSC with DMA binding
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

As atmel-ssc can be used with DMA, the documentation should be updated.
Also, a configuration DMA example is given.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 .../devicetree/bindings/misc/atmel-ssc.txt         |   23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
index 38e51ad..a45ae08 100644
--- a/Documentation/devicetree/bindings/misc/atmel-ssc.txt
+++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
@@ -7,9 +7,30 @@ Required properties:
 - reg: Should contain SSC registers location and length
 - interrupts: Should contain SSC interrupt
 
-Example:
+
+Required properties for devices compatible with "atmel,at91sam9g45-ssc":
+- dmas: DMA specifier, consisting of a phandle to DMA controller node,
+  the memory interface and SSC DMA channel ID (for tx and rx).
+  See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
+- dma-names: Must be "tx", "rx".
+
+Examples:
+- PDC transfer:
 ssc0: ssc at fffbc000 {
 	compatible = "atmel,at91rm9200-ssc";
 	reg = <0xfffbc000 0x4000>;
 	interrupts = <14 4 5>;
 };
+
+- DMA transfer:
+ssc0: ssc at f0010000 {
+      compatible = "atmel,at91sam9g45-ssc";
+      reg = <0xf0010000 0x4000>;
+      interrupts = <28 4 5>;
+      dmas = <&dma0 1 13>,
+	     <&dma0 1 14>;
+      dma-names = "tx", "rx";
+      pinctrl-names = "default";
+      pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
+      status = "disabled";
+};
-- 
1.7.10.4

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

* [PATCH v5 4/7] ARM: AT91: DTS: sam9x5: add SSC DMA parameters
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/boot/dts/at91sam9x5.dtsi |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 57d45f5..cf78ac0 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -542,6 +542,9 @@
 				compatible = "atmel,at91sam9g45-ssc";
 				reg = <0xf0010000 0x4000>;
 				interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>;
+				dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(13)>,
+				       <&dma0 1 AT91_DMA_CFG_PER_ID(14)>;
+				dma-names = "tx", "rx";
 				pinctrl-names = "default";
 				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
 				status = "disabled";
-- 
1.7.10.4


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

* [PATCH v5 4/7] ARM: AT91: DTS: sam9x5: add SSC DMA parameters
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/boot/dts/at91sam9x5.dtsi |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 57d45f5..cf78ac0 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -542,6 +542,9 @@
 				compatible = "atmel,at91sam9g45-ssc";
 				reg = <0xf0010000 0x4000>;
 				interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>;
+				dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(13)>,
+				       <&dma0 1 AT91_DMA_CFG_PER_ID(14)>;
+				dma-names = "tx", "rx";
 				pinctrl-names = "default";
 				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
 				status = "disabled";
-- 
1.7.10.4

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

* [PATCH v5 5/7] ARM: AT91: DTS: sam9x5ek: add WM8731 codec
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

The WM8731 codec on sam9x5ek board is on i2c, address 1A

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Acked-by: Mark Brown <broonie@linaro.org>
---
 arch/arm/boot/dts/at91sam9x5ek.dtsi |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index d107241..e6fb309 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -59,6 +59,11 @@
 
 			i2c0: i2c@f8010000 {
 				status = "okay";
+
+				wm8731: wm8731@1a {
+					compatible = "wm8731";
+					reg = <0x1a>;
+				};
 			};
 
 			pinctrl@fffff400 {
-- 
1.7.10.4


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

* [PATCH v5 5/7] ARM: AT91: DTS: sam9x5ek: add WM8731 codec
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

The WM8731 codec on sam9x5ek board is on i2c, address 1A

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Acked-by: Mark Brown <broonie@linaro.org>
---
 arch/arm/boot/dts/at91sam9x5ek.dtsi |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index d107241..e6fb309 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -59,6 +59,11 @@
 
 			i2c0: i2c at f8010000 {
 				status = "okay";
+
+				wm8731: wm8731 at 1a {
+					compatible = "wm8731";
+					reg = <0x1a>;
+				};
 			};
 
 			pinctrl at fffff400 {
-- 
1.7.10.4

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

* [PATCH v5 6/7] ARM: AT91: DTS: sam9x5ek: enable SSC
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

Enable the SSC needed for the WM8731 codec

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/boot/dts/at91sam9x5ek.dtsi |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index e6fb309..f3e83f7 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -95,6 +95,10 @@
 			watchdog@fffffe40 {
 				status = "okay";
 			};
+
+			ssc0: ssc@f0010000 {
+				status = "okay";
+			};
 		};
 
 		usb0: ohci@00600000 {
-- 
1.7.10.4


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

* [PATCH v5 6/7] ARM: AT91: DTS: sam9x5ek: enable SSC
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

Enable the SSC needed for the WM8731 codec

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/boot/dts/at91sam9x5ek.dtsi |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index e6fb309..f3e83f7 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -95,6 +95,10 @@
 			watchdog at fffffe40 {
 				status = "okay";
 			};
+
+			ssc0: ssc at f0010000 {
+				status = "okay";
+			};
 		};
 
 		usb0: ohci at 00600000 {
-- 
1.7.10.4

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

* [PATCH v5 7/7] ARM: AT91: DTS: sam9x5ek: add sound configuration
  2013-07-11 16:15 ` Richard Genoud
@ 2013-07-11 16:15   ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: Mark Brown, Nicolas Ferre, Liam Girdwood
  Cc: Bo Shen, Lars-Peter Clausen, linux-arm-kernel, linux-kernel,
	alsa-devel, devicetree-discuss, Richard Genoud

The sam9x5ek board has 2 jacks:
headphone wired on RHPOUT/LHPOUT of the wm8731
line in wired on LLINEIN/RLINEIN of the wm8731

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/boot/dts/at91sam9x5ek.dtsi |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index f3e83f7..9afe15b 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -113,4 +113,19 @@
 			status = "okay";
 		};
 	};
+
+	sound {
+		compatible = "atmel,sam9x5-wm8731-audio";
+
+		atmel,model = "wm8731 @ AT91SAM9X5EK";
+
+		atmel,audio-routing =
+			"Headphone Jack", "RHPOUT",
+			"Headphone Jack", "LHPOUT",
+			"LLINEIN", "Line In Jack",
+			"RLINEIN", "Line In Jack";
+
+		atmel,ssc-controller = <&ssc0>;
+		atmel,audio-codec = <&wm8731>;
+	};
 };
-- 
1.7.10.4


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

* [PATCH v5 7/7] ARM: AT91: DTS: sam9x5ek: add sound configuration
@ 2013-07-11 16:15   ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-11 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

The sam9x5ek board has 2 jacks:
headphone wired on RHPOUT/LHPOUT of the wm8731
line in wired on LLINEIN/RLINEIN of the wm8731

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/boot/dts/at91sam9x5ek.dtsi |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index f3e83f7..9afe15b 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -113,4 +113,19 @@
 			status = "okay";
 		};
 	};
+
+	sound {
+		compatible = "atmel,sam9x5-wm8731-audio";
+
+		atmel,model = "wm8731 @ AT91SAM9X5EK";
+
+		atmel,audio-routing =
+			"Headphone Jack", "RHPOUT",
+			"Headphone Jack", "LHPOUT",
+			"LLINEIN", "Line In Jack",
+			"RLINEIN", "Line In Jack";
+
+		atmel,ssc-controller = <&ssc0>;
+		atmel,audio-codec = <&wm8731>;
+	};
 };
-- 
1.7.10.4

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

* Re: [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
  2013-07-11 16:15   ` Richard Genoud
  (?)
@ 2013-07-12 11:45     ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-12 11:45 UTC (permalink / raw)
  To: Richard Genoud
  Cc: Nicolas Ferre, Liam Girdwood, Bo Shen, Lars-Peter Clausen,
	linux-arm-kernel, linux-kernel, alsa-devel, devicetree-discuss

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

On Thu, Jul 11, 2013 at 06:15:53PM +0200, Richard Genoud wrote:

Please always try to use commit logs that look like normal commit logs
for the subsystem.

>  	switch (freq) {
> -	case 11289600:
>  	case 12000000:
> +		wm8731->constraints = &wm8731_constraints_12000000;
> +		break;
>  	case 12288000:
> -	case 16934400:
>  	case 18432000:
> -		wm8731->sysclk = freq;
> +		wm8731->constraints = &wm8731_constraints_12288000_18432000;
> +		break;
> +	case 16934400:
> +	case 11289600:
> +		wm8731->constraints = &wm8731_constraints_11289600_16934400;
>  		break;
>  	default:
>  		return -EINVAL;
>  	}

This isn't going to work with systems which have a variable clock as the
input to the CODEC.  If it's imposing constraints the driver needs to
allow setting the clock to zero as a way of removing constraints (and
any existing drivers should be updated to do this if needed).

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

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

* Re: [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
@ 2013-07-12 11:45     ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-12 11:45 UTC (permalink / raw)
  To: Richard Genoud
  Cc: alsa-devel, Lars-Peter Clausen, devicetree-discuss,
	Nicolas Ferre, Liam Girdwood, linux-kernel, Bo Shen,
	linux-arm-kernel


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

On Thu, Jul 11, 2013 at 06:15:53PM +0200, Richard Genoud wrote:

Please always try to use commit logs that look like normal commit logs
for the subsystem.

>  	switch (freq) {
> -	case 11289600:
>  	case 12000000:
> +		wm8731->constraints = &wm8731_constraints_12000000;
> +		break;
>  	case 12288000:
> -	case 16934400:
>  	case 18432000:
> -		wm8731->sysclk = freq;
> +		wm8731->constraints = &wm8731_constraints_12288000_18432000;
> +		break;
> +	case 16934400:
> +	case 11289600:
> +		wm8731->constraints = &wm8731_constraints_11289600_16934400;
>  		break;
>  	default:
>  		return -EINVAL;
>  	}

This isn't going to work with systems which have a variable clock as the
input to the CODEC.  If it's imposing constraints the driver needs to
allow setting the clock to zero as a way of removing constraints (and
any existing drivers should be updated to do this if needed).

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

* [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
@ 2013-07-12 11:45     ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-12 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 11, 2013 at 06:15:53PM +0200, Richard Genoud wrote:

Please always try to use commit logs that look like normal commit logs
for the subsystem.

>  	switch (freq) {
> -	case 11289600:
>  	case 12000000:
> +		wm8731->constraints = &wm8731_constraints_12000000;
> +		break;
>  	case 12288000:
> -	case 16934400:
>  	case 18432000:
> -		wm8731->sysclk = freq;
> +		wm8731->constraints = &wm8731_constraints_12288000_18432000;
> +		break;
> +	case 16934400:
> +	case 11289600:
> +		wm8731->constraints = &wm8731_constraints_11289600_16934400;
>  		break;
>  	default:
>  		return -EINVAL;
>  	}

This isn't going to work with systems which have a variable clock as the
input to the CODEC.  If it's imposing constraints the driver needs to
allow setting the clock to zero as a way of removing constraints (and
any existing drivers should be updated to do this if needed).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130712/f6b906da/attachment.sig>

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

* Re: [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
  2013-07-11 16:15   ` Richard Genoud
  (?)
@ 2013-07-12 11:49     ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-12 11:49 UTC (permalink / raw)
  To: Richard Genoud
  Cc: Nicolas Ferre, Liam Girdwood, Bo Shen, Lars-Peter Clausen,
	linux-arm-kernel, linux-kernel, alsa-devel, devicetree-discuss,
	Uwe Kleine-König

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

On Thu, Jul 11, 2013 at 06:15:54PM +0200, Richard Genoud wrote:
> From: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Description of the Asoc machine driver for an at91sam9x5 based board

ASoC.

> +sam9x5 pins:
> + * LOUT
> + * ROUT
> + * LHPOUT
> + * RHPOUT
> + * LLINEIN
> + * RLINEIN
> + * MICIN

These aren't pins on the CPU, they're pins on the CODEC, and you should
be adding this to the binding document for the CODEC and referring to
that rather than having them in each individual binding document.  This
also helps if any new variants are added (not that this is likely for
the WM8731).

> +static struct sam9x5_drvdata sam9x5_priv;

Why is this a global static?

> +	ret = snd_soc_register_card(&snd_soc_sam9x5);
> +	if (ret) {
> +		dev_err(&pdev->dev,
> +			"ASoC: Platform device allocation failed\n");
> +		goto out_put_audio;
> +	}

> +	platform_set_drvdata(pdev, &snd_soc_sam9x5);

It should be being dynamically allocated and retrieved as driver data
when needed.

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

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

* Re: [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
@ 2013-07-12 11:49     ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-12 11:49 UTC (permalink / raw)
  To: Richard Genoud
  Cc: alsa-devel, Lars-Peter Clausen, devicetree-discuss,
	Nicolas Ferre, Liam Girdwood, linux-kernel, Bo Shen,
	Uwe Kleine-König, linux-arm-kernel


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

On Thu, Jul 11, 2013 at 06:15:54PM +0200, Richard Genoud wrote:
> From: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Description of the Asoc machine driver for an at91sam9x5 based board

ASoC.

> +sam9x5 pins:
> + * LOUT
> + * ROUT
> + * LHPOUT
> + * RHPOUT
> + * LLINEIN
> + * RLINEIN
> + * MICIN

These aren't pins on the CPU, they're pins on the CODEC, and you should
be adding this to the binding document for the CODEC and referring to
that rather than having them in each individual binding document.  This
also helps if any new variants are added (not that this is likely for
the WM8731).

> +static struct sam9x5_drvdata sam9x5_priv;

Why is this a global static?

> +	ret = snd_soc_register_card(&snd_soc_sam9x5);
> +	if (ret) {
> +		dev_err(&pdev->dev,
> +			"ASoC: Platform device allocation failed\n");
> +		goto out_put_audio;
> +	}

> +	platform_set_drvdata(pdev, &snd_soc_sam9x5);

It should be being dynamically allocated and retrieved as driver data
when needed.

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

* [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
@ 2013-07-12 11:49     ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-12 11:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 11, 2013 at 06:15:54PM +0200, Richard Genoud wrote:
> From: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Description of the Asoc machine driver for an at91sam9x5 based board

ASoC.

> +sam9x5 pins:
> + * LOUT
> + * ROUT
> + * LHPOUT
> + * RHPOUT
> + * LLINEIN
> + * RLINEIN
> + * MICIN

These aren't pins on the CPU, they're pins on the CODEC, and you should
be adding this to the binding document for the CODEC and referring to
that rather than having them in each individual binding document.  This
also helps if any new variants are added (not that this is likely for
the WM8731).

> +static struct sam9x5_drvdata sam9x5_priv;

Why is this a global static?

> +	ret = snd_soc_register_card(&snd_soc_sam9x5);
> +	if (ret) {
> +		dev_err(&pdev->dev,
> +			"ASoC: Platform device allocation failed\n");
> +		goto out_put_audio;
> +	}

> +	platform_set_drvdata(pdev, &snd_soc_sam9x5);

It should be being dynamically allocated and retrieved as driver data
when needed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130712/2edc0bad/attachment.sig>

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

* Re: [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
  2013-07-12 11:45     ` Mark Brown
@ 2013-07-15 14:53       ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-15 14:53 UTC (permalink / raw)
  To: Mark Brown
  Cc: Nicolas Ferre, Liam Girdwood, Bo Shen, Lars-Peter Clausen,
	linux-arm-kernel, linux-kernel, alsa-devel, devicetree-discuss

2013/7/12 Mark Brown <broonie@kernel.org>:
> On Thu, Jul 11, 2013 at 06:15:53PM +0200, Richard Genoud wrote:
>
> Please always try to use commit logs that look like normal commit logs
> for the subsystem.
Ok, I'll pay attention to that.

>>       switch (freq) {
>> -     case 11289600:
>>       case 12000000:
>> +             wm8731->constraints = &wm8731_constraints_12000000;
>> +             break;
>>       case 12288000:
>> -     case 16934400:
>>       case 18432000:
>> -             wm8731->sysclk = freq;
>> +             wm8731->constraints = &wm8731_constraints_12288000_18432000;
>> +             break;
>> +     case 16934400:
>> +     case 11289600:
>> +             wm8731->constraints = &wm8731_constraints_11289600_16934400;
>>               break;
>>       default:
>>               return -EINVAL;
>>       }
>
> This isn't going to work with systems which have a variable clock as the
> input to the CODEC.  If it's imposing constraints the driver needs to
> allow setting the clock to zero as a way of removing constraints (and
> any existing drivers should be updated to do this if needed).
Maybe I'm wrong, but I didn't find any system using variable clock
with this codec.
The sam9g20ek (soc/atmel/sam9g20_wm8731.c) is not using a crystal, but
it's using a fixed clock anyway.
But there's soc/pxa/corgi.c and soc/pxa/poodle.c that puzzle me.
They seems to use a crystal, but they are setting a different sysclk
depending on the rate.
That seems wrong, but as I'm a newbie in ASoC...

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

* [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
@ 2013-07-15 14:53       ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-15 14:53 UTC (permalink / raw)
  To: linux-arm-kernel

2013/7/12 Mark Brown <broonie@kernel.org>:
> On Thu, Jul 11, 2013 at 06:15:53PM +0200, Richard Genoud wrote:
>
> Please always try to use commit logs that look like normal commit logs
> for the subsystem.
Ok, I'll pay attention to that.

>>       switch (freq) {
>> -     case 11289600:
>>       case 12000000:
>> +             wm8731->constraints = &wm8731_constraints_12000000;
>> +             break;
>>       case 12288000:
>> -     case 16934400:
>>       case 18432000:
>> -             wm8731->sysclk = freq;
>> +             wm8731->constraints = &wm8731_constraints_12288000_18432000;
>> +             break;
>> +     case 16934400:
>> +     case 11289600:
>> +             wm8731->constraints = &wm8731_constraints_11289600_16934400;
>>               break;
>>       default:
>>               return -EINVAL;
>>       }
>
> This isn't going to work with systems which have a variable clock as the
> input to the CODEC.  If it's imposing constraints the driver needs to
> allow setting the clock to zero as a way of removing constraints (and
> any existing drivers should be updated to do this if needed).
Maybe I'm wrong, but I didn't find any system using variable clock
with this codec.
The sam9g20ek (soc/atmel/sam9g20_wm8731.c) is not using a crystal, but
it's using a fixed clock anyway.
But there's soc/pxa/corgi.c and soc/pxa/poodle.c that puzzle me.
They seems to use a crystal, but they are setting a different sysclk
depending on the rate.
That seems wrong, but as I'm a newbie in ASoC...

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

* Re: [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
  2013-07-12 11:49     ` Mark Brown
@ 2013-07-15 14:59       ` Richard Genoud
  -1 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-15 14:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: Nicolas Ferre, Liam Girdwood, Bo Shen, Lars-Peter Clausen,
	linux-arm-kernel, linux-kernel, alsa-devel, devicetree-discuss,
	Uwe Kleine-König

2013/7/12 Mark Brown <broonie@kernel.org>:
> On Thu, Jul 11, 2013 at 06:15:54PM +0200, Richard Genoud wrote:
>> From: Nicolas Ferre <nicolas.ferre@atmel.com>
>>
>> Description of the Asoc machine driver for an at91sam9x5 based board
>
> ASoC.
>
>> +sam9x5 pins:
>> + * LOUT
>> + * ROUT
>> + * LHPOUT
>> + * RHPOUT
>> + * LLINEIN
>> + * RLINEIN
>> + * MICIN
>
> These aren't pins on the CPU, they're pins on the CODEC, and you should
> be adding this to the binding document for the CODEC and referring to
> that rather than having them in each individual binding document.  This
> also helps if any new variants are added (not that this is likely for
> the WM8731).
ok, I'll move that

>
>> +static struct sam9x5_drvdata sam9x5_priv;
>
> Why is this a global static?
>
>> +     ret = snd_soc_register_card(&snd_soc_sam9x5);
>> +     if (ret) {
>> +             dev_err(&pdev->dev,
>> +                     "ASoC: Platform device allocation failed\n");
>> +             goto out_put_audio;
>> +     }
>
>> +     platform_set_drvdata(pdev, &snd_soc_sam9x5);
>
> It should be being dynamically allocated and retrieved as driver data
> when needed.
ok.

Thanks !


-- 
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?

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

* [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards
@ 2013-07-15 14:59       ` Richard Genoud
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Genoud @ 2013-07-15 14:59 UTC (permalink / raw)
  To: linux-arm-kernel

2013/7/12 Mark Brown <broonie@kernel.org>:
> On Thu, Jul 11, 2013 at 06:15:54PM +0200, Richard Genoud wrote:
>> From: Nicolas Ferre <nicolas.ferre@atmel.com>
>>
>> Description of the Asoc machine driver for an at91sam9x5 based board
>
> ASoC.
>
>> +sam9x5 pins:
>> + * LOUT
>> + * ROUT
>> + * LHPOUT
>> + * RHPOUT
>> + * LLINEIN
>> + * RLINEIN
>> + * MICIN
>
> These aren't pins on the CPU, they're pins on the CODEC, and you should
> be adding this to the binding document for the CODEC and referring to
> that rather than having them in each individual binding document.  This
> also helps if any new variants are added (not that this is likely for
> the WM8731).
ok, I'll move that

>
>> +static struct sam9x5_drvdata sam9x5_priv;
>
> Why is this a global static?
>
>> +     ret = snd_soc_register_card(&snd_soc_sam9x5);
>> +     if (ret) {
>> +             dev_err(&pdev->dev,
>> +                     "ASoC: Platform device allocation failed\n");
>> +             goto out_put_audio;
>> +     }
>
>> +     platform_set_drvdata(pdev, &snd_soc_sam9x5);
>
> It should be being dynamically allocated and retrieved as driver data
> when needed.
ok.

Thanks !


-- 
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?

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

* Re: [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
  2013-07-15 14:53       ` Richard Genoud
@ 2013-07-15 15:22         ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-15 15:22 UTC (permalink / raw)
  To: Richard Genoud
  Cc: Nicolas Ferre, Liam Girdwood, Bo Shen, Lars-Peter Clausen,
	linux-arm-kernel, linux-kernel, alsa-devel, devicetree-discuss

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

On Mon, Jul 15, 2013 at 04:53:46PM +0200, Richard Genoud wrote:
> 2013/7/12 Mark Brown <broonie@kernel.org>:

> > This isn't going to work with systems which have a variable clock as the
> > input to the CODEC.  If it's imposing constraints the driver needs to
> > allow setting the clock to zero as a way of removing constraints (and
> > any existing drivers should be updated to do this if needed).

> Maybe I'm wrong, but I didn't find any system using variable clock
> with this codec.

The driver should be written with that possibility in mind even if there
were no users; it only takes a couple of lines of code.

> The sam9g20ek (soc/atmel/sam9g20_wm8731.c) is not using a crystal, but
> it's using a fixed clock anyway.
> But there's soc/pxa/corgi.c and soc/pxa/poodle.c that puzzle me.
> They seems to use a crystal, but they are setting a different sysclk
> depending on the rate.
> That seems wrong, but as I'm a newbie in ASoC...

Note that the CPU is clock master for those - it's going to be
outputting a clock based on the sample rate selected automatically.
These boards would be broken by your change as it stands.

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

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

* [PATCH v5 1/7] sound: codec: wm8731: add rates constraints
@ 2013-07-15 15:22         ` Mark Brown
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2013-07-15 15:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 15, 2013 at 04:53:46PM +0200, Richard Genoud wrote:
> 2013/7/12 Mark Brown <broonie@kernel.org>:

> > This isn't going to work with systems which have a variable clock as the
> > input to the CODEC.  If it's imposing constraints the driver needs to
> > allow setting the clock to zero as a way of removing constraints (and
> > any existing drivers should be updated to do this if needed).

> Maybe I'm wrong, but I didn't find any system using variable clock
> with this codec.

The driver should be written with that possibility in mind even if there
were no users; it only takes a couple of lines of code.

> The sam9g20ek (soc/atmel/sam9g20_wm8731.c) is not using a crystal, but
> it's using a fixed clock anyway.
> But there's soc/pxa/corgi.c and soc/pxa/poodle.c that puzzle me.
> They seems to use a crystal, but they are setting a different sysclk
> depending on the rate.
> That seems wrong, but as I'm a newbie in ASoC...

Note that the CPU is clock master for those - it's going to be
outputting a clock based on the sample rate selected automatically.
These boards would be broken by your change as it stands.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130715/6730f15f/attachment.sig>

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

end of thread, other threads:[~2013-07-15 15:22 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-11 16:15 [PATCH v5 0/7] Sound support for at91sam9x5-wm8731 based boards Richard Genoud
2013-07-11 16:15 ` Richard Genoud
2013-07-11 16:15 ` [PATCH v5 1/7] sound: codec: wm8731: add rates constraints Richard Genoud
2013-07-11 16:15   ` Richard Genoud
2013-07-12 11:45   ` Mark Brown
2013-07-12 11:45     ` Mark Brown
2013-07-12 11:45     ` Mark Brown
2013-07-15 14:53     ` Richard Genoud
2013-07-15 14:53       ` Richard Genoud
2013-07-15 15:22       ` Mark Brown
2013-07-15 15:22         ` Mark Brown
2013-07-11 16:15 ` [PATCH v5 2/7] sound: sam9x5_wm8731: machine driver for at91sam9x5 wm8731 boards Richard Genoud
2013-07-11 16:15   ` Richard Genoud
2013-07-12 11:49   ` Mark Brown
2013-07-12 11:49     ` Mark Brown
2013-07-12 11:49     ` Mark Brown
2013-07-15 14:59     ` Richard Genoud
2013-07-15 14:59       ` Richard Genoud
2013-07-11 16:15 ` [PATCH v5 3/7] Documentation: DT: update atmel SSC with DMA binding Richard Genoud
2013-07-11 16:15   ` Richard Genoud
2013-07-11 16:15 ` [PATCH v5 4/7] ARM: AT91: DTS: sam9x5: add SSC DMA parameters Richard Genoud
2013-07-11 16:15   ` Richard Genoud
2013-07-11 16:15 ` [PATCH v5 5/7] ARM: AT91: DTS: sam9x5ek: add WM8731 codec Richard Genoud
2013-07-11 16:15   ` Richard Genoud
2013-07-11 16:15 ` [PATCH v5 6/7] ARM: AT91: DTS: sam9x5ek: enable SSC Richard Genoud
2013-07-11 16:15   ` Richard Genoud
2013-07-11 16:15 ` [PATCH v5 7/7] ARM: AT91: DTS: sam9x5ek: add sound configuration Richard Genoud
2013-07-11 16:15   ` Richard Genoud

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.