]> www.infradead.org Git - users/willy/linux.git/commitdiff
ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 28 May 2020 01:48:03 +0000 (10:48 +0900)
committerMark Brown <broonie@kernel.org>
Sat, 30 May 2020 01:11:28 +0000 (02:11 +0100)
Card related function should be implemented at soc-card now.
This patch moves it.

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/878shc25kc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-card.h
include/sound/soc.h
sound/soc/soc-card.c
sound/soc/soc-jack.c

index c601eddf0975f2ab64af9e6e6eec5ab10a70e4cd..775c08d056aeb70ff66287f221de7995522e5014 100644 (file)
@@ -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 */
index f93827c6be510fcb4c75546f8067b8aff94ea26a..38b21e815a28feb2dc788c56c6a6d5326e570fd9 100644 (file)
@@ -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);
index 340ab682cc763bde8b84a9e1b5c94e9b01bf8854..aa9dbb89f8a151def5a296396d7ca6b487c678ea 100644 (file)
@@ -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);
index b5748dcd490f22cfc87b6121a05ba281f6c86de0..0f1820f36b4d720d7a957bc9c41f30a36280b5b6 100644 (file)
@@ -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
  *