Skip to contentSkip to conversation

ASoC: soc-core: update dai_link init

PATCH In review Jerome Brunet 2 participants 5 messages Jun 27, 2019 – Jun 28, 2019

Subsystems (3)
lore
Share & tools
lore

Jerome Brunet

author reviewer
#0 lore raw

v2 cover ASoC: soc-core: update dai_link init

My initial goal with this patchset was to allow a dai_link to have no no platform component, instead of having dummy by default.

However, when rebasing, I discovered that Kuninori Morimoto had recently done that in a different way :)

I am still submitting my change since it should allow multiple platform components on a dai_link, which is one of the FIXME note in soc-core.

I have also added a check on the codecs component availability to align on what was done for platforms and cpus

Change since v1 [0]:
* Fix registartion typo
* Rename dlc variable to codec/platform

[0]: https://lkml.kernel.org/r/[email protected]

Jerome Brunet (2):
ASoC: soc-core: defer card registration if codec component is missing
ASoC: soc-core: support dai_link with platforms_num != 1

 include/sound/soc.h  |  6 ++++
 sound/soc/soc-core.c | 67 +++++++++++++++++++++-----------------------
 2 files changed, 38 insertions(+), 35 deletions(-)
Signature · 1 line
2.21.0
author reviewer
#1 lore raw

PATCH v2 1/2 ASoC: soc-core: defer card registration if codec component is missing

Like cpus and platforms, defer sound card initialization if the codec component is missing when initializing the dai_link

---
 sound/soc/soc-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/soc-core.c +8 -0
index 358f1fbf9a30..0ec1d7a59b24 100644
@@ -1064,12 +1064,20 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 				link->name);
 			return -EINVAL;
 		}
+
 		/* Codec DAI name must be specified */
 		if (!codec->dai_name) {
 			dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n",
 				link->name);
 			return -EINVAL;
 		}
+
+		/*
+		 * Defer card registration if codec component is not added to
+		 * component list.
+		 */
+		if (!soc_find_component(codec))
+			return -EPROBE_DEFER;
 	}
 
 	/*
Signature · 1 line
2.21.0
maintainer
#2 lore raw

Applied "ASoC: soc-core: defer card registration if codec component is missing" to the asoc tree

The patch

ASoC: soc-core: defer card registration if codec component is missing

has been applied to the asoc tree at

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

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

Quoted 1 line

From af18b13fedae4637b439d1265038b30929ca5a4c Mon Sep 17 00:00:00 2001

From: Jerome Brunet <[email protected]>
Date: Thu, 27 Jun 2019 14:13:49 +0200
Subject: [PATCH] ASoC: soc-core: defer card registration if codec component is
missing

Like cpus and platforms, defer sound card initialization if the codec component is missing when initializing the dai_link

---
 sound/soc/soc-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/soc-core.c +8 -0
index 05cd710273b6..b5f3c09311c3 100644
@@ -1071,12 +1071,20 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 				link->name);
 			return -EINVAL;
 		}
+
 		/* Codec DAI name must be specified */
 		if (!codec->dai_name) {
 			dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n",
 				link->name);
 			return -EINVAL;
 		}
+
+		/*
+		 * Defer card registration if codec component is not added to
+		 * component list.
+		 */
+		if (!soc_find_component(codec))
+			return -EPROBE_DEFER;
 	}
 
 	/*
Signature · 1 line
2.20.1
author reviewer
#3 lore raw

PATCH v2 2/2 ASoC: soc-core: support dai_link with platforms_num != 1

In reply to Jerome Brunet

Add support platforms_num != 1 in dai_link. Initially, the main purpose of this change was to make the platform optional in the dai_link, instead of inserting the dummy platform driver.

This particular case had just been solved by Kuninori Morimoto with commit 1d7689892878 ("ASoC: soc-core: allow no Platform on dai_link").

However, this change may still be useful for those who need multiple platform components on a single dai_link (it solves one of the FIXME note in soc-core)

---
 include/sound/soc.h  |  6 +++++
 sound/soc/soc-core.c | 59 ++++++++++++++++++--------------------------
 2 files changed, 30 insertions(+), 35 deletions(-)
include/sound/soc.h +6 -0
index 64405cdab8bb..4e8071269639 100644
@@ -997,6 +997,12 @@ struct snd_soc_dai_link {
 	     ((i) < link->num_codecs) && ((codec) = &link->codecs[i]);	\
 	     (i)++)
 
+#define for_each_link_platforms(link, i, platform)			\
+	for ((i) = 0;							\
+	     ((i) < link->num_platforms) &&				\
+	     ((platform) = &link->platforms[i]);			\
+	     (i)++)
+
 /*
  * Sample 1 : Single CPU/Codec/Platform
  *
sound/soc/soc-core.c +24 -35

107 lines not on this page · raw message

Signature · 1 line
2.21.0
maintainer
#4 lore raw

Applied "ASoC: soc-core: support dai_link with platforms_num != 1" to the asoc tree

The patch

ASoC: soc-core: support dai_link with platforms_num != 1

has been applied to the asoc tree at

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

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

Quoted 1 line

From 34614739988ad60c3493da66dd856002ee93edf9 Mon Sep 17 00:00:00 2001

From: Jerome Brunet <[email protected]>
Date: Thu, 27 Jun 2019 14:13:50 +0200
Subject: [PATCH] ASoC: soc-core: support dai_link with platforms_num != 1

Add support platforms_num != 1 in dai_link. Initially, the main purpose of this change was to make the platform optional in the dai_link, instead of inserting the dummy platform driver.

This particular case had just been solved by Kuninori Morimoto with commit 1d7689892878 ("ASoC: soc-core: allow no Platform on dai_link").

However, this change may still be useful for those who need multiple platform components on a single dai_link (it solves one of the FIXME note in soc-core)

---
 include/sound/soc.h  |  6 +++++
 sound/soc/soc-core.c | 59 ++++++++++++++++++--------------------------
 2 files changed, 30 insertions(+), 35 deletions(-)
include/sound/soc.h +6 -0
index 64405cdab8bb..4e8071269639 100644
@@ -997,6 +997,12 @@ struct snd_soc_dai_link {
 	     ((i) < link->num_codecs) && ((codec) = &link->codecs[i]);	\
 	     (i)++)
 
+#define for_each_link_platforms(link, i, platform)			\
+	for ((i) = 0;							\
+	     ((i) < link->num_platforms) &&				\
+	     ((platform) = &link->platforms[i]);			\
+	     (i)++)
+
 /*
  * Sample 1 : Single CPU/Codec/Platform
  *
sound/soc/soc-core.c +24 -35

107 lines not on this page · raw message

Signature · 1 line
2.20.1