All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/19] ASoC: add soc-card
@ 2020-05-28  1:47 Kuninori Morimoto
  2020-05-28  1:47 ` [PATCH v2 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:47 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 v2 patch-set creates new snd_soc_card_xxx() functions
which handles snd_soc_card related operation,
and implmement these at new soc-card.c.

v1 -> v2

	- careed scripts/checkpatch.pl except for MAINTAINERS file update
	- added detail log at git-log, and/or comment at file.
	- cares "if (card)" under snd_soc_card_xxx()

Link: https://lore.kernel.org/r/87h7w3339l.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (19):
   1 ASoC: soc.h: convert bool to bit field for snd_soc_card
   2 ASoC: add soc-card.c
   3 ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
   4 ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
   5 ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
   6 ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
   7 ASoC: soc-card: move snd_soc_card_subclass to soc-card
   8 ASoC: soc-card: add snd_soc_card_suspend_pre()
   9 ASoC: soc-card: add snd_soc_card_suspend_post()
  10 ASoC: soc-card: add snd_soc_card_resume_pre()
  11 ASoC: soc-card: add snd_soc_card_resume_post()
  12 ASoC: soc-card: add probed bit field to snd_soc_card
  13 ASoC: soc-card: add snd_soc_card_probe()
  14 ASoC: soc-card: add snd_soc_card_late_probe()
  15 ASoC: soc-card: add snd_soc_card_remove()
  16 ASoC: soc-card: add snd_soc_card_set_bias_level()
  17 ASoC: soc-card: add snd_soc_card_set_bias_level_post()
  18 ASoC: soc-card: add snd_soc_card_add_dai_link()
  19 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     | 225 +++++++++++++++++++++++++++++++++++++++
 sound/soc/soc-core.c     |  71 ++++--------
 sound/soc/soc-dapm.c     |   6 +-
 sound/soc/soc-jack.c     |  38 -------
 7 files changed, 325 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] 22+ messages in thread

* [PATCH v2 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
@ 2020-05-28  1:47 ` Kuninori Morimoto
  2020-05-28  1:47 ` [PATCH v2 02/19] ASoC: add soc-card.c Kuninori Morimoto
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:47 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] 22+ messages in thread

* [PATCH v2 02/19] ASoC: add soc-card.c
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
  2020-05-28  1:47 ` [PATCH v2 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
@ 2020-05-28  1:47 ` Kuninori Morimoto
  2020-05-28  1:47 ` [PATCH v2 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card Kuninori Morimoto
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:47 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] 22+ messages in thread

* [PATCH v2 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
  2020-05-28  1:47 ` [PATCH v2 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
  2020-05-28  1:47 ` [PATCH v2 02/19] ASoC: add soc-card.c Kuninori Morimoto
@ 2020-05-28  1:47 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 04/19] ASoC: soc-card: move snd_soc_card_jack_new() " Kuninori Morimoto
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:47 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] 22+ messages in thread

* [PATCH v2 04/19] ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2020-05-28  1:47 ` [PATCH v2 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() " Kuninori Morimoto
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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..775c08d056ae 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..aa9dbb89f8a1 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] 22+ messages in thread

* [PATCH v2 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 04/19] ASoC: soc-card: move snd_soc_card_jack_new() " Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() " Kuninori Morimoto
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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 775c08d056ae..e60ad39b87bd 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] 22+ messages in thread

* [PATCH v2 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() " Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 07/19] ASoC: soc-card: move snd_soc_card_subclass " Kuninori Morimoto
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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 e60ad39b87bd..2e2dd69313d2 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] 22+ messages in thread

* [PATCH v2 07/19] ASoC: soc-card: move snd_soc_card_subclass to soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() " Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre() Kuninori Morimoto
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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 2e2dd69313d2..41bafb59eb3c 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] 22+ messages in thread

* [PATCH v2 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 07/19] ASoC: soc-card: move snd_soc_card_subclass " Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 09/19] ASoC: soc-card: add snd_soc_card_suspend_post() Kuninori Morimoto
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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     | 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 41bafb59eb3c..58b6958c0f8b 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 aa9dbb89f8a1..710684c030bc 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] 22+ messages in thread

* [PATCH v2 09/19] ASoC: soc-card: add snd_soc_card_suspend_post()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre() Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:48 ` [PATCH v2 10/19] ASoC: soc-card: add snd_soc_card_resume_pre() Kuninori Morimoto
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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 58b6958c0f8b..55f15120d7db 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,
 			  struct snd_soc_jack_pin *pins, 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 710684c030bc..d196103225ba 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] 22+ messages in thread

* [PATCH v2 10/19] ASoC: soc-card: add snd_soc_card_resume_pre()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 09/19] ASoC: soc-card: add snd_soc_card_suspend_post() Kuninori Morimoto
@ 2020-05-28  1:48 ` Kuninori Morimoto
  2020-05-28  1:49 ` [PATCH v2 11/19] ASoC: soc-card: add snd_soc_card_resume_post() Kuninori Morimoto
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:48 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 55f15120d7db..23490df0f189 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 d196103225ba..78dc30568416 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] 22+ messages in thread

* [PATCH v2 11/19] ASoC: soc-card: add snd_soc_card_resume_post()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2020-05-28  1:48 ` [PATCH v2 10/19] ASoC: soc-card: add snd_soc_card_resume_pre() Kuninori Morimoto
@ 2020-05-28  1:49 ` Kuninori Morimoto
  2020-05-28  1:49 ` [PATCH v2 13/19] ASoC: soc-card: add snd_soc_card_probe() Kuninori Morimoto
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:49 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 23490df0f189..ab2410397d0e 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 78dc30568416..dc14179a1e0f 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] 22+ messages in thread

* [PATCH v2 13/19] ASoC: soc-card: add snd_soc_card_probe()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2020-05-28  1:49 ` [PATCH v2 11/19] ASoC: soc-card: add snd_soc_card_resume_post() Kuninori Morimoto
@ 2020-05-28  1:49 ` Kuninori Morimoto
  2020-05-28  1:49 ` [PATCH v2 14/19] ASoC: soc-card: add snd_soc_card_late_probe() Kuninori Morimoto
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:49 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.

One note here is that card has "card->probe" and "card->late_probe"
callbacks.
Because it needs to care "late_probe", "card->probed" flag is set
under if (card->probe) at snd_soc_card_probe().

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

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index ab2410397d0e..191285a0ce19 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 dc14179a1e0f..ff3bf379f166 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -119,3 +119,26 @@ 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);
+
+		/*
+		 * It has "card->probe" and "card->late_probe" callbacks.
+		 * So, set "probed" flag here, because it needs to care
+		 * about "late_probe".
+		 *
+		 * 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] 22+ messages in thread

* [PATCH v2 14/19] ASoC: soc-card: add snd_soc_card_late_probe()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2020-05-28  1:49 ` [PATCH v2 13/19] ASoC: soc-card: add snd_soc_card_probe() Kuninori Morimoto
@ 2020-05-28  1:49 ` Kuninori Morimoto
  2020-05-28  1:49 ` [PATCH v2 15/19] ASoC: soc-card: add snd_soc_card_remove() Kuninori Morimoto
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:49 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.

card has "card->probe" and "card->late_probe" callbacks,
and "late_probe" callback is called after "probe".
This means, we can set "card->probed" flag afer "late_probe"
for all cases.

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

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 191285a0ce19..521dc05e4e9f 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 ff3bf379f166..317771d87e3f 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -142,3 +142,27 @@ 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);
+	}
+
+	/*
+	 * It has "card->probe" and "card->late_probe" callbacks,
+	 * and "late_probe" callback is called after "probe".
+	 * This means, we can set "card->probed" flag afer "late_probe"
+	 * for all cases.
+	 *
+	 * 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] 22+ messages in thread

* [PATCH v2 15/19] ASoC: soc-card: add snd_soc_card_remove()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (12 preceding siblings ...)
  2020-05-28  1:49 ` [PATCH v2 14/19] ASoC: soc-card: add snd_soc_card_late_probe() Kuninori Morimoto
@ 2020-05-28  1:49 ` Kuninori Morimoto
  2020-05-28  1:49 ` [PATCH v2 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:49 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 521dc05e4e9f..97a34f0b0d2f 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 317771d87e3f..920967a9a5ea 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -166,3 +166,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] 22+ messages in thread

* [PATCH v2 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (13 preceding siblings ...)
  2020-05-28  1:49 ` [PATCH v2 15/19] ASoC: soc-card: add snd_soc_card_remove() Kuninori Morimoto
@ 2020-05-28  1:49 ` Kuninori Morimoto
  2020-05-28  1:50 ` [PATCH v2 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:49 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     |  3 +--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 97a34f0b0d2f..81e0c239b2e8 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 920967a9a5ea..dbcaa3d72dae 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -179,3 +179,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 && 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..5dc7849ecf41 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -725,8 +725,7 @@ 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);
+	ret = snd_soc_card_set_bias_level(card, dapm, level);
 	if (ret != 0)
 		goto out;
 
-- 
2.17.1


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

* [PATCH v2 12/19] ASoC: soc-card: add probed bit field to snd_soc_card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (14 preceding siblings ...)
  2020-05-28  1:49 ` [PATCH v2 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
@ 2020-05-28  1:50 ` Kuninori Morimoto
  2020-05-28  1:50 ` [PATCH v2 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


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

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

One note here is that soc_cleanup_card_resources()
will be called as (A) formal cleanup or as (B) error handling,
thus, it needs to distinguish these.

In (A) case, card will have "instantiated" flag if all probe
callback functions were called without error.
Thus, snd_soc_unbind_card() is using it to judging card was probed.
But this this patch removes it, because it is no longer needed.

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

* [PATCH v2 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (15 preceding siblings ...)
  2020-05-28  1:50 ` [PATCH v2 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
@ 2020-05-28  1:50 ` Kuninori Morimoto
  2020-05-28  1:50 ` [PATCH v2 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link() Kuninori Morimoto
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:50 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     |  3 +--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 81e0c239b2e8..e35f777fd8cc 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 dbcaa3d72dae..5bc2832b3505 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -191,3 +191,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 && 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 5dc7849ecf41..653a58c96e24 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -735,8 +735,7 @@ 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);
+	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] 22+ messages in thread

* [PATCH v2 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (16 preceding siblings ...)
  2020-05-28  1:50 ` [PATCH v2 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
@ 2020-05-28  1:50 ` Kuninori Morimoto
  2020-05-28  1:50 ` [PATCH v2 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link() Kuninori Morimoto
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:50 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.

This patch adds missing return when error case.

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 e35f777fd8cc..f7e5c0ec5dc5 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 5bc2832b3505..ba84a55fa80d 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -203,3 +203,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] 22+ messages in thread

* [PATCH v2 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link()
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (17 preceding siblings ...)
  2020-05-28  1:50 ` [PATCH v2 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link() Kuninori Morimoto
@ 2020-05-28  1:50 ` Kuninori Morimoto
  2020-05-29 23:17 ` [PATCH v2 00/19] ASoC: add soc-card Ranjani Sridharan
  2020-05-30  1:18 ` Mark Brown
  20 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2020-05-28  1:50 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 f7e5c0ec5dc5..4f2cc4fb56b7 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 ba84a55fa80d..41c586b86dc3 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -215,3 +215,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] 22+ messages in thread

* Re: [PATCH v2 00/19] ASoC: add soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (18 preceding siblings ...)
  2020-05-28  1:50 ` [PATCH v2 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link() Kuninori Morimoto
@ 2020-05-29 23:17 ` Ranjani Sridharan
  2020-05-30  1:18 ` Mark Brown
  20 siblings, 0 replies; 22+ messages in thread
From: Ranjani Sridharan @ 2020-05-29 23:17 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA

On Thu, 2020-05-28 at 10:47 +0900, Kuninori Morimoto wrote:
> 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 v2 patch-set creates new snd_soc_card_xxx() functions
> which handles snd_soc_card related operation,
> and implmement these at new soc-card.c.
> 
> v1 -> v2
> 
> 	- careed scripts/checkpatch.pl except for MAINTAINERS file
> update
> 	- added detail log at git-log, and/or comment at file.
> 	- cares "if (card)" under snd_soc_card_xxx()
> 
> Link: 
> https://lore.kernel.org/r/87h7w3339l.wl-kuninori.morimoto.gx@renesas.com
> 
> Kuninori Morimoto (19):
>    1 ASoC: soc.h: convert bool to bit field for snd_soc_card
>    2 ASoC: add soc-card.c
>    3 ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
>    4 ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
>    5 ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
>    6 ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
>    7 ASoC: soc-card: move snd_soc_card_subclass to soc-card
>    8 ASoC: soc-card: add snd_soc_card_suspend_pre()
>    9 ASoC: soc-card: add snd_soc_card_suspend_post()
>   10 ASoC: soc-card: add snd_soc_card_resume_pre()
>   11 ASoC: soc-card: add snd_soc_card_resume_post()
>   12 ASoC: soc-card: add probed bit field to snd_soc_card
>   13 ASoC: soc-card: add snd_soc_card_probe()
>   14 ASoC: soc-card: add snd_soc_card_late_probe()
>   15 ASoC: soc-card: add snd_soc_card_remove()
>   16 ASoC: soc-card: add snd_soc_card_set_bias_level()
>   17 ASoC: soc-card: add snd_soc_card_set_bias_level_post()
>   18 ASoC: soc-card: add snd_soc_card_add_dai_link()
>   19 ASoC: soc-card: add snd_soc_card_remove_dai_link()
LGTM, Morimoto-san.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>


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

* Re: [PATCH v2 00/19] ASoC: add soc-card
  2020-05-28  1:47 [PATCH v2 00/19] ASoC: add soc-card Kuninori Morimoto
                   ` (19 preceding siblings ...)
  2020-05-29 23:17 ` [PATCH v2 00/19] ASoC: add soc-card Ranjani Sridharan
@ 2020-05-30  1:18 ` Mark Brown
  20 siblings, 0 replies; 22+ messages in thread
From: Mark Brown @ 2020-05-30  1:18 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA

On 28 May 2020 10:47:07 +0900, Kuninori Morimoto wrote:
> Current ALSA SoC is handling snd_soc_card related operation,
> but it is implmemented directly without using function/macro,
> and at random place.
> 
> This v2 patch-set creates new snd_soc_card_xxx() functions
> which handles snd_soc_card related operation,
> and implmement these at new soc-card.c.
> 
> [...]

Applied to

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

Thanks!

[01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card
        commit: 317ec67593100f0ef0d017bcd73d42704d73fdb6
[02/19] ASoC: add soc-card.c
        commit: 1793936bc9081d541da2ecd2af83eded7e6212a7
[03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
        commit: 209c6cdfd28360f030f88ae9adb69f633e6bcd2d
[04/19] ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
        commit: 3359e9b6fa3eafeeb79d5f0ec8a04f3fe6986db1
[05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
        commit: 63efed582cc346c098adf6f5c852e2d5b0753783
[06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
        commit: 65a75718d68ea338b918328d471eff6f472192fc
[07/19] ASoC: soc-card: move snd_soc_card_subclass to soc-card
        commit: bf5bb8db5bf07b0a82cdcdc44e4494e55aaa4ed7
[08/19] ASoC: soc-card: add snd_soc_card_suspend_pre()
        commit: 130dc08c827db76f4a32fe7867075029fe9071d1
[09/19] ASoC: soc-card: add snd_soc_card_suspend_post()
        commit: d17b60b2c46750ebfb6ea39a2b02d988b97484eb
[10/19] ASoC: soc-card: add snd_soc_card_resume_pre()
        commit: 934c752c38b751663fe3dc18413db13e73b8b2b2
[11/19] ASoC: soc-card: add snd_soc_card_resume_post()
        commit: 739443d1f162ce80eb717c695e58302958b51239
[12/19] ASoC: soc-card: add probed bit field to snd_soc_card
        commit: 27f07cacc9f1ddf955b85e5746f967351ab0b40b
[13/19] ASoC: soc-card: add snd_soc_card_probe()
        commit: 73de4b026850da432b8bcfb73fc4af94674a8102
[14/19] ASoC: soc-card: add snd_soc_card_late_probe()
        commit: 5c0eac036dfd3e20dd09ab86343c3b2fb2a1ac86
[15/19] ASoC: soc-card: add snd_soc_card_remove()
        commit: b0275d956fab05a5088e20244c8d1eb433b7b90f
[16/19] ASoC: soc-card: add snd_soc_card_set_bias_level()
        commit: 39caefda0a30cac8284264e5031a0dd478510ced
[17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post()
        commit: d41278ea0579a8c1e216c5321e2d207705ab3b54
[18/19] ASoC: soc-card: add snd_soc_card_add_dai_link()
        commit: cbc7a6b5a87a129084c643455d16699ea490fd2f
[19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link()
        commit: fcbbcc325bc2dd90212de19b520c190b6fbeddae

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

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

end of thread, other threads:[~2020-05-30  1:20 UTC | newest]

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

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