ASoC: add soc-card.c
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 28 May 2020 01:47:46 +0000 (10:47 +0900)
committerMark Brown <broonie@kernel.org>
Sat, 30 May 2020 01:11:27 +0000 (02:11 +0100)
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>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87blm825kt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-card.h [new file with mode: 0644]
include/sound/soc.h
sound/soc/Makefile
sound/soc/soc-card.c [new file with mode: 0644]

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
new file mode 100644 (file)
index 0000000..997809b
--- /dev/null
@@ -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 */
index 11ee3ed..5b880e2 100644 (file)
@@ -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
index 70a5f19..7f17475 100644 (file)
@@ -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 (file)
index 0000000..4bc6f26
--- /dev/null
@@ -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;
+}