All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] ASoC: simple-card: Fix configuration of DAI format
@ 2019-05-16 17:51 ` Jon Hunter
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Hunter @ 2019-05-16 17:51 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linux-kernel, linux-tegra, Jon Hunter

When configuring a codec to be both bit-clock and frame-master, it was
found that the codec was always configured as bit-clock and frame-slave.
Looking at the simple_dai_link_of() function there appears to be two
problems with the configuration of the DAI format, which are ...

1. The function asoc_simple_parse_daifmt() is called before the function
   asoc_simple_parse_codec() and this means that the device-tree node
   for the codec has not been parsed yet, which is needed by the
   function asoc_simple_parse_daifmt() to determine who is the codec.
2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to
   the 'codec' node and not the phandle of the actual codec defined by
   the 'sound-dai' property under the 'codec' node.

Fix the above by moving the call to asoc_simple_parse_daifmt() after the
the call to asoc_simple_parse_codec() and pass the phandle for the codec
to asoc_simple_parse_daifmt().

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 sound/soc/generic/simple-card.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b568f578bcd..c2c8dcbcf795 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -283,11 +283,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	codec_dai		=
 	dai_props->codec_dai	= &priv->dais[li->dais++];
 
-	ret = asoc_simple_parse_daifmt(dev, node, codec,
-				       prefix, &dai_link->dai_fmt);
-	if (ret < 0)
-		goto dai_link_of_err;
-
 	simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix);
 
 	ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
@@ -298,6 +293,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_parse_daifmt(dev, node, dai_link->codecs->of_node,
+				       prefix, &dai_link->dai_fmt);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_parse_platform(plat, dai_link);
 	if (ret < 0)
 		goto dai_link_of_err;
-- 
2.7.4

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

* [RFC PATCH] ASoC: simple-card: Fix configuration of DAI format
@ 2019-05-16 17:51 ` Jon Hunter
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Hunter @ 2019-05-16 17:51 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linux-kernel, linux-tegra, Jon Hunter

When configuring a codec to be both bit-clock and frame-master, it was
found that the codec was always configured as bit-clock and frame-slave.
Looking at the simple_dai_link_of() function there appears to be two
problems with the configuration of the DAI format, which are ...

1. The function asoc_simple_parse_daifmt() is called before the function
   asoc_simple_parse_codec() and this means that the device-tree node
   for the codec has not been parsed yet, which is needed by the
   function asoc_simple_parse_daifmt() to determine who is the codec.
2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to
   the 'codec' node and not the phandle of the actual codec defined by
   the 'sound-dai' property under the 'codec' node.

Fix the above by moving the call to asoc_simple_parse_daifmt() after the
the call to asoc_simple_parse_codec() and pass the phandle for the codec
to asoc_simple_parse_daifmt().

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 sound/soc/generic/simple-card.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b568f578bcd..c2c8dcbcf795 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -283,11 +283,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	codec_dai		=
 	dai_props->codec_dai	= &priv->dais[li->dais++];
 
-	ret = asoc_simple_parse_daifmt(dev, node, codec,
-				       prefix, &dai_link->dai_fmt);
-	if (ret < 0)
-		goto dai_link_of_err;
-
 	simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix);
 
 	ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
@@ -298,6 +293,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_parse_daifmt(dev, node, dai_link->codecs->of_node,
+				       prefix, &dai_link->dai_fmt);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_parse_platform(plat, dai_link);
 	if (ret < 0)
 		goto dai_link_of_err;
-- 
2.7.4


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

* Applied "ASoC: simple-card: Fix configuration of DAI format" to the asoc tree
  2019-05-16 17:51 ` Jon Hunter
@ 2019-05-21 20:32   ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2019-05-21 20:32 UTC (permalink / raw)
  To: Jon Hunter
  Cc: alsa-devel, Jaroslav Kysela, Liam Girdwood, linux-kernel,
	linux-tegra, Mark Brown, Takashi Iwai

The patch

   ASoC: simple-card: Fix configuration of DAI format

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 069d037aea98ffa64c26d4b1dc958fb8f39f5c2b Mon Sep 17 00:00:00 2001
From: Jon Hunter <jonathanh@nvidia.com>
Date: Thu, 16 May 2019 18:51:26 +0100
Subject: [PATCH] ASoC: simple-card: Fix configuration of DAI format

When configuring a codec to be both bit-clock and frame-master, it was
found that the codec was always configured as bit-clock and frame-slave.
Looking at the simple_dai_link_of() function there appears to be two
problems with the configuration of the DAI format, which are ...

1. The function asoc_simple_parse_daifmt() is called before the function
   asoc_simple_parse_codec() and this means that the device-tree node
   for the codec has not been parsed yet, which is needed by the
   function asoc_simple_parse_daifmt() to determine who is the codec.
2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to
   the 'codec' node and not the phandle of the actual codec defined by
   the 'sound-dai' property under the 'codec' node.

Fix the above by moving the call to asoc_simple_parse_daifmt() after the
the call to asoc_simple_parse_codec() and pass the phandle for the codec
to asoc_simple_parse_daifmt().

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b568f578bcd..c2c8dcbcf795 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -283,11 +283,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	codec_dai		=
 	dai_props->codec_dai	= &priv->dais[li->dais++];
 
-	ret = asoc_simple_parse_daifmt(dev, node, codec,
-				       prefix, &dai_link->dai_fmt);
-	if (ret < 0)
-		goto dai_link_of_err;
-
 	simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix);
 
 	ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
@@ -298,6 +293,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_parse_daifmt(dev, node, dai_link->codecs->of_node,
+				       prefix, &dai_link->dai_fmt);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_parse_platform(plat, dai_link);
 	if (ret < 0)
 		goto dai_link_of_err;
-- 
2.20.1

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

* Applied "ASoC: simple-card: Fix configuration of DAI format" to the asoc tree
@ 2019-05-21 20:32   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2019-05-21 20:32 UTC (permalink / raw)
  To: Jon Hunter
  Cc: alsa-devel, Jaroslav Kysela, Liam Girdwood, linux-kernel,
	linux-tegra, Mark Brown, Takashi Iwai

The patch

   ASoC: simple-card: Fix configuration of DAI format

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 069d037aea98ffa64c26d4b1dc958fb8f39f5c2b Mon Sep 17 00:00:00 2001
From: Jon Hunter <jonathanh@nvidia.com>
Date: Thu, 16 May 2019 18:51:26 +0100
Subject: [PATCH] ASoC: simple-card: Fix configuration of DAI format

When configuring a codec to be both bit-clock and frame-master, it was
found that the codec was always configured as bit-clock and frame-slave.
Looking at the simple_dai_link_of() function there appears to be two
problems with the configuration of the DAI format, which are ...

1. The function asoc_simple_parse_daifmt() is called before the function
   asoc_simple_parse_codec() and this means that the device-tree node
   for the codec has not been parsed yet, which is needed by the
   function asoc_simple_parse_daifmt() to determine who is the codec.
2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to
   the 'codec' node and not the phandle of the actual codec defined by
   the 'sound-dai' property under the 'codec' node.

Fix the above by moving the call to asoc_simple_parse_daifmt() after the
the call to asoc_simple_parse_codec() and pass the phandle for the codec
to asoc_simple_parse_daifmt().

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b568f578bcd..c2c8dcbcf795 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -283,11 +283,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	codec_dai		=
 	dai_props->codec_dai	= &priv->dais[li->dais++];
 
-	ret = asoc_simple_parse_daifmt(dev, node, codec,
-				       prefix, &dai_link->dai_fmt);
-	if (ret < 0)
-		goto dai_link_of_err;
-
 	simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix);
 
 	ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
@@ -298,6 +293,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_parse_daifmt(dev, node, dai_link->codecs->of_node,
+				       prefix, &dai_link->dai_fmt);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_parse_platform(plat, dai_link);
 	if (ret < 0)
 		goto dai_link_of_err;
-- 
2.20.1

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

* Re: Applied "ASoC: simple-card: Fix configuration of DAI format" to the asoc tree
  2019-05-21 20:32   ` Mark Brown
@ 2019-05-23  8:54     ` Jon Hunter
  -1 siblings, 0 replies; 7+ messages in thread
From: Jon Hunter @ 2019-05-23  8:54 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Jaroslav Kysela, Liam Girdwood, linux-kernel,
	linux-tegra, Takashi Iwai, Kuninori Morimoto

Hi Mark,

On 21/05/2019 21:32, Mark Brown wrote:
> The patch
> 
>    ASoC: simple-card: Fix configuration of DAI format
> 
> has been applied to the asoc tree at
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2
> 
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.  
> 
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
> 
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
> 
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
> 
> Thanks,
> Mark
> 
> From 069d037aea98ffa64c26d4b1dc958fb8f39f5c2b Mon Sep 17 00:00:00 2001
> From: Jon Hunter <jonathanh@nvidia.com>
> Date: Thu, 16 May 2019 18:51:26 +0100
> Subject: [PATCH] ASoC: simple-card: Fix configuration of DAI format
> 
> When configuring a codec to be both bit-clock and frame-master, it was
> found that the codec was always configured as bit-clock and frame-slave.
> Looking at the simple_dai_link_of() function there appears to be two
> problems with the configuration of the DAI format, which are ...
> 
> 1. The function asoc_simple_parse_daifmt() is called before the function
>    asoc_simple_parse_codec() and this means that the device-tree node
>    for the codec has not been parsed yet, which is needed by the
>    function asoc_simple_parse_daifmt() to determine who is the codec.
> 2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to
>    the 'codec' node and not the phandle of the actual codec defined by
>    the 'sound-dai' property under the 'codec' node.
> 
> Fix the above by moving the call to asoc_simple_parse_daifmt() after the
> the call to asoc_simple_parse_codec() and pass the phandle for the codec
> to asoc_simple_parse_daifmt().
Please can you drop this patch?

Per some offline review with Morimoto-san, it turns out that the actual
issue resided in my DT (which was incorrect) and not the simple-card
machine driver.

In my DT I incorrectly had ...

sound {
	compatible = "simple-audio-card";

	...
=>	simple-audio-card,bitclock-master = <&codec>;
=>	simple-audio-card,frame-master = <&codec>;
	...

	simple-audio-card,cpu {
		sound-dai = <&xxx>;
	};

	simple-audio-card,codec {
=>		sound-dai = <&codec>;
	};
};

But I should have had ...

sound {
	compatible = "simple-audio-card";

	...
=>	simple-audio-card,bitclock-master = <&codec>;
=>	simple-audio-card,frame-master = <&codec>;
	...

	simple-audio-card,cpu {
		sound-dai = <&xxx>;
	};

=>	codec: simple-audio-card,codec {	/* simple-card wants here */
		sound-dai = <&xxx>;		/* not here */
	};
};

Thanks to Morimoto-san for correcting me!

Cheers
Jon

-- 
nvpublic

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

* Re: Applied "ASoC: simple-card: Fix configuration of DAI format" to the asoc tree
@ 2019-05-23  8:54     ` Jon Hunter
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Hunter @ 2019-05-23  8:54 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Jaroslav Kysela, Liam Girdwood, linux-kernel,
	linux-tegra, Takashi Iwai, Kuninori Morimoto

Hi Mark,

On 21/05/2019 21:32, Mark Brown wrote:
> The patch
> 
>    ASoC: simple-card: Fix configuration of DAI format
> 
> has been applied to the asoc tree at
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2
> 
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.  
> 
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
> 
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
> 
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
> 
> Thanks,
> Mark
> 
> From 069d037aea98ffa64c26d4b1dc958fb8f39f5c2b Mon Sep 17 00:00:00 2001
> From: Jon Hunter <jonathanh@nvidia.com>
> Date: Thu, 16 May 2019 18:51:26 +0100
> Subject: [PATCH] ASoC: simple-card: Fix configuration of DAI format
> 
> When configuring a codec to be both bit-clock and frame-master, it was
> found that the codec was always configured as bit-clock and frame-slave.
> Looking at the simple_dai_link_of() function there appears to be two
> problems with the configuration of the DAI format, which are ...
> 
> 1. The function asoc_simple_parse_daifmt() is called before the function
>    asoc_simple_parse_codec() and this means that the device-tree node
>    for the codec has not been parsed yet, which is needed by the
>    function asoc_simple_parse_daifmt() to determine who is the codec.
> 2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to
>    the 'codec' node and not the phandle of the actual codec defined by
>    the 'sound-dai' property under the 'codec' node.
> 
> Fix the above by moving the call to asoc_simple_parse_daifmt() after the
> the call to asoc_simple_parse_codec() and pass the phandle for the codec
> to asoc_simple_parse_daifmt().
Please can you drop this patch?

Per some offline review with Morimoto-san, it turns out that the actual
issue resided in my DT (which was incorrect) and not the simple-card
machine driver.

In my DT I incorrectly had ...

sound {
	compatible = "simple-audio-card";

	...
=>	simple-audio-card,bitclock-master = <&codec>;
=>	simple-audio-card,frame-master = <&codec>;
	...

	simple-audio-card,cpu {
		sound-dai = <&xxx>;
	};

	simple-audio-card,codec {
=>		sound-dai = <&codec>;
	};
};

But I should have had ...

sound {
	compatible = "simple-audio-card";

	...
=>	simple-audio-card,bitclock-master = <&codec>;
=>	simple-audio-card,frame-master = <&codec>;
	...

	simple-audio-card,cpu {
		sound-dai = <&xxx>;
	};

=>	codec: simple-audio-card,codec {	/* simple-card wants here */
		sound-dai = <&xxx>;		/* not here */
	};
};

Thanks to Morimoto-san for correcting me!

Cheers
Jon

-- 
nvpublic

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

* Re: Applied "ASoC: simple-card: Fix configuration of DAI format" to the asoc tree
  2019-05-23  8:54     ` Jon Hunter
  (?)
@ 2019-05-23 13:17     ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2019-05-23 13:17 UTC (permalink / raw)
  To: Jon Hunter
  Cc: alsa-devel, Jaroslav Kysela, Liam Girdwood, linux-kernel,
	linux-tegra, Takashi Iwai, Kuninori Morimoto

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

On Thu, May 23, 2019 at 09:54:25AM +0100, Jon Hunter wrote:

> Please can you drop this patch?

> Per some offline review with Morimoto-san, it turns out that the actual
> issue resided in my DT (which was incorrect) and not the simple-card
> machine driver.

Sure, can you send a patch doing a revert with a commit log explaining
why please?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-05-23 13:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 17:51 [RFC PATCH] ASoC: simple-card: Fix configuration of DAI format Jon Hunter
2019-05-16 17:51 ` Jon Hunter
2019-05-21 20:32 ` Applied "ASoC: simple-card: Fix configuration of DAI format" to the asoc tree Mark Brown
2019-05-21 20:32   ` Mark Brown
2019-05-23  8:54   ` Jon Hunter
2019-05-23  8:54     ` Jon Hunter
2019-05-23 13:17     ` Mark Brown

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.