All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/19] ASoC: add soc-card
@ 2020-05-26  1:15 Kuninori Morimoto
  2020-05-26  1:16 ` [PATCH 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
                   ` (18 more replies)
  0 siblings, 19 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Hi Mark

Current ALSA SoC is handling snd_soc_card related operation,
but it is implmemented directly without using function/macro,
and at random place.

This patch-set creates new snd_soc_card_xxx() functions
which handles snd_soc_card related operation,
and implmement these at new soc-card.c.

Kuninori Morimoto (19):
  ASoC: soc.h: convert bool to bit field for snd_soc_card
  ASoC: add soc-card.c
  ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
  ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
  ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
  ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
  ASoC: soc-card: move snd_soc_card_subclass to soc-card
  ASoC: soc-card: add snd_soc_card_suspend_pre()
  ASoC: soc-card: add snd_soc_card_suspend_post()
  ASoC: soc-card: add snd_soc_card_resume_pre()
  ASoC: soc-card: add snd_soc_card_resume_post()
  ASoC: soc-card: add probed bit field to snd_soc_card
  ASoC: soc-card: add snd_soc_card_probe()
  ASoC: soc-card: add snd_soc_card_late_probe()
  ASoC: soc-card: add snd_soc_card_remove()
  ASoC: soc-card: add snd_soc_card_set_bias_level()
  ASoC: soc-card: add snd_soc_card_set_bias_level_post()
  ASoC: soc-card: add snd_soc_card_add_dai_link()
  ASoC: soc-card: add snd_soc_card_remove_dai_link()

 include/sound/soc-card.h |  69 +++++++++++++
 include/sound/soc.h      |  53 ++--------
 sound/soc/Makefile       |   2 +-
 sound/soc/soc-card.c     | 218 +++++++++++++++++++++++++++++++++++++++
 sound/soc/soc-core.c     |  71 ++++---------
 sound/soc/soc-dapm.c     |   8 +-
 sound/soc/soc-jack.c     |  38 -------
 7 files changed, 320 insertions(+), 139 deletions(-)
 create mode 100644 include/sound/soc-card.h
 create mode 100644 sound/soc/soc-card.c

-- 
2.17.1


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

* [PATCH 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
@ 2020-05-26  1:16 ` Kuninori Morimoto
  2020-05-26  1:16 ` [PATCH 02/19] ASoC: add soc-card.c Kuninori Morimoto
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

snd_soc_card has many bool, but it can be bit field.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index a7fa64260108..11ee3ed87aa1 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -820,7 +820,7 @@ struct snd_soc_dai_link {
 	const struct snd_soc_compr_ops *compr_ops;
 
 	/* Mark this pcm with non atomic ops */
-	bool nonatomic;
+	unsigned int nonatomic:1;
 
 	/* For unidirectional dai links */
 	unsigned int playback_only:1;
@@ -1016,9 +1016,6 @@ struct snd_soc_card {
 
 	spinlock_t dpcm_lock;
 
-	bool instantiated;
-	bool topology_shortname_created;
-
 	int (*probe)(struct snd_soc_card *card);
 	int (*late_probe)(struct snd_soc_card *card);
 	int (*remove)(struct snd_soc_card *card);
@@ -1079,8 +1076,6 @@ struct snd_soc_card {
 	int num_of_dapm_widgets;
 	const struct snd_soc_dapm_route *of_dapm_routes;
 	int num_of_dapm_routes;
-	bool fully_routed;
-	bool disable_route_checks;
 
 	/* lists of probed devices belonging to this card */
 	struct list_head component_dev_list;
@@ -1107,6 +1102,12 @@ struct snd_soc_card {
 #endif
 	u32 pop_time;
 
+	/* bit field */
+	unsigned int instantiated:1;
+	unsigned int topology_shortname_created:1;
+	unsigned int fully_routed:1;
+	unsigned int disable_route_checks:1;
+
 	void *drvdata;
 };
 #define for_each_card_prelinks(card, i, link)				\
-- 
2.17.1


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

* [PATCH 02/19] ASoC: add soc-card.c
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
  2020-05-26  1:16 ` [PATCH 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
@ 2020-05-26  1:16 ` Kuninori Morimoto
  2020-05-27  0:26   ` Ranjani Sridharan
  2020-05-26  1:16 ` [PATCH 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card Kuninori Morimoto
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current ALSA SoC has some snd_soc_card_xxx() functions,
and card->xxx() callbacks.
But, it is implemented randomly at random place.

To collect all card related functions into one place,
this patch creats new soc-card.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h | 11 +++++++++++
 include/sound/soc.h      |  1 +
 sound/soc/Makefile       |  2 +-
 sound/soc/soc-card.c     | 26 ++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 include/sound/soc-card.h
 create mode 100644 sound/soc/soc-card.c

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
new file mode 100644
index 000000000000..997809bb3afb
--- /dev/null
+++ b/include/sound/soc-card.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * soc-card.h
+ *
+ * Copyright (C) 2019 Renesas Electronics Corp.
+ * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ */
+#ifndef __SOC_CARD_H
+#define __SOC_CARD_H
+
+#endif /* __SOC_CARD_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 11ee3ed87aa1..5b880e29d106 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1450,5 +1450,6 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
 }
 
 #include <sound/soc-component.h>
+#include <sound/soc-card.h>
 
 #endif
diff --git a/sound/soc/Makefile b/sound/soc/Makefile
index 70a5f19ea3a1..7f1747518e79 100644
--- a/sound/soc/Makefile
+++ b/sound/soc/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-utils.o soc-dai.o soc-component.o
-snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o soc-link.o
+snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o soc-link.o soc-card.o
 snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
 
 ifneq ($(CONFIG_SND_SOC_TOPOLOGY),)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
new file mode 100644
index 000000000000..4bc6f26ea8cb
--- /dev/null
+++ b/sound/soc/soc-card.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// soc-card.c
+//
+// Copyright (C) 2019 Renesas Electronics Corp.
+// Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+//
+#include <sound/soc.h>
+
+#define soc_card_ret(dai, ret) _soc_card_ret(dai, __func__, ret)
+static inline int _soc_card_ret(struct snd_soc_card *card,
+				const char *func, int ret)
+{
+	switch (ret) {
+	case -EPROBE_DEFER:
+	case -ENOTSUPP:
+	case 0:
+		break;
+	default:
+		dev_err(card->dev,
+			"ASoC: error at %s on %s: %d\n",
+			func, card->name, ret);
+	}
+
+	return ret;
+}
-- 
2.17.1


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

* [PATCH 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
  2020-05-26  1:16 ` [PATCH 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
  2020-05-26  1:16 ` [PATCH 02/19] ASoC: add soc-card.c Kuninori Morimoto
@ 2020-05-26  1:16 ` Kuninori Morimoto
  2020-05-26  1:16 ` [PATCH 04/19] ASoC: soc-card: move snd_soc_card_jack_new() " Kuninori Morimoto
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  3 +++
 include/sound/soc.h      |  2 --
 sound/soc/soc-card.c     | 16 ++++++++++++++++
 sound/soc/soc-core.c     | 16 ----------------
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 997809bb3afb..c601eddf0975 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -8,4 +8,7 @@
 #ifndef __SOC_CARD_H
 #define __SOC_CARD_H
 
+struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
+					       const char *name);
+
 #endif /* __SOC_CARD_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5b880e29d106..f93827c6be51 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -582,8 +582,6 @@ static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
 				  void *data, const char *long_name,
 				  const char *prefix);
-struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
-					       const char *name);
 int snd_soc_add_component_controls(struct snd_soc_component *component,
 	const struct snd_kcontrol_new *controls, unsigned int num_controls);
 int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 4bc6f26ea8cb..340ab682cc76 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -24,3 +24,19 @@ static inline int _soc_card_ret(struct snd_soc_card *card,
 
 	return ret;
 }
+
+struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
+					       const char *name)
+{
+	struct snd_card *card = soc_card->snd_card;
+	struct snd_kcontrol *kctl;
+
+	if (unlikely(!name))
+		return NULL;
+
+	list_for_each_entry(kctl, &card->controls, list)
+		if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name)))
+			return kctl;
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e1b65059c0c4..b6105b92f589 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2096,22 +2096,6 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
 	return 0;
 }
 
-struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
-					       const char *name)
-{
-	struct snd_card *card = soc_card->snd_card;
-	struct snd_kcontrol *kctl;
-
-	if (unlikely(!name))
-		return NULL;
-
-	list_for_each_entry(kctl, &card->controls, list)
-		if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name)))
-			return kctl;
-	return NULL;
-}
-EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
-
 /**
  * snd_soc_add_component_controls - Add an array of controls to a component.
  *
-- 
2.17.1


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

* [PATCH 04/19] ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2020-05-26  1:16 ` [PATCH 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card Kuninori Morimoto
@ 2020-05-26  1:16 ` Kuninori Morimoto
  2020-05-26  1:17 ` [PATCH 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() " Kuninori Morimoto
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  3 +++
 include/sound/soc.h      |  4 ----
 sound/soc/soc-card.c     | 39 +++++++++++++++++++++++++++++++++++++++
 sound/soc/soc-jack.c     | 38 --------------------------------------
 4 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index c601eddf0975..58ddf52c1cfc 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -10,5 +10,8 @@
 
 struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
 					       const char *name);
+int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
+			  struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
+			  unsigned int num_pins);
 
 #endif /* __SOC_CARD_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f93827c6be51..38b21e815a28 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -509,10 +509,6 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
 	const struct snd_pcm_hardware *hw);
 
 /* Jack reporting */
-int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
-	struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
-	unsigned int num_pins);
-
 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
 			  struct snd_soc_jack_pin *pins);
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 340ab682cc76..4c0fe015ebd4 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -6,6 +6,7 @@
 // Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
 //
 #include <sound/soc.h>
+#include <sound/jack.h>
 
 #define soc_card_ret(dai, ret) _soc_card_ret(dai, __func__, ret)
 static inline int _soc_card_ret(struct snd_soc_card *card,
@@ -40,3 +41,41 @@ struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
+
+/**
+ * snd_soc_card_jack_new - Create a new jack
+ * @card:  ASoC card
+ * @id:    an identifying string for this jack
+ * @type:  a bitmask of enum snd_jack_type values that can be detected by
+ *         this jack
+ * @jack:  structure to use for the jack
+ * @pins:  Array of jack pins to be added to the jack or NULL
+ * @num_pins: Number of elements in the @pins array
+ *
+ * Creates a new jack object.
+ *
+ * Returns zero if successful, or a negative error code on failure.
+ * On success jack will be initialised.
+ */
+int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
+			  struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
+			  unsigned int num_pins)
+{
+	int ret;
+
+	mutex_init(&jack->mutex);
+	jack->card = card;
+	INIT_LIST_HEAD(&jack->pins);
+	INIT_LIST_HEAD(&jack->jack_zones);
+	BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier);
+
+	ret = snd_jack_new(card->snd_card, id, type, &jack->jack, false, false);
+	if (ret)
+		goto end;
+
+	if (num_pins)
+		ret = snd_soc_jack_add_pins(jack, num_pins, pins);
+end:
+	return soc_card_ret(card, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_card_jack_new);
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index b5748dcd490f..0f1820f36b4d 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -23,44 +23,6 @@ struct jack_gpio_tbl {
 	struct snd_soc_jack_gpio *gpios;
 };
 
-/**
- * snd_soc_card_jack_new - Create a new jack
- * @card:  ASoC card
- * @id:    an identifying string for this jack
- * @type:  a bitmask of enum snd_jack_type values that can be detected by
- *         this jack
- * @jack:  structure to use for the jack
- * @pins:  Array of jack pins to be added to the jack or NULL
- * @num_pins: Number of elements in the @pins array
- *
- * Creates a new jack object.
- *
- * Returns zero if successful, or a negative error code on failure.
- * On success jack will be initialised.
- */
-int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
-	struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
-	unsigned int num_pins)
-{
-	int ret;
-
-	mutex_init(&jack->mutex);
-	jack->card = card;
-	INIT_LIST_HEAD(&jack->pins);
-	INIT_LIST_HEAD(&jack->jack_zones);
-	BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier);
-
-	ret = snd_jack_new(card->snd_card, id, type, &jack->jack, false, false);
-	if (ret)
-		return ret;
-
-	if (num_pins)
-		return snd_soc_jack_add_pins(jack, num_pins, pins);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(snd_soc_card_jack_new);
-
 /**
  * snd_soc_jack_report - Report the current status for a jack
  *
-- 
2.17.1


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

* [PATCH 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2020-05-26  1:16 ` [PATCH 04/19] ASoC: soc-card: move snd_soc_card_jack_new() " Kuninori Morimoto
@ 2020-05-26  1:17 ` Kuninori Morimoto
  2020-05-26  1:17 ` [PATCH 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() " Kuninori Morimoto
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h | 12 ++++++++++++
 include/sound/soc.h      | 13 -------------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 58ddf52c1cfc..77d362ca800f 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -14,4 +14,16 @@ int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
 			  struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
 			  unsigned int num_pins);
 
+/* device driver data */
+static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
+					    void *data)
+{
+	card->drvdata = data;
+}
+
+static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
+{
+	return card->drvdata;
+}
+
 #endif /* __SOC_CARD_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 38b21e815a28..3072298e756a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1260,19 +1260,6 @@ struct soc_enum {
 #endif
 };
 
-/* device driver data */
-
-static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
-		void *data)
-{
-	card->drvdata = data;
-}
-
-static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
-{
-	return card->drvdata;
-}
-
 static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
 {
 	if (mc->reg == mc->rreg && mc->shift == mc->rshift)
-- 
2.17.1


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

* [PATCH 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2020-05-26  1:17 ` [PATCH 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() " Kuninori Morimoto
@ 2020-05-26  1:17 ` Kuninori Morimoto
  2020-05-26  1:17 ` [PATCH 07/19] ASoC: soc-card: move snd_soc_card_subclass " Kuninori Morimoto
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h | 14 ++++++++++++++
 include/sound/soc.h      | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 77d362ca800f..deab6c2730bd 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -26,4 +26,18 @@ static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
 	return card->drvdata;
 }
 
+static inline
+struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
+					       const char *dai_name)
+{
+	struct snd_soc_pcm_runtime *rtd;
+
+	for_each_card_rtds(card, rtd) {
+		if (!strcmp(asoc_rtd_to_codec(rtd, 0)->name, dai_name))
+			return asoc_rtd_to_codec(rtd, 0);
+	}
+
+	return NULL;
+}
+
 #endif /* __SOC_CARD_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 3072298e756a..5c126ab0e32d 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1372,20 +1372,6 @@ struct snd_soc_dai *snd_soc_find_dai(
 
 #include <sound/soc-dai.h>
 
-static inline
-struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
-					       const char *dai_name)
-{
-	struct snd_soc_pcm_runtime *rtd;
-
-	list_for_each_entry(rtd, &card->rtd_list, list) {
-		if (!strcmp(asoc_rtd_to_codec(rtd, 0)->name, dai_name))
-			return asoc_rtd_to_codec(rtd, 0);
-	}
-
-	return NULL;
-}
-
 static inline
 int snd_soc_fixup_dai_links_platform_name(struct snd_soc_card *card,
 					  const char *platform_name)
-- 
2.17.1


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

* [PATCH 07/19] ASoC: soc-card: move snd_soc_card_subclass to soc-card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2020-05-26  1:17 ` [PATCH 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() " Kuninori Morimoto
@ 2020-05-26  1:17 ` Kuninori Morimoto
  2020-05-26  1:17 ` [PATCH 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre() Kuninori Morimoto
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h | 5 +++++
 include/sound/soc.h      | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index deab6c2730bd..11ff957ea359 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -8,6 +8,11 @@
 #ifndef __SOC_CARD_H
 #define __SOC_CARD_H
 
+enum snd_soc_card_subclass {
+	SND_SOC_CARD_CLASS_INIT		= 0,
+	SND_SOC_CARD_CLASS_RUNTIME	= 1,
+};
+
 struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
 					       const char *name);
 int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5c126ab0e32d..060c01c32547 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -414,11 +414,6 @@ enum snd_soc_pcm_subclass {
 	SND_SOC_PCM_CLASS_BE	= 1,
 };
 
-enum snd_soc_card_subclass {
-	SND_SOC_CARD_CLASS_INIT		= 0,
-	SND_SOC_CARD_CLASS_RUNTIME	= 1,
-};
-
 int snd_soc_register_card(struct snd_soc_card *card);
 int snd_soc_unregister_card(struct snd_soc_card *card);
 int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card);
-- 
2.17.1


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

* [PATCH 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2020-05-26  1:17 ` [PATCH 07/19] ASoC: soc-card: move snd_soc_card_subclass " Kuninori Morimoto
@ 2020-05-26  1:17 ` Kuninori Morimoto
  2020-05-26  1:17 ` [PATCH 09/19] ASoC: soc-card: add snd_soc_card_suspend_post() Kuninori Morimoto
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  2 ++
 sound/soc/soc-card.c     | 10 ++++++++++
 sound/soc/soc-core.c     |  3 +--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 11ff957ea359..db95d6896b4a 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -19,6 +19,8 @@ int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
 			  struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
 			  unsigned int num_pins);
 
+int snd_soc_card_suspend_pre(struct snd_soc_card *card);
+
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
 					    void *data)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 4c0fe015ebd4..643704febe5f 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -79,3 +79,13 @@ int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
 	return soc_card_ret(card, ret);
 }
 EXPORT_SYMBOL_GPL(snd_soc_card_jack_new);
+
+int snd_soc_card_suspend_pre(struct snd_soc_card *card)
+{
+	int ret = 0;
+
+	if (card->suspend_pre)
+		ret = card->suspend_pre(card);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b6105b92f589..52d09fa495c3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -561,8 +561,7 @@ int snd_soc_suspend(struct device *dev)
 		snd_pcm_suspend_all(rtd->pcm);
 	}
 
-	if (card->suspend_pre)
-		card->suspend_pre(card);
+	snd_soc_card_suspend_pre(card);
 
 	/* close any waiting streams */
 	snd_soc_flush_all_delayed_work(card);
-- 
2.17.1


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

* [PATCH 09/19] ASoC: soc-card: add snd_soc_card_suspend_post()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2020-05-26  1:17 ` [PATCH 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre() Kuninori Morimoto
@ 2020-05-26  1:17 ` Kuninori Morimoto
  2020-05-26  1:17 ` [PATCH 10/19] ASoC: soc-card: add snd_soc_card_resume_pre() Kuninori Morimoto
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  1 +
 sound/soc/soc-card.c     | 10 ++++++++++
 sound/soc/soc-core.c     |  3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index db95d6896b4a..4a6787a7021f 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -20,6 +20,7 @@ int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
 			  unsigned int num_pins);
 
 int snd_soc_card_suspend_pre(struct snd_soc_card *card);
+int snd_soc_card_suspend_post(struct snd_soc_card *card);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 643704febe5f..1853c7aa0dfd 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -89,3 +89,13 @@ int snd_soc_card_suspend_pre(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_suspend_post(struct snd_soc_card *card)
+{
+	int ret = 0;
+
+	if (card->suspend_post)
+		ret = card->suspend_post(card);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 52d09fa495c3..c0327995efc1 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -631,8 +631,7 @@ int snd_soc_suspend(struct device *dev)
 		}
 	}
 
-	if (card->suspend_post)
-		card->suspend_post(card);
+	snd_soc_card_suspend_post(card);
 
 	return 0;
 }
-- 
2.17.1


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

* [PATCH 10/19] ASoC: soc-card: add snd_soc_card_resume_pre()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2020-05-26  1:17 ` [PATCH 09/19] ASoC: soc-card: add snd_soc_card_suspend_post() Kuninori Morimoto
@ 2020-05-26  1:17 ` Kuninori Morimoto
  2020-05-26  1:18 ` [PATCH 11/19] ASoC: soc-card: add snd_soc_card_resume_post() Kuninori Morimoto
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  1 +
 sound/soc/soc-card.c     | 10 ++++++++++
 sound/soc/soc-core.c     |  3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 4a6787a7021f..0d4837f3f182 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -21,6 +21,7 @@ int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
 
 int snd_soc_card_suspend_pre(struct snd_soc_card *card);
 int snd_soc_card_suspend_post(struct snd_soc_card *card);
+int snd_soc_card_resume_pre(struct snd_soc_card *card);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 1853c7aa0dfd..a5c83363b611 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -99,3 +99,13 @@ int snd_soc_card_suspend_post(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_resume_pre(struct snd_soc_card *card)
+{
+	int ret = 0;
+
+	if (card->resume_pre)
+		ret = card->resume_pre(card);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c0327995efc1..540ee055a1e8 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -660,8 +660,7 @@ static void soc_resume_deferred(struct work_struct *work)
 	/* Bring us up into D2 so that DAPM starts enabling things */
 	snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D2);
 
-	if (card->resume_pre)
-		card->resume_pre(card);
+	snd_soc_card_resume_pre(card);
 
 	for_each_card_components(card, component) {
 		if (snd_soc_component_is_suspended(component))
-- 
2.17.1


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

* [PATCH 11/19] ASoC: soc-card: add snd_soc_card_resume_post()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2020-05-26  1:17 ` [PATCH 10/19] ASoC: soc-card: add snd_soc_card_resume_pre() Kuninori Morimoto
@ 2020-05-26  1:18 ` Kuninori Morimoto
  2020-05-26  1:18 ` [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  1 +
 sound/soc/soc-card.c     | 10 ++++++++++
 sound/soc/soc-core.c     |  3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 0d4837f3f182..a54711b5c58f 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -22,6 +22,7 @@ int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
 int snd_soc_card_suspend_pre(struct snd_soc_card *card);
 int snd_soc_card_suspend_post(struct snd_soc_card *card);
 int snd_soc_card_resume_pre(struct snd_soc_card *card);
+int snd_soc_card_resume_post(struct snd_soc_card *card);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index a5c83363b611..e3b75e0640ab 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -109,3 +109,13 @@ int snd_soc_card_resume_pre(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_resume_post(struct snd_soc_card *card)
+{
+	int ret = 0;
+
+	if (card->resume_post)
+		ret = card->resume_post(card);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 540ee055a1e8..02147acf6547 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -692,8 +692,7 @@ static void soc_resume_deferred(struct work_struct *work)
 		}
 	}
 
-	if (card->resume_post)
-		card->resume_post(card);
+	snd_soc_card_resume_post(card);
 
 	dev_dbg(card->dev, "ASoC: resume work completed\n");
 
-- 
2.17.1


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

* [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2020-05-26  1:18 ` [PATCH 11/19] ASoC: soc-card: add snd_soc_card_resume_post() Kuninori Morimoto
@ 2020-05-26  1:18 ` Kuninori Morimoto
  2020-05-26 14:08   ` Pierre-Louis Bossart
  2020-05-26  1:18 ` [PATCH 13/19] ASoC: soc-card: add snd_soc_card_probe() Kuninori Morimoto
                   ` (6 subsequent siblings)
  18 siblings, 1 reply; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We have bit field to control snd_soc_card.
Let's add probed field on it instead of local variable.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 18 ++++++++----------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 060c01c32547..74868436ac79 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1096,6 +1096,7 @@ struct snd_soc_card {
 	unsigned int topology_shortname_created:1;
 	unsigned int fully_routed:1;
 	unsigned int disable_route_checks:1;
+	unsigned int probed:1;
 
 	void *drvdata;
 };
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 02147acf6547..7cfb3ee6ff4f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1723,8 +1723,7 @@ static void __soc_setup_card_name(char *name, int len,
 	}
 }
 
-static void soc_cleanup_card_resources(struct snd_soc_card *card,
-				       int card_probed)
+static void soc_cleanup_card_resources(struct snd_soc_card *card)
 {
 	struct snd_soc_pcm_runtime *rtd, *n;
 
@@ -1748,8 +1747,9 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
 	soc_cleanup_card_debugfs(card);
 
 	/* remove the card */
-	if (card_probed && card->remove)
+	if (card->probed && card->remove)
 		card->remove(card);
+	card->probed = 0;
 
 	if (card->snd_card) {
 		snd_card_free(card->snd_card);
@@ -1760,12 +1760,10 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
 static void snd_soc_unbind_card(struct snd_soc_card *card, bool unregister)
 {
 	if (card->instantiated) {
-		int card_probed = 1;
-
 		card->instantiated = false;
 		snd_soc_flush_all_delayed_work(card);
 
-		soc_cleanup_card_resources(card, card_probed);
+		soc_cleanup_card_resources(card);
 		if (!unregister)
 			list_add(&card->list, &unbind_card_list);
 	} else {
@@ -1779,7 +1777,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 	struct snd_soc_pcm_runtime *rtd;
 	struct snd_soc_component *component;
 	struct snd_soc_dai_link *dai_link;
-	int ret, i, card_probed = 0;
+	int ret, i;
 
 	mutex_lock(&client_mutex);
 	mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
@@ -1831,7 +1829,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 		ret = card->probe(card);
 		if (ret < 0)
 			goto probe_end;
-		card_probed = 1;
+		card->probed = 1;
 	}
 
 	/* probe all components used by DAI links on this card */
@@ -1923,7 +1921,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 			goto probe_end;
 		}
 	}
-	card_probed = 1;
+	card->probed = 1;
 
 	snd_soc_dapm_new_widgets(card);
 
@@ -1945,7 +1943,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 
 probe_end:
 	if (ret < 0)
-		soc_cleanup_card_resources(card, card_probed);
+		soc_cleanup_card_resources(card);
 
 	mutex_unlock(&card->mutex);
 	mutex_unlock(&client_mutex);
-- 
2.17.1


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

* [PATCH 13/19] ASoC: soc-card: add snd_soc_card_probe()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2020-05-26  1:18 ` [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
@ 2020-05-26  1:18 ` Kuninori Morimoto
  2020-05-26  1:18 ` [PATCH 14/19] ASoC: soc-card: add snd_soc_card_late_probe() Kuninori Morimoto
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  2 ++
 sound/soc/soc-card.c     | 20 ++++++++++++++++++++
 sound/soc/soc-core.c     |  9 +++------
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index a54711b5c58f..38bb25428446 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -24,6 +24,8 @@ int snd_soc_card_suspend_post(struct snd_soc_card *card);
 int snd_soc_card_resume_pre(struct snd_soc_card *card);
 int snd_soc_card_resume_post(struct snd_soc_card *card);
 
+int snd_soc_card_probe(struct snd_soc_card *card);
+
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
 					    void *data)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index e3b75e0640ab..49516fe7c54c 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -119,3 +119,23 @@ int snd_soc_card_resume_post(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_probe(struct snd_soc_card *card)
+{
+	if (card->probe) {
+		int ret = card->probe(card);
+
+		if (ret < 0)
+			return soc_card_ret(card, ret);
+
+		/*
+		 * set probed here
+		 * see
+		 *	snd_soc_bind_card()
+		 *	snd_soc_card_late_probe()
+		 */
+		card->probed = 1;
+	}
+
+	return 0;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7cfb3ee6ff4f..13a7d5158534 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1825,12 +1825,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 		goto probe_end;
 
 	/* initialise the sound card only once */
-	if (card->probe) {
-		ret = card->probe(card);
-		if (ret < 0)
-			goto probe_end;
-		card->probed = 1;
-	}
+	ret = snd_soc_card_probe(card);
+	if (ret < 0)
+		goto probe_end;
 
 	/* probe all components used by DAI links on this card */
 	ret = soc_probe_link_components(card);
-- 
2.17.1


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

* [PATCH 14/19] ASoC: soc-card: add snd_soc_card_late_probe()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (12 preceding siblings ...)
  2020-05-26  1:18 ` [PATCH 13/19] ASoC: soc-card: add snd_soc_card_probe() Kuninori Morimoto
@ 2020-05-26  1:18 ` Kuninori Morimoto
  2020-05-26  1:18 ` [PATCH 15/19] ASoC: soc-card: add snd_soc_card_remove() Kuninori Morimoto
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  1 +
 sound/soc/soc-card.c     | 20 ++++++++++++++++++++
 sound/soc/soc-core.c     | 12 +++---------
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 38bb25428446..58b25963151a 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -25,6 +25,7 @@ int snd_soc_card_resume_pre(struct snd_soc_card *card);
 int snd_soc_card_resume_post(struct snd_soc_card *card);
 
 int snd_soc_card_probe(struct snd_soc_card *card);
+int snd_soc_card_late_probe(struct snd_soc_card *card);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 49516fe7c54c..63bfcb0d1579 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -139,3 +139,23 @@ int snd_soc_card_probe(struct snd_soc_card *card)
 
 	return 0;
 }
+
+int snd_soc_card_late_probe(struct snd_soc_card *card)
+{
+	if (card->late_probe) {
+		int ret = card->late_probe(card);
+
+		if (ret < 0)
+			return soc_card_ret(card, ret);
+	}
+
+	/*
+	 * set probed here
+	 * see
+	 *	snd_soc_bind_card()
+	 *	snd_soc_card_probe()
+	 */
+	card->probed = 1;
+
+	return 0;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 13a7d5158534..42e8c11a0b26 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1910,15 +1910,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 		}
 	}
 
-	if (card->late_probe) {
-		ret = card->late_probe(card);
-		if (ret < 0) {
-			dev_err(card->dev, "ASoC: %s late_probe() failed: %d\n",
-				card->name, ret);
-			goto probe_end;
-		}
-	}
-	card->probed = 1;
+	ret = snd_soc_card_late_probe(card);
+	if (ret < 0)
+		goto probe_end;
 
 	snd_soc_dapm_new_widgets(card);
 
-- 
2.17.1


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

* [PATCH 15/19] ASoC: soc-card: add snd_soc_card_remove()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (13 preceding siblings ...)
  2020-05-26  1:18 ` [PATCH 14/19] ASoC: soc-card: add snd_soc_card_late_probe() Kuninori Morimoto
@ 2020-05-26  1:18 ` Kuninori Morimoto
  2020-05-26  1:18 ` [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  1 +
 sound/soc/soc-card.c     | 13 +++++++++++++
 sound/soc/soc-core.c     |  4 +---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 58b25963151a..b338bbd08219 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -26,6 +26,7 @@ int snd_soc_card_resume_post(struct snd_soc_card *card);
 
 int snd_soc_card_probe(struct snd_soc_card *card);
 int snd_soc_card_late_probe(struct snd_soc_card *card);
+int snd_soc_card_remove(struct snd_soc_card *card);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 63bfcb0d1579..449f6cc86859 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -159,3 +159,16 @@ int snd_soc_card_late_probe(struct snd_soc_card *card)
 
 	return 0;
 }
+
+int snd_soc_card_remove(struct snd_soc_card *card)
+{
+	int ret = 0;
+
+	if (card->probed &&
+	    card->remove)
+		ret = card->remove(card);
+
+	card->probed = 0;
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 42e8c11a0b26..136ff7237a80 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1747,9 +1747,7 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
 	soc_cleanup_card_debugfs(card);
 
 	/* remove the card */
-	if (card->probed && card->remove)
-		card->remove(card);
-	card->probed = 0;
+	snd_soc_card_remove(card);
 
 	if (card->snd_card) {
 		snd_card_free(card->snd_card);
-- 
2.17.1


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

* [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (14 preceding siblings ...)
  2020-05-26  1:18 ` [PATCH 15/19] ASoC: soc-card: add snd_soc_card_remove() Kuninori Morimoto
@ 2020-05-26  1:18 ` Kuninori Morimoto
  2020-05-27  0:23   ` Ranjani Sridharan
  2020-05-26  1:19 ` [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  4 ++++
 sound/soc/soc-card.c     | 12 ++++++++++++
 sound/soc/soc-dapm.c     |  4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index b338bbd08219..4bcdc1d382bf 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -28,6 +28,10 @@ int snd_soc_card_probe(struct snd_soc_card *card);
 int snd_soc_card_late_probe(struct snd_soc_card *card);
 int snd_soc_card_remove(struct snd_soc_card *card);
 
+int snd_soc_card_set_bias_level(struct snd_soc_card *card,
+				struct snd_soc_dapm_context *dapm,
+				enum snd_soc_bias_level level);
+
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
 					    void *data)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 449f6cc86859..a9f25b6a4c67 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -172,3 +172,15 @@ int snd_soc_card_remove(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_set_bias_level(struct snd_soc_card *card,
+				struct snd_soc_dapm_context *dapm,
+				enum snd_soc_bias_level level)
+{
+	int ret = 0;
+
+	if (card->set_bias_level)
+		ret = card->set_bias_level(card, dapm, level);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index a4de3e4bc2ef..add39d24a583 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -725,8 +725,8 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 
 	trace_snd_soc_bias_level_start(card, level);
 
-	if (card && card->set_bias_level)
-		ret = card->set_bias_level(card, dapm, level);
+	if (card)
+		ret = snd_soc_card_set_bias_level(card, dapm, level);
 	if (ret != 0)
 		goto out;
 
-- 
2.17.1


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

* [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (15 preceding siblings ...)
  2020-05-26  1:18 ` [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
@ 2020-05-26  1:19 ` Kuninori Morimoto
  2020-05-27  0:24   ` Ranjani Sridharan
  2020-05-26  1:19 ` [PATCH 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link() Kuninori Morimoto
  2020-05-26  1:19 ` [PATCH 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link() Kuninori Morimoto
  18 siblings, 1 reply; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  3 +++
 sound/soc/soc-card.c     | 12 ++++++++++++
 sound/soc/soc-dapm.c     |  4 ++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 4bcdc1d382bf..54341e4d818a 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -31,6 +31,9 @@ int snd_soc_card_remove(struct snd_soc_card *card);
 int snd_soc_card_set_bias_level(struct snd_soc_card *card,
 				struct snd_soc_dapm_context *dapm,
 				enum snd_soc_bias_level level);
+int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
+				     struct snd_soc_dapm_context *dapm,
+				     enum snd_soc_bias_level level);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index a9f25b6a4c67..8db3b98d1c80 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -184,3 +184,15 @@ int snd_soc_card_set_bias_level(struct snd_soc_card *card,
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
+				     struct snd_soc_dapm_context *dapm,
+				     enum snd_soc_bias_level level)
+{
+	int ret = 0;
+
+	if (card->set_bias_level_post)
+		ret = card->set_bias_level_post(card, dapm, level);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index add39d24a583..af457ee5ef83 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -736,8 +736,8 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 	if (ret != 0)
 		goto out;
 
-	if (card && card->set_bias_level_post)
-		ret = card->set_bias_level_post(card, dapm, level);
+	if (card)
+		ret = snd_soc_card_set_bias_level_post(card, dapm, level);
 out:
 	trace_snd_soc_bias_level_done(card, level);
 
-- 
2.17.1


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

* [PATCH 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (16 preceding siblings ...)
  2020-05-26  1:19 ` [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
@ 2020-05-26  1:19 ` Kuninori Morimoto
  2020-05-26  1:19 ` [PATCH 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link() Kuninori Morimoto
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h |  3 +++
 sound/soc/soc-card.c     | 12 ++++++++++++
 sound/soc/soc-core.c     |  5 +++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 54341e4d818a..501d3d5b6efb 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -35,6 +35,9 @@ int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
 				     struct snd_soc_dapm_context *dapm,
 				     enum snd_soc_bias_level level);
 
+int snd_soc_card_add_dai_link(struct snd_soc_card *card,
+			      struct snd_soc_dai_link *dai_link);
+
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
 					    void *data)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 8db3b98d1c80..3886e6f2dbc3 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -196,3 +196,15 @@ int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_add_dai_link(struct snd_soc_card *card,
+			      struct snd_soc_dai_link *dai_link)
+{
+	int ret = 0;
+
+	if (card->add_dai_link)
+		ret = card->add_dai_link(card, dai_link);
+
+	return soc_card_ret(card, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_card_add_dai_link);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 136ff7237a80..d238b47252a5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -978,8 +978,9 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
 	/*
 	 * Notify the machine driver for extra initialization
 	 */
-	if (card->add_dai_link)
-		card->add_dai_link(card, dai_link);
+	ret = snd_soc_card_add_dai_link(card, dai_link);
+	if (ret < 0)
+		return ret;
 
 	if (dai_link->ignore)
 		return 0;
-- 
2.17.1


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

* [PATCH 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link()
  2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (17 preceding siblings ...)
  2020-05-26  1:19 ` [PATCH 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link() Kuninori Morimoto
@ 2020-05-26  1:19 ` Kuninori Morimoto
  18 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-26  1:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-card.h | 2 ++
 sound/soc/soc-card.c     | 8 ++++++++
 sound/soc/soc-core.c     | 3 +--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 501d3d5b6efb..267f613b6690 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -37,6 +37,8 @@ int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
 
 int snd_soc_card_add_dai_link(struct snd_soc_card *card,
 			      struct snd_soc_dai_link *dai_link);
+void snd_soc_card_remove_dai_link(struct snd_soc_card *card,
+				  struct snd_soc_dai_link *dai_link);
 
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 3886e6f2dbc3..1d5c5b460e39 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -208,3 +208,11 @@ int snd_soc_card_add_dai_link(struct snd_soc_card *card,
 	return soc_card_ret(card, ret);
 }
 EXPORT_SYMBOL_GPL(snd_soc_card_add_dai_link);
+
+void snd_soc_card_remove_dai_link(struct snd_soc_card *card,
+				  struct snd_soc_dai_link *dai_link)
+{
+	if (card->remove_dai_link)
+		card->remove_dai_link(card, dai_link);
+}
+EXPORT_SYMBOL_GPL(snd_soc_card_remove_dai_link);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d238b47252a5..b07eca2c6ccc 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -947,8 +947,7 @@ void snd_soc_remove_pcm_runtime(struct snd_soc_card *card,
 	/*
 	 * Notify the machine driver for extra destruction
 	 */
-	if (card->remove_dai_link)
-		card->remove_dai_link(card, rtd->dai_link);
+	snd_soc_card_remove_dai_link(card, rtd->dai_link);
 
 	soc_free_pcm_runtime(rtd);
 }
-- 
2.17.1


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

* Re: [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card
  2020-05-26  1:18 ` [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
@ 2020-05-26 14:08   ` Pierre-Louis Bossart
  2020-05-27 23:58     ` Kuninori Morimoto
  0 siblings, 1 reply; 28+ messages in thread
From: Pierre-Louis Bossart @ 2020-05-26 14:08 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA



On 5/25/20 8:18 PM, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> We have bit field to control snd_soc_card.
> Let's add probed field on it instead of local variable.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   include/sound/soc.h  |  1 +
>   sound/soc/soc-core.c | 18 ++++++++----------
>   2 files changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index 060c01c32547..74868436ac79 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -1096,6 +1096,7 @@ struct snd_soc_card {
>   	unsigned int topology_shortname_created:1;
>   	unsigned int fully_routed:1;
>   	unsigned int disable_route_checks:1;
> +	unsigned int probed:1;
>   
>   	void *drvdata;
>   };
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 02147acf6547..7cfb3ee6ff4f 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1723,8 +1723,7 @@ static void __soc_setup_card_name(char *name, int len,
>   	}
>   }
>   
> -static void soc_cleanup_card_resources(struct snd_soc_card *card,
> -				       int card_probed)
> +static void soc_cleanup_card_resources(struct snd_soc_card *card)
>   {
>   	struct snd_soc_pcm_runtime *rtd, *n;
>   
> @@ -1748,8 +1747,9 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
>   	soc_cleanup_card_debugfs(card);
>   
>   	/* remove the card */
> -	if (card_probed && card->remove)
> +	if (card->probed && card->remove)
>   		card->remove(card);
> +	card->probed = 0;
>   
>   	if (card->snd_card) {
>   		snd_card_free(card->snd_card);
> @@ -1760,12 +1760,10 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
>   static void snd_soc_unbind_card(struct snd_soc_card *card, bool unregister)
>   {
>   	if (card->instantiated) {
> -		int card_probed = 1;
> -

This looks like a change, now soc_cleanup_card_resources() is called 
without setting the card_probed bitfield?

everywhere else I see a 1:1 mapping between variable and bitfield usage, 
not here, is this intentional?

>   		card->instantiated = false;
>   		snd_soc_flush_all_delayed_work(card);
>   
> -		soc_cleanup_card_resources(card, card_probed);
> +		soc_cleanup_card_resources(card);
>   		if (!unregister)
>   			list_add(&card->list, &unbind_card_list);
>   	} else {
> @@ -1779,7 +1777,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   	struct snd_soc_pcm_runtime *rtd;
>   	struct snd_soc_component *component;
>   	struct snd_soc_dai_link *dai_link;
> -	int ret, i, card_probed = 0;
> +	int ret, i;
>   
>   	mutex_lock(&client_mutex);
>   	mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
> @@ -1831,7 +1829,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   		ret = card->probe(card);
>   		if (ret < 0)
>   			goto probe_end;
> -		card_probed = 1;
> +		card->probed = 1;
>   	}
>   
>   	/* probe all components used by DAI links on this card */
> @@ -1923,7 +1921,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   			goto probe_end;
>   		}
>   	}
> -	card_probed = 1;
> +	card->probed = 1;
>   
>   	snd_soc_dapm_new_widgets(card);
>   
> @@ -1945,7 +1943,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   
>   probe_end:
>   	if (ret < 0)
> -		soc_cleanup_card_resources(card, card_probed);
> +		soc_cleanup_card_resources(card);
>   
>   	mutex_unlock(&card->mutex);
>   	mutex_unlock(&client_mutex);
> 

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

* Re: [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level()
  2020-05-26  1:18 ` [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
@ 2020-05-27  0:23   ` Ranjani Sridharan
  2020-05-28  0:02     ` Kuninori Morimoto
  0 siblings, 1 reply; 28+ messages in thread
From: Ranjani Sridharan @ 2020-05-27  0:23 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA

On Tue, 2020-05-26 at 10:18 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Card related function should be implemented at soc-card now.
> This patch adds it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  include/sound/soc-card.h |  4 ++++
>  sound/soc/soc-card.c     | 12 ++++++++++++
>  sound/soc/soc-dapm.c     |  4 ++--
>  3 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
> index b338bbd08219..4bcdc1d382bf 100644
> --- a/include/sound/soc-card.h
> +++ b/include/sound/soc-card.h
> @@ -28,6 +28,10 @@ int snd_soc_card_probe(struct snd_soc_card *card);
>  int snd_soc_card_late_probe(struct snd_soc_card *card);
>  int snd_soc_card_remove(struct snd_soc_card *card);
>  
> +int snd_soc_card_set_bias_level(struct snd_soc_card *card,
> +				struct snd_soc_dapm_context *dapm,
> +				enum snd_soc_bias_level level);
> +
>  /* device driver data */
>  static inline void snd_soc_card_set_drvdata(struct snd_soc_card
> *card,
>  					    void *data)
> diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
> index 449f6cc86859..a9f25b6a4c67 100644
> --- a/sound/soc/soc-card.c
> +++ b/sound/soc/soc-card.c
> @@ -172,3 +172,15 @@ int snd_soc_card_remove(struct snd_soc_card
> *card)
>  
>  	return soc_card_ret(card, ret);
>  }
> +
> +int snd_soc_card_set_bias_level(struct snd_soc_card *card,
> +				struct snd_soc_dapm_context *dapm,
> +				enum snd_soc_bias_level level)
> +{
> +	int ret = 0;
> +
> +	if (card->set_bias_level)
> +		ret = card->set_bias_level(card, dapm, level);
> +
> +	return soc_card_ret(card, ret);
> +}
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index a4de3e4bc2ef..add39d24a583 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -725,8 +725,8 @@ static int snd_soc_dapm_set_bias_level(struct
> snd_soc_dapm_context *dapm,
>  
>  	trace_snd_soc_bias_level_start(card, level);
>  
> -	if (card && card->set_bias_level)
> -		ret = card->set_bias_level(card, dapm, level);
> +	if (card)
Morimoto-san,

Why not move this check inside snd_soc_card_set_bias_level() and remove
the first parameter from the function?

Thanks,
Ranjani


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

* Re: [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post()
  2020-05-26  1:19 ` [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
@ 2020-05-27  0:24   ` Ranjani Sridharan
  0 siblings, 0 replies; 28+ messages in thread
From: Ranjani Sridharan @ 2020-05-27  0:24 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA

On Tue, 2020-05-26 at 10:19 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Card related function should be implemented at soc-card now.
> This patch adds it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  include/sound/soc-card.h |  3 +++
>  sound/soc/soc-card.c     | 12 ++++++++++++
>  sound/soc/soc-dapm.c     |  4 ++--
>  3 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
> index 4bcdc1d382bf..54341e4d818a 100644
> --- a/include/sound/soc-card.h
> +++ b/include/sound/soc-card.h
> @@ -31,6 +31,9 @@ int snd_soc_card_remove(struct snd_soc_card *card);
>  int snd_soc_card_set_bias_level(struct snd_soc_card *card,
>  				struct snd_soc_dapm_context *dapm,
>  				enum snd_soc_bias_level level);
> +int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
> +				     struct snd_soc_dapm_context *dapm,
> +				     enum snd_soc_bias_level level);
>  
>  /* device driver data */
>  static inline void snd_soc_card_set_drvdata(struct snd_soc_card
> *card,
> diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
> index a9f25b6a4c67..8db3b98d1c80 100644
> --- a/sound/soc/soc-card.c
> +++ b/sound/soc/soc-card.c
> @@ -184,3 +184,15 @@ int snd_soc_card_set_bias_level(struct
> snd_soc_card *card,
>  
>  	return soc_card_ret(card, ret);
>  }
> +
> +int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
> +				     struct snd_soc_dapm_context *dapm,
> +				     enum snd_soc_bias_level level)
> +{
> +	int ret = 0;
> +
> +	if (card->set_bias_level_post)
> +		ret = card->set_bias_level_post(card, dapm, level);
> +
> +	return soc_card_ret(card, ret);
> +}
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index add39d24a583..af457ee5ef83 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -736,8 +736,8 @@ static int snd_soc_dapm_set_bias_level(struct
> snd_soc_dapm_context *dapm,
>  	if (ret != 0)
>  		goto out;
>  
> -	if (card && card->set_bias_level_post)
> -		ret = card->set_bias_level_post(card, dapm, level);
> +	if (card)
> +		ret = snd_soc_card_set_bias_level_post(card, dapm,
> level);
same here too. We can move the check to
snd_soc_card_set_bias_level_post() and remove the first parameter?

Thanks,
Ranjani


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

* Re: [PATCH 02/19] ASoC: add soc-card.c
  2020-05-26  1:16 ` [PATCH 02/19] ASoC: add soc-card.c Kuninori Morimoto
@ 2020-05-27  0:26   ` Ranjani Sridharan
  2020-05-28  0:03     ` Kuninori Morimoto
  0 siblings, 1 reply; 28+ messages in thread
From: Ranjani Sridharan @ 2020-05-27  0:26 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA

On Tue, 2020-05-26 at 10:16 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current ALSA SoC has some snd_soc_card_xxx() functions,
> and card->xxx() callbacks.
> But, it is implemented randomly at random place.
> 
> To collect all card related functions into one place,
> this patch creats new soc-card.c.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  include/sound/soc-card.h | 11 +++++++++++
>  include/sound/soc.h      |  1 +
>  sound/soc/Makefile       |  2 +-
>  sound/soc/soc-card.c     | 26 ++++++++++++++++++++++++++
>  4 files changed, 39 insertions(+), 1 deletion(-)
>  create mode 100644 include/sound/soc-card.h
>  create mode 100644 sound/soc/soc-card.c
> 
> diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
> new file mode 100644
> index 000000000000..997809bb3afb
> --- /dev/null
> +++ b/include/sound/soc-card.h
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: GPL-2.0
> + *
> + * soc-card.h
> + *
> + * Copyright (C) 2019 Renesas Electronics Corp.
> + * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> + */
> +#ifndef __SOC_CARD_H
> +#define __SOC_CARD_H
> +
> +#endif /* __SOC_CARD_H */
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index 11ee3ed87aa1..5b880e29d106 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -1450,5 +1450,6 @@ static inline void
> snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
>  }
>  
>  #include <sound/soc-component.h>
> +#include <sound/soc-card.h>
Morimoto-san,

soc-card.h should be added where it is needed. For example, in this
patch, it should be included in soc-card.c and in the following
patches, it should be included in soc-core.c, soc-dapm.c etc where it
is needed.

Thanks,
Ranjani


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

* Re: [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card
  2020-05-26 14:08   ` Pierre-Louis Bossart
@ 2020-05-27 23:58     ` Kuninori Morimoto
  0 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-27 23:58 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: Linux-ALSA, Mark Brown


Hi Pierre-Louis

Thank you for the review

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > We have bit field to control snd_soc_card.
> > Let's add probed field on it instead of local variable.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
(snip)
> > @@ -1760,12 +1760,10 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
> >   static void snd_soc_unbind_card(struct snd_soc_card *card, bool unregister)
> >   {
> >   	if (card->instantiated) {
> > -		int card_probed = 1;
> > -
> 
> This looks like a change, now soc_cleanup_card_resources() is called
> without setting the card_probed bitfield?
> 
> everywhere else I see a 1:1 mapping between variable and bitfield
> usage, not here, is this intentional?

This is a little bit confusable point for reviewing.
I will explain, so, please double check it.

This "soc_cleanup_card_resources()" will be called from
snd_soc_unbind_card() as "formal cleanup" or,
snd_soc_bind_card()   as "error handling" (D).

For "error handling" purpose, it needed to have "card_probed"
flags as parameter.

This "card->instantiated" will be set at (A) if
all probe functions were called (B) without error.
By this patch, "probed" is handled by "card".
Thus, it already has card->probed flag if
card has instantiated flag.

	static int snd_soc_bind_card(struct snd_soc_card *card)
	{
		...
	(B)	ret = snd_soc_card_probe(card);
		if (ret < 0)
			goto probe_end;
		...
	(B)	ret = snd_soc_card_late_probe(card);
		if (ret < 0)
			goto probe_end;
		...
	(A)	card->instantiated = 1;
		...
	probe_end:
		if (ret < 0)
	(D)		soc_cleanup_card_resources();
		...
	}

But indeed patch and log are confusable.
I will try to add such explanation at git-log area.

Thank you for your help !!

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level()
  2020-05-27  0:23   ` Ranjani Sridharan
@ 2020-05-28  0:02     ` Kuninori Morimoto
  0 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  0:02 UTC (permalink / raw)
  To: Ranjani Sridharan; +Cc: Linux-ALSA, Mark Brown


Hi Ranjani

Thank you for review

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > Card related function should be implemented at soc-card now.
> > This patch adds it.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
(snip)
> > +int snd_soc_card_set_bias_level(struct snd_soc_card *card,
> > +				struct snd_soc_dapm_context *dapm,
> > +				enum snd_soc_bias_level level)
> > +{
> > +	int ret = 0;
> > +
> > +	if (card->set_bias_level)
> > +		ret = card->set_bias_level(card, dapm, level);
> > +
> > +	return soc_card_ret(card, ret);
> > +}
> > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> > index a4de3e4bc2ef..add39d24a583 100644
> > --- a/sound/soc/soc-dapm.c
> > +++ b/sound/soc/soc-dapm.c
> > @@ -725,8 +725,8 @@ static int snd_soc_dapm_set_bias_level(struct
> > snd_soc_dapm_context *dapm,
> >  
> >  	trace_snd_soc_bias_level_start(card, level);
> >  
> > -	if (card && card->set_bias_level)
> > -		ret = card->set_bias_level(card, dapm, level);
> > +	if (card)
> Morimoto-san,
> 
> Why not move this check inside snd_soc_card_set_bias_level() and remove
> the first parameter from the function?

Oh, yes, indeed.
We don't need "if (card)" check here.

But what does this "remove the first parameter from the function" mean ?
Do you mean "remove card" ?
Anyway, I will fixup [16/19] and [17/19] patches in v2

Thank you for your help !!

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 02/19] ASoC: add soc-card.c
  2020-05-27  0:26   ` Ranjani Sridharan
@ 2020-05-28  0:03     ` Kuninori Morimoto
  2020-05-28  0:35       ` Kuninori Morimoto
  0 siblings, 1 reply; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  0:03 UTC (permalink / raw)
  To: Ranjani Sridharan; +Cc: Linux-ALSA, Mark Brown


Hi Ranjani

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > Current ALSA SoC has some snd_soc_card_xxx() functions,
> > and card->xxx() callbacks.
> > But, it is implemented randomly at random place.
> > 
> > To collect all card related functions into one place,
> > this patch creats new soc-card.c.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
(snip)
> >  #include <sound/soc-component.h>
> > +#include <sound/soc-card.h>
> Morimoto-san,
> 
> soc-card.h should be added where it is needed. For example, in this
> patch, it should be included in soc-card.c and in the following
> patches, it should be included in soc-core.c, soc-dapm.c etc where it
> is needed.

OK, will fixup in v2

Thank you for your help !!

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 02/19] ASoC: add soc-card.c
  2020-05-28  0:03     ` Kuninori Morimoto
@ 2020-05-28  0:35       ` Kuninori Morimoto
  0 siblings, 0 replies; 28+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  0:35 UTC (permalink / raw)
  To: Ranjani Sridharan; +Cc: Linux-ALSA, Mark Brown


Hi Ranjani, again

> > > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > 
> > > Current ALSA SoC has some snd_soc_card_xxx() functions,
> > > and card->xxx() callbacks.
> > > But, it is implemented randomly at random place.
> > > 
> > > To collect all card related functions into one place,
> > > this patch creats new soc-card.c.
> > > 
> > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > ---
> (snip)
> > >  #include <sound/soc-component.h>
> > > +#include <sound/soc-card.h>
> > Morimoto-san,
> > 
> > soc-card.h should be added where it is needed. For example, in this
> > patch, it should be included in soc-card.c and in the following
> > patches, it should be included in soc-core.c, soc-dapm.c etc where it
> > is needed.

Hmm.... it seesm too many drivers are using snd_soc_card_xxx().
This means, I / this patch-set need to add too many #included <sound/soc-card.h>
line at too many files...

soc-component already did, but keeping it at soc.h is
more simple for some of them.
So, I want to keep it in v2

Thank you for your help !!

Best regards
---
Kuninori Morimoto

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

end of thread, other threads:[~2020-05-28  0:36 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 02/19] ASoC: add soc-card.c Kuninori Morimoto
2020-05-27  0:26   ` Ranjani Sridharan
2020-05-28  0:03     ` Kuninori Morimoto
2020-05-28  0:35       ` Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 04/19] ASoC: soc-card: move snd_soc_card_jack_new() " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 07/19] ASoC: soc-card: move snd_soc_card_subclass " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre() Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 09/19] ASoC: soc-card: add snd_soc_card_suspend_post() Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 10/19] ASoC: soc-card: add snd_soc_card_resume_pre() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 11/19] ASoC: soc-card: add snd_soc_card_resume_post() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
2020-05-26 14:08   ` Pierre-Louis Bossart
2020-05-27 23:58     ` Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 13/19] ASoC: soc-card: add snd_soc_card_probe() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 14/19] ASoC: soc-card: add snd_soc_card_late_probe() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 15/19] ASoC: soc-card: add snd_soc_card_remove() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
2020-05-27  0:23   ` Ranjani Sridharan
2020-05-28  0:02     ` Kuninori Morimoto
2020-05-26  1:19 ` [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
2020-05-27  0:24   ` Ranjani Sridharan
2020-05-26  1:19 ` [PATCH 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link() Kuninori Morimoto
2020-05-26  1:19 ` [PATCH 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link() Kuninori Morimoto

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.