Linux-Amlogic Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/4] ASoC: meson: tdm fixes
@ 2020-07-29 15:44 Jerome Brunet
  2020-07-29 15:44 ` [PATCH 1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup Jerome Brunet
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jerome Brunet @ 2020-07-29 15:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: linux-amlogic, alsa-devel, Kevin Hilman, linux-kernel, Jerome Brunet

This patcheset is collection of fixes for the TDM input and output the
axg audio architecture. Its fixes:
 - slave mode format setting
 - g12 and sm1 skew offset
 - tdm clock inversion
 - standard daifmt props names which don't require a specific prefix

Jerome Brunet (4):
  ASoC: meson: axg-tdm-interface: fix link fmt setup
  ASoC: meson: axg-tdmin: fix g12a skew
  ASoC: meson: axg-tdm-formatters: fix sclk inversion
  ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties

 sound/soc/meson/axg-tdm-formatter.c | 11 ++++++-----
 sound/soc/meson/axg-tdm-formatter.h |  1 -
 sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++---------
 sound/soc/meson/axg-tdmin.c         | 16 +++++++++++++++-
 sound/soc/meson/axg-tdmout.c        |  3 ---
 sound/soc/meson/meson-card-utils.c  |  2 +-
 6 files changed, 39 insertions(+), 20 deletions(-)

-- 
2.25.4


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

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

* [PATCH 1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup
  2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
@ 2020-07-29 15:44 ` Jerome Brunet
  2020-07-29 15:44 ` [PATCH 2/4] ASoC: meson: axg-tdmin: fix g12a skew Jerome Brunet
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jerome Brunet @ 2020-07-29 15:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: linux-amlogic, alsa-devel, Kevin Hilman, linux-kernel, Jerome Brunet

The .set_fmt() callback of the axg tdm interface incorrectly
test the content of SND_SOC_DAIFMT_MASTER_MASK as if it was a
bitfield, which it is not.

Implement the test correctly.

Fixes: d60e4f1e4be5 ("ASoC: meson: add tdm interface driver")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c
index 6de27238e9df..36df30915378 100644
--- a/sound/soc/meson/axg-tdm-interface.c
+++ b/sound/soc/meson/axg-tdm-interface.c
@@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
 	struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
 
-	/* These modes are not supported */
-	if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) {
+	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBS_CFS:
+		if (!iface->mclk) {
+			dev_err(dai->dev, "cpu clock master: mclk missing\n");
+			return -ENODEV;
+		}
+		break;
+
+	case SND_SOC_DAIFMT_CBM_CFM:
+		break;
+
+	case SND_SOC_DAIFMT_CBS_CFM:
+	case SND_SOC_DAIFMT_CBM_CFS:
 		dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
+		/* Fall-through */
+	default:
 		return -EINVAL;
 	}
 
-	/* If the TDM interface is the clock master, it requires mclk */
-	if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) {
-		dev_err(dai->dev, "cpu clock master: mclk missing\n");
-		return -ENODEV;
-	}
-
 	iface->fmt = fmt;
 	return 0;
 }
@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream,
 	if (ret)
 		return ret;
 
-	if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) {
+	if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) ==
+	    SND_SOC_DAIFMT_CBS_CFS) {
 		ret = axg_tdm_iface_set_sclk(dai, params);
 		if (ret)
 			return ret;
-- 
2.25.4


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

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

* [PATCH 2/4] ASoC: meson: axg-tdmin: fix g12a skew
  2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
  2020-07-29 15:44 ` [PATCH 1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup Jerome Brunet
@ 2020-07-29 15:44 ` Jerome Brunet
  2020-07-29 15:44 ` [PATCH 3/4] ASoC: meson: axg-tdm-formatters: fix sclk inversion Jerome Brunet
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jerome Brunet @ 2020-07-29 15:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: linux-amlogic, alsa-devel, Kevin Hilman, linux-kernel, Jerome Brunet

After carefully checking the result provided by the TDMIN on the g12a and
sm1 SoC families, the TDMIN skew offset appears to be 3 instead of 2 on the
axg.

Fixes: f01bc67f58fd ("ASoC: meson: axg-tdm-formatter: rework quirks settings")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/meson/axg-tdmin.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c
index 973d4c02ef8d..3d002b4eb939 100644
--- a/sound/soc/meson/axg-tdmin.c
+++ b/sound/soc/meson/axg-tdmin.c
@@ -233,10 +233,26 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = {
 	},
 };
 
+static const struct axg_tdm_formatter_driver g12a_tdmin_drv = {
+	.component_drv	= &axg_tdmin_component_drv,
+	.regmap_cfg	= &axg_tdmin_regmap_cfg,
+	.ops		= &axg_tdmin_ops,
+	.quirks		= &(const struct axg_tdm_formatter_hw) {
+		.invert_sclk	= false,
+		.skew_offset	= 3,
+	},
+};
+
 static const struct of_device_id axg_tdmin_of_match[] = {
 	{
 		.compatible = "amlogic,axg-tdmin",
 		.data = &axg_tdmin_drv,
+	}, {
+		.compatible = "amlogic,g12a-tdmin",
+		.data = &g12a_tdmin_drv,
+	}, {
+		.compatible = "amlogic,sm1-tdmin",
+		.data = &g12a_tdmin_drv,
 	}, {}
 };
 MODULE_DEVICE_TABLE(of, axg_tdmin_of_match);
-- 
2.25.4


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

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

* [PATCH 3/4] ASoC: meson: axg-tdm-formatters: fix sclk inversion
  2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
  2020-07-29 15:44 ` [PATCH 1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup Jerome Brunet
  2020-07-29 15:44 ` [PATCH 2/4] ASoC: meson: axg-tdmin: fix g12a skew Jerome Brunet
@ 2020-07-29 15:44 ` Jerome Brunet
  2020-07-29 15:44 ` [PATCH 4/4] ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties Jerome Brunet
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jerome Brunet @ 2020-07-29 15:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: linux-amlogic, alsa-devel, Kevin Hilman, linux-kernel, Jerome Brunet

After carefully checking, it appears that both tdmout and tdmin require the
rising edge of the sclk they get to be synchronized with the frame sync
event (which should be a rising edge of lrclk).

TDMIN was improperly set before this patch. Remove the sclk_invert quirk
which is no longer needed and fix the sclk phase.

Fixes: 1a11d88f499c ("ASoC: meson: add tdm formatter base driver")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/meson/axg-tdm-formatter.c | 11 ++++++-----
 sound/soc/meson/axg-tdm-formatter.h |  1 -
 sound/soc/meson/axg-tdmin.c         |  2 --
 sound/soc/meson/axg-tdmout.c        |  3 ---
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c
index 358c8c0d861c..f7e8e9da68a0 100644
--- a/sound/soc/meson/axg-tdm-formatter.c
+++ b/sound/soc/meson/axg-tdm-formatter.c
@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks);
 static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter)
 {
 	struct axg_tdm_stream *ts = formatter->stream;
-	bool invert = formatter->drv->quirks->invert_sclk;
+	bool invert;
 	int ret;
 
 	/* Do nothing if the formatter is already enabled */
@@ -96,11 +96,12 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter)
 		return ret;
 
 	/*
-	 * If sclk is inverted, invert it back and provide the inversion
-	 * required by the formatter
+	 * If sclk is inverted, it means the bit should latched on the
+	 * rising edge which is what our HW expects. If not, we need to
+	 * invert it before the formatter.
 	 */
-	invert ^= axg_tdm_sclk_invert(ts->iface->fmt);
-	ret = clk_set_phase(formatter->sclk, invert ? 180 : 0);
+	invert = axg_tdm_sclk_invert(ts->iface->fmt);
+	ret = clk_set_phase(formatter->sclk, invert ? 0 : 180);
 	if (ret)
 		return ret;
 
diff --git a/sound/soc/meson/axg-tdm-formatter.h b/sound/soc/meson/axg-tdm-formatter.h
index 9ef98e955cb2..a1f0dcc0ff13 100644
--- a/sound/soc/meson/axg-tdm-formatter.h
+++ b/sound/soc/meson/axg-tdm-formatter.h
@@ -16,7 +16,6 @@ struct snd_kcontrol;
 
 struct axg_tdm_formatter_hw {
 	unsigned int skew_offset;
-	bool invert_sclk;
 };
 
 struct axg_tdm_formatter_ops {
diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c
index 3d002b4eb939..88ed95ae886b 100644
--- a/sound/soc/meson/axg-tdmin.c
+++ b/sound/soc/meson/axg-tdmin.c
@@ -228,7 +228,6 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = {
 	.regmap_cfg	= &axg_tdmin_regmap_cfg,
 	.ops		= &axg_tdmin_ops,
 	.quirks		= &(const struct axg_tdm_formatter_hw) {
-		.invert_sclk	= false,
 		.skew_offset	= 2,
 	},
 };
@@ -238,7 +237,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmin_drv = {
 	.regmap_cfg	= &axg_tdmin_regmap_cfg,
 	.ops		= &axg_tdmin_ops,
 	.quirks		= &(const struct axg_tdm_formatter_hw) {
-		.invert_sclk	= false,
 		.skew_offset	= 3,
 	},
 };
diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c
index 418ec314b37d..3ceabddae629 100644
--- a/sound/soc/meson/axg-tdmout.c
+++ b/sound/soc/meson/axg-tdmout.c
@@ -238,7 +238,6 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = {
 	.regmap_cfg	= &axg_tdmout_regmap_cfg,
 	.ops		= &axg_tdmout_ops,
 	.quirks		= &(const struct axg_tdm_formatter_hw) {
-		.invert_sclk = true,
 		.skew_offset = 1,
 	},
 };
@@ -248,7 +247,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmout_drv = {
 	.regmap_cfg	= &axg_tdmout_regmap_cfg,
 	.ops		= &axg_tdmout_ops,
 	.quirks		= &(const struct axg_tdm_formatter_hw) {
-		.invert_sclk = true,
 		.skew_offset = 2,
 	},
 };
@@ -309,7 +307,6 @@ static const struct axg_tdm_formatter_driver sm1_tdmout_drv = {
 	.regmap_cfg	= &axg_tdmout_regmap_cfg,
 	.ops		= &axg_tdmout_ops,
 	.quirks		= &(const struct axg_tdm_formatter_hw) {
-		.invert_sclk = true,
 		.skew_offset = 2,
 	},
 };
-- 
2.25.4


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

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

* [PATCH 4/4] ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties
  2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
                   ` (2 preceding siblings ...)
  2020-07-29 15:44 ` [PATCH 3/4] ASoC: meson: axg-tdm-formatters: fix sclk inversion Jerome Brunet
@ 2020-07-29 15:44 ` Jerome Brunet
  2020-07-30 22:28 ` [PATCH 0/4] ASoC: meson: tdm fixes Mark Brown
  2020-08-17 17:48 ` patchwork-bot+linux-amlogic
  5 siblings, 0 replies; 7+ messages in thread
From: Jerome Brunet @ 2020-07-29 15:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: linux-amlogic, alsa-devel, Kevin Hilman, linux-kernel, Jerome Brunet

Standard dai format property don't need the "amlogic," prefix.
There nothing amlogic specific about them. Just remove it.

Fixes: 435857e015dc ("ASoC: meson: align axg card driver with DT bindings documentation")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/meson/meson-card-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c
index 29b601a0e274..f9ce03f3921f 100644
--- a/sound/soc/meson/meson-card-utils.c
+++ b/sound/soc/meson/meson-card-utils.c
@@ -119,7 +119,7 @@ unsigned int meson_card_parse_daifmt(struct device_node *node,
 	struct device_node *framemaster = NULL;
 	unsigned int daifmt;
 
-	daifmt = snd_soc_of_parse_daifmt(node, DT_PREFIX,
+	daifmt = snd_soc_of_parse_daifmt(node, "",
 					 &bitclkmaster, &framemaster);
 	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
 
-- 
2.25.4


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

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

* Re: [PATCH 0/4] ASoC: meson: tdm fixes
  2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
                   ` (3 preceding siblings ...)
  2020-07-29 15:44 ` [PATCH 4/4] ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties Jerome Brunet
@ 2020-07-30 22:28 ` Mark Brown
  2020-08-17 17:48 ` patchwork-bot+linux-amlogic
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-07-30 22:28 UTC (permalink / raw)
  To: Liam Girdwood, Jerome Brunet
  Cc: Kevin Hilman, alsa-devel, linux-kernel, linux-amlogic

On Wed, 29 Jul 2020 17:44:52 +0200, Jerome Brunet wrote:
> This patcheset is collection of fixes for the TDM input and output the
> axg audio architecture. Its fixes:
>  - slave mode format setting
>  - g12 and sm1 skew offset
>  - tdm clock inversion
>  - standard daifmt props names which don't require a specific prefix
> 
> [...]

Applied to

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

Thanks!

[1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup
      commit: 6878ba91ce84f7a07887a0615af70f969508839f
[2/4] ASoC: meson: axg-tdmin: fix g12a skew
      commit: 80a254394fcfe55450b0351da298ca7231889219
[3/4] ASoC: meson: axg-tdm-formatters: fix sclk inversion
      commit: 0d3f01dcdc234001f979a0af0b6b31cb9f25b6c1
[4/4] ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties
      commit: e44815a295a50027a9953f3ef62827d14631b96b

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

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

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

* Re: [PATCH 0/4] ASoC: meson: tdm fixes
  2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
                   ` (4 preceding siblings ...)
  2020-07-30 22:28 ` [PATCH 0/4] ASoC: meson: tdm fixes Mark Brown
@ 2020-08-17 17:48 ` patchwork-bot+linux-amlogic
  5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+linux-amlogic @ 2020-08-17 17:48 UTC (permalink / raw)
  To: Jerome Brunet; +Cc: linux-amlogic, khilman

Hello:

This series was applied to khilman/linux-amlogic.git (refs/heads/for-next).

On Wed, 29 Jul 2020 17:44:52 +0200 you wrote:
> This patcheset is collection of fixes for the TDM input and output the
> axg audio architecture. Its fixes:
>  - slave mode format setting
>  - g12 and sm1 skew offset
>  - tdm clock inversion
>  - standard daifmt props names which don't require a specific prefix
> 
> [...]


Here is a summary with links:
  - [1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup
    https://git.kernel.org/khilman/linux-amlogic/c/6878ba91ce84f7a07887a0615af70f969508839f
  - [2/4] ASoC: meson: axg-tdmin: fix g12a skew
    https://git.kernel.org/khilman/linux-amlogic/c/80a254394fcfe55450b0351da298ca7231889219
  - [3/4] ASoC: meson: axg-tdm-formatters: fix sclk inversion
    https://git.kernel.org/khilman/linux-amlogic/c/0d3f01dcdc234001f979a0af0b6b31cb9f25b6c1
  - [4/4] ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties
    https://git.kernel.org/khilman/linux-amlogic/c/e44815a295a50027a9953f3ef62827d14631b96b

You are awesome, thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot

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

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 15:44 [PATCH 0/4] ASoC: meson: tdm fixes Jerome Brunet
2020-07-29 15:44 ` [PATCH 1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup Jerome Brunet
2020-07-29 15:44 ` [PATCH 2/4] ASoC: meson: axg-tdmin: fix g12a skew Jerome Brunet
2020-07-29 15:44 ` [PATCH 3/4] ASoC: meson: axg-tdm-formatters: fix sclk inversion Jerome Brunet
2020-07-29 15:44 ` [PATCH 4/4] ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties Jerome Brunet
2020-07-30 22:28 ` [PATCH 0/4] ASoC: meson: tdm fixes Mark Brown
2020-08-17 17:48 ` patchwork-bot+linux-amlogic

Linux-Amlogic Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \
		linux-amlogic@lists.infradead.org
	public-inbox-index linux-amlogic

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git