summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 71b022f7edfd..b48efc3a08d2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -348,7 +348,7 @@ void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int playback = SNDRV_PCM_STREAM_PLAYBACK;
- mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
+ snd_soc_dpcm_mutex_lock(rtd);
dev_dbg(rtd->dev,
"ASoC: pop wq checking: %s status: %s waiting: %s\n",
@@ -364,7 +364,7 @@ void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
SND_SOC_DAPM_STREAM_STOP);
}
- mutex_unlock(&rtd->card->pcm_mutex);
+ snd_soc_dpcm_mutex_unlock(rtd);
}
EXPORT_SYMBOL_GPL(snd_soc_close_delayed_work);
@@ -959,8 +959,8 @@ EXPORT_SYMBOL_GPL(snd_soc_remove_pcm_runtime);
* topology component. And machine drivers can still define static
* DAI links in dai_link array.
*/
-int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
- struct snd_soc_dai_link *dai_link)
+static int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_link)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link_component *codec, *platform, *cpu;
@@ -1027,13 +1027,26 @@ _err_defer:
snd_soc_remove_pcm_runtime(card, rtd);
return -EPROBE_DEFER;
}
-EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime);
+
+int snd_soc_add_pcm_runtimes(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_link,
+ int num_dai_link)
+{
+ for (int i = 0; i < num_dai_link; i++) {
+ int ret = snd_soc_add_pcm_runtime(card, dai_link + i);
+
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtimes);
static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai_link *dai_link = rtd->dai_link;
struct snd_soc_dai *dai, *not_used;
- struct device *dev = rtd->dev;
u64 pos, possible_fmt;
unsigned int mask = 0, dai_fmt = 0;
int i, j, priority, pri, until;
@@ -1075,8 +1088,6 @@ static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd)
*/
until = snd_soc_dai_get_fmt_max_priority(rtd);
for (priority = 1; priority <= until; priority++) {
-
- dev_dbg(dev, "priority = %d\n", priority);
for_each_rtd_dais(rtd, j, not_used) {
possible_fmt = ULLONG_MAX;
@@ -1085,7 +1096,6 @@ static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd)
pri = (j >= i) ? priority : priority - 1;
fmt = snd_soc_dai_get_fmt(dai, pri);
- dev_dbg(dev, "%s: (pri, fmt) = (%d, %016llX)\n", dai->name, pri, fmt);
possible_fmt &= fmt;
}
if (possible_fmt)
@@ -1095,8 +1105,6 @@ static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd)
/* Not Found */
return;
found:
- dev_dbg(dev, "found auto selected format: %016llX\n", possible_fmt);
-
/*
* convert POSSIBLE_DAIFMT to DAIFMT
*
@@ -1457,11 +1465,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card)
for_each_comp_order(order) {
for_each_card_rtds(card, rtd) {
-
- dev_dbg(card->dev,
- "ASoC: probe %s dai link %d late %d\n",
- card->name, rtd->num, order);
-
/* probe all rtd connected DAIs in good order */
ret = snd_soc_pcm_dai_probe(rtd, order);
if (ret)
@@ -1932,11 +1935,10 @@ 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;
+ int ret;
mutex_lock(&client_mutex);
- mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
+ snd_soc_card_mutex_lock_root(card);
snd_soc_dapm_init(&card->dapm, card, NULL);
@@ -1950,11 +1952,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
/* add predefined DAI links to the list */
card->num_rtd = 0;
- for_each_card_prelinks(card, i, dai_link) {
- ret = snd_soc_add_pcm_runtime(card, dai_link);
- if (ret < 0)
- goto probe_end;
- }
+ ret = snd_soc_add_pcm_runtimes(card, card->dai_link, card->num_links);
+ if (ret < 0)
+ goto probe_end;
/* card bind complete so register a sound card */
ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
@@ -2093,7 +2093,7 @@ probe_end:
if (ret < 0)
soc_cleanup_card_resources(card);
- mutex_unlock(&card->mutex);
+ snd_soc_card_mutex_unlock(card);
mutex_unlock(&client_mutex);
return ret;
@@ -2421,8 +2421,6 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
struct device *dev = component->dev;
struct snd_soc_dai *dai;
- dev_dbg(dev, "ASoC: dynamically register DAI %s\n", dev_name(dev));
-
lockdep_assert_held(&client_mutex);
dai = devm_kzalloc(dev, sizeof(*dai), GFP_KERNEL);